fontParts icon indicating copy to clipboard operation
fontParts copied to clipboard

Annotate and document `info.py`.

Open knutnergaard opened this issue 1 year ago • 4 comments

knutnergaard avatar Dec 07 '24 23:12 knutnergaard

@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?

knutnergaard avatar Dec 08 '24 00:12 knutnergaard

@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 avatar Dec 12 '24 16:12 benkiel

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.

benkiel avatar Jan 17 '25 03:01 benkiel

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

knutnergaard avatar Jan 20 '25 08:01 knutnergaard