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

Resolve a few straightforward mypy type errors. #1492

Merged
merged 2 commits into from Jan 10, 2021

Conversation

obi1kenobi
Copy link
Contributor

Description

This PR is only about improving type hint coverage and quality. It contains no new features and makes no substantive changes to existing functionality, so it should be fully covered by existing tests. This is similar in spirit to #1397 and #1398.

In particular, this PR:

The following mypy-reported errors are resolved as a result:

arviz/data/io_pystan.py:20: error: Name 'json' already defined (by an import)  [no-redef]
arviz/data/io_json.py:9: error: Name 'json' already defined (by an import)  [no-redef]
arviz/data/base.py:15: error: Name 'json' already defined (by an import)  [no-redef]
arviz/tests/helpers.py:259: error: Incompatible return value type (got "List[str]", expected "List[Union[str, Tuple[str, str]]]")  [return-value]
arviz/tests/helpers.py:259: note: "List" is invariant -- see http://mypy.readthedocs.io/en/latest/common_issues.html#variance
arviz/tests/helpers.py:259: note: Consider using "Sequence" instead, which is covariant
arviz/tests/helpers.py:259: note: Perhaps you need a type annotation for "failed_attrs"? Suggestion: "List[Union[str, Tuple[str, str]]]"

Additionally, a similar mypy type error related to a conditional ujson import that would be uncovered if #1491 merges is also addressed here.

Checklist

  • Follows official PR format
  • Code style correct (follows pylint and black guidelines)

@codecov
Copy link

codecov bot commented Jan 9, 2021

Codecov Report

Merging #1492 (a27b0fa) into master (2d202de) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1492   +/-   ##
=======================================
  Coverage   91.97%   91.97%           
=======================================
  Files         105      105           
  Lines       11239    11239           
=======================================
  Hits        10337    10337           
  Misses        902      902           
Impacted Files Coverage Δ
arviz/data/base.py 97.70% <0.00%> (ø)
arviz/data/inference_data.py 85.81% <0.00%> (ø)
arviz/data/io_json.py 66.66% <0.00%> (ø)
arviz/data/io_pystan.py 96.00% <0.00%> (ø)

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 2d202de...a27b0fa. Read the comment docs.

Copy link
Member

@canyon289 canyon289 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@OriolAbril OriolAbril merged commit 910e781 into arviz-devs:master Jan 10, 2021
@obi1kenobi obi1kenobi deleted the fix_up_type_hints branch January 10, 2021 01:46
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.

None yet

3 participants