general_tools package¶
Submodules¶
general_tools.file_utils module¶
-
general_tools.file_utils.add_contents_to_zip(zip_file, path)[source]¶ Zip the contents of <path> into <zip_file>. :param str|unicode zip_file: The file name of the zip file :param str|unicode path: Full path of the directory to zip up
-
general_tools.file_utils.add_file_to_zip(zip_file, file_name, arc_name=None, compress_type=None)[source]¶ Zip <file_name> into <zip_file> as <arc_name>. :param str|unicode zip_file: The file name of the zip file :param str|unicode file_name: The name of the file to add, including the path :param str|unicode arc_name: The new name, with directories, of the file, the same as filename if not given :param str|unicode compress_type:
-
general_tools.file_utils.copy_tree(src, dst, symlinks=False, ignore=None)[source]¶ Recursively copy a directory and all subdirectories. Parameters same as shutil.copytree :param src: :param dst: :param symlinks: :param ignore: :return:
-
general_tools.file_utils.get_files(dir, relative_paths=False, include_directories=False, topdown=False)[source]¶
-
general_tools.file_utils.load_json_object(file_name, default=None)[source]¶ Deserialized <file_name> into a Python object :param str|unicode file_name: The name of the file to read :param default: The value to return if the file is not found
-
general_tools.file_utils.make_dir(dir_name, linux_mode=493, error_if_not_writable=False)[source]¶ Creates a directory, if it doesn’t exist already. If the directory does exist, and <error_if_not_writable> is True, the directory will be checked for writability. :param str|unicode dir_name: The name of the directory to create :param int linux_mode: The mode/permissions to set for the new directory expressed as an octal integer (ex. 0o755) :param bool error_if_not_writable: The name of the file to read
-
general_tools.file_utils.unzip(source_file, destination_dir)[source]¶ Unzips <source_file> into <destination_dir>. :param str|unicode source_file: The name of the file to read :param str|unicode destination_dir: The name of the directory to write the unzipped files
-
general_tools.file_utils.write_file(file_name, file_contents, indent=None)[source]¶ Writes the <file_contents> to <file_name>. If <file_contents> is not a string, it is serialized as JSON. :param str|unicode file_name: The name of the file to write :param str|unicode|object file_contents: The string to write or the object to serialize :param int indent: Specify a value if you want the output formatted to be more easily readable
general_tools.print_utils module¶
general_tools.smartquotes module¶
This script accepts a paragraph of input and outputs typographically correct text using pandoc. Note line breaks are not retained.
general_tools.url_utils module¶
-
general_tools.url_utils.get_languages()[source]¶ Returns an array of over 7000 dictionaries
Structure: [
- {
- cc: [“DJ”, “US”, “CA”], pk: 2, lr: “Africa”, ln: “Afaraf”, ang: “Afar”, gw: false, ld: “ltr”, alt: [“Afaraf”, “Danakil”], lc: aa
]