Skip to content

add type hints to matcher.py #137

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
merged 5 commits into from
Jan 16, 2023
Merged

Conversation

vladak
Copy link
Contributor

@vladak vladak commented Dec 26, 2022

This change approaches #92, specifically for matcher.py. After that mypy complains only about the function parameters/assignment:

$ mypy --strict adafruit_minimqtt/matcher.py 
adafruit_minimqtt/matcher.py:50: error: Incompatible types in assignment (expression has type "Callable[..., Any]", variable has type "None")  [assignment]
adafruit_minimqtt/matcher.py:100: error: Incompatible types in assignment (expression has type "None", variable has type "Callable[..., Any]")  [assignment]
Found 2 errors in 1 file (checked 1 source file)

This is my first time adding type hints to Python code and have to say, being used to strongly typed language, that it feels a bit strange - retrofitting type specification that is still limping, e.g. the case of None or missing function type parameters. That said, here you go.

Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

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

Thanks for the submission! A couple notes of feedback:

@tekktrik tekktrik self-requested a review January 10, 2023 01:23
@vladak vladak mentioned this pull request Jan 16, 2023
34 tasks
Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@tekktrik tekktrik merged commit b47e7b1 into adafruit:main Jan 16, 2023
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 17, 2023
Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM303_Accel to 1.1.17 from 1.1.16:
  > Merge pull request adafruit/Adafruit_CircuitPython_LSM303_Accel#16 from tcfranks/main
  > Add .venv to .gitignore

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 7.1.3 from 7.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#137 from vladak/type_hints_matcher

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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.

2 participants