Skip to content

Add include_career_stats flag to scrape_player_details - #92

Open
YonatanHen wants to merge 5 commits into
oseymour:mainfrom
YonatanHen:dev/optional-career-stats
Open

Add include_career_stats flag to scrape_player_details#92
YonatanHen wants to merge 5 commits into
oseymour:mainfrom
YonatanHen:dev/optional-career-stats

Conversation

@YonatanHen

Copy link
Copy Markdown

Summary

  • Adds an optional include_career_stats: bool = True parameter to scrape_player_details in sofascore.py. When set to False, the per-player career stats API call is skipped, reducing scrape time when that data isn't needed.
  • Updates SofascorePlayer.career_stats type annotation from pd.DataFrame to pd.DataFrame | None to reflect the new possible value.
  • Extends test_scrape_player_details to assert career_stats is a pd.DataFrame by default and None when include_career_stats=False.
  • Fixes a pre-existing mypy error in scrape_team_league_stats where team_row (typed pd.Series) was reassigned to a pd.DataFrame — renamed to team_row_df.
  • Adds Python 3.14 to tox.ini envlist and pyproject.toml classifiers.
  • Adds pandas.DataFrame to nitpick_ignore in docs/source/conf.py to fix a sphinx docs build failure caused by the new union type annotation.

Test plan

All tox environments were run locally and passed:

  • python -m tox -r -e typecheck
  • python -m tox -r -e lint
  • python -m tox -r -e docs
  • python -m tox -r -e build
  • python -m tox -r -e py314 (full test suite against live Sofascore API)

Adds an optional include_career_stats parameter (default True) so callers
can skip the per-player career stats API call when that data isn't needed,
reducing scrape time. Updates SofascorePlayer.career_stats type annotation
to pd.DataFrame | None accordingly.
Renamed team_row to team_row_df after .to_frame().T to avoid reassigning
a Series variable with a DataFrame value.
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 3 high

Alerts:
⚠ 3 issues (≤ 0 issues of at least minor severity)

Results:
3 new issues

Category Results
Security 3 high

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@deepsource-io

deepsource-io Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

DeepSource Code Review

We reviewed changes in 50f5df9...9d33829 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Python Jun 3, 2026 12:50p.m. Review ↗
Code coverage Jun 3, 2026 12:50p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

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.

1 participant