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

Improve typing hints in generated code #7

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

jmuhlich
Copy link
Collaborator

@jmuhlich jmuhlich commented Jul 7, 2020

This fixes the following runtime errors:

  • Correctly set default to "None" for TiffData/UUID

and these typing errors:

  • Cast default values for constrained integer attributes (both mypy and
    pywright were complaining about this)
  • Drop use of conlist in ROI/Union in favor of Field (only mypy noticed this)

This fixes the following runtime errors:
* Correctly set default to "None" for TiffData/UUID

and these typing errors:
* Cast default values for constrained integer attributes (both mypy and
  pywright were complaining about this)
* Drop use of conlist in ROI/Union in favor of Field (only mypy noticed this)
@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2020

Codecov Report

Merging #7 into master will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #7      +/-   ##
==========================================
+ Coverage   95.28%   95.37%   +0.08%     
==========================================
  Files           1        1              
  Lines         382      389       +7     
==========================================
+ Hits          364      371       +7     
  Misses         18       18              
Impacted Files Coverage Δ
src/ome_autogen.py 95.37% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 749d46d...dabc42f. Read the comment docs.

@jmuhlich
Copy link
Collaborator Author

jmuhlich commented Jul 7, 2020

I'm not totally happy with the constrained integer casting. My solution just assumes everything with a subtype of xsd:decimal needs a cast for its default value. This hits all the right stuff for the current schema, at least. Also I'm not sure what the user experience will be trying to type-check code that writes to these attributes -- will people need cast everywhere or disable type checking on those lines?

@tlambert03 tlambert03 merged commit 0c0c2fd into tlambert03:master Jul 14, 2020
@jmuhlich jmuhlich deleted the typing-improvements branch July 15, 2020 14:05
@jmuhlich jmuhlich restored the typing-improvements branch July 15, 2020 14:36
@jmuhlich jmuhlich deleted the typing-improvements branch July 15, 2020 14:37
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.

3 participants