-
Notifications
You must be signed in to change notification settings - Fork 52
Add Python Typing stub files for Cython extensions (_p4p, _gw) #209
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
Open
Monarda
wants to merge
15
commits into
epics-base:master
Choose a base branch
from
Monarda:typing_stubs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f1fd91d
Begun adding RulesHandler
Monarda 4ccfb7c
Implementation and example for nthandlers
Monarda df902e4
Merge branch 'epics-base:master' into master
Monarda 6c45ed9
Merge branch 'epics-base:master' into master
Monarda b3b7a36
Merge branch 'master' of github.com:Monarda/p4p
Monarda ac97302
Merge branch 'master' of github.com:Monarda/p4p
Monarda 800e3ec
Add support for Python stub file generation for _p4p and _gw
Monarda 8e1b84a
Fixes as a result of testing on Linux
Monarda 2a598d7
Move mypy to a dev dependency
Monarda 1dadd13
Remove example leftover from previous work
Monarda cf3d483
Not required for minimal demo
Monarda e2f73c4
Rollback automation of stubgen
Monarda 7235388
Explain binding=True probably does nothing
Monarda 3355a01
Can't have comments in the Cython directives
Monarda b9d6947
Add stubgen as optional extra
Monarda 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
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,92 @@ | ||
| import _cython_3_2_5 | ||
| import p4p._p4p | ||
| from _typeshed import Incomplete | ||
| from typing import Any | ||
|
|
||
| Server_report: _cython_3_2_5.cython_function_or_method | ||
| __reduce_cython__: _cython_3_2_5.cython_function_or_method | ||
| __setstate_cython__: _cython_3_2_5.cython_function_or_method | ||
| __test__: dict | ||
| addOdometer: _cython_3_2_5.cython_function_or_method | ||
|
|
||
| class Channel(InfoBase): | ||
| expired: Incomplete | ||
| name: Incomplete | ||
| @classmethod | ||
| def __init__(cls, *args, **kwargs) -> None: | ||
| """Create and return a new object. See help(type) for accurate signature.""" | ||
| def access(self, *args, **kwargs): ... | ||
| def __reduce__(self): ... | ||
|
|
||
| class CreateOp(InfoBase): | ||
| """Handle for in-progress Channel creation request | ||
| """ | ||
| name: Incomplete | ||
| @classmethod | ||
| def __init__(cls, *args, **kwargs) -> None: | ||
| """Create and return a new object. See help(type) for accurate signature.""" | ||
| def create(self, *args, **kwargs): | ||
| """Create a Channel with a given upstream (server-side) name | ||
|
|
||
| :param bytes name: Upstream name to use. This is what the GW Client will search for. | ||
| :returns: A `Channel` | ||
| """ | ||
| def __reduce__(self): ... | ||
|
|
||
| class InfoBase: | ||
| account: Incomplete | ||
| peer: Incomplete | ||
| roles: Incomplete | ||
| @classmethod | ||
| def __init__(cls, *args, **kwargs) -> None: | ||
| """Create and return a new object. See help(type) for accurate signature.""" | ||
| def __reduce__(self): ... | ||
|
|
||
| class Provider(p4p._p4p.Source): | ||
| BanHost: Incomplete | ||
| BanHostPV: Incomplete | ||
| BanPV: Incomplete | ||
| Claim: Incomplete | ||
| Ignore: Incomplete | ||
| def __init__(self, *args, **kwargs) -> None: | ||
| """Initialize self. See help(type(self)) for accurate signature.""" | ||
| def cachePeek(self, *args, **kwargs): | ||
| """Returns PV names in channel cache | ||
|
|
||
| :returns: a set of strings | ||
| """ | ||
| def clearBan(self, *args, **kwargs): | ||
| """Clear the negative results cache | ||
| """ | ||
| def forceBan(self, *args, **kwargs): | ||
| """Preemptively Add an entry to the negative result cache. | ||
| Either host or usname must be not None | ||
|
|
||
| :param bytes host: None or a host name | ||
| :param bytes usname: None or a upstream (Server side) PV name | ||
| """ | ||
| def ignoreByGUID(self, *args, **kwargs): ... | ||
| def report(self, *args, **kwargs): | ||
| """Run Client/Upstream bandwidth usage report | ||
|
|
||
| :returns: List of tuple | ||
| :rtype: [(usname, opTx, opRx, peer, trTx, trRx)] | ||
| """ | ||
| def stats(self, *args, **kwargs): | ||
| """Return statistics of various internal caches | ||
|
|
||
| :rtype: dict | ||
| """ | ||
| def sweep(self, *args, **kwargs): | ||
| """Call periodically to remove unused `Channel` from channel cache. | ||
| """ | ||
| def testChannel(self, usname) -> Any: | ||
| """testChannel(usname) | ||
| Add the upstream name to the channel cache and begin trying to connect. | ||
| Returns Claim if the channel is connected, and Ignore if it is not. | ||
|
|
||
| :param bytes usname: Upstream (Server side) PV name | ||
| :returns: Claim or Ignore | ||
| """ | ||
| def use_count(self, *args, **kwargs): ... | ||
| def __reduce__(self): ... |
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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # distutils: language = c++ | ||
| #cython: language_level=2 | ||
| #cython: binding=True | ||
|
|
||
| cimport cython | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not strictly necessary as it has been default behaviour in Cython since 3.0. The flag is set so that stubgen can use introspection to determine typing information.