Package XPyLIB
[hide private]
[frames] | no frames]

Package XPyLIB

source code

Some libraries for python programmers.

Common description.

XPyLIb library commonly configured throw configuration file. It's sitax see below.

Root package XPyLIB do main initialization and provide some useful things. The dir_... variables contanes path to place that they named. It more better use this variables then calculate path youself. Also you can obtain needed path by using function dir_get().

User configurations, logs and other things are plased in user home "~/.xpylib/" directory.

XPyLIB compact distributing.

You can use/distribute XPyLIB package from XPyLIB library in compact form. For this you need compress and move all needed files (".py" or ".pyc" or ".pyo"), exclude "__init__.py[co]", in "XPyLIB/XPyLIB" folder into "xpylib.zip" zip archive in this folder. In initialization XPyLIB package try find "xlogging.py[co]" and if not find then add to __path__ "xpylib.zip" path.

XPyLIB configuration file.

XPyLIB package auto configures from "XPyLIB/config/xpylib.cfg" file. This file may have next structure: All logging output from XPyLIB library saved into "XPyLIB/logs" folder if not set other. If in library occurs error then you may look logs and if they contains info may send it to author in zipped format.


Version: 0.1.1

Submodules [hide private]

Functions [hide private]
 
dir_get(dirpath='', user=True, create=False)
Return quering path.
source code
Variables [hide private]
int {0755} _mode = 755
Mode for folder creation.
str dir_root = '/home/alex/projects/XPyLIB/XPyLIB'
Absolute path to XPyLIB library.
str dir_rootuser = '/home/alex/.xpylib'
Absolute path to ".xpylib" folder in user directory.
str dir_logs = '/home/alex/.xpylib/logs'
Absolute path to user ".xpylib/logs" folder.
str dir_config = '/home/alex/projects/XPyLIB/XPyLIB/config'
Absolute path to XPyLIB library "config" folder.
str dir_configuser = '/home/alex/.xpylib/config'
Absolute path to user configuration ".xpylib/config" folder.
str dir_xpylib = '/home/alex/projects/XPyLIB/XPyLIB'
Absolute path to "XPyLIB" folder (default same as dir_root).
str log_levelbodychar = '.'
Character that fill indentation spaces.
str log_levelendchar = '>'
Character that insert before string output but after level indentation.
int log_levelwidth = 2
Number of indentation characters in one indentation level.
int log_levelerr = '*** LEVEL ERROR = '
Error message then level indentation is invalid thrn return from wrapped function.
str log_descfuncall = 'CALL '
Function call description.
str log_descfunret = 'RET from '
Function return description.

Imports: os, XPyLIB.xlogging, XPyLIB.dbg


Function Details [hide private]

dir_get(dirpath='', user=True, create=False)

source code 
Return quering path.
Parameters:
  • dirpath (str = '' or list of str ['']) - Relative quering directory path.
  • user (bool = True) - If true then return path to dir in user home dir "~/.xpylib/" otherwise in XPyLIB directory "/XPyLIB/".
  • create (bool = False) - If True and path not exists then create directory recursively. If false then do nothing. Create new directory available only for user home dir (parameter user=True ).
Returns:
Absolute path to queried folder or empty string '' if no such folder or can't create or error occurs.

Variables Details [hide private]

dir_rootuser

Absolute path to ".xpylib" folder in user directory. Used for user configuration, logs and etc.
Type:
str
Value:
'/home/alex/.xpylib'