-
Notifications
You must be signed in to change notification settings - Fork 44
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
Improve lib.py
.
#790
Improve lib.py
.
#790
Conversation
- Add type annotation. - Add/improve documentation. - changed `BaseSegments.segments` to return `tuple` instead of `list`.
Remaining errors to be collected in robotools#775: ```zsh contour.py:58: error: Signature of "_reprContents" incompatible with supertype "BaseObject" [override] contour.py:58: note: Superclass: contour.py:58: note: @classmethod contour.py:58: note: def _reprContents(cls) -> List[str] contour.py:58: note: Subclass: contour.py:58: note: def _reprContents(self) -> List[str] contour.py:125: error: Incompatible types in assignment (expression has type "Callable[[], Any]", variable has type "Optional[BaseGlyph]") [assignment] contour.py:125: error: Argument 1 to "reference" has incompatible type "BaseGlyph"; expected "Callable[[], Any]" [arg-type] contour.py:277: error: "BaseContour" has no attribute "_getIdentifierforPoint"; maybe "_getIdentifierForPoint" or "getIdentifierForPoint"? [attr-defined] contour.py:477: error: Signature of "isCompatible" incompatible with supertype "InterpolationMixin" [override] contour.py:477: note: Superclass: contour.py:477: note: def isCompatible(self, other: Any, cls: Type[Any]) -> Tuple[bool, Any] contour.py:477: note: Subclass: contour.py:477: note: def isCompatible(self, other: BaseContour) -> Tuple[bool, str] contour.py:532: error: "str" has no attribute "fatal" [attr-defined] contour.py:532: error: "str" has no attribute "warning" [attr-defined] contour.py:533: error: "str" has no attribute "fatal" [attr-defined] contour.py:535: error: "str" has no attribute "warning" [attr-defined] contour.py:657: error: "BaseContour" has no attribute "_reverseContour" [attr-defined] ```
Several of the |
Remaining errors after ae7328f to be collected in #775: lib.py:34: error: Signature of "_reprContents" incompatible with supertype "BaseObject" [override]
lib.py:34: note: Superclass:
lib.py:34: note: @classmethod
lib.py:34: note: def _reprContents(cls) -> List[str]
lib.py:34: note: Subclass:
lib.py:34: note: def _reprContents(self) -> List[str]
lib.py:75: error: "BaseGlyph" not callable [operator]
lib.py:80: error: "BaseGlyph" not callable [operator]
lib.py:83: error: Incompatible types in assignment (expression has type "Callable[[], Any]", variable has type "Optional[BaseGlyph]") [assignment]
lib.py:83: error: Argument 1 to "reference" has incompatible type "BaseGlyph"; expected "Callable[[], Any]" [arg-type]
lib.py:112: error: "BaseFont" not callable [operator]
lib.py:118: error: "BaseFont" not callable [operator]
lib.py:123: error: Incompatible types in assignment (expression has type "Callable[[], Any]", variable has type "Optional[BaseFont]") [assignment]
lib.py:123: error: Argument 1 to "reference" has incompatible type "BaseFont"; expected "Callable[[], Any]" [arg-type] |
@typesupply are you ok with relaxing the value to be any type? |
|
The value limitations in methods like |
From plistlib:
Maybe we could just point to the plistlib doc instead of enumerating everything ourselves. Or we could do what the UFO spec does and point to Apple's DTD. |
For the sake of clarity and explicitness, I suggest extending |
My concern back then with using I just looked at the plistlib code and it does something similar to what you suggest: a sequence of Thanks for pressing on this! |
Yes, I agree with Tal; changing the validator to test for the accepted types (and recursively for dictionaries) is the thing to do here. Thank you @knutnergaard for pushing on this! |
My pressure! Since I'm already working on |
Changes in normalizers.py include: - Handle normalization of specific plistlib-compatible types in `normalizeLibValue`. - Resolve `mypy` errors. - Improve error messages and efficiency in certain functions.
@benkiel @typesupply I ended up referencing a new common value type |
@knutnergaard thank you for this! |
No description provided.