Skip to main content

AlexBerUtils is collection of the small utilities

Project description

AlexBerUtils

AlexBerUtils is collection of the small utilities. See CHANGELOG.md for detail description.

Getting Help

QuickStart

pip3 install -U alex-ber-utils

Installing from Githib

python3 -m pip install -U https://github.com/alex-ber/AlexBerUtils/archive/master.zip

Optionally installing tests requirements.

python3 -m pip install -U https://github.com/alex-ber/AlexBerUtils/archive/master.zip#egg=alex-ber-utils[tests]

Or explicitly:

wget https://github.com/alex-ber/AlexBerUtils/archive/master.zip -O master.zip; unzip master.zip; rm master.zip

And then installing from source (see below).

Installing from source

python3 -m pip install . # only installs "required"
python3 -m pip install .[test] # installs dependencies for tests
python3 -m pip install .[md]   # installs multidispatcher (used in method_overloading_test.py)

From the directory with setup.py

python3 setup.py test #run all tests
pytest

Requirements

AlexBerUtils requires the following modules.

  • Python 3.7+

  • PyYAML==5.1

Changelog

All notable changes to this project will be documented in this file.

#https://pypi.org/manage/project/alex-ber-utils/releases/

[Unrelased]

[0.2.1] - 2019-05-22

Changed

  • setup url fixed.
  • Added import of Enum to alexber.utils package.

[0.2.0] - 2019-05-22

Changed

  • setup.py - keywords added.

[0.1.1] - 2019-05-22

Changed

  • README.md fixed typo.

[0.1.0] - 2019-05-22

Changed

  • alexber.utils.UploadCommand - bug fixed, failed on git tag, because VERSION was undefined.

[0.0.1] - 2019-05-22

Added

  • alexber.utils.StrAsReprMixinEnum - Enum Mixin that has str() equal to repr().

  • 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 as repr().

  • alexber.utils.threadlocal_var, get_threadlocal_var, del_threadlocal_var.

    Inspired by https://stackoverflow.com/questions/1408171/thread-local-storage-in-python

  • alexber.utils.UploadCommand - Support setup.py upload.

    UploadCommand is intented to be used only from setup.py

    It'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 appropriate new() / 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 class

    This is modelled as closely as possible to the Java original.

    Created - Anand B Pillai abpillai@gmail.com.

    Update to Python 3 by Alex.

    Also there are some tweeks that was done by Alex.

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

alex_ber_utils-0.2.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

alex_ber_utils-0.2.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file alex_ber_utils-0.2.1.tar.gz.

File metadata

  • Download URL: alex_ber_utils-0.2.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for alex_ber_utils-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7bfefe6ec6dee49a519b659d0c7c1b6b15687bda07eedb23561bb4ea17937617
MD5 350fd7d08277f856aa9d0ec13630234a
BLAKE2b-256 d5188b07b7d799e726ba40451822c9143106882366eef84063b2e4dfedaa6d31

See more details on using hashes here.

File details

Details for the file alex_ber_utils-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: alex_ber_utils-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for alex_ber_utils-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f48400d7baa5f2533e7df7a0bc9d609a6331ffbc4eba9713c176fef8c148a63a
MD5 83ba4cb08337c3a676b795d73149ddba
BLAKE2b-256 2b3bc7781609d10f931b3a50bd3a3599750fead862144c484f410ac5312f308c

See more details on using hashes here.

Supported by

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