pysportbot 0.0.8__tar.gz → 0.0.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {pysportbot-0.0.8 → pysportbot-0.0.10}/PKG-INFO +11 -11
  2. {pysportbot-0.0.8 → pysportbot-0.0.10}/README.md +9 -8
  3. {pysportbot-0.0.8 → pysportbot-0.0.10}/pyproject.toml +10 -8
  4. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/__init__.py +1 -2
  5. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/__main__.py +2 -2
  6. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/booking.py +2 -2
  7. pysportbot-0.0.10/pysportbot/service/config_loader.py +7 -0
  8. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/config_validator.py +3 -3
  9. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/service.py +2 -2
  10. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/utils/logger.py +2 -2
  11. pysportbot-0.0.8/pysportbot/service/config_loader.py +0 -7
  12. {pysportbot-0.0.8 → pysportbot-0.0.10}/LICENSE +0 -0
  13. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/activities.py +0 -0
  14. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/authenticator.py +0 -0
  15. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/bookings.py +0 -0
  16. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/centres.py +0 -0
  17. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/endpoints.py +0 -0
  18. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/__init__.py +0 -0
  19. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/scheduling.py +0 -0
  20. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/service/threading.py +0 -0
  21. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/session.py +0 -0
  22. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/utils/__init__.py +0 -0
  23. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/utils/errors.py +0 -0
  24. {pysportbot-0.0.8 → pysportbot-0.0.10}/pysportbot/utils/time.py +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pysportbot
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: A python-based bot for automatic resasports slot booking
5
5
  Author: Joshua Falco Beirer
6
6
  Author-email: jbeirer@cern.ch
7
- Requires-Python: >=3.9,<3.14
7
+ Requires-Python: >=3.10,<3.14
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
9
  Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
@@ -110,20 +109,21 @@ Let's say you would like to book Yoga next Monday at 18:00:00, but the execution
110
109
  }
111
110
  ```
112
111
 
113
- **Note:** By default, pysportbot will be attempt to execute *N* bookings in parallel, where *N* is the number of available cores on your machine.
112
+ **Note:** By default, PySportBot will attempt to execute *N* bookings in parallel, where *N* is the number of available cores on your machine.
114
113
 
115
114
  The service also provides various other options that can be inspected with
116
115
 
117
116
  ```bash
118
117
  python -m pysportbot.service --help
119
118
  ```
120
- Currently supported options include
121
- 1. ```--booking-delay``` sets a global delay in seconds before booking execution [default: 0]
122
- 2. ```--retry-attempts``` sets the number of retries attempted in case a booking attempt fails [default: 3]
123
- 3. ```--retry-delay``` sets the delay in seconds between booking retries [default: 5]
124
- 4. ```--time-zone``` sets the time zone for the service [default: Europe/Madrid]
125
- 5. ```--log-level``` sets the log-level of the service [default: INFO]
126
- 6. ```--max-threads``` limits the number of used threads for parallel bookings [default: -1]
119
+ Currently supported options include:
120
+
121
+ 1. `--booking-delay`: sets a global delay in seconds before booking execution [default: 0]
122
+ 2. `--retry-attempts`: sets the number of retries attempted in case a booking attempt fails [default: 3]
123
+ 3. `--retry-delay`: sets the delay in seconds between booking retries [default: 5]
124
+ 4. `--time-zone`: sets the time zone for the service [default: Europe/Madrid]
125
+ 5. `--log-level`: sets the log-level of the service [default: INFO]
126
+ 6. `--max-threads`: limits the number of used threads for parallel bookings [default: -1]
127
127
 
128
128
  ## LICENSE
129
129
 
@@ -91,20 +91,21 @@ Let's say you would like to book Yoga next Monday at 18:00:00, but the execution
91
91
  }
92
92
  ```
93
93
 
94
- **Note:** By default, pysportbot will be attempt to execute *N* bookings in parallel, where *N* is the number of available cores on your machine.
94
+ **Note:** By default, PySportBot will attempt to execute *N* bookings in parallel, where *N* is the number of available cores on your machine.
95
95
 
96
96
  The service also provides various other options that can be inspected with
97
97
 
98
98
  ```bash
99
99
  python -m pysportbot.service --help
100
100
  ```
101
- Currently supported options include
102
- 1. ```--booking-delay``` sets a global delay in seconds before booking execution [default: 0]
103
- 2. ```--retry-attempts``` sets the number of retries attempted in case a booking attempt fails [default: 3]
104
- 3. ```--retry-delay``` sets the delay in seconds between booking retries [default: 5]
105
- 4. ```--time-zone``` sets the time zone for the service [default: Europe/Madrid]
106
- 5. ```--log-level``` sets the log-level of the service [default: INFO]
107
- 6. ```--max-threads``` limits the number of used threads for parallel bookings [default: -1]
101
+ Currently supported options include:
102
+
103
+ 1. `--booking-delay`: sets a global delay in seconds before booking execution [default: 0]
104
+ 2. `--retry-attempts`: sets the number of retries attempted in case a booking attempt fails [default: 3]
105
+ 3. `--retry-delay`: sets the delay in seconds between booking retries [default: 5]
106
+ 4. `--time-zone`: sets the time zone for the service [default: Europe/Madrid]
107
+ 5. `--log-level`: sets the log-level of the service [default: INFO]
108
+ 6. `--max-threads`: limits the number of used threads for parallel bookings [default: -1]
108
109
 
109
110
  ## LICENSE
110
111
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pysportbot"
3
- version = "v0.0.8"
3
+ version = "v0.0.10"
4
4
  description = "A python-based bot for automatic resasports slot booking"
5
5
  authors = [
6
6
  { name = "Joshua Falco Beirer", email = "jbeirer@cern.ch" }
@@ -14,7 +14,7 @@ packages = [
14
14
  dynamic = ["requires-python", "dependencies"]
15
15
 
16
16
  [tool.poetry.dependencies]
17
- python = ">=3.9,<3.14"
17
+ python = ">=3.10,<3.14"
18
18
  requests = "^2.32.3"
19
19
  beautifulsoup4 = "^4.12.3"
20
20
  pandas = "^2.2.3"
@@ -23,8 +23,8 @@ pytz = "^2024.2"
23
23
  [tool.poetry.group.dev.dependencies]
24
24
  pytest = "^8.3.4"
25
25
  pytest-cov = "^6.0.0"
26
- deptry = "^0.21.2"
27
- mypy = "^1.14.0"
26
+ deptry = "^0.22.0"
27
+ mypy = "^1.14.1"
28
28
  pre-commit = "^4.0.1"
29
29
  tox = "^4.23.2"
30
30
  ipykernel = "^6.29.5"
@@ -37,12 +37,12 @@ mkdocs-material = "^9.5.49"
37
37
  mkdocstrings = {extras = ["python"], version = "^0.27.0"}
38
38
 
39
39
  [build-system]
40
- requires = ["poetry-core>=1.9.1"]
40
+ requires = ["poetry-core>=2.0.1"]
41
41
  build-backend = "poetry.core.masonry.api"
42
42
 
43
43
  [tool.black]
44
44
  line-length = 120
45
- target-version = ['py37']
45
+ target-version = ['py313']
46
46
  preview = true
47
47
 
48
48
  [tool.mypy]
@@ -65,7 +65,7 @@ filterwarnings = [
65
65
  ]
66
66
 
67
67
  [tool.ruff]
68
- target-version = "py37"
68
+ target-version = "py313"
69
69
  line-length = 120
70
70
  fix = true
71
71
  lint.select = [
@@ -108,7 +108,9 @@ lint.ignore = [
108
108
  # Comparison to true should be 'if cond is true:'
109
109
  "E712",
110
110
  # Long exception message
111
- "TRY003"
111
+ "TRY003",
112
+ # Module shadows a Python standard-library module
113
+ "A005"
112
114
  ]
113
115
 
114
116
  [tool.coverage.report]
@@ -1,7 +1,6 @@
1
1
  # pysportbot/sportbot.py
2
2
 
3
3
  import logging
4
- from typing import Optional
5
4
 
6
5
  from pandas import DataFrame
7
6
 
@@ -25,7 +24,7 @@ class SportBot:
25
24
  self._logger.info(f"Time zone: {time_zone}")
26
25
  self._centres = Centres(print_centres)
27
26
  self._session: Session = Session()
28
- self._auth: Optional[Authenticator] = None
27
+ self._auth: Authenticator | None = None
29
28
  self._activities: Activities = Activities(self._session)
30
29
  self._bookings: Bookings = Bookings(self._session)
31
30
  self._df_activities: DataFrame | None = None
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  import argparse
4
- from typing import Any, Dict
4
+ from typing import Any
5
5
 
6
6
  from .config_loader import load_config
7
7
  from .service import run_service
@@ -23,7 +23,7 @@ def main() -> None:
23
23
  )
24
24
  args = parser.parse_args()
25
25
 
26
- config: Dict[str, Any] = load_config(args.config)
26
+ config: dict[str, Any] = load_config(args.config)
27
27
  run_service(
28
28
  config,
29
29
  booking_delay=args.booking_delay,
@@ -1,7 +1,7 @@
1
1
  import time
2
2
  from concurrent.futures import ThreadPoolExecutor, as_completed
3
3
  from datetime import datetime
4
- from typing import Any, Dict
4
+ from typing import Any
5
5
 
6
6
  import pytz
7
7
 
@@ -95,7 +95,7 @@ def attempt_booking(
95
95
 
96
96
  def schedule_bookings(
97
97
  bot: SportBot,
98
- config: Dict[str, Any],
98
+ config: dict[str, Any],
99
99
  booking_delay: int,
100
100
  retry_attempts: int,
101
101
  retry_delay: int,
@@ -0,0 +1,7 @@
1
+ import json
2
+ from typing import Any, cast
3
+
4
+
5
+ def load_config(config_path: str) -> dict[str, Any]:
6
+ with open(config_path) as f:
7
+ return cast(dict[str, Any], json.load(f))
@@ -1,5 +1,5 @@
1
1
  from datetime import datetime
2
- from typing import Any, Dict
2
+ from typing import Any
3
3
 
4
4
  from pysportbot import SportBot
5
5
  from pysportbot.utils.errors import ErrorMessages
@@ -10,7 +10,7 @@ logger = get_logger(__name__)
10
10
  DAY_MAP = {"monday": 0, "tuesday": 1, "wednesday": 2, "thursday": 3, "friday": 4, "saturday": 5, "sunday": 6}
11
11
 
12
12
 
13
- def validate_config(config: Dict[str, Any]) -> None:
13
+ def validate_config(config: dict[str, Any]) -> None:
14
14
  """
15
15
  Validate the overall configuration structure and values.
16
16
 
@@ -48,7 +48,7 @@ def validate_config(config: Dict[str, Any]) -> None:
48
48
  raise ValueError(ErrorMessages.invalid_class_definition())
49
49
 
50
50
 
51
- def validate_activities(bot: SportBot, config: Dict[str, Any]) -> None:
51
+ def validate_activities(bot: SportBot, config: dict[str, Any]) -> None:
52
52
  """
53
53
  Validate that all activities specified in the configuration exist.
54
54
 
@@ -1,4 +1,4 @@
1
- from typing import Any, Dict
1
+ from typing import Any
2
2
 
3
3
  from pysportbot import SportBot
4
4
  from pysportbot.service.booking import schedule_bookings
@@ -8,7 +8,7 @@ from pysportbot.utils.logger import get_logger
8
8
 
9
9
 
10
10
  def run_service(
11
- config: Dict[str, Any],
11
+ config: dict[str, Any],
12
12
  booking_delay: int,
13
13
  retry_attempts: int,
14
14
  retry_delay: int,
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  import threading
3
3
  from datetime import datetime
4
- from typing import ClassVar, Optional
4
+ from typing import ClassVar
5
5
 
6
6
  import pytz
7
7
 
@@ -52,7 +52,7 @@ class ColorFormatter(logging.Formatter):
52
52
  self.include_threads = include_threads
53
53
  self.thread_colors: dict[str, str] = {} # Initialize empty dictionary
54
54
 
55
- def formatTime(self, record: logging.LogRecord, datefmt: Optional[str] = None) -> str:
55
+ def formatTime(self, record: logging.LogRecord, datefmt: str | None = None) -> str:
56
56
  """
57
57
  Override to format the time in the desired timezone.
58
58
  """
@@ -1,7 +0,0 @@
1
- import json
2
- from typing import Any, Dict, cast
3
-
4
-
5
- def load_config(config_path: str) -> Dict[str, Any]:
6
- with open(config_path) as f:
7
- return cast(Dict[str, Any], json.load(f))
File without changes