collection of utility functions to make task easy
Function list:
csv_to_linear_tsv
- function to convert given csv file into linear tsv filefile_split
- function to split text or csv file into given chunksmerge_sqlite_db
- function to merge sqlite database file of same schemaget_string_product
- function to generate product of the given string of given lengthget_string_combinations
- function to generate combination of the given string of given lengthdict_to_object
- function to convert dictionary or json dump into object
Classes:
-
S3
(wrapper for S3 data storages)file_exists
- check if given key exists or notget_temporary_link
- get temporary download link for a given keyupload
- upload your file or directory to s3 storagedownload
- download given key or entire folder from s3 storage
-
DictManager
(wrapper to operate on nested dictionaries)- DictManager takes
dict
as an input and a separator (default =.
) and gives you the flexibility to manage your nested dictionary taking key as string. - Example:
>>> data = {"a": {"b": {"c": 123}}} >>> manager = DictManager(data) Accessing value >>> manager["a.b.c"] >>> 123 Setting value >>> manager["a.b.c"] = 1234 >>> data {"a": {"b": {"c": 1234}}}
- DictManager takes
-
FileIO
(wrapper for https://file.io 'snapchat' of file sharing)- NOTE: it requires 'curl' command line tool to be installed
upload
- upload file to 'https://file.io' and returns file download linkdownload
- download file from the given file.io url to given location
CLI (Command line Utilities):
gi
(designed to help you create .gitignore files for your git repositories)- It is used to generate gitignore for
operating systems
,IDEs
, orProgramming Languages
- The below command will generate .gitignore for python (PL) and code (IDE) in same place.
$ tms gi python,code
- In case of any such type which is not valid then
$ tms gi python3,abcdx "python3" is invalid, try from "python" "abcdx" is invalid.
- It is used to generate gitignore for
mdb
(merging sqlite database command)- It is used to merge sqlite3 database files
Options: --path = default current directory from where command runs --extension = default is set to sqlite, can also use 'db' It returns db file path if which all other are merged or return No file found.
sf
(splitting files (eg: txt, csv, tsv etc..) into equal chunks of given size)- takes file path as an argument, it splits the file by default into 10 chunks
Options: FILEPATH - path to the file --chunk, -c <int> number of chunks (default=10)
Another Installation method:
$ pip install tmsutils --extra-index-url=https://dl.mrinal.xyz/pypi/