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

Use :rtype: to clarify types returned because of __get__() #28

Merged
merged 1 commit into from
Feb 18, 2022
Merged

Use :rtype: to clarify types returned because of __get__() #28

merged 1 commit into from
Feb 18, 2022

Conversation

tekktrik
Copy link
Member

@tekktrik tekktrik commented Feb 17, 2022

Resolves #26

UnaryStruct uses __get__() to return a different type, but this is unclear currently because now that these variable have type annotations, class variable utilizing it are automatically typed as UnaryStruct.

While one option is to manually document the class variables, I think it's preferable to use an attached docstring so the documentation and code don't ever get split up if one is removed for some reason. Using Sphinx :rtype: seems to be the best way to document it then.

`UnaryStruct` uses __get__() to return a different type, but this is unclear currently because now that these variable have type annotations, class variable utilizing ot are automatically typed as `UnaryStruct`.

While one option is to manually document the class variables, I think it's preferable to use an attached docstring so the documentation and code don't ever get split up if one is removed for some reason.  Using Sphinx `rtype` seems to be the best way to document it then.
@tekktrik tekktrik requested a review from a team February 17, 2022 14:46
@tekktrik tekktrik changed the title Use r:type: to clarify types returned because of __get__() Use :rtype: to clarify types returned because of __get__() Feb 17, 2022
@dhalbert dhalbert merged commit c820deb into adafruit:main Feb 18, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 19, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_AS7341 to 1.2.6 from 1.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_AS7341#29 from tekktrik/fix-python-version
  > Merge pull request adafruit/Adafruit_CircuitPython_AS7341#28 from tekktrik/doc/fix-cvar-typing

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Media to 0.9.7 from 0.9.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Apple_Media#13 from tekktrik/dev/fix-issue8
  > Fixed readthedocs build
  > Consolidate Documentation sections of README

Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 5.1.7 from 5.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#85 from tekktrik/hotfix/require-python-version

Updating https://github.com/adafruit/Adafruit_CircuitPython_Debug_I2C to 1.2.9 from 1.2.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_Debug_I2C#14 from tekktrik/dev/add-python-ver

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.22.1 from 2.22.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#165 from tekktrik/add-missing-dependency
  > Fixed readthedocs build

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_ESP32S2TFT
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.

Fix documentation typing for astep and atime
2 participants