Python versions#279
Conversation
…a` handling - Introduced `internal_name` across spells, troops, heroes, and equipment for better alignment with underlying data source. - Updated `TimeDelta` class to use a unified `total_seconds` calculation, improving accuracy and consistency. - Fixed star count calculation bug in Raid API response handling. - Improved caching logic to handle cases where the client is `None`.
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces comprehensive improvements to the codebase including enhanced metadata handling with internal_name support, improved time calculations via refactored TimeDelta model, expanded Python version support (3.10-3.14), enhanced test coverage, and updated CI/CD workflows with CodeQL security scanning.
Key changes:
- Added
internal_namefield support across game entities (troops, spells, heroes, equipment) for better Supercell internal identifier handling - Refactored
TimeDeltato properly handle days/hours/minutes/seconds with accurate total seconds calculation - Updated minimum Python version requirement from 3.9 to 3.10 and expanded CI test matrix to include Python 3.10-3.14
- Fixed critical bug in raid star calculation when attack list is empty
- Enhanced mock data and added utility script for regenerating test data
Reviewed Changes
Copilot reviewed 18 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_clash_meta.py |
Added comprehensive troop metadata validation tests including internal_name verification |
tests/test_capitalraidseasons.py |
Updated test method signatures and added missing RaidLog initialization parameters |
tests/mockdata/regenerate_mockdata.py |
New utility script for regenerating mock test data from live API |
coc/abc.py |
Added internal_name support to DataContainer and enhanced upgrade time parsing |
coc/miscmodels.py |
Refactored TimeDelta for accurate time calculations with improved string representations |
coc/raid.py |
Fixed potential crash when calculating stars with empty attacks list |
coc/entry_logs.py |
Enhanced None client handling to prevent attribute errors |
coc/http.py |
Added safer dictionary access for API key retrieval |
pyproject.toml |
Updated Python version requirement to 3.10+ and added dev dependencies |
.github/workflows/tests.yml |
Expanded test matrix to Python 3.10-3.14 and added unit test execution |
.github/workflows/codeql-analysis.yml |
Added CodeQL security scanning workflow |
Comments suppressed due to low confidence (1)
coc/hero.py:20
- The class 'Hero' does not override 'eq', but adds the new attribute max_level.
The class 'Hero' does not override 'eq', but adds the new attribute internal_name.
The class 'Hero' does not override 'eq', but adds the new attribute _townhall.
The class 'Hero' does not override 'eq', but adds the new attribute __name.
The class 'Hero' does not override 'eq', but adds the new attribute __level.
The class 'Hero' does not override 'eq', but adds the new attribute __village.
The class 'Hero' does not override 'eq', but adds the new attribute __is_active.
The class 'Hero' does not override 'eq', but adds the new attribute equipment.
class Hero(DataContainer):
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Changes for TH18 * Update Version to 3.10 Fix documentation that is flagging * fix comments * Add Missing troops,spells,equipment that seem to have been missed since march
| (days or 0) * 86400 + | ||
| (hours or 0) * 3600 + | ||
| (minutes or 0) * 60 + | ||
| (seconds or 0) |
There was a problem hiding this comment.
The or clauses are not really relevant with how the defaults are set up. Not strictly against keeping them in place, either
This pull request introduces several improvements and updates across the codebase, focusing on enhanced metadata handling for game entities, improved time calculations, expanded test coverage, and updates to CI/CD workflows and dependencies. The most significant changes include adding support for
internal_namefields, improving theTimeDeltamodel, updating Python version requirements, and expanding test matrix coverage.Metadata and Model Improvements:
internal_name(and fallback tooriginalName) toDataContainerand related classes (coc/abc.py,coc/hero.py,coc/spell.py,coc/troop.py). This improves handling of Supercell internal identifiers across troops, spells, heroes, and equipment. [1] [2] [3] [4] [5] [6] [7] [8]TimeDeltamodel to support days, hours, minutes, and seconds, with accurate total second calculations and string representations. [1] [2]Testing and Mock Data:
tests/mockdata/players/player/FOUND.jsonwith new fields (leagueTier), corrected and expanded achievement info, and adjusted values to reflect recent game/API changes. [1] [2] [3] [4] [5] [6] [7] [8] [9]Run unit testsstep to the CI workflow and improved which example scripts are run.CI/CD and Dependency Updates:
pyproject.toml.pyproject.toml.Bug Fixes and Miscellaneous:
coc/raid.pywhere star calculation could fail if the attacks list was empty.coc/entry_logs.pyto avoid errors whenclientisNone.