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

Add some type hints #443

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spider-man-tm
Copy link

@spider-man-tm spider-man-tm commented Jul 21, 2024

close #442

Thanks to your project, I was able to write an analytical report on baseball! Thank you very much.

I have added information about Python type hints in several places. Although the current mypy errors in the tests are not completely resolved, they are somewhat reduced.

local test results
================================== test session starts ==================================
platform darwin -- Python 3.11.4, pytest-8.3.1, pluggy-1.5.0
rootdir: /Users/takayoshi/repos/pybaseball
configfile: pytest.ini
plugins: cov-5.0.0, xdist-3.6.1
collected 130 items

tests/pybaseball/analysis/projections/marcels/test_age.py .                       [  0%]
tests/pybaseball/analysis/projections/marcels/test_marcels_batting.py .           [  1%]
tests/pybaseball/analysis/projections/marcels/test_marcels_pitching.py .          [  2%]
tests/pybaseball/analysis/trajectories/batted_balls/test_batted_balls_utils.py .. [  3%]
....                                                                              [  6%]
tests/pybaseball/analysis/trajectories/batted_balls/test_calculator.py ...        [  9%]
tests/pybaseball/analysis/trajectories/batted_balls/test_parameters.py .          [ 10%]
tests/pybaseball/cache/test_cache.py ...........                                  [ 18%]
tests/pybaseball/cache/test_cache_config.py .............                         [ 28%]
tests/pybaseball/cache/test_cache_record.py ......                                [ 33%]
tests/pybaseball/cache/test_dataframe_utils.py ......                             [ 37%]
tests/pybaseball/cache/test_func_utils.py ..                                      [ 39%]
tests/pybaseball/datahelpers/test_column_mapper.py ..                             [ 40%]
tests/pybaseball/datahelpers/test_postprocessing.py ................              [ 53%]
tests/pybaseball/datahelpers/test_singleton.py ...                                [ 55%]
tests/pybaseball/datahelpers/test_statcast_utils.py ..                            [ 56%]
tests/pybaseball/datahelpers/test_transform.py ...                                [ 59%]
tests/pybaseball/datasources/test_fangraphs.py ..........                         [ 66%]
tests/pybaseball/datasources/test_html_table.py ....                              [ 70%]
tests/pybaseball/test_amateur_draft.py ..                                         [ 71%]
tests/pybaseball/test_amateur_draft_by_team.py ..                                 [ 73%]
tests/pybaseball/test_batting_leaders.py .                                        [ 73%]
tests/pybaseball/test_league_batting_stats.py ..                                  [ 75%]
tests/pybaseball/test_league_pitching_stats.py ....                               [ 78%]
tests/pybaseball/test_pitching_leaders.py .                                       [ 79%]
tests/pybaseball/test_plotting.py ..                                              [ 80%]
tests/pybaseball/test_statcast.py .                                               [ 81%]
tests/pybaseball/test_statcast_batter.py .                                        [ 82%]
tests/pybaseball/test_statcast_pitching_spin.py ..                                [ 83%]
tests/pybaseball/test_team_batting.py .                                           [ 84%]
tests/pybaseball/test_team_fielding.py .                                          [ 85%]
tests/pybaseball/test_team_pitching.py .                                          [ 86%]
tests/pybaseball/test_teamid_lookup.py ............                               [ 95%]
tests/pybaseball/test_utils.py ......                                             [100%]

=================================== warnings summary ====================================
tests/pybaseball/test_statcast_pitching_spin.py::test_individual_calculations
  /Users/takayoshi/repos/pybaseball/.venv/lib/python3.11/site-packages/pandas/core/arrays/masked.py:582: RuntimeWarning: invalid value encountered in arccos
    result = getattr(ufunc, method)(*inputs2, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================ 130 passed, 1 warning in 8.78s =============================

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.

mypy errors caused by Python type hints
1 participant