pycmdtools package¶
Submodules¶
pycmdtools.configs module¶
All configurations for pycmdtools
- class pycmdtools.configs.ConfigAlgorithm[source]¶
Bases:
ConfigConfiguration options to select the digest algorithm
- algorithm = 'md5'¶
- class pycmdtools.configs.ConfigChangeLine[source]¶
Bases:
ConfigChange a line in file parameters
- from_line = None¶
- to_line = <pytconf.param.Unique object>¶
- class pycmdtools.configs.ConfigDownloadGdriveURL[source]¶
Bases:
ConfigParameters to download a share url from google drive
- url = <pytconf.param.Unique object>¶
- class pycmdtools.configs.ConfigDownloadGoogleDrive[source]¶
Bases:
ConfigParameters for downloading a file from google drive
- destination = <pytconf.param.Unique object>¶
- file_id = <pytconf.param.Unique object>¶
- class pycmdtools.configs.ConfigFolder[source]¶
Bases:
ConfigParameters for the symlink install tool
- folder = <pytconf.param.Unique object>¶
- class pycmdtools.configs.ConfigProgress[source]¶
Bases:
ConfigConfiguration options for progress reporting
- progress = False¶
- class pycmdtools.configs.ConfigSchemaUrl[source]¶
Bases:
ConfigA schema URL parameter
- schema_url = <pytconf.param.Unique object>¶
pycmdtools.main module¶
The default group of operations that pycmdtools has
- pycmdtools.main.google_drive_download_by_id() None[source]¶
If you have a link to a google drive file like this: https://drive.google.com/open?id=0BwNoUKizWBdnRmRmLVlWSWxzWnM or like this: https://drive.google.com/file/d/0BwNoUKizWBdnSHF4SFlyRkxNSVE/view?usp=sharing Then the file id of the relevant files are: 0BwNoUKizWBdnRmRmLVlWSWxzWnM 0BwNoUKizWBdnSHF4SFlyRkxNSVE And this is what you have to supply to this script to download the files.
References: - http://stackoverflow.com/questions/25010369/wget-curl-large-file-from-google-drive
- pycmdtools.main.mcmp() None[source]¶
TODO: - make the algorithm faster by looking only at the beginning of the files. - make the algorithm faster by looking at the length of the files. - make the algorithm faster by having a gnu dbm ~/.mcmp which already stores hashes of known files.
- pycmdtools.main.progress() None[source]¶
enable to show progress by pointing to a FILE and not a PROCESS NAME or PID. If you point to a file then something like fuser(1) should be called on the file, and if there is just one process holding the file open then show the progress on that file.
References: - https://unix.stackexchange.com/questions/66795/how-to-check-progress-of-running-cp - https://github.com/Xfennec/progress - https://gist.github.com/azat/2830255 - https://stackoverflow.com/questions/10980689/how-to-follow-the-progress-of-a-linux-command
pycmdtools.python module¶
This script checks the syntax of other python scripts. It returns a bad error code to the parent if something goes wrong.
- Its basically a more sophisticated version of something like this:
python2 -m py_compile $< || python3 -m py_compile $<
pycmdtools.schema_cache module¶
Disk-persistent cache for JSON schemas fetched by URL. Stores schemas as individual JSON files under ~/.cache/pycmdtools/schemas/.
pycmdtools.static module¶
version which can be consumed from within the module
pycmdtools.utils module¶
utils.py
- pycmdtools.utils.checksum(file_name: str, algorithm: str) str[source]¶
calculate a checksum of a file. You dictate which algorithm. If you want to see all algorithms try: hashlib.algorithms_available :param file_name: :param algorithm: :return:
- pycmdtools.utils.gdrive_download_link(url: str)[source]¶
Here is a sample google drive shared url: https://drive.google.com/file/d/1EbAbRUKowIi7ZL8fcktsEqj-gvcyq0a6/view?usp=sharing This function will: - download the link - extract the name of the file from the link - extract the id of the file from the link - use the method above to download the file :param url: the share link you got from google :return:
- pycmdtools.utils.remove_bad_symlinks(folder: str, use_standard_exceptions: bool) None[source]¶
remove bad symbolic links from a folder
- pycmdtools.utils.yield_bad_symlinks(folder: str = '.', use_standard_exceptions: bool = True, onerror: Callable | None = None)[source]¶
remove bad symbolic links from a folder.
Control this functions verbosity using the python logging framework :param folder: :param use_standard_exceptions: :param onerror: passed to os.walk :return:
Module contents¶
Initialize the module