Skip to main content

No project description provided

Project description

Shaonutil - 0.0.0.61.1

Utility Functions for Developers

Stable Version - 0.0.0.61.1
Author: Shaon Majumder
Contact: smazoomder@gmail.com

Area of Utilities

  • file
  • image
  • imgcode
  • mysqlDB
  • network
  • process
  • security
  • stats
  • strings
  • windows

Installation

pip install shaonutil

Function Usages

File

Function get_module_path(module)
Function get_all_dirs()
Function get_all_files_dirs()
Function package_exists(package_name) -> Description: check if a python pcakage exists.
Function pip_install(package_name)
Function get_all_functions(object) -> Description: shaonutil.file.get_all_functions(object/file/class)
Function ConfigSectionMap(Config,section)
Function read_configuration_ini(filename)
Function read_safecase_configuration_ini(filename)
Function write_configuration_ini(configs_par,filename,f_mode)
Function read_json(filename) -> Description: Read JSON file and return dictionary
Function write_json(obj,filename) -> Description: Write JSON file
Function read_file(filename) -> Description: Read File and return lines as list
Function write_file(filename,strs,mode) -> Description: Write File from string
Function read_pickle(filename)
Function write_pickle(filename,obj_)
Function open_file_with_default_app(filepath)
Function get_last_file_of_dir(filename)
Function remove_duplicateLines_from_file(filename)
Class CaseConfigParser
    Function optionxform(optionstr)

Image

Function svg2img(infile,outfile)
Function svg2pdf(infile,outfile)
Function change_image_size_ratio(img_name,out_name,percent)
Function draw_text(img,text,fnt_name,fnt_size)
Function merge_horizontally(images,filename)
Function merge_vertically(images,filename)
Function give_screenshot_caption(img_name,text,fnt_path)

BarCode

Function calculate_checksum(data) -> Description: Calculates the checksum for EAN13-Code / EAN8-Code return type: Integer
Function verify_data(data) -> Description: Verify the EAN encoded data
Function actual_data(decodedObjects) -> Description: Returns data without checksum digit for EAN type
Function encode(type_,file_,data,rt) -> Description: Encode the data as barcode or qrcode
Function decode(infile,log) -> Description: Decode barcode or qrcode
Function markBarcode(im,decodedObjects) -> Description: Mark and show the detected barcode
Function make_barcode_matrix(type_,unique_ids,row_number,column_number,filename) -> Description: Make barcode matrix image
Function read_live_barcode(detection_threshold) -> Description: Live read the barcode and returns data

Mysql Database

Function create_configuration(option,file_name) -> Description: Creating Configuration
Function remove_aria_log(mysql_data_dir) -> Description: Removing aria_log.### files to in mysql data dir to restart mysql
Function get_mysql_datadir(mysql_bin_folder,user,pass_) -> Description: Get mysql data directory
Class MySQL -> Description: A class for all mysql actions
    Function init(config,init_start_server,log)
    Function start_mysql_server() -> Description: Start mysql server
    Function stop_mysql_server(force) -> Description: Stop MySQL Server
    Function reopen_connection() -> Description: reopen
    Function close_connection() -> Description: closing the connection
    Function config()
    Function config(new_value)
    Function filter_config()
    Function make_cursor()
    Function is_mysql_user_exist(mysql_username) -> Description: check if mysql user exist return type:boolean
    Function listMySQLUsers() -> Description: list all mysql users
    Function createMySQLUser(host,userName,password,querynum,updatenum,connection_num) -> Description: Create a Mysql User
    Function delete_mysql_user(user,host,password) -> Description: Delete a mysql user
    Function show_privileges(user,host) -> Description: Show privileges of mysql user
    Function check_privileges(database,host,username) -> Description: Check if a mysql user has privileges on a database
    Function grant_all_privileges(host,userName,privileges,database,table,querynum,updatenum,connection_num) -> Description: Grant a user all privilages
    Function grant_privileges(user,host,database,privileges,table) -> Description: Grant specified privileges for a mysql user
    Function remove_all_privileges(user,host,privileges) -> Description: Revoke/Remove all privileges for a mysql user
    Function remove_privileges(user,host,privileges) -> Description: Remove specified privileges for a mysql user
    Function change_privileges(user,host,privileges) -> Description: Change to specified privileges for a mysql user
    Function flush_privileges() -> Description: Update database permissions/privilages
    Function add_db_privilages_for_MySQLUSer()
    Function change_db_privilages_for_MySQLUSer()
    Function is_db_exist(dbname) -> Description: Check if database exist
    Function create_database(dbname) -> Description: Create Database
    Function delete_database(dbname) -> Description: Delete Database
    Function get_databases() -> Description: Get databases names
    Function create_table(tbname,column_info) -> Description: Create a table under a database
    Function delete_table(table,database) -> Description: Delete a table under a database
    Function get_tables(database) -> Description: Get table names
    Function describe_table(tbname) -> Description: Describe a table structure
    Function is_table_exist(tbname) -> Description: Check if table exist
    Function get_columns(tbname) -> Description: Get column names of a table
    Function update_row()
    Function delete_row() -> Description: Delete a row of data
    Function add_column(tbname,column_name)
    Function delete_column(tbname,column_name)
    Function delete_unique_column(tbname,column_name)
    Function change_to_unique_column()
    Function change_column()
    Function rename_column(tbname,old_column_name,new_column_name)
    Function backup_all()
    Function backup_table()
    Function backup_database()
    Function restore_table()
    Function restore_databalse()
    Function load_CSV_into_table()
    Function show_table(tbname)
    Function get_unique_id_from_field(field_name,key_length,filters) -> Description: Get a random unique id not registered in a specific field
    Function delete_row(delete_dict) -> Description: Delete a row of data
    Function insert_row(value_tupple) -> Description: Insert row of data

Network

Function check_port(address,port,log)
Function urlExist(url) -> Description: Check if the file exist in online
Function downloadFile(url,filename) -> Description: Donwload a file if error occurs returns false
Function url_encoding_to_utf_8(url) -> Description: url_encoding_to_utf_8(url)
Function check_valid_url(url)
Class Email
    Function init()
    Function authentication()
    Function authentication(new_value)
    Function send_email(receiver_address,subject,mail_content,attachment_file_link,log)

Process

Function is_process_exist(process_name)
Function kill_duplicate_process(process_name,log) -> Description: Kill a process if there is more than one instance is running.
Function killProcess_ByAll(PROCNAME)
Function killProcess_ByPid(pid)
Function list_processes(sort,save_file,log)
Function computer_idle_mode()
Function obj_details_dump(obj) -> Description: check dump

Security

Function randomString(stringLength) -> Description: Generate a random string of fixed length
Function generateSecureRandomString(stringLength) -> Description: Generate a secure random string of letters, digits and special characters
Function generateCryptographicallySecureRandomString(stringLength,filters) -> Description: Generate a random string in a UUID fromat which is crytographically secure and random

Statistics

Function counter(li,number)
Function occurance_dic(li)
Function mean(li) -> Description: Avearage or mean of elements - shaonutil.stats.mean(list of numbers)
Function median(li) -> Description: Median of elements - shaonutil.stats.median(list of numbers)
Function mode(li) -> Description: Mode of elements - shaonutil.stats.mode(list of numbers)

String

Function nicely_print(dictionary,print) -> Description: Prints the nicely formatted dictionary - shaonutil.strings.nicely_print(object)
Function change_dic_key(dic,old_key,new_key) -> Description: Change dictionary key with new key

Windows

Function is_winapp_admin() -> Description: If the windows app is running with Administrator permission
Function get_UAC_permission() -> Description: Get Windows User Account Control Permission for the executing file. If already executing file has admin access, do not ask for permission.

Function Usages End

Versioning

major.minor[.maintenance[.build]] (example: 1.4.3.5249)

adoption: major.minor.patch.maintenance.status.trials_for_success

The last position

  • 0 for alpha (status)
  • 1 for beta (status)
  • 2 for release candidate
  • 3 for (final) release

For instance:

  • 1.2.0.1 instead of 1.2-a1
  • 1.2.1.2 instead of 1.2-b2 (beta with some bug fixes)
  • 1.2.2.3 instead of 1.2-rc3 (release candidate)
  • 1.2.3.0 instead of 1.2-r (commercial distribution)
  • 1.2.3.5 instead of 1.2-r5 (commercial distribution with many bug fixes)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shaonutil-0.0.0.64.2.tar.gz (26.0 kB view details)

Uploaded Source

Built Distributions

shaonutil-0.0.0.64.2-py3.8.egg (51.0 kB view details)

Uploaded Source

shaonutil-0.0.0.64.2-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file shaonutil-0.0.0.64.2.tar.gz.

File metadata

  • Download URL: shaonutil-0.0.0.64.2.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for shaonutil-0.0.0.64.2.tar.gz
Algorithm Hash digest
SHA256 2e56f6c03b9c6b950c835535d8361839b6af36f65059ab6e6584b12ec4b76a7e
MD5 eabaf10050226214c4c4ff34e92f9cb2
BLAKE2b-256 3488573850daef9942a19e24a4eddea82554aec3d1151a0b6ca914559b9c68a1

See more details on using hashes here.

File details

Details for the file shaonutil-0.0.0.64.2-py3.8.egg.

File metadata

  • Download URL: shaonutil-0.0.0.64.2-py3.8.egg
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for shaonutil-0.0.0.64.2-py3.8.egg
Algorithm Hash digest
SHA256 b5eca5585db138225286c5ff18549035af2a3281bbf6d369aeafea89f320840f
MD5 512cbec07818be644d5e0d948a525271
BLAKE2b-256 574f63543ac3d162d7cbcbb86c1bab647e3c60b09f64b8357d6622b2812a6f95

See more details on using hashes here.

File details

Details for the file shaonutil-0.0.0.64.2-py3-none-any.whl.

File metadata

  • Download URL: shaonutil-0.0.0.64.2-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for shaonutil-0.0.0.64.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0f096a62c644d97da01a8a8cf7d978b8da3012465eb836f80537fc9e2d02623f
MD5 2c404ae7c217ecd14279a5ea4e53e13b
BLAKE2b-256 3fff53b0b2bfd6b0cdfae8573c24757e700bce59bbf59d0c079b297e8ef0d4cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page