Metadata-Version: 2.0
Name: b3j0f.utils
Version: 0.9.1
Summary: Set of tools and utilities useful in python projects
Home-page: https://github.com/b3j0f/utils/
Author: b3j0f
Author-email: jlabejof@yahoo.fr
License: MIT License
Keywords: utils,chaining,iterable,tools,path,property,dynamic,reflection,reflect,runtime,unittest,unit test,version,common
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: French
Classifier: Operating System :: OS Independent
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4

Description
-----------

Common tools useful to python projects.

.. image:: https://img.shields.io/pypi/l/b3j0f.utils.svg
   :target: https://pypi.python.org/pypi/b3j0f.utils/
   :alt: License

.. image:: https://img.shields.io/pypi/status/b3j0f.utils.svg
   :target: https://pypi.python.org/pypi/b3j0f.utils/
   :alt: Development Status

.. image:: https://img.shields.io/pypi/v/b3j0f.utils.svg
   :target: https://pypi.python.org/pypi/b3j0f.utils/
   :alt: Latest release

.. image:: https://img.shields.io/pypi/pyversions/b3j0f.utils.svg
   :target: https://pypi.python.org/pypi/b3j0f.utils/
   :alt: Supported Python versions

.. image:: https://img.shields.io/pypi/implementation/b3j0f.utils.svg
   :target: https://pypi.python.org/pypi/b3j0f.utils/
   :alt: Supported Python implementations

.. image:: https://img.shields.io/pypi/wheel/b3j0f.utils.svg
   :target: https://travis-ci.org/b3j0f/utils
   :alt: Build status

.. image:: https://coveralls.io/repos/b3j0f/utils/badge.png
   :target: https://coveralls.io/r/b3j0f/utils
   :alt: Code test coverage

.. image:: https://img.shields.io/pypi/dm/b3j0f.utils.svg
   :target: https://pypi.python.org/pypi/b3j0f.utils/
   :alt: Downloads

Links
-----

- `Homepage`_
- `PyPI`_
- `Documentation`_

Installation
------------

pip install b3j0f.utils

Features
--------

This library provides a set of generic tools in order to ease development of projects in python >= 2.6.

Provided tools are:

- chaining: chain object methods calls in a dedicated Chaining object. Such method calls return the Chaining object itself, allowing multiple calls to object methods to be invoked in a concise statement.
- iterable: tools in order to manage iterable elements.
- path: python object path resolver, from object to absolute/relative path or the inverse.
- property: (un)bind/find properties in reflective and oop concerns.
- reflect: tools which ease development with reflective concerns.
- runtime: ease runtime execution.
- proxy: create proxy (from design pattern) objects from a routine or an object which respects the signature and description of the proxified element.
- ut: improve unit tests.
- version: ease compatibility between python version (from 2.x to 3.x).

Examples
--------

Chaining
########

>>> # add characters to a string in one line
>>> from b3j0f.utils.chaining import Chaining, ListChaining
>>> c = Chaining("te").__iadd__("s").__iadd__("t")
>>> # display content of Chaining
>>> c._
test
>>> # call several strings operations on several strings and get operation results in one line
>>> ListChaining("Test", "Example").upper().lower()[:]
[["TEST", "EXAMPLE"], ["test", "example"]]

Iterable
########

>>> from b3j0f.utils.iterable import is_iterable, first
>>> is_iterable(1)
False
>>> is_iterable("aze")
True
>>> is_iterable("aze", exclude=str)
False

>>> first("aze")
"a"
>>> first("", default="test")
"test"

Path
####

>>> from b3j0f.utils.path import lookup, getpath
>>> getpath(lookup)
"b3j0f.utils.path.lookup"
>>> getpath(lookup("b3j0f.utils.path.getpath"))
"b3j0f.utils.path.getpath"

Property
########

>>> from b3j0f.utils.property import put_properties, get_properties, del_properties
>>> put_properties(min, {'test': True})
>>> get_properties(min)
{'test': True}
>>> del_properties(min)
>>> get_properties(min)
None

Reflect
#######

>>> from b3j0f.utils.reflect import base_elts, is_inherited
>>> class BaseTest(object):
>>>     def test(self): pass
>>> class Test(BaseTest): pass
>>> class FinalTest(Test): pass
>>> base_elts(FinalTest().test, depth=1)[-1].im_class.__name__
Test
>>> base_elts(FinalTest().test)[-1].im_class.__name__
BaseTest

>>> is_inherited(FinalTest.test)
True
>>> is_inherited(BaseTest.test)
False

Proxy
#####

>>> from b3j0f.utils.proxy import get_proxy, proxified_elt
>>> l = lambda: 2
>>> proxy = get_proxy(l, lambda: 3)
>>> proxy()
3
>>> assert proxified_elt(proxy) is l
True
>>> proxified_elt(proxy)()
2
>>> proxy = get_proxy(l)
>>> proxy()
2
>>> assert proxy is not l
>>> assert proxified_elt(proxy) is l

Perspectives
------------

- wait feedbacks during 6 months before passing it to a stable version.
- Cython implementation.

Donation
--------

.. image:: https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.png
   :target: https://gratipay.com/b3j0f/
   :alt: I'm grateful for gifts, but don't have a specific funding goal.

.. _Homepage: https://github.com/b3j0f/utils
.. _Documentation: http://pythonhosted.org/b3j0f.utils
.. _PyPI: https://pypi.python.org/pypi/b3j0f.utils/


