fix(examples): resolve all mypy type errors #2047#2495
Open
joelpaulfernandez wants to merge 1 commit into
Open
fix(examples): resolve all mypy type errors #2047#2495joelpaulfernandez wants to merge 1 commit into
joelpaulfernandez wants to merge 1 commit into
Conversation
- Add py/mypy.ini with disable_error_code=import-untyped and per-module ignore_missing_imports for synth, h2o, altair, vega_datasets, plotly - Add pandas-stubs to requirements.txt for real pandas type checking - Relax version pins to >= in requirements.txt for Python 3.13 compat - Use Optional[T] for parameters defaulting to None (synth.py, table_pagination.py, table_pagination_pandas.py) - Switch to `import h2o_wave.graphics as g` in 8 graphics files — mypy 1.19 no longer resolves the submodule via __init__.py re-export - Replace deprecated pd.np with numpy directly (table_markdown_pandas.py) - Wrap bokeh json_item() second arg with ID() cast (plot_bokeh_*.py) - Add type: ignore[attr-defined] for bokeh js_on_change dynamic attr - Update tour.py type: ignore comment to cover str-unpack (mypy 1.19) - Fix pu(1) -> pu(close=True) in graphics_turtle.py, graphics_background.py - Fix update_ui value param type int -> float (background_progress.py) - Guard against None rows in db_todo.py list comprehension - Replace builtin any with Any from typing (plot_events_routing.py) - Rename shadowed loop variable filters -> col_filters (table_pagination.py)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2047.
Resolves all mypy errors in
py/examples/(209 → 0) without breaking existing functionality.py/mypy.iniwithdisable_error_code = import-untypedfor third-party packages lackingpy.typedmarkers, andignore_missing_importsforsynth,h2o,altair,vega_datasets,plotlypandas-stubstorequirements.txtfor real pandas type checking instead of suppression>=inrequirements.txtfor Python 3.13 compatibilityOptional[T]for parameters that default toNone(synth.py,table_pagination.py,table_pagination_pandas.py)import h2o_wave.graphics as gin 8 graphics files — mypy 1.19 no longer resolves the submodule via__init__.pyre-exportpd.npwithnumpydirectly (table_markdown_pandas.py)bokeh.embed.json_item()second argument withID()cast (plot_bokeh_*.py)# type: ignore[attr-defined]for bokehjs_on_changedynamic attributetour.pytype: ignorecomment to coverstr-unpackerror code (mypy 1.19)pu(1)→pu(close=True)ingraphics_turtle.py,graphics_background.pyupdate_uivalue parameter typeint→float(background_progress.py)Nonerows indb_todo.pylist comprehensionanywithAnyfromtyping(plot_events_routing.py)filters→col_filters(table_pagination.py)Test plan
mypy py/examples/reports 0 errors