mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-07 15:10:47 +03:00
0.10.5 release
This commit is contained in:
parent
addbd16b3b
commit
b22b893623
|
@ -39,7 +39,7 @@ from .utils import ensure_is_catalog_bundle
|
||||||
from .errors import Error
|
from .errors import Error
|
||||||
|
|
||||||
|
|
||||||
VERSION = '0.10.4'
|
VERSION = '0.10.5'
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
|
|
@ -9,6 +9,7 @@ from .utils import is_catalog
|
||||||
from .utils import ensure_is_catalog_bundle
|
from .utils import ensure_is_catalog_bundle
|
||||||
|
|
||||||
|
|
||||||
|
@six.python_2_unicode_compatible
|
||||||
class CatalogBundle(object):
|
class CatalogBundle(object):
|
||||||
"""Bundle of catalog providers."""
|
"""Bundle of catalog providers."""
|
||||||
|
|
||||||
|
@ -58,11 +59,15 @@ class CatalogBundle(object):
|
||||||
self._raise_undefined_provider_error(item)
|
self._raise_undefined_provider_error(item)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Return string representation of bundle."""
|
"""Return string representation of catalog bundle."""
|
||||||
return '<Bundle of {0} providers ({1})>'.format(
|
return '<{0}.{1}.Bundle({2})>'.format(
|
||||||
self.catalog, ', '.join(six.iterkeys(self.providers)))
|
self.catalog.__module__, self.catalog.__name__,
|
||||||
|
', '.join(six.iterkeys(self.providers)))
|
||||||
|
|
||||||
|
__str__ = __repr__
|
||||||
|
|
||||||
|
|
||||||
|
@six.python_2_unicode_compatible
|
||||||
class CatalogMetaClass(type):
|
class CatalogMetaClass(type):
|
||||||
"""Catalog meta class."""
|
"""Catalog meta class."""
|
||||||
|
|
||||||
|
@ -121,7 +126,9 @@ class CatalogMetaClass(type):
|
||||||
|
|
||||||
def __repr__(cls):
|
def __repr__(cls):
|
||||||
"""Return string representation of the catalog class."""
|
"""Return string representation of the catalog class."""
|
||||||
return '<Catalog "' + '.'.join((cls.__module__, cls.__name__)) + '">'
|
return '<{0}.{1}>'.format(cls.__module__, cls.__name__)
|
||||||
|
|
||||||
|
__str__ = __repr__
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(CatalogMetaClass)
|
@six.add_metaclass(CatalogMetaClass)
|
||||||
|
|
|
@ -7,6 +7,11 @@ that were made in every particular version.
|
||||||
From version 0.7.6 *Dependency Injector* framework strictly
|
From version 0.7.6 *Dependency Injector* framework strictly
|
||||||
follows `Semantic versioning`_
|
follows `Semantic versioning`_
|
||||||
|
|
||||||
|
0.10.5
|
||||||
|
------
|
||||||
|
- Add more representable implementation for ``di.AbstractCatalog`` and
|
||||||
|
``di.AbstractCatalog.Bundle``.
|
||||||
|
|
||||||
0.10.4
|
0.10.4
|
||||||
------
|
------
|
||||||
- Remove VERSION file from MANIFEST.in.
|
- Remove VERSION file from MANIFEST.in.
|
||||||
|
|
|
@ -39,6 +39,9 @@ class Views(di.AbstractCatalog):
|
||||||
auth_view = Views.auth()
|
auth_view = Views.auth()
|
||||||
photos_view = Views.photos()
|
photos_view = Views.photos()
|
||||||
|
|
||||||
|
print auth_view.services # prints: <__main__.Services.Bundle(users, auth)>
|
||||||
|
print photos_view.services # prints <__main__.Services.Bundle(photos, users)>
|
||||||
|
|
||||||
# Making some asserts:
|
# Making some asserts:
|
||||||
assert auth_view.services.users is Services.users
|
assert auth_view.services.users is Services.users
|
||||||
assert auth_view.services.auth is Services.auth
|
assert auth_view.services.auth is Services.auth
|
||||||
|
|
Loading…
Reference in New Issue
Block a user