Skip to content

Commit

Permalink
relax component "name" to allow any value
Browse files Browse the repository at this point in the history
  • Loading branch information
diefans committed Feb 22, 2021
1 parent c68825b commit 98b2811
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.41.4
current_version = 0.41.5
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.41.4
0.41.5
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def finalize_options(self):

setup_kwargs = {
"name": "buvar",
"version": "0.41.4",
"version": "0.41.5",
"description": "Asyncio plugins, components, dependency injection and configs",
"long_description": description,
"long_description_content_type": "text/x-rst",
Expand Down
2 changes: 1 addition & 1 deletion src/buvar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.41.4"
__version__ = "0.41.5"
__version_info__ = tuple(__version__.split("."))


Expand Down
2 changes: 1 addition & 1 deletion src/buvar/components/c_components.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ cdef class Components:

cdef _push(self, namespaces, stack)
cpdef pop(self)
cdef _add(self, item, namespace=*, str name=*)
cdef _add(self, item, namespace=*, name=*)
cdef dict _find(self, namespace)
cdef _get(self, namespace, name=*, default=*)
2 changes: 1 addition & 1 deletion src/buvar/components/c_components.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cdef class Components:
def stack(self):
return self._stack

cdef _add(self, object item, namespace=None, str name=None):
cdef _add(self, object item, namespace=None, name=None):
cdef dict space

if isinstance(item, type):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,13 @@ def pushpop():
benchmark(pushpop)

assert c.find(str) == {None: "foo"}


def test_components_add_name_any(components):
c = components.Components()

c.add("foo", name=("bar", 123))

foo = c.get(str, name=("bar", 123))

assert foo == "foo"

0 comments on commit 98b2811

Please sign in to comment.