Skip to content

Commit 438d3ae

Browse files
authored
Merge pull request #30 from takos22/1.4.x
[RELEASE] 1.4.3
2 parents 356c261 + 3848d51 commit 438d3ae

26 files changed

+128
-97
lines changed

.github/workflows/lint-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
python-version: [3.7, 3.8, 3.9, '3.10']
20+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
2121

2222
steps:
2323
- uses: actions/checkout@v3

.readthedocs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the version of Python and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.9"
12+
13+
# Build documentation in the docs/ directory with Sphinx
14+
sphinx:
15+
configuration: docs/conf.py
16+
17+
# We recommend specifying your dependencies to enable reproducible builds:
18+
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
19+
python:
20+
install:
21+
- requirements: docs/requirements.txt

CHANGELOG.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ The format is based on
77
`Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`__, and this project
88
adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`__.
99

10+
Version 1.4.3 (2024-02-21)
11+
--------------------------
12+
13+
Changed
14+
*******
15+
16+
- Every `datetime.date <https://docs.python.org/library/datetime.html#datetime.date>`__ is now timezone aware, using the CodinGame
17+
timezone (UTC).
18+
- `ClashOfCode.creation_time <https://codingame.readthedocs.io/en/latest/api.html#codingame.ClashOfCode.creation_time>`__ can be ``None`` because of an API change
19+
by CodinGame.
20+
21+
Fixed
22+
*****
23+
24+
- `KeyError <https://docs.python.org/library/exceptions.html#KeyError>`__ was raised when using `Client.get_clash_of_code <https://codingame.readthedocs.io/en/latest/api.html#codingame.Client.get_clash_of_code>`__ because
25+
of an API change by CodinGame.
26+
27+
Removed
28+
*******
29+
30+
- Removed support for python 3.7 as it has reached its end of life. For more
31+
information, see `PEP 537 <https://peps.python.org/pep-0537/#lifespan>`__.
32+
1033
Version 1.4.2 (2023-04-14)
1134
--------------------------
1235

@@ -66,7 +89,7 @@ Changed
6689
Removed
6790
*******
6891

69-
- Removed `Notification._raw`.
92+
- Removed ``Notification._raw``.
7093

7194
Version 1.2.4 (2022-06-17)
7295
--------------------------

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Pythonic wrapper for the undocumented `CodinGame <https://www.codingame.com/>`_
2929
Installation
3030
------------
3131

32-
**Python 3.7 or higher is required.**
32+
**Python 3.8 or higher is required.**
3333

3434
Install ``codingame`` with pip:
3535

codingame/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"VersionInfo", major=int, minor=int, micro=int, releaselevel=str, serial=int
1212
)
1313

14-
version_info = VersionInfo(major=1, minor=4, micro=2, releaselevel="", serial=0)
14+
version_info = VersionInfo(major=1, minor=4, micro=3, releaselevel="", serial=0)
1515

1616
__title__ = "codingame"
1717
__author__ = "takos22"
18-
__version__ = "1.4.2"
18+
__version__ = "1.4.3"
1919

2020
from .clash_of_code import ClashOfCode, Player
2121
from .client import Client

codingame/clash_of_code.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ class ClashOfCode(BaseObject):
5656
mode: Optional :class:`str`
5757
The mode of the Clash of Code.
5858
59-
creation_time: :class:`~datetime.datetime`
59+
creation_time: Optional :class:`~datetime.datetime`
6060
Creation time of the Clash of Code.
61+
Doesn't always exist.
6162
6263
start_time: :class:`~datetime.datetime`
6364
Start time of the Clash of Code. If the Clash of Code hasn't started
@@ -86,7 +87,7 @@ class ClashOfCode(BaseObject):
8687
started: bool
8788
finished: bool
8889
mode: Optional[Mode]
89-
creation_time: datetime
90+
creation_time: Optional[datetime]
9091
start_time: datetime
9192
end_time: Optional[datetime]
9293
time_before_start: timedelta
@@ -117,7 +118,7 @@ def __init__(self, state: "ConnectionState", data: ClashOfCodeDict):
117118
self.join_url = (
118119
f"https://www.codingame.com/clashofcode/clash/{self.public_handle}"
119120
)
120-
self.public = data["publicClash"]
121+
self.public = data.get("type", "PUBLIC") == "PUBLIC"
121122
self.min_players = data["nbPlayersMin"]
122123
self.max_players = data["nbPlayersMax"]
123124
self.modes = data.get("modes")
@@ -127,8 +128,8 @@ def __init__(self, state: "ConnectionState", data: ClashOfCodeDict):
127128
self.finished = data["finished"]
128129
self.mode = data.get("mode")
129130

130-
self.creation_time = to_datetime(data["creationTime"])
131-
self.start_time = to_datetime(data["startTime"])
131+
self.creation_time = to_datetime(data.get("creationTime"))
132+
self.start_time = to_datetime(data["startTimestamp"])
132133
self.end_time = to_datetime(data.get("endTime"))
133134

134135
self.time_before_start = timedelta(milliseconds=data["msBeforeStart"])

codingame/types/clash_of_code.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
Typings for the `ClashOfCode/` endpoints of the CodinGame API.
55
"""
66

7-
from typing import List, Optional
8-
9-
try:
10-
from typing import Literal, TypedDict
11-
except ImportError:
12-
from typing_extensions import Literal, TypedDict
7+
from typing import List, Literal, Optional, TypedDict
138

149
__all__ = (
1510
"ClashOfCode",

codingame/types/codingamer.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
Typings for the `CodinGamer/` endpoints of the CodinGame API.
55
"""
66

7-
from typing import Dict, List, Optional
8-
9-
try:
10-
from typing import Literal, TypedDict
11-
except ImportError:
12-
from typing_extensions import Literal, TypedDict
7+
from typing import Dict, List, Literal, Optional, TypedDict
138

149
__all__ = (
1510
"PartialCodinGamer",

codingame/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22
import typing
3-
from datetime import datetime
3+
from datetime import datetime, timezone
44

55
from .exceptions import LoginRequired
66

@@ -102,8 +102,8 @@ def validate_leaderboard_group(group: str, logged_in: bool) -> str:
102102

103103
def to_datetime(data: typing.Optional[typing.Union[int, str]]) -> datetime:
104104
if isinstance(data, int):
105-
return datetime.utcfromtimestamp(data / 1000.0)
106-
elif isinstance(data, str):
105+
return datetime.fromtimestamp(data / 1000.0, timezone.utc)
106+
elif isinstance(data, str): # pragma: no cover
107107
try:
108108
return datetime.strptime(data, DT_FORMAT_1)
109109
except ValueError:

dev-requirements.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
autoflake~=1.4
1+
autoflake~=2.3
22
black~=22.6
3-
doc8~=0.9
4-
flake8~=3.9
5-
importlib-metadata~=4.13
6-
isort~=5.8
7-
pytest~=6.2
3+
doc8~=1.1
4+
flake8~=7.0
5+
isort~=5.13
6+
pytest~=7.4
87
pytest-asyncio~=0.16.0
9-
pytest-cov~=2.12
8+
pytest-cov~=4.1
109
pytest-mock~=3.6
11-
python-dotenv~=0.17.1
12-
requests
13-
twine
10+
python-dotenv~=1.0
11+
setuptools~=69.1
12+
twine~=5.0

0 commit comments

Comments
 (0)