-
-
Notifications
You must be signed in to change notification settings - Fork 135
Adds missing return type to collect_traces
function
#442
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
Merged
sobolevn
merged 11 commits into
dry-python:master
from
thepabloaguilar:bug/add-return-type-collect-traces
Jul 1, 2020
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
515f440
Adds missing return type hint to the `collect_traces` function
thepabloaguilar 5f88a48
Creates type safety tests to `collect_traces` function
thepabloaguilar 05c1bcb
Removes `@contextmanager` decorator from `collect_traces` function
thepabloaguilar 275c0a1
Fixes type safety tests for `collect_traces` function
thepabloaguilar cf68d80
Adds `noqa: WPS501` flag in `try` block on `collect_traces` function
thepabloaguilar 7e50f7b
Modifies `tracing.py`
thepabloaguilar c39150a
Updates safety tests of `collect_traces` function
thepabloaguilar 329475d
Updates documentation of `collect_traces` function
thepabloaguilar 8c274c9
Changes type var name from `Function` to `_FunctionType`
thepabloaguilar 7f8736e
Changes `factory` function to use the `@contextmanager` decorator ins…
thepabloaguilar 95db932
Updates safety tests of `collect_traces` function, specifically the `…
thepabloaguilar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
typesafety/test_primitives/test_tracing/test_collect_traces.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
- case: collect_traces_context_manager_return_type_one | ||
disable_cache: true | ||
main: | | ||
from returns.primitives.tracing import collect_traces | ||
|
||
reveal_type(collect_traces) # N: Revealed type is 'Overload(def () -> typing.ContextManager[None], def [_FunctionType <: def (*Any, **Any) -> Any] (function: _FunctionType`-1) -> _FunctionType`-1)' | ||
|
||
- case: collect_traces_context_manager_return_type_two | ||
disable_cache: true | ||
main: | | ||
from returns.primitives.tracing import collect_traces | ||
|
||
with reveal_type(collect_traces()): # N: Revealed type is 'typing.ContextManager[None]' | ||
pass | ||
|
||
- case: collect_traces_decorated_function_return_type | ||
disable_cache: true | ||
main: | | ||
from returns.primitives.tracing import collect_traces | ||
|
||
@collect_traces | ||
def function() -> int: | ||
return 0 | ||
|
||
reveal_type(function) # N: Revealed type is 'def () -> builtins.int' | ||
|
||
- case: collect_traces_decorated_function_with_argument_return_type | ||
disable_cache: true | ||
main: | | ||
from returns.primitives.tracing import collect_traces | ||
|
||
@collect_traces | ||
def function(number: int) -> str: | ||
return str(number) | ||
|
||
reveal_type(function) # N: Revealed type is 'def (number: builtins.int) -> builtins.str' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.