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

Update network.pyi a bit #296

Merged
merged 8 commits into from
Jul 23, 2024
Merged

Update network.pyi a bit #296

merged 8 commits into from
Jul 23, 2024

Conversation

elmot
Copy link
Collaborator

@elmot elmot commented Jul 23, 2024

Fixes #241

@elmot elmot requested a review from lancelote July 23, 2024 08:54
@elmot elmot changed the title Update network.pyi a bit, Fixes #241 Update network.pyi a bit Jul 23, 2024
@lancelote
Copy link
Member

@elmot Where did you get country() and hostname() function signatures?

@elmot
Copy link
Collaborator Author

elmot commented Jul 23, 2024

@elmot Where did you get country() and hostname() function signatures?

https://github.com/micropython/micropython/blob/master/docs/library/network.rst#network-functions


import pyb

@overload
def country(code: str, /) -> NoReturn | str:
def country(code: str, /) -> str:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does not return value if a parameter is provided

>>> import network
>>> print(network.country())
XX
>>> print(network.country('FI'))
None
>>> print(network.country())
FI
>>> 

Copy link
Member

Choose a reason for hiding this comment

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

If nothing is returned, then the return type is None. NoReturn means the function always raises an exception or aborts the program execution.

typehints/micropython/network.pyi Outdated Show resolved Hide resolved
@lancelote lancelote self-requested a review July 23, 2024 14:14
@elmot elmot merged commit b7a03ac into master Jul 23, 2024
1 check passed
@elmot elmot deleted the fix-network-pyi branch July 23, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot find reference to 'STA_IF' in 'network.pyi'
2 participants