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

Typehint issues #164

Open
1 of 6 tasks
jpfeuffer opened this issue Sep 29, 2022 · 0 comments
Open
1 of 6 tasks

Typehint issues #164

jpfeuffer opened this issue Sep 29, 2022 · 0 comments

Comments

@jpfeuffer
Copy link
Contributor

jpfeuffer commented Sep 29, 2022

  • missing unicode leads to warnings when parsing types in a python 3 environment (maybe we should only use EITHER unicode or str, depending on the current version of python, or just ditch unicode from 2.7). EDIT: We ditched unicode.
  • pairs are currently types as List[t1,t2]. We probably should use namedtuples or recordclasses so we can type them correctly. Lists are homogeneous. See Do not use list as pair replacement, since list cannot be heterogenously typed #168
  • attached classes seem to be typed with their hidden global types (_AttacheeClass_AttachedClass). (Might be fixable during doc generation) But we can check if it would be easier to just type with the attached type.
  • attached functions are currently typed via:
      class AASequence:
        ...
        fromString: __static_AASequence_fromString
    
    but mypy does not seem to like it. Transfer of types is apparently not easy. We might need to copy the whole signature.
  • typing of setters is missing. We type attributes though. It can get complicated to have different types for the properties (i.e. attributes) and their setters. E.g. if you use libcpp_utf8_string as a property it accepts str and bytes as setter but of course can only return one of them as getter. See also What to do about setters of a different type than their property? python/mypy#3004
  • similar to the point before: We probably need to support input and output types (like we have input and output conversion code). This can then be used for asymmetric types that accept many python types but return only one (like OpenMS' String)
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

No branches or pull requests

1 participant