refactor: Apply PEP8 naming conventions - convert PascalCase methods to snake_case

This comprehensive refactoring applies PEP8 naming conventions across the codebase:

## Core Changes:

### src/cli/Main.py
- Renamed __InitList__() to __init_list__()
- Renamed print_Download_Progress() to print_download_progress()
- Fixed variable naming: task3 -> download_progress_task
- Fixed parameter spacing: words :str -> words: str
- Updated all method calls to use snake_case
- Added comprehensive docstrings

### src/core/SerieScanner.py
- Renamed Scan() to scan()
- Renamed GetTotalToScan() to get_total_to_scan()
- Renamed Reinit() to reinit()
- Renamed private methods to snake_case:
  - __ReadDataFromFile() -> __read_data_from_file()
  - __GetMissingEpisodesAndSeason() -> __get_missing_episodes_and_season()
  - __GetEpisodeAndSeason() -> __get_episode_and_season()
  - __GetEpisodesAndSeasons() -> __get_episodes_and_seasons()
- Added comprehensive docstrings to all methods
- Fixed long line issues

### src/core/providers/base_provider.py
- Refactored abstract base class with proper naming:
  - Search() -> search()
  - IsLanguage() -> is_language()
  - Download() -> download()
  - GetSiteKey() -> get_site_key()
  - GetTitle() -> get_title()
- Added proper type hints (Dict, List, etc.)
- Added comprehensive docstrings explaining contracts
- Fixed newline at end of file

### src/core/providers/aniworld_provider.py
- Renamed public methods to snake_case:
  - Search() -> search()
  - IsLanguage() -> is_language()
  - Download() -> download()
  - GetSiteKey() -> get_site_key()
  - GetTitle() -> get_title()
  - ClearCache() -> clear_cache()
  - RemoveFromCache() -> remove_from_cache()
- Renamed private methods to snake_case:
  - _GetLanguageKey() -> _get_language_key()
  - _GetKeyHTML() -> _get_key_html()
  - _GetEpisodeHTML() -> _get_episode_html()
- Fixed import organization
- Improved code formatting and line lengths
- Added docstrings to all methods

### src/core/SeriesApp.py
- Updated all calls to use new snake_case method names
- Updated loader calls: loader.Search() -> loader.search()
- Updated loader calls: loader.Download() -> loader.download()
- Updated scanner calls: SerieScanner.GetTotalToScan() -> SerieScanner.get_total_to_scan()
- Updated scanner calls: SerieScanner.Reinit() -> SerieScanner.reinit()
- Updated scanner calls: SerieScanner.Scan() -> SerieScanner.scan()

### tests/unit/test_series_app.py
- Updated mock calls to use new snake_case method names:
  - get_total_to_scan() instead of GetTotalToScan()
  - reinit() instead of Reinit()
  - scan() instead of Scan()

## Verification:
- All unit tests pass 
- All integration tests pass 
- All tests pass 
- No breaking changes to functionality

## Standards Applied:
- PEP 8: Function/method names use lowercase with underscores (snake_case)
- PEP 257: Added comprehensive docstrings
- Type hints: Proper type annotations where applicable
- Code formatting: Fixed line lengths and spacing
This commit is contained in:
2025-10-22 12:44:42 +02:00
parent 80507119b7
commit f64ba74d93
8 changed files with 536 additions and 299 deletions

View File

@@ -1,7 +1,7 @@
{
"pending": [
{
"id": "ec2570fb-9903-4942-87c9-0dc63078bb41",
"id": "ce5dbeb5-d872-437d-aefc-bb6aedf42cf0",
"serie_id": "workflow-series",
"serie_name": "Workflow Test Series",
"episode": {
@@ -11,7 +11,7 @@
},
"status": "pending",
"priority": "high",
"added_at": "2025-10-22T09:08:49.319607Z",
"added_at": "2025-10-22T10:30:01.007391Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -20,7 +20,7 @@
"source_url": null
},
{
"id": "64d4a680-a4ec-49f8-8a73-ca27fa3e31b7",
"id": "29dfed73-c0af-4159-9b24-1802dcecb7ca",
"serie_id": "series-2",
"serie_name": "Series 2",
"episode": {
@@ -30,7 +30,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.051921Z",
"added_at": "2025-10-22T10:30:00.724654Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -39,7 +39,7 @@
"source_url": null
},
{
"id": "98e47c9e-17e5-4205-aacd-4a2d31ca6b29",
"id": "1afc358a-a606-45c4-a9e7-8306e95e1f3b",
"serie_id": "series-1",
"serie_name": "Series 1",
"episode": {
@@ -49,7 +49,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.049588Z",
"added_at": "2025-10-22T10:30:00.722784Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -58,7 +58,7 @@
"source_url": null
},
{
"id": "aa4bf164-0f66-488d-b5aa-04b152c5ec6b",
"id": "66b03e8d-7556-44ef-a9c4-06ca99ed54e7",
"serie_id": "series-0",
"serie_name": "Series 0",
"episode": {
@@ -68,7 +68,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.045265Z",
"added_at": "2025-10-22T10:30:00.720703Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -77,7 +77,7 @@
"source_url": null
},
{
"id": "96b78a9c-bcba-461a-a3f7-c9413c8097bb",
"id": "0cce266d-a2a4-4b4f-a75d-ee1325a70645",
"serie_id": "series-high",
"serie_name": "Series High",
"episode": {
@@ -87,7 +87,7 @@
},
"status": "pending",
"priority": "high",
"added_at": "2025-10-22T09:08:48.825866Z",
"added_at": "2025-10-22T10:30:00.494291Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -96,7 +96,7 @@
"source_url": null
},
{
"id": "af79a00c-1677-41a4-8cf1-5edd715c660f",
"id": "6db02bdc-3586-4b09-9647-a5d382698c3b",
"serie_id": "test-series-2",
"serie_name": "Another Series",
"episode": {
@@ -106,7 +106,7 @@
},
"status": "pending",
"priority": "high",
"added_at": "2025-10-22T09:08:48.802199Z",
"added_at": "2025-10-22T10:30:00.466528Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -115,7 +115,7 @@
"source_url": null
},
{
"id": "4f2a07da-0248-4a69-9c8a-e17913fa5fa2",
"id": "67c4483e-4bd1-4e4c-a57f-30b47b0ea103",
"serie_id": "test-series-1",
"serie_name": "Test Anime Series",
"episode": {
@@ -125,7 +125,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:48.776865Z",
"added_at": "2025-10-22T10:30:00.442074Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -134,7 +134,7 @@
"source_url": null
},
{
"id": "7dd638cb-da1a-407f-8716-5bb9d4388a49",
"id": "531d6683-10d0-4148-9def-8b247d08aa3d",
"serie_id": "test-series-1",
"serie_name": "Test Anime Series",
"episode": {
@@ -144,7 +144,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:48.776962Z",
"added_at": "2025-10-22T10:30:00.442169Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -153,7 +153,7 @@
"source_url": null
},
{
"id": "226764e6-1ac5-43cf-be43-a47a2e4f46e8",
"id": "e406ccf7-5a03-41d9-99b2-7b033f642ab0",
"serie_id": "series-normal",
"serie_name": "Series Normal",
"episode": {
@@ -163,7 +163,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:48.827876Z",
"added_at": "2025-10-22T10:30:00.496264Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -172,7 +172,7 @@
"source_url": null
},
{
"id": "04298256-9f47-41d8-b5ed-b2df0c978ad6",
"id": "3a87ada4-deec-47a3-9628-e2f671e628f1",
"serie_id": "series-low",
"serie_name": "Series Low",
"episode": {
@@ -182,7 +182,7 @@
},
"status": "pending",
"priority": "low",
"added_at": "2025-10-22T09:08:48.833026Z",
"added_at": "2025-10-22T10:30:00.500874Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -191,7 +191,7 @@
"source_url": null
},
{
"id": "b5f39f9a-afc1-42ba-94c7-10820413ae8f",
"id": "61f07b48-927c-4b63-8bcd-974a0a9ace35",
"serie_id": "test-series",
"serie_name": "Test Series",
"episode": {
@@ -201,7 +201,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.000308Z",
"added_at": "2025-10-22T10:30:00.673057Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -210,7 +210,7 @@
"source_url": null
},
{
"id": "f8c9f7c1-4d24-4d13-bec2-25001b6b04fb",
"id": "995caaa2-c7bf-441a-b6b2-bb6e8f6a9477",
"serie_id": "test-series",
"serie_name": "Test Series",
"episode": {
@@ -220,7 +220,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.076920Z",
"added_at": "2025-10-22T10:30:00.751717Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -229,7 +229,7 @@
"source_url": null
},
{
"id": "1954ad7d-d977-4b5b-a603-2c9f4d3bc747",
"id": "e2f350a2-d6d6-40ef-9674-668a970bafb1",
"serie_id": "invalid-series",
"serie_name": "Invalid Series",
"episode": {
@@ -239,7 +239,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.125379Z",
"added_at": "2025-10-22T10:30:00.802319Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -248,7 +248,7 @@
"source_url": null
},
{
"id": "48d00dab-8caf-4eef-97c4-1ceead6906e7",
"id": "3c92011c-ce2b-4a43-b07f-c9a2b6a3d440",
"serie_id": "test-series",
"serie_name": "Test Series",
"episode": {
@@ -258,7 +258,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.150809Z",
"added_at": "2025-10-22T10:30:00.830059Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -267,83 +267,7 @@
"source_url": null
},
{
"id": "4cdd33c4-e2bd-4425-8e4d-661b1c3d43b3",
"serie_id": "series-0",
"serie_name": "Series 0",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.184788Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "93f7fba9-65c7-4b95-8610-416fe6b0f3df",
"serie_id": "series-1",
"serie_name": "Series 1",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.185634Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "a7204eaa-d3a6-4389-9634-1582aabeb963",
"serie_id": "series-4",
"serie_name": "Series 4",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.186289Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "1a4a3ed9-2694-4edf-8448-2239cc240d46",
"serie_id": "series-2",
"serie_name": "Series 2",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.186944Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "b3e007b3-da38-46ac-8a96-9cbbaf61777a",
"id": "9243249b-0ec2-4c61-b5f2-c6b2ed8d7069",
"serie_id": "series-3",
"serie_name": "Series 3",
"episode": {
@@ -353,7 +277,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.188800Z",
"added_at": "2025-10-22T10:30:00.868948Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -362,7 +286,83 @@
"source_url": null
},
{
"id": "7d0e5f7e-92f6-4d39-9635-9f4d490ddb3b",
"id": "65f68572-33e1-4eea-9726-6e6d1e7baabc",
"serie_id": "series-0",
"serie_name": "Series 0",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T10:30:00.870314Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "f9bfe9dd-c8a2-4796-a85b-640c795ede5c",
"serie_id": "series-4",
"serie_name": "Series 4",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T10:30:00.870979Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "70cfaf98-ea74-49d7-a455-bab3951936b7",
"serie_id": "series-1",
"serie_name": "Series 1",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T10:30:00.871649Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "5518bfe5-30ae-48ab-8e63-05dcc5741bb7",
"serie_id": "series-2",
"serie_name": "Series 2",
"episode": {
"season": 1,
"episode": 1,
"title": null
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T10:30:00.872370Z",
"started_at": null,
"completed_at": null,
"progress": null,
"error": null,
"retry_count": 0,
"source_url": null
},
{
"id": "407df11b-ac9d-4be1-a128-49c6d2b6357d",
"serie_id": "persistent-series",
"serie_name": "Persistent Series",
"episode": {
@@ -372,7 +372,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.246329Z",
"added_at": "2025-10-22T10:30:00.933545Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -381,7 +381,7 @@
"source_url": null
},
{
"id": "3466d362-602f-4410-b16a-ac70012035f1",
"id": "8ce9a528-28e5-4b6b-9c90-4d3012fcf7a2",
"serie_id": "ws-series",
"serie_name": "WebSocket Series",
"episode": {
@@ -391,7 +391,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.293513Z",
"added_at": "2025-10-22T10:30:00.980521Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -400,7 +400,7 @@
"source_url": null
},
{
"id": "0433681e-6e3a-49fa-880d-24fbef35ff04",
"id": "7f6f0b8b-954b-436d-817e-54f53761cb81",
"serie_id": "pause-test",
"serie_name": "Pause Test Series",
"episode": {
@@ -410,7 +410,7 @@
},
"status": "pending",
"priority": "normal",
"added_at": "2025-10-22T09:08:49.452875Z",
"added_at": "2025-10-22T10:30:01.142998Z",
"started_at": null,
"completed_at": null,
"progress": null,
@@ -421,5 +421,5 @@
],
"active": [],
"failed": [],
"timestamp": "2025-10-22T09:08:49.453140+00:00"
"timestamp": "2025-10-22T10:30:01.143302+00:00"
}