From 3046804bf5902201a73525b29068229af6babd8f Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 9 Jun 2017 01:39:07 +0300 Subject: [PATCH 1/6] Add / remove some performance tests --- tests/performance/test.py | 112 ++++++++++---------------------------- 1 file changed, 28 insertions(+), 84 deletions(-) diff --git a/tests/performance/test.py b/tests/performance/test.py index 0ac4deed..fda5d76b 100644 --- a/tests/performance/test.py +++ b/tests/performance/test.py @@ -38,42 +38,6 @@ class Tester(object): gc.enable() print('\n') -# def test_simple_object(self, providers): -# """Test simple object's creation.""" -# class Test(object): -# pass -# -# for x in xrange(int(5000000 * self.duration_factor)): -# Test() -# -# def test_simple_object_factory(self, providers): -# """Test simple object's factory.""" -# class Test(object): -# pass -# -# test_factory = providers.Factory(Test) -# for x in xrange(int(5000000 * self.duration_factor)): -# test_factory() -# -# def test_3_ctx_positional_injections(self, providers): -# """Test factory with 3 context positional injections.""" -# class Test(object): -# def __init__(self, a, b, c): -# pass -# -# for x in xrange(int(5000000 * self.duration_factor)): -# Test(1, 2, 3) -# -# def test_factory_3_ctx_positional_injections(self, providers): -# """Test factory with 3 context positional injections.""" -# class Test(object): -# def __init__(self, a, b, c): -# pass -# -# test_factory = providers.Factory(Test) -# for x in xrange(int(5000000 * self.duration_factor)): -# test_factory(1, 2, 3) - def test_raw_3_kw_injections(self, providers): """Test 3 keyword argument injections.""" class A(object): @@ -143,55 +107,35 @@ class Tester(object): for x in xrange(int(5000000 * self.duration_factor)): test_factory() -# def test_factory_subcls_3_factory_subcls_kw_injections(self, providers): -# """Test factory with 3 keyword argument injections via factories.""" -# class MyFactory(providers.Factory): -# pass -# -# class A(object): -# pass -# -# class B(object): -# pass -# -# class C(object): -# pass -# -# class Test(object): -# def __init__(self, a, b, c): -# pass -# -# a_factory = MyFactory(A) -# b_factory = MyFactory(B) -# c_factory = MyFactory(C) -# test_factory = MyFactory(Test, -# a=a_factory, -# b=b_factory, -# c=c_factory) -# for x in xrange(int(5000000 * self.duration_factor)): -# test_factory() + def test_factory_6_factory_kw_injections_0_context(self, providers): + """Test factory with 6 keyword argument injections.""" + class Test(object): + def __init__(self, a, b, c, d, e, f): + pass -# def test_singleton(self, providers): -# """Test factory with 3 keyword argument injections via factories.""" -# class Test(object): -# def __init__(self): -# pass -# -# test_factory = providers.Singleton(Test) -# for x in xrange(int(5000000 * self.duration_factor)): -# test_factory() -# -# def test_singleton_subcls(self, providers): -# """Test factory with 3 keyword argument injections via factories.""" -# class MySingleton(providers.Singleton): -# pass -# -# class Test(object): -# pass -# -# test_factory = MySingleton(Test) -# for x in xrange(int(5000000 * self.duration_factor)): -# test_factory() + test_factory = providers.Factory(Test, a=1, b=2, c=3, d=4, e=5, f=6) + for x in xrange(int(5000000 * self.duration_factor)): + test_factory() + + def test_factory_6_factory_kw_injections_1_context(self, providers): + """Test factory with 6 keyword argument injections.""" + class Test(object): + def __init__(self, a, b, c, d, e, f): + pass + + test_factory = providers.Factory(Test, f=6) + for x in xrange(int(5000000 * self.duration_factor)): + test_factory(a=1, b=2, c=3, d=4, e=5) + + def test_factory_6_factory_kw_injections_3_context(self, providers): + """Test factory with 6 keyword argument injections.""" + class Test(object): + def __init__(self, a, b, c, d, e, f): + pass + + test_factory = providers.Factory(Test, a=1, b=2, c=3) + for x in xrange(int(5000000 * self.duration_factor)): + test_factory(d=4, e=5, f=6) if __name__ == '__main__': From 007c256c5f9aaa2399382673cf1dde457b943659 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 9 Jun 2017 01:41:22 +0300 Subject: [PATCH 2/6] Make code style fixes in providers module --- docs/main/changelog.rst | 2 +- src/dependency_injector/containers.c | 10 +++++----- src/dependency_injector/providers.c | 10 +++++----- src/dependency_injector/providers.pxd | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 685c968e..838950f7 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -9,7 +9,7 @@ follows `Semantic versioning`_ Development version ------------------- -- No features. +- Code style fixes in ``providers`` module. 3.4.7 ----- diff --git a/src/dependency_injector/containers.c b/src/dependency_injector/containers.c index 7d0d8301..3c82bef8 100644 --- a/src/dependency_injector/containers.c +++ b/src/dependency_injector/containers.c @@ -8815,8 +8815,8 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab /* "providers.pxd":246 * self.__args_len) * keyword_args = __provide_keyword_args(kwargs, - * self.__kwargs, # <<<<<<<<<<<<<< - * self.__kwargs_len) + * self.__kwargs, # <<<<<<<<<<<<<< + * self.__kwargs_len) * */ __pyx_t_2 = __pyx_v_self->__pyx___kwargs; @@ -8826,8 +8826,8 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab * self.__args, * self.__args_len) * keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<< - * self.__kwargs, - * self.__kwargs_len) + * self.__kwargs, + * self.__kwargs_len) */ __pyx_t_1 = __pyx_f_19dependency_injector_9providers___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -8836,7 +8836,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab __pyx_t_1 = 0; /* "providers.pxd":249 - * self.__kwargs_len) + * self.__kwargs_len) * * return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<< * diff --git a/src/dependency_injector/providers.c b/src/dependency_injector/providers.c index 8e2afc26..afbd3016 100644 --- a/src/dependency_injector/providers.c +++ b/src/dependency_injector/providers.c @@ -22296,8 +22296,8 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab /* "dependency_injector/providers.pxd":246 * self.__args_len) * keyword_args = __provide_keyword_args(kwargs, - * self.__kwargs, # <<<<<<<<<<<<<< - * self.__kwargs_len) + * self.__kwargs, # <<<<<<<<<<<<<< + * self.__kwargs_len) * */ __pyx_t_2 = __pyx_v_self->__pyx___kwargs; @@ -22307,8 +22307,8 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab * self.__args, * self.__args_len) * keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<< - * self.__kwargs, - * self.__kwargs_len) + * self.__kwargs, + * self.__kwargs_len) */ __pyx_t_1 = __pyx_f_19dependency_injector_9providers___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -22317,7 +22317,7 @@ static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callab __pyx_t_1 = 0; /* "dependency_injector/providers.pxd":249 - * self.__kwargs_len) + * self.__kwargs_len) * * return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<< * diff --git a/src/dependency_injector/providers.pxd b/src/dependency_injector/providers.pxd index 74b15662..c460dc27 100644 --- a/src/dependency_injector/providers.pxd +++ b/src/dependency_injector/providers.pxd @@ -243,8 +243,8 @@ cdef inline object __callable_call(Callable self, tuple args, dict kwargs): self.__args, self.__args_len) keyword_args = __provide_keyword_args(kwargs, - self.__kwargs, - self.__kwargs_len) + self.__kwargs, + self.__kwargs_len) return self.__provides(*positional_args, **keyword_args) From 928aaa12b6b34d9872eda4effca9217ecda8e245 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 9 Jun 2017 01:45:12 +0300 Subject: [PATCH 3/6] Update makefile --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f3684c28..73c32de4 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,13 @@ check: pydocstyle examples/ publish: cythonize - # Create and upload build - python setup.py sdist upload + # Merge release to master branch + git checkout master + git merge --no-ff release/$(VERSION) + git commit -m 'Release $(VERSION)' + git push origin master # Create and upload tag git tag -a $(VERSION) -m 'version $(VERSION)' git push --tags + # Create and upload build + python setup.py sdist upload From 2712d693a0360046257a38cd153d64280d3b1673 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 9 Jun 2017 01:46:06 +0300 Subject: [PATCH 4/6] Bump version to 3.4.8 --- src/dependency_injector/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dependency_injector/__init__.py b/src/dependency_injector/__init__.py index 91a172aa..35faf460 100644 --- a/src/dependency_injector/__init__.py +++ b/src/dependency_injector/__init__.py @@ -1,6 +1,6 @@ """Dependency injector top-level package.""" -__version__ = '3.4.7' +__version__ = '3.4.8' """Version number that follows semantic versioning. :type: str From 0635d7783f647ec63c1b640d47abe717256ea2e1 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 9 Jun 2017 01:46:18 +0300 Subject: [PATCH 5/6] Add changelog for 3.4.8 --- docs/main/changelog.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 838950f7..3676a07c 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -9,6 +9,10 @@ follows `Semantic versioning`_ Development version ------------------- +- No features. + +3.4.8 +----- - Code style fixes in ``providers`` module. 3.4.7 From 67745f8b882b23a79e2bab3220cd30bfe9fd20e0 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 9 Jun 2017 01:50:09 +0300 Subject: [PATCH 6/6] Update makefile --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 73c32de4..c5c3f271 100644 --- a/Makefile +++ b/Makefile @@ -60,8 +60,7 @@ check: publish: cythonize # Merge release to master branch git checkout master - git merge --no-ff release/$(VERSION) - git commit -m 'Release $(VERSION)' + git merge --no-ff release/$(VERSION) -m 'Merge branch release/$(VERSION)' git push origin master # Create and upload tag git tag -a $(VERSION) -m 'version $(VERSION)'