A package for commonly used functions
Project description
PYCOF (PYthon COmmon Functions)
1. Installation
You can get pycof from PyPI with:
pip install pycof
The library is supported on Windows, Linux and MacOs.
2. Usage
2.1. Documentation
You can find the full documentation at https://www.florianfelice.com/pycof or by clicking on the name of each function in the next section. It will redirect you the the function's specific documentation.
2.1. Available functions
The current version of the library provides:
remote_execute_sql: aggragated function for SQL queries toSELECT,INSERT,DELETEorCOPY.f_read: Load any data file, regarless of the format.send_email: simple function to send email to contacts in a concise way.verbose_display: extended function to print strings, lists, data frames and progression bar if used as a wrapper inforloops.add_zero: simple function to convertinttostrby adding a 0 is less than 10.group: will convert anintto astrwith thousand seperator.replace_zero: will transform 0 values to-for display purposes.week_sunday: will return week number of last sunday date of a given date.display_name: displays the current user name. Will display eitherfirst,lastorfullname.write: writes astrto a specific file (usually .txt) in one line of code.file_age: computes the age (in days, hours, ...) of a given local file.str2bool: converts string to boolean.- And
many others!
2.2. Config file for credentials
The function remote_execute_sql and send_email will by default look for the credentials located at /etc/.pycof/config.json.
On Windows, save the config file as C:/Windows/.pycof/config.json.
The file follows the below structure:
{
"DB_USER": "",
"DB_PASSWORD": "",
"DB_HOST": "",
"DB_PORT": "3306",
"DB_DATABASE": "",
"__COMMENT_1__": "Email specific, send_email"
"EMAIL_USER": "",
"EMAIL_PASSWORD": "",
"EMAIL_SMTP": "smtp.gmail.com",
"EMAIL_PORT": "587"
"__COMMENT_2__": "IAM specific, if useIAM=True in remote_execute_sql",
"CLUSTER_NAME": "",
"AWS_ACCESS_KEY_ID": "",
"AWS_SECRET_ACCESS_KEY": "",
"REGION": "eu-west-1"
}
On Unix based system, run:
sudo nano /etc/.pycof/config.json
and paste the above json after filling the empty strings (pre-filled values are standard default values).
Reminder: To save the file, with nano press CTRL + O, confirm with y then CTRL + X to exit.
On Windows, use the path C:/Windows/.pycof/config.json.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycof-1.2.5.tar.gz.
File metadata
- Download URL: pycof-1.2.5.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a42be28a63c3a56050ff2c41b1a6964d30d3ff403d9b68c8c659af9baed8605a
|
|
| MD5 |
fee9e1079ef6320730b921287ff1505f
|
|
| BLAKE2b-256 |
db97758c8f09aed0b87af480fa05fae0e4a839d0acf319407e4dc3e04a22484a
|
File details
Details for the file pycof-1.2.5-py3-none-any.whl.
File metadata
- Download URL: pycof-1.2.5-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
239241c71fe957eb5d29a0ff30da4014a98b90cafde3c5e752dbd8c442c8be3d
|
|
| MD5 |
759e90bbf1bba4fc874a96e16cb7b9c8
|
|
| BLAKE2b-256 |
d7399012b0b116dd2891913c250c04dce726a44a6015bf0c2de3eb4b7ea6db16
|