ka_uts_com

Overview

Communication Utilities

Installation

The package ka_uts_com can be installed from PyPI or Anaconda.

To install with pip:

$ python -m pip install ka_uts_com

To install with conda:

$ conda install -c conda-forge ka_uts_com

This requires that the readme extra is installed:

$ python -m pip install ka_uts_com[readme]

Configuration

The Configuration of standard or personal (tenant specific) Package logging can be defined in Yaml Configuration Files in the data directory <Package Name>/data of the Package.

Logging Configuration Files
Type Name Directory Description
standard log.standard.yml ka_uts_com/data the Python Logger compatible stabdard Yaml config. file is used to define standard logging
personal log.personal.yml the Python Logger compatible personal Yaml config. file is used to define personal logging

Modules

Classification

The Modules of Package ka_uts_com could be classified in the follwing module classes:

  1. Base-Module
  2. Utility-Modules
  3. Special-Modules

Base Modules

Base Modules with classes
Name Type Static Classes
Name Description
com Communication App Setup Application Management
Com Communication Management
Cfg Configuaration Management
Exit Setup Exit Rules
LogStandard Standard Log Configuration
LogPersonal Peronal Log Configuration
Mgo Mongo DB Interface

Utility Modules

Utility Modules with classes
Name Type Static Classes
Name Description
argv Commandline Arguments Argv Command Line Arguments Handling
deq Dictionary of Equates Deq Processing of Dictionaries which are created out of Parameter Equates
fnc Function Management Fnc Function Managment (Show, Execution)
ioc I/O Control Yaml I/O Control for YAML files
Jinja2 I/O Control for Jinja2 files
log Logging Log Log Management
pacmod Package and Module Pacmod Package and Module Managment
str String Str String Processing
timer Timer Timestamp Timestamp Handling
Timer Timer Management

Special Modules

Special Modules without classes
Name Type Statements
__init__ Package directory marker Module with no Statements; the module is used to mark the directory it contains as a package. A dummy Module enforces explicit imports and thus clear namespace use and call them with the dot notation
__version__ Version Assignment Statements for Version System Variables

Base Module: com

The Base Module com contains the subsequent static classes

  1. App
  2. Com
  3. Cfg
  4. Exit
  5. LogStandard
  6. LogPersonal

static Class: App

The static Class App contains the subsequent static variables and methods

static Variables

App static Variables
Name Type Default Description
sw_init T_Bool False initialisation switch
httpmod T_Dic None http modus
sw_replace_keys TN_Bool False replace keys switch
keys TN_Arr None Keys array
reqs T_Dic None Requests dictionary
app T_Dic None Appliction dictionary

Methods

App Methods
Name Description Parameter / Return Value
Name Type P/R Description
init initialise static variables of class if they are not allready initialized cls class P current class
**kwargs list P Keyword arguments
sh show (return) class cls class P current class
**kwargs list P Keyword arguments
log Logger R  

static Class: Com

The static Class Com contains the subsequent variables and methods

static Variables

Com static Variables
Name Type Default Description
cfg T_Dic None Configuration dictionary
log Logger None logging Method
sw_init T_Bool False initialisation switch

Methods

Com Methods
Name Description Parameter / Return Value
Name Type P/RV Description
init initialise static variables of class if they are not allready initialized cls class P current class
**kwargs list P keyword arguments

static Class: Cfg

The static Class Cfg contains the subsequent methods.

Methods

Cfg Methods
Name Description Parameter / Return Value
Name Type P/RV Description
init read pacmod yaml file into dictionary variable _dic and return _dic cls class P current class
pacmod T_Dic P pacmod dictionary
_dic TN_Dic RV  

static Class: Exit

Exit static Variables
Name Type Default Description
sw_critical T_Bool False critical switch
sw_stop T_Bool False stop switch
sw_interactive T_Bool False interactive switch

static Class: LogPersonal

The static Class LogPersonal contains the subsequent static variables and methods.

static Variables

LogPersonal static Variables
Name Type Default Description
sw_init T_Bool False initialisation switch
cfg T_Dic None Configuration dictionary
log Logger None logging function
logfile str None Logfile name

Methods

LogPersonal Methods
Name Description Parameter / Return Value
Name Type P/RV Description
init Initialize static class variables if they are not allready initialized cls class P current class
**kwargs   P keywords
read   pacmod T_Dic P pacmod dictionary
filename str P  
log_main str RV  
set_level set static variable log level in log configuration handlers sw_debug bool P debug switch
sh show static Logger variable log cls class P current class
**kwargs   P keyword arguments
log Logger P  

static Class: LogStandard

The static Class LogStandard contains the subsequent static variables and methods

static Variables

LogStandard static Variables
Name Type Default Description
sw_init T_Bool False initialisation switch
cfg T_Dic None Configuration dictionary
log Logger None logging function
logfile str None Logfile name

Methods

LogStandard Methods
Name Description Parameter / Return Value
Name Type P/RV Description
read Read log file path with jinja2 I/O utility pacmod T_Dic P  
filename str P  
log_main str RV  
set_level Set static variable log level in log configuration handlers sw_debug bool P  
init initialise static variables of class if if they are not allready initialized cls class P current class
**kwargs   P  
sh show static Logger variable cls class P current class
**kwargs   P Keywords
log Logger RV  

Utility Module: argv

The Module argv contains the subsequent static classes.

Module argv static Classes
Name Type Static Classes
Name Description
argv CLI Argument Management Argv Manage Commandline Arguments as Equate-Strings

static Class: Argv

The static Class Argv contains the subsequent variables and methods

static variables

Argv static Variables
Name Type Default Description
sw_init T_Bool False initialisation switch
httpmod T_Dic None http modus
sw_replace_keys TN_Bool False replace keys switch
keys TN_Arr None Keys array
reqs T_Dic None Requests dictionary
app T_Dic None Appliction dictionary

Methods

Argv Methods
Name Description Parameter / Return Value
Name Type P/RV Description
set_by_pacmod set current pacmod dictionary d_eq T_Dic P Dictionary of equates
root_cls Class P Root Class
set_d_eq set current pacmod dictionary d_eq T_Dic P Dictionary of equates
root_cls Class P Root Class

static Class: Aeq

The static Class Aeq contains the subsequent variables and methods

Methods

Aeq static Methods
Name Description Parameter / Return Value
Name Type P/R Description
sh_value Show value of equate string provided by single command line argument cls class P current class
key str P Key of equate string
value Any P Value of equate string
d_valid_parms TN_Dic P Dictionary of valid keys (parameters)
value Any RV converted Value of the equate-string according Value type d_valid_parms
sh_d_eq Show Dictionary creat created by parsing array of equate strings provided by commandline arguments cls class P current class
a_s_eq T_Arr P array of equate strings
d_valid_parms TN_Dic P Dictionary of valid parameter-keys
d_eq TN_Dic RV Dictiony of parameter key, values

Utility Module: ioc

The Module ioc provides Classes with I/O Control methods for files; it contains the subsequent classes classified by the supported file type.

ioc static Classes
Name Type Static Classes
Name Description
ioc I/O Control Jinja2 I/O Control for Jinja2 files
Yaml MI/O Control for Yaml files

static Class: Jinja2

The static Class Jinja2 provides I/O Control methods for Jinja2 files; it contains the subsequent variables and methods.

Methods

Jinja2 Methods
Name   Parameter / Return Value
Name Type P/R Description
read Read log file path with jinja pacmod TN_Dic P  
filename str P  
  TN_Any RV no return value
read_template Read log file path with jinja2 pacmod TN_Dic P  
filename TN_Any P  
  TN_Any RV no return value

static Class: Yaml

The static Class Yaml provides I/O Control methods for Yaml files; it contains the subsequent variables and methods

static Methods

Yaml Methods
Name Description Parameter / Return Value
Name Type P/RV Description
load Load yaml string into any object using yaml loader; default is yaml.safeloader string str P  
loader str P  
  TN_Any RV no return value
read Read yaml file path into any object using yaml loader; default loader is yaml.safeloader path str P  
loader str P  
  TN_Any RV no return value

Utility Module: log

The Module log provides Classes with I/O Control methods for log files; it contains the following static classes.

* Module log static Classes*
Name Type Static Classes
Name Description
log Logging Log Log Management

static Class: Log

static Variables

Log static Variables
Name Type Default Description
sw_init T_Bool False initialisation switch
cfg T_Dic None Configuration dictionary
log Logger None logging function

static Sub-Classes

The Class Log contains the following static sub-classes.

Log static Sub-Classes
Name Type Description
Eq   Log Management for Equate Messages
Methods
Log Methods
Name Description Parameter / Return Value
Name Type P/RV Description
debug Log debug message cls class P current class
key Any P  
value Any P  
error Log error message cls class P current class
key Any P  
value Any P  
info Log info message cls class P current class
key Any P  
value Any P  
warning Log warning message cls class P current class
key Any P  
value Any P  
sh show equate message key Any P  
value Any P  
  str RV no return value

Utility Module: pacmod

The Module pacmod contains the following static classes.

pacmod static Classes
Name Type Static Classes
Name Description
Pacmod Package Module Pacmod Package Module Management

static Class: Pacmod

Methods

Pacmod Methods
Name Description Parameter / Return Value
Name Type P/RV Description
sh_d_pacmod create and show (return) pacmod dictionary root_cls class P root class
tenant Any P  
  T_Dic RV no return value
sh_path_cfg_yaml show pacmod file path of the yaml file <pacmod module>.yaml in the data directory of the current module of the current package pacmod T_Dic P  
  str RV no return value
sh_path_keys_yaml show pacmod file path type for the yaml file keys.yml keys.yml in the data directory of the current module of the current pacmod T_Dic P  
type_ str P  
  str RV no return value
sh_pacmod_type show pacmod type directory path pacmod T_Dic P  
type_ str P  
  str RV no return value
sh_file_path show pacmod file path cls class P current class
pacmod T_Dic P  
type_ str P  
suffix str P  
pid Any P  
ts Any P  
**kwargs   P keyword arguments
  str RV no return value
sh_pattern show pacmod file path pattern pacmod T_Dic P  
type_ str P  
suffix str P  
**kwargs   P keyword arguments
  str RV no return value
sh_path_cfg_log show file path of log configuration file pacmod TN_Dic P  
filename str P  
  str RV no return value
sh_d_pacmod show pacmod dictionary cls class P current class
**kwargs   P keyword arguments

Utility Module: timer

The Module timer contains the following static classes.

timer static Classes
Name Type Static Classes
Name Description
Timer Timer Timestamp Timestamop class
Timer Timer class

Class: Timer

static Variables

Class Timer static Variables
Name Type Default Description
sw_init T_Bool False initialisation switch
cfg T_Dic None Configuration dictionary
log Logger None logging function

Methods

Class Timer static Methods
Name Description Parameter / Return Value
Name Type P/RV Description
read Read log file path with jinja2 pacmod T_Dic P  
filename str P  
log_main str RV  
set_level Set static variable log level in log configuration handlers sw_debug bool P  
init initialise static variables if they are not allready initialized cls class P current class
**kwargs   P keyword arguments
sh show static variable log cls class P  
**kwargs   P keyword arguments

Special Module: __version__

The Module __version__ contains no classes, but assignment statements for system variables used by versioning.

Module __version_ System Variables
Name Example
__title__ 'ka_uts_com'
__description__ 'Communication Area Utilities.'
__url__ 'https://ka-com.readthedocs.io/en/latest'
__version___ '2023.2.2'
__build__ 0x022200
__author_email_ 'Bernd Stroehle'
__license__ 'Apache-2.0'
__copyright__ 'Copyright 2023 bs29'
__cake__ u'u2728 U0001f370 u2728'

Module Data

Name Description
log.main.tenant.yml __copyright__ 'ka_uts_com' 'Copyright 2023 bs29'