lokal-profil / batchuploadtools Goto Github PK
View Code? Open in Web Editor NEWAn attempt of unifying the various tools for batch uploads
License: MIT License
An attempt of unifying the various tools for batch uploads
License: MIT License
Per request from @mattiasostmar
Document the needed/expected structure of the json data file and any assumptions made about it's contents.
Also clarify if we support filenames (i.e. original image names) which are only unique when we also considering it's directory.
I.e.
(Thus requiring the folder name is included in the dictionary key of the .json)
SMM/check_indata.py
is largely deprecated but still contains methods for building/setting up original mappings.
This functionality should be integrated into the abstract classes after which check_indata.py
can either be deleted or rebuilt on top of these classes.
Another py2 -> py3 issue:
08:54 $ python /home/mos/anaconda3/lib/python3.5/site-packages/batchupload/prepUpload.py -in_path:~/Documents/testimages -out_path:~/Documents/testimages_renamed -data_path:./mexiko_info_data.json
Traceback (most recent call last):
File "/home/mos/anaconda3/lib/python3.5/site-packages/batchupload/prepUpload.py", line 192, in <module>
main()
File "/home/mos/anaconda3/lib/python3.5/site-packages/batchupload/prepUpload.py", line 176, in main
in_path = helpers.convertFromCommandline(value)
File "/home/mos/anaconda3/lib/python3.5/site-packages/batchupload/helpers.py", line 380, in convertFromCommandline
return s.decode(sys.stdin.encoding or
AttributeError: 'str' object has no attribute 'decode'
<class 'AttributeError'>
CRITICAL: Closing network session.
It seems I have lost the external HD when carrying at around during my X-mas holiday. If I don't get it back I cant resolve an important task. Since I store eveything in the script dir on Github it would've been nice to have access to the logs even though the external drive is missing.
Or is there some other simple way to assure this malaise doesn't have to happen again?
I can't find out how to find a version number corresponding to the way you've set the requirements in the pip install package, I've got pywikibot==2.0rc5.
!pip install https://github.com/lokal-profil/BatchUploadTools/tarball/0.0.1
Collecting https://github.com/lokal-profil/BatchUploadTools/tarball/0.0.1
Downloading https://github.com/lokal-profil/BatchUploadTools/tarball/0.0.1
/ 81kB 313kB/s
Collecting pywikibot==3.0-dev (from BatchUploadTools==0.0.1)
Could not find a version that satisfies the requirement pywikibot==3.0-dev (from BatchUploadTools==0.0.1) (from versions: 2.0rc1.post1, 2.0rc1.post2, 2.0rc3, 2.0rc4, 2.0rc5)
No matching distribution found for pywikibot==3.0-dev (from BatchUploadTools==0.0.1)
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
common.py
and helpers.py
largely overlap.
Figure out a good division (potentially along the lines of which work with wiki syntax/wiki conventions) then reshuffle/rename.
Also ensure that all methods are still in use and properly documented/tested.
Seems to be a Py 2 vs 3 compatibility issue:
http://python-future.org/compatible_idioms.html#iterating-through-dict-keys-values-items
AttributeError Traceback (most recent call last)
in ()
1 for index, row in mexiko.iterrows():
----> 2 create_infofiles(row)
in create_infofiles(row)
4 infotext = "{{photograph\n"
5
----> 6 new_filename = create_new_filename(row)
7
8 lacking_description = False
in create_new_filename(row)
65 #fname = construct_new_name_from_dataframe(row, id_str)
66 description = compose_description(row)
---> 67 checked_fname = helpers.format_filename(description, "SMVK", id_str)
68 print("fname: {}\nchecked_fname: {}\n".format(fname, checked_fname))
69 return fname
/home/mos/anaconda3/lib/python3.5/site-packages/batchupload/helpers.py in format_filename(descr, institution, idno, delimiter)
90 """
91 delimiter = delimiter or u' - '
---> 92 descr = shortenString(touchup(cleanString(descr), delimiter))
93 institution = cleanString(institution)
94 idno = cleanString(idno)
/home/mos/anaconda3/lib/python3.5/site-packages/batchupload/helpers.py in cleanString(text)
110 u'e´': u'é',
111 u'”': u' ', u'"': u' ', u'“': u' '}
--> 112 for k, v in bad_char.iteritems():
113 text = text.replace(k, v)
114
AttributeError: 'dict' object has no attribute 'iteritems'
Use (https://pypi.python.org/pypi/iso8601)[iso8601] for isoDate.
Note though that this converts:
YYYY
to YYYY-01-01
YYYY-MM
to YYYY-MM-01
So some added testing is still needed.
The docstrings use a mishmash of different formats (especially when it comes to parameter description).
Standardise and activate pydocstyle
in tox
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.