Package: alex-ber-utils
AlexBerUtilsAlexBerUtils is collection of the small utilities. See CHANGELOG.md for detail description.Getting HelpQuickStartpython3-mpipinstall-Ualex-ber-utilsInstalling from Githubpython3-mpipinstall-Uhttps://github.com/alex-ber/AlexBerUtils/archive/master.zipOptionally installing tests requirements.python3-mpipinstall-Uhttps://github.com/alex-ber/AlexBerUtils/archive/master.zip#egg=alex-ber-utils[tests]Or explicitly:wgethttps://github.com/alex-ber/AlexBerUtils/archive/master.zip-Omaster.zip;unzipmaster.zip;rmmaster.zipAnd then installing from source (see below).Installing from sourcepython3-mpipinstall.# only installs "required"python3-mpipinstall.[tests]# installs dependencies for testspython3-mpipinstall.[piptools]# installs dependencies for pip-toolspython3-mpipinstall.[md]# installs multidispatcher (used in method_overloading_test.py)python3-mpipinstall.[fabric]# installs fabric (used in fabs.py)python3-mpipinstall.[yml]# installs Yml related dependencies# (used in ymlparsers.py, init_app_conf.py, deploys.py;# optionally used in ymlparsers_extra.py, emails.py)python3-mpipinstall.[env]# installs pydotenv (optionally used in deploys.py and mains.py)Alternatively you install from requirements file:python3-mpipinstall-rrequirements.txt# only installs "required"python3-mpipinstall-rrequirements-tests.txt# installs dependencies for testspython3-mpipinstall-rrequirements-piptools.txt# installs dependencies for pip-toolspython3-mpipinstall-rrequirements-md.txt# installs multidispatcher (used in method_overloading_test.py)python3-mpipinstall-rrequirements-fabric.txt# installs fabric (used in fabs.py)python3-mpipinstall-rrequirements-yml.txt# installs Yml related dependencies# (used in ymlparsers.py, init_app_conf.py, deploys.py;# optionally used in ymlparsers_extra.py, emails.py)python3-mpipinstall-rrequirements-env.txt# installs pydotenv (optionally used in deploys.py)Using Dockeralexberkovich/AlexBerUtils:latestcontains allAlexBerUtilsdependencies.
This Dockerfile is very simple, you can take relevant part for you and put them into your Dockerfile.Alternatively, you can use it as base Docker image for your project and add/upgrade
another dependencies as you need.For example:FROMalexberkovich/alex_ber_utils:latestCOPYrequirements.txtetc/requirements.txtRUNset-ex&&\#latestpip,setuptools,wheelpipinstall--upgradepipsetuptoolswheel&&\pipinstallalex_ber_utilspipinstall-retc/requirements.txtCMD["/bin/sh"]#CMD tail -f /dev/nullwhererequirements.txtis requirements for your project.From the directory with setup.pypython3setup.pytest#run all testsorpytestInstalling new versionSeehttps://docs.python.org/3.1/distutils/uploading.htmlInstalling new version to venvpython38-mpipuninstall--yesalex_ber_utils
python38setup.pycleansdistbdist_wheel
python38-mpipinstall--find-links=./distalex_ber_utils==0.6.5##Manual upload#python setup.py clean sdist uploadRequirementsAlexBerUtils requires the following modules.Python 3.6+PyYAML>=6.0.1ChangelogAll notable changes to this project will be documented in this file.#https://pypi.org/manage/project/alex-ber-utils/releases/Unreleased[0.8.0] 04.12.2023ChangedIn setup.cfg flag mock_use_standalone_module
was changed to false (to use unittest.mock).Many version of the packages in extra was updated to latest:python-dotenv from 0.15.0 to 1.0.0.MarkupSafe isdowngradedfrom 2.1.3 to 2.0.1bcrypt is upgraded from 3.2.0 to 4.1.1cffi is upgraded from 1.14.5 to 1.16.0cryptography is upgraded from 38.0.4 to to 41.0.7fabric is upgraded from 2.5.0 to 3.2.2invoke is upgraded from 1.7.3 to 2.2.0paramiko is upgraded from 2.7.2 to 3.3.1pycparser is upgraded from 2.20 to 2.21PyNaCl is upgraded from 1.3.0 to 1.5.0HiYaPyCo is upgraded from 0.5.1 to 0.5.4Addednew extra-group, with name requirements-piptools.txt is added.alexber.utils.props.lazyproperty is added. TODO: add test for itNew file requirements.in that have all high-level dependecies together.New file requirements.all that have pinned low-level dependecies resolution.Removedmock package was removed. pytest will use unittest.mock. See Changed
p.1 above.six was removed.[0.7.0] - 04-08-2023ChangedUpgrade pyparsing==2.4.7 to 3.1.1.Upgrade cryptography from 3.4.7 to 41.0.3.Upgrade invoke from 1.4.1 to 1.7.3.Upgrade six from 1.15.0 to 1.16.0.Upgrade colorama from 0.4.3 to 0.4.4.Change declaration of namespace todeclare_namespace()mechanism.AddedExplicit dependency on pyOpenSSL==22.1.0 (lowest version where cryptography version is
pinned). cryptography's and pyOpenSSL's version change should be in sync.[0.6.6] - 13-06-2021AddedstdLoggingmodule. The main function isinitStream(). This is Thin adapter layer that redirects stdout/stderr
(or any other stream-like object) to standard Python's logger. Based onhttps://github.com/fx-kirin/py-stdlogging/blob/master/stdlogging.pySeehttps://github.com/fx-kirin/py-stdlogging/pull/1Quote fromhttps://stackoverflow.com/questions/47325506/making-python-loggers-log-all-stdout-and-stderr-messages:
"But be careful to capture stdout because it's very fragile". I decided to focus on redirecting stderr only to the
logger. If you want you can also redirect stdout, by making 2 calls to initStream() package-level method.
But, because ofhttps://unix.stackexchange.com/questions/616616/separate-stdout-and-stderr-for-docker-runit is
sufficient only to do it for stderr for me.
See [https://alex-ber.medium.com/stdlogging-module-d5d69ff7103f] for details.ChangedDoockerfilesbase-image. Now, you can transparentely switch betwee AMD64 to ARM 64 proccessor.cffidependency from 1.14.3 to 1.14.5.cryptographydependency from 3.1.1 to 3.4.7.[0.6.5] - 12-04-2021AddedFixRelCwdcontext-manager inmainsmodule - This context-manager temporary changes current working directory to
the one where relPackage is installed. What if you have some script or application that use relative path and you
want to invoke in from another directory. To get things more complicated. maybe your “external” code also userelativepath, but relative to another directory.
See [https://alex-ber.medium.com/making-more-yo-relative-path-to-file-to-work-fbf6280f9511] for details.GuardedWorkerExceptioncontext-manager inmainsmodule - context manager that mitigate exception propogation
from another process. It is very difficult if not impossible to pickle exceptions back to the parent process.
Simple ones work, but many others don’t.
For example, CalledProcessError is not pickable (my guess, this is because of stdout, stderr data-members).
This means, that if child process raise CalledProcessError that is not catched, it will propagate to the parent
process, but the propagation will fail, apparently because of bug in Python itself.
This causepool.join() to halt forever — and thus memory leak!See [https://alex-ber.medium.com/exception-propagation-from-another-process-bb09894ba4ce] for details.join_files()function infilesmodule - Suppose, that you have some multi-threaded/multi-process application
where each thread/process creates some file (each thread/process create different file)
and you want to join them to one file.
See [https://alex-ber.medium.com/join-files-cc5e38e3c658] for details.Changedfixabscwd()function inmainsmodule - minour refactoring - moving out some internal helper function for reuse
in new function.Base docker image version to alexberkovich/alpine-anaconda3:0.2.1-slim.
alexberkovich/alpine-anaconda3:0.1.1 has some minor changes relative to alexberkovich/alpine-anaconda3:0.1.1.
See [https://github.com/alex-ber/alpine-anaconda3/blob/master/CHANGELOG.md] for details.UpdatedDocumentationSee [https://github.com/alex-ber/AlexBerUtils/issues/8] Config file from another directory is not resolved
(usingargumentParserwith--general.config.filecan't be passed toinit_app_conf.parse_config())[0.6.4] - 12/12/2020ChangedBase docker image version to alexberkovich/alpine-anaconda3:0.1.1-slim.
alexberkovich/alpine-anaconda3:0.1.1 has some minor changes relative to alexberkovich/alpine-anaconda3:0.1.0.
See [https://github.com/alex-ber/alpine-anaconda3/blob/master/CHANGELOG.md] for details.
alexberkovich/alpine-anaconda3:0.1.1-slim is "slim" version of the same docker image, most unused packaged are removed.update versions to pip==20.3.1 setuptools==51.0.0 wheel==0.36.1RemovedScript check_d.py[0.6.3] - 18/11/2020ChangedBase docker image version to alexberkovich/alpine-anaconda3:0.1.0, it has fix for potential security risk: Git was changed
not to store credential as plain text, but to keep them in memory for 1 hour,
seehttps://git-scm.com/docs/git-credential-cacheUpdatedDocumentationMydeploysmodule [https://medium.com/analytics-vidhya/my-deploys-module-26c5599f1b15 for documentation]
is updated to containfix_retry_env()function inmainsmodule.AddedDocumentationfix_retry_env()function inmainsmodule. [https://alex-ber.medium.com/make-path-to-file-on-windows-works-on-linux-402ed3624f66][0.6.2] - 17/11/2020Deprecationmethod_overloading_test.pyis deprecated and will be removed once AlexBerUtils will support
Python 3.9. It will happen approximately at 01.11.2021.This test usesmultidispatchproject that wasn't updated since 2014.
In Python 3.8 it has following warning:multidispatch.py:163: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working from collections import MutableMappingAddedclassOsEnvrionPathRetry, functionfix_retry_env()tomainsmodule.ChangedOsEnvrionPathExpender- refactored, functionality is preserved.[0.6.1] - 16/11/2020Addedoptional Dockerfileoptional .env.docker for reference.Support of Python 3.8 is validated, seehttps://github.com/alex-ber/AlexBerUtils/issues/5Email formatting changed in Python 3.8, seehttps://github.com/alex-ber/AlexBerUtils/issues/7Note that it is possible that7bitwill be replaced with8bitasContent-Transfer-Encoding,
that I'm considering as ok.check_all.pyto run all unit test.check_d.pyfor sanity test..dockerignorerequirements*.txt - dependencies version changed, seehttps://github.com/alex-ber/AlexBerUtils/issues/6Because of pytest upgradeconftest.pywas changed:pytest_configure()was added to support dynamically used marks.Inymlparsers_test.pydeprecation warning removed (it will be error in Python 3.9)collections.Mappingwas changed tocollections.abc.Mapping.ChangedREADME.MD added section about Docker usage.setup.py to indicate support of Python 3.8[0.5.3] - 10/09/2020Changedalexber.utils.emails.initConfigis fixed. Before this default variables where ignored.2 Unit tests forinit_app_confare fixed. These fix are minors.Documentationimportermodule [https://medium.com/analytics-vidhya/how-to-write-easily-customizable-code-8b00b43406b2]fixabscwd()function inmainsmodule.  [https://medium.com/@alex_ber/making-relative-path-to-file-to-work-d5d0f1da67bf]fix_retry_env()function inmainsmodule. [https://alex-ber.medium.com/make-path-to-file-on-windows-works-on-linux-402ed3624f66]Myparsermodule [https://medium.com/analytics-vidhya/my-parser-module-429ed1457718]Myymlparsersmodule [https://medium.com/analytics-vidhya/my-ymlparsers-module-88221edf16a6]My majorinit_app_confmodule [https://medium.com/analytics-vidhya/my-major-init-app-conf-module-1a5d9fb3998c]Mydeploysmodule [https://medium.com/analytics-vidhya/my-deploys-module-26c5599f1b15]Myemailsmodule [https://medium.com/analytics-vidhya/my-emails-module-3ad36a4861c5]Myprocessinvokesmodule [https://medium.com/analytics-vidhya/my-processinvokes-module-de4d301518df][0.5.2] - 21/06/2020Addedpath()function inmainsmodule. For older Python version usesimportlib_resourcesmodule. For newer version built inimportlib.resources.load_env()function inmainsmodule. Added kwargs forwarding. if dotenv_path or stream is present it will be used.
if ENV_PCK is present, dotenv_path will be constructed from ENV_PCK and ENV_NAME.
Otherwise, kwargs will be forwarded as is to load_dotenv.fix_env()function inmainsmodule. For each key in ENV_KEYS, this method prepends full_prefix to os.environ[key].
full_prefix is calculated as absolute path of__init__.pyof ENV_PCK.Changedprocessinvokesfunctionrun_sub_process- documentation typo fixed.
Lower Python version to 3.6.[0.5.1] - 06-05-2020Addedmainsmodule explanation articlehttps://medium.com/@alex_ber/making-relative-path-to-file-to-work-d5d0f1da67bfis published.fabsmodule. It adds cp method to fabric.Connection.This method is Linux-like cp command. It copies single file to remote (Posix) machine.Spited dependency list for setup.py req.txt (inexact versions, direct dependency only) and for
reproducible installation requirements.txt (exact versions, all, including transitive dependencies).Added req-fabric.txt, requirements-fabric.txt - Fabric, used infabsmodule.Added req-yml.txt, requirements-yml.txt - Yml-related dependencies, used in ymlparsers.py
and in init_app_conf.py, deploys.py; optionally used in ymlparsers_extra.py, emails.py.Main dependency is HiYaPyCo. I'm using feature that is availlable in the minimal version.HiYaPyCo depends upon PyYAML and Jinja2. Limitations for Jinja2 is from HiYaPyCo project.Added req-env.txt, requirements-env.txt - pydotenv, optionally used in deploys.py.Addedinspects.has_method(cls, methodName). Check if class cls has method with name methodName directly,
or in one of it's super-classes.Addedpareser.parse_sys_argsfunction parses command line arguments.Addedymlparsersmodule -load/safe_dumpa Hierarchical Yml files. This is essentially wrapper arround HiYaPyCo project with streamlined
and extended API and couple of work-arrounds.Note: this module doesn't use any package-level variables in hiYaPyCo module, including hiYaPyCo.jinja2env.
This module do use Jinja2'sEnvironment.It also has another defaults forload/safe_dumpmethods.
They can be overridden ininitConfig()function.safe_dump()method supports simple Python objects like primitive types (str, integer, etc), list, dict,OrderedDict.as_str()- convenient method for getting str representation of the data,
for example of dict.DisableVarSubst- use of this context manager disables variable substation in theload()function.initConfig- this method reset some defaults. If running from the MainThread, this method is idempotent.Addedinit_app_confmajormodule.The main function isparse_config.  This function parses command line arguments first.
Than it parse yml files. Command line arguments overrides yml files arguments.
Parameters of yml files we always try to convert on best-effort basses.
Parameters of system args we try convert according toimplicit_convertparam.If you supplyimplicit_convert=True, thanmask_value()will be applied to the flat map (first parameter).
Otherwise,implicit_convertwiil have the value that was set inintiConfig(). By default it isTrue.Command line key --general.profiles or appropriate key default yml file is used to find 'profiles'.
Let suppose, that --config_file is resolved to config.yml.
If 'profiles' is not empty, than it will be used to calculate filenames
that will be used to override default yml file.
Let suppose, 'profiles' resolved to ['dev', 'local']. Than first config.yml
will be loaded, than it will be overridden with config-dev.yml, than
it will be overridden with config-local.yml.
At last, it will be overridden with system args.
This entry can be always be overridden with system args.ymlparsersandparsermodules serves as Low-Level API for this module.mask_value()implemented as a wrapper toparsers.safe_eval()method with support for boolean
variables. This implementation is used to get type for arguments that we get from system args.
This mechanism can be easily replaced with your own one.to_convex_map()This method receives dictionary with 'flat keys', it has simple key:value structure
where value can't be another dictionary.
It will return dictionary of dictionaries with natural key mapping,
optionally, entries will be filtered out according to white_list_flat_keys and,
optionally, value will be implicitly converted to appropriate type.In order to simulate dictionary of dictionaries 'flat keys' compose key from outer dict with key from inner dict
separated with dot.
For example, 'general.profiles' 'flat key' corresponds to convex map with 'general' key with dictionary as value
that have one of the keys 'profiles' with corresponding value.If you supplyimplicit_convert=True, thanmask_value()will be applied to the values of the received flat dictionary.
Otherwise,implicit_convertwiil have the value that was set inintiConfig(). By default it is True.merge_list_value_in_dicts- merges value of 2 dicts. This value represents list of values.
Value from flat_d is roughly obtained by flat_d[main_key+'.'+sub_key].
Value from d is roughly obtained by d[main_key][sub_key].If you supplyimplicit_convert=True, thanmask_value()will be applied to the flat map (first parameter).
Otherwise,implicit_convertwiil have the value that was set inintiConfig(). By default it isTrue.initConfig- you can set default value ofimplicit_convert. By default it isTrue.
This parameters is used ifimplicit_convertwasn't explicitly supplied. This method is idempotent.Addeddeploysmodule.
This module is usable in your deployment script. See alsofabsmodule.This method useparsers, ymlparsers,init_app_confas it's low-level API.init_app_conf` usage is limited.The main function isload_config(). It is simplified method for parsing yml configuration file with optionally
overrided profiles only. Seeinit_app_conf.parse_config()for another variant.split_path- Split filename in 2 part parts by split_dirname. first_part will ends with split_dirname.
second_part will start immediately after split_dirname.add_to_zip_copy_function- Factory method that returns closure that can be used as copy_function param inshutil.copytree().Addedemailsmodule.
This module contains extensions of the logging handlers.
This module optionally depends onymlparsesermodule.
It is better to useEmailStatuscontext manager with configuredemailLogger.
It is intended to configure first youremailLoggerwithOneMemoryHandler(together withSMTPHandler).
Than the code block that you want to aggregate log messages from is better to be enclosed withEmailStatuscontext manager.alexber.utils.emails.SMTPHandleris customization oflogging.handlers.SMTPHandler. It's purpose is to connect to
SMTP server and actually send the e-mail. Unlikelogging.handlers.SMTPHandlerthis class expects for record.msg to be built EmailMessage.
You can also change use of underline SMTP class to SMTP_SSL, LMTP, etc.
This implementation isthread-safe.alexber.utils.emails.OneMemoryHandleris variant oflogging.handlers.MemoryHandler. This handler aggregates
log messages untilFINISHEDlog-level is received or application is going to terminate abruptly (see docstring
ofcalc_abrupt_vars()method for the details) and we have some log messages in the buffer. On such event
all messages (in the current Thread) are aggregated to the singleEmailMessage. The subject of theEmailMessageis determined byget_subject()method.
If you want to change delimeters used to indicate variable declaration inside template, see docstring of theget_subject()method.
It is better to useEmailStatuscontext manager with configured emailLogger. See docstring ofEmailStatus.This implementation isthread-safe.alexber.utils.emails.EmailStatus-  if contextmanager exits with exception (it fails), than e-mail with
subject formatted with faildargs and faildkwargs will be send.
Otherwise, e-mail with subject formatted with successargs and successkwargs will be send.
All messages (in the current Thread) will be aggregated to one long e-mail with the subject described inOneMemoryHandler.get_subject()method.alexber.utils.emails.initConfig- this method reset some defaults. This method is idempotent.
By default,SMTPclass fromsmtplibis used to send actual e-mail. You can change it toSMTP_SSL,LMTP,
or another class by specifying default_smpt_cls_name.
You can also specified default port for sending e-mails.processInvokesmodule has one primary function -run_sub_process()This method run subprocess and logs it's out
to the logger. This method is sophisticated decorator tosubprocess.run(). It is useful, when your subprocessrun's a lot of time and you're interesting to receive it'sstdoutandstderr. By default, it's streamed to log.
You can easily customize this behavior, seeinitConig()method.initConig()This method can be optionally called prior any call to another function in this module. You can use your
custom class for the logging. For example, FilePipe.ChangedSpited dependency list for setup.py req.txt (inexact versions, direct dependency only) and for
reproducible installation requirements.txt (exact versions, all, including transitive dependencies).README.md changed, added section 'Alternatively you install install from requirements file:'.
Some other misc changed done.CHANGELOG.md version 0.4.1 misc changes.Misc improvement in unit tests.Fixedparser.safe_eval- safe_eval('%(message)s') was blow up, now it returns value as is.
Seehttps://github.com/alex-ber/AlexBerUtils/issues/2Enhancedimporter.importer- added support for PEP 420 (implicit Namespace Packages).Namespace packages are a mechanism for splitting a single Python package across multiple directories on disk.
When interpreted encounter with non-emptypathattribute it adds modules found in those locations
to the current package.
Seehttps://github.com/alex-ber/AlexBerUtils/issues/3In all documentation refference topip3was changed topython3 -m pip[0.4.1] - 2020-04-02BREAKING CHANGEI highly recommend not to use 0.3.X versions.Removedmodulewarnsis dropedChangedLimitation::mainsmodule wasn't tested with frozen python script (frozen using py2exe).modulemainsis rewritten. FunctioninitConfis dropped entirely.modulemainsnow works with logger and with warnings (it was wrong decision to work with warnings).[0.3.4] - 2020-04-02ChangedCHANGELOG.md fixedwarnsmodule bug fixed, now warnings.warn() works.FixabscwdWarning is added to simplify warnings disabling.Changing howmainsmodule usewarns.[0.3.3] - 2020-04-02ChangedCHANGELOG.md fixed[0.3.2] - 2020-04-01ChangedTo REAMDE.md addInstalling new versionsectionFix typo in REAMDE.md (tests, not test).Fixing bug: now, you're able to import package in the Python interpreter (setups.pyfixed)Fixing bug:warnsmodule now doesn't change log_level in the preconfigured logger in any cases.BREAKING CHANGE: Inmainsmodule methodwarnsInitConfig()was renamed tomainInitConfig()Also singature was changed.mainsmodule minor refactored.AddedUnit tests are added forwarnsmoduleUnit tests are added formainsmodule[0.3.1] - 2020-04-01ChangedTests minor improvements.Excluded tests, data from setup.py (from being installed from the sdist.)Created MANIFEST.inAddedwarnsmodule is added:It provides better integration between warnings and logger.
Unlikelogging._showwarning()this variant will always go through logger.warns.initConfig()has optional file parameter (it's file-like object) to redirect warnings.
Default value issys.stderr.If logger forlog_name(default ispy.warnings) will be configured before call toshowwarning()method,
than warning will go to the logger's handler withlog_level(default islogging.WARNING).If logger forlog_name(default ispy.warnings) willn't be configured before call to showwarning() method,
than warning will be done tofile(default issys.stderr) withlog_level(default islogging.WARNING).mainmodule is added:main.fixabscwd()changesos.getcwd()to be the directory of the__main__module.main.warnsInitConfig()reexportswarns.initConfig()for convenience.AddedTests for alexber.utils.thread_locals added.[0.2.5] - 2019-05-22ChangedFixed bug in UploadCommand, git push should be before git tag.[0.2.4] - 2019-05-22ChangedFixed bug in setup.py, incorrect order between VERSION and UploadCommand (no tag was created on upload)[0.2.1] - 2019-05-22Changedsetup url fixed.Added import of Enum to alexber.utils package.[0.2.0] - 2019-05-22Changedsetup.py - keywords added.[0.1.1] - 2019-05-22ChangedREADME.md fixed typo.[0.1.0] - 2019-05-22Changedalexber.utils.UploadCommand - bug fixed, failed on git tag, because VERSION was undefined.[0.0.1] - 2019-05-22Addedalexber.utils.StrAsReprMixinEnum - Enum Mixin that hasstr() equal torepr().alexber.utils.AutoNameMixinEnum-  Enum Mixin that generate value equal to the name.alexber.utils.MissingNoneMixinEnum - Enum Mixin will return None if value will not be found.alexber.utils.LookUpMixinEnum - Enim Mixin that is designed to be used for lookup by value.If lookup fail, None will be return. Also,str() will return the same value asrepr().alexber.utils.threadlocal_var, get_threadlocal_var, del_threadlocal_var.Inspired byhttps://stackoverflow.com/questions/1408171/thread-local-storage-in-pythonalexber.utils.UploadCommand -  Support setup.py upload.UploadCommand is intented to be used only from setup.pyIt's builds Source and Wheel distribution.It's uploads the package to PyPI via Twine.It's pushes the git tags.alexber.utils.uuid1mc is is a hybrid between version 1 & version 4. This is v1 with random MAC ("v1mc").uuid1mc() is deliberately generating v1 UUIDs with a random broadcast MAC address.The resulting v1 UUID is time dependant (like regular v1), but lacks all host-specific information (like v4).Note: somebody reported that ran into trouble using UUID1 in Amazon EC2 instances.alexber.utils.importer.importer - Convert str to Python construct that target is represented.alexber.utils.importer.new_instance - Convert str to Python construct that target is represented.
args and kwargs will be passed in to appropriatenew() /init() /init_subclass() methods.alexber.utils.inspects.issetdescriptor - Return true if the object is a method descriptor with setters.But not if ismethod() or isclass() or isfunction() are true.alexber.utils.inspects.ismethod - Return false if object is not a class and not a function.
Otherwise, return true iff signature has 2 params.alexber.utils.parsers.safe_eval - The purpose of this function is convert numbers from str to correct type.This function support convertion of built-in Python number to correct type (int, float)This function doesn't support decimal.Decimal or datetime.datetime or numpy types.alexber.utils.parsers.is_empty - if value is None returns True.if value is empty iterable (for example, empty str or emptry list),returns true otherwise false.Note: For not iterable values, behaivour is undefined.alexber.utils.parsers.parse_boolean - if value is None returns None.if value is boolean, it is returned as it is.
if value is str and value is equals ignoring case to "True", True is returned.
if value is str and value is equals ignoring case to "False", False is returned.For every other value, the answer is undefined.alexber.utils.props.Properties - A Python replacement for java.util.Properties classThis is modelled as closely as possible to the Java original.Created - Anand B Pillaiabpillai@gmail.com.Update to Python 3 by Alex.Also there are some tweeks that was done by Alex.