Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds missing return type to collect_traces function #442

Merged

Conversation

thepabloaguilar
Copy link
Member

@thepabloaguilar thepabloaguilar commented Jun 27, 2020

closes #441
closes #443

@codecov
Copy link

codecov bot commented Jun 27, 2020

Codecov Report

Merging #442 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #442   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           48        48           
  Lines         1213      1228   +15     
  Branches       154       154           
=========================================
+ Hits          1213      1228   +15     
Impacted Files Coverage Δ
returns/primitives/tracing.py 100.00% <100.00%> (ø)
returns/io.py 100.00% <0.00%> (ø)
returns/maybe.py 100.00% <0.00%> (ø)
returns/future.py 100.00% <0.00%> (ø)
returns/result.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e8b1b9...95db932. Read the comment docs.

returns/primitives/tracing.py Outdated Show resolved Hide resolved
@thepabloaguilar thepabloaguilar force-pushed the bug/add-return-type-collect-traces branch from 5b9e980 to bb5dae2 Compare June 30, 2020 05:41
To fix type hint errors we separate all the possible `collect_traces` function signatures using `@overload` decorator
The implementation of `collect_traces`, now, acts like a factory!
@thepabloaguilar thepabloaguilar force-pushed the bug/add-return-type-collect-traces branch from bb5dae2 to 329475d Compare June 30, 2020 05:56
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! Just two small features left and we are ready to go!

returns/primitives/tracing.py Outdated Show resolved Hide resolved
@thepabloaguilar
Copy link
Member Author

thepabloaguilar commented Jul 1, 2020

I was wrong in this explanation, in fact it's just a PyCharm error/warning!

collect_traces_cm = contextmanager(factory)()

To avoid mypy error I've decided to pass the factory function directly to contextmanager function instead of using it as a decorator

I've made the modification to use contextmanager as a decorator!

@sobolevn sobolevn merged commit 5a211af into dry-python:master Jul 1, 2020
@sobolevn
Copy link
Member

sobolevn commented Jul 1, 2020

Thanks a lot for the great work!

@thepabloaguilar thepabloaguilar deleted the bug/add-return-type-collect-traces branch July 1, 2020 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

collect_traces wrong return type when it's used as a decorator collect_traces() is missing a return type
2 participants