Skip to content

Annotate and document info.py.#812

Open
knutnergaard wants to merge 14 commits intorobotools:v1from
knutnergaard:info
Open

Annotate and document info.py.#812
knutnergaard wants to merge 14 commits intorobotools:v1from
knutnergaard:info

Conversation

@knutnergaard
Copy link
Copy Markdown
Contributor

No description provided.

@knutnergaard
Copy link
Copy Markdown
Contributor Author

@benkiel I ran into a few problems with this module:

  1. What are the available types for the value parameter in _validateFontInfoAttributeValue?
  2. Where are the magic methods in this class defined? mypy throws this error:
    info.py:107: error: "__hasattr__" undefined in superclass  [misc]
  3. What value types is BaseInfo.__setattr__ supposed to return? In my experience __setattr__ is supposed to return None, yet here, the method is treated as if returning something else.
  4. What is _getAttr supposed to return? mypy throws this error:
    info.py:113: error: "_getAttr" of "BaseInfo" does not return a value (it only ever returns None)  [func-returns-value]
  5. Isn't _fromMathInfo supposed to return anything? It's missing a return statement, yet its called in the return of the public equivalent. It also returns this mypy error:
    info.py:271: error: "_fromMathInfo" of "BaseInfo" does not return a value (it only ever returns None)  [func-returns-value]
  6. mypy throws the this error due to the differences in signature with the base method:
    info.py:230: error: Signature of "update" incompatible with supertype "DeprecatedBase"  [override]
    info.py:230: note:      Superclass:
    info.py:230: note:          def update(self) -> Any
    info.py:230: note:      Subclass:
    info.py:230: note:          def update(self, other: BaseInfo) -> None
    Not sure of the best way to deal with this.
  7. mypy also shows this error, (I think) due to BaseInfo not following the annotations.Interpolatable protocol:
    info.py:369: error: Value of type variable "InterpolatableType" of "interpolate" cannot be "BaseInfo"
    How should this be handled?

@benkiel
Copy link
Copy Markdown
Member

benkiel commented Dec 12, 2024

@knutnergaard, this is just a note that I've not forgotten this — I'm caught up in end-of-year things. I will get to it by the weekend.

@benkiel
Copy link
Copy Markdown
Member

benkiel commented Jan 17, 2025

Hey @knutnergaard, just a ping to let you know that I have not forgotten this: work and holidays. Will get you answers this coming week.

@knutnergaard
Copy link
Copy Markdown
Contributor Author

@benkiel No worries, I'm very busy myself these days.

@knutnergaard
Copy link
Copy Markdown
Contributor Author

knutnergaard commented Apr 14, 2026

@benkiel I decided to opt for a simpler solution, utilizing the already defined __getattribute__ and __setattribute__ methods and only adding docstrings to declared type annotation stubs. This works fine in Sphinx.

For now, I've only added the descriptions from the UFO specification as docstrings. Some of these need (manual) editing, but I'm not sure how much information is needed in this case.

Also, In addition to the mypy errors already accounted for, there seems to be some kind of problem with implicit setuptools import which leads to the failure of the test for Python 3.12 on Ubuntu. Not sure how to fix this.

@knutnergaard knutnergaard marked this pull request as ready for review April 16, 2026 10:44
@knutnergaard
Copy link
Copy Markdown
Contributor Author

@benkiel I've solved all mypy errors and finished the documentation for all methods. Please review this and suggest any necessary edits to the attribute docs.

@benkiel
Copy link
Copy Markdown
Member

benkiel commented Apr 16, 2026

Will do; I can't until next week, fyi!

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