Skip to content

Commit

Permalink
Inject named Autowired params when named args already present (#14)
Browse files Browse the repository at this point in the history
* Inject named Autowired params when named args present

* Fix #15 & unit test positional-only args

Co-authored-by: Craig Minihan <[email protected]>
Co-authored-by: Rodrigo Oliveira <[email protected]>
  • Loading branch information
3 people authored May 12, 2020
1 parent 249b904 commit 28fff24
Show file tree
Hide file tree
Showing 55 changed files with 348 additions and 244 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 = 3.4.0
current_version = 3.4.1

[bumpversion:file:Makefile]
search = CURRENT_VERSION = {current_version}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ ENV/

# PyCharm
.idea/

# vscode
.vscode/
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Authors
=======

* Rodrigo Martins de Oliveira - https://github.com/allrod5
* Craig Minihan - https://github.com/craigminihan
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

3.4.1 (2020-05-11)
------------------

* Fix the use of named args by the caller breaking autowired functions injection

3.4.0 (2020-05-09)
------------------

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ docs:
make html -B
cp -a build/html/. docs

CURRENT_VERSION = 3.4.0
CURRENT_VERSION = 3.4.1

.PHONY: bump-patch-version
bump-patch-version:
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e8b2b421cce8e7ab698d3e3acbafebee
config: fdb100afd8af971a7f6d7bb34cc70893
tags: 645f666f9bcd5a90fca523b33c5a78b7
8 changes: 4 additions & 4 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>Overview: module code &#8212; injectable 3.4.0 documentation</title>
<title>Overview: module code &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../index.html">injectable-3.4.1</a> &#187;</li>
</ul>
</div>

Expand Down Expand Up @@ -106,8 +106,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
14 changes: 7 additions & 7 deletions docs/_modules/injectable/autowiring/autowired_decorator.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.autowiring.autowired_decorator &#8212; injectable 3.4.0 documentation</title>
<title>injectable.autowiring.autowired_decorator &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -117,10 +117,10 @@ <h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="hi
<span class="k">if</span> <span class="n">parameter</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">bound_arguments</span><span class="p">:</span>
<span class="k">continue</span>
<span class="n">dependency</span> <span class="o">=</span> <span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span><span class="o">.</span><span class="n">inject</span><span class="p">()</span>
<span class="k">if</span> <span class="n">parameter</span><span class="o">.</span><span class="n">kind</span> <span class="ow">is</span> <span class="n">parameter</span><span class="o">.</span><span class="n">KEYWORD_ONLY</span><span class="p">:</span>
<span class="n">kwargs</span><span class="p">[</span><span class="n">parameter</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">dependency</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">parameter</span><span class="o">.</span><span class="n">kind</span> <span class="ow">is</span> <span class="n">parameter</span><span class="o">.</span><span class="n">POSITIONAL_ONLY</span><span class="p">:</span>
<span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dependency</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">kwargs</span><span class="p">[</span><span class="n">parameter</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">dependency</span>

<span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

Expand Down Expand Up @@ -173,8 +173,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/autowiring/autowired_type.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.autowiring.autowired_type &#8212; injectable 3.4.0 documentation</title>
<title>injectable.autowiring.autowired_type &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -236,8 +236,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/container/injectable.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.container.injectable &#8212; injectable 3.4.0 documentation</title>
<title>injectable.container.injectable &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -143,8 +143,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/container/injection_container.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.container.injection_container &#8212; injectable 3.4.0 documentation</title>
<title>injectable.container.injection_container &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -282,8 +282,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.container.load_injection_container &#8212; injectable 3.4.0 documentation</title>
<title>injectable.container.load_injection_container &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -138,8 +138,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/errors/autowiring_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.errors.autowiring_error &#8212; injectable 3.4.0 documentation</title>
<title>injectable.errors.autowiring_error &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -100,8 +100,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/errors/injection_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.errors.injection_error &#8212; injectable 3.4.0 documentation</title>
<title>injectable.errors.injection_error &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -100,8 +100,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/injection/inject.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.injection.inject &#8212; injectable 3.4.0 documentation</title>
<title>injectable.injection.inject &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -267,8 +267,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions docs/_modules/injectable/injection/injectable_decorator.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.injection.injectable_decorator &#8212; injectable 3.4.0 documentation</title>
<title>injectable.injection.injectable_decorator &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -153,8 +153,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>injectable.injection.injectable_factory_decorator &#8212; injectable 3.4.0 documentation</title>
<title>injectable.injection.injectable_factory_decorator &#8212; injectable 3.4.1 documentation</title>
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.0</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.1</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -170,8 +170,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on May 09, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.3.
Last updated on May 11, 2020.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.2.
</div>
</body>
</html>
Loading

0 comments on commit 28fff24

Please sign in to comment.