Giter Site home page Giter Site logo

unicum's Introduction

Python library unicum

CodeShip

Travis ci

Read the Docs

CodeFactor Grade

Code Climate maintainability

Codecov

lgtm grade

total lgtm alerts

GitHub

GitHub release

PyPI Version

PyPI - Python Version

PyPI Downloads

unicum consists of multiple object implementations that implement various factory pattern. All types merge into on type VisibleObject and each type contributes bits and piece.

The visible obj focus on robust and simple construction from a dictionary via PersistentObject having values only simple types or containers containers of simple types.

These values are translated via FatoryObject into more complex structures which are take from a factory.

Or, alternatively, using DataRange into something similar to a data_frame type in R, a table with column and row names as well as common types for each column values.

Inheriting from LinkedObject provides functionality to swap or update attributes at runtime

Example Usage

Using `FactoryObject`:

>>> from unicum import FactoryObject

>>> class Currency(FactoryObject): __factory = dict()
>>> class EUR(Currency): pass
>>> class USD(Currency): pass

>>> EUR().register()  # registers USD() instance with class name 'EUR'
>>> eur = Currency('EUR')  # picks instance with key 'EUR' from currency cache
>>> eur == EUR()  # picks instance with key given by class name 'EUR' from currency cache, too.

True

>>> eur2 = eur.__class__('EUR')  # picks instance with key 'EUR' from currency cache
>>> eur == eur2

True

>>> usd = USD().register()  # registers USD() instance with class name 'USD'
>>> usd.register('usd')  # registers usd with name 'usd'
>>> usd == USD()

True

>>> eur == eur.__class__('USD')

False

>>> usd == eur.__class__('USD')

True

>>> usd == Currency('usd')

True

Using `LinkedObject`:

>>> from unicum import LinkedObject

Development Version

The latest development version can be installed directly from GitHub:

$ pip install --upgrade git+https://github.com/sonntagsgesicht/unicum.git

Contributions

Issues and Pull Requests are always welcome.

License

Code and documentation are available according to the Apache Software License (see LICENSE).

unicum's People

Contributors

sonntagsgesicht avatar

Forkers

pbmst fagan2888

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.