From 9b3c44435d803ee8a0fb209a84b82279de5e0caa Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 13:56:12 +0100 Subject: [PATCH 1/8] Fix ImportError of codingame.types --- codingame/__init__.py | 5 ++--- setup.py | 6 +----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/codingame/__init__.py b/codingame/__init__.py index 181f090..d0e1421 100644 --- a/codingame/__init__.py +++ b/codingame/__init__.py @@ -11,13 +11,12 @@ "VersionInfo", major=int, minor=int, micro=int, releaselevel=str, serial=int ) -version_info = VersionInfo(major=1, minor=2, micro=2, releaselevel="", serial=0) +version_info = VersionInfo(major=1, minor=2, micro=3, releaselevel="", serial=0) __title__ = "codingame" __author__ = "takos22" -__version__ = "1.2.2" +__version__ = "1.2.3" -from . import types # needed for including codingame.types submodule in release from .clash_of_code import ClashOfCode, Player from .client import Client from .codingamer import CodinGamer diff --git a/setup.py b/setup.py index 845882d..c5ea28a 100644 --- a/setup.py +++ b/setup.py @@ -64,11 +64,7 @@ def get_requirements(filename: str = "requirements.txt") -> typing.List[str]: long_description_content_type="text/x-rst", author="takos22", author_email="takos2210@gmail.com", - packages=[ - "codingame", - "codingame.client", - "codingame.http", - ], + packages=get_packages("codingame"), python_requires=">=3.6", install_requires=get_requirements(), extras_require=extra_requires, From 26f3cb8e6a44b614378c6a4618732f3b53c12b9c Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 13:56:30 +0100 Subject: [PATCH 2/8] Update changelog --- docs/changelog.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index c3b33a8..ae9992d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -31,6 +31,15 @@ Changed - Deprecated :attr:`Notification.creation_time` in favor of :attr:`Notification.date` +Version 1.2.3 (2021-11-07) +-------------------------- + +Fixed +***** + +- :exc:`ImportError` of ``codingame.types`` submodule when importing + ``codingame``, the ``1.2.1`` and ``1.2.2`` fixes don't work. + Version 1.2.2 (2021-11-06) -------------------------- From b663e99b125ff06fb6386013f3401ff4592654fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 7 Nov 2021 12:58:01 +0000 Subject: [PATCH 3/8] Update CHANGELOG.rst --- CHANGELOG.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d0415f5..3e82a4e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -29,6 +29,15 @@ Changed - Deprecated `Notification.creation_time `__ in favor of `Notification.date `__ +Version 1.2.3 (2021-11-07) +-------------------------- + +Fixed +***** + +- ``ImportError`` of ``codingame.types`` submodule when importing + ``codingame``, the ``1.2.1`` and ``1.2.2`` fixes don't work. + Version 1.2.2 (2021-11-06) -------------------------- From 5b75d07c75c84aa4dc9698990c6b35ea00e99a88 Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 14:02:35 +0100 Subject: [PATCH 4/8] Update coverage setup --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index c53642e..6c2f735 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,7 @@ addopts = --cov source = codingame tests +omit = codingame/types branch = True [coverage:report] From a361bfe2055d929ef50cccf5d0d84f34282a6e82 Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 14:11:11 +0100 Subject: [PATCH 5/8] Update coverage setup --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 6c2f735..53b1e84 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,7 @@ addopts = --cov source = codingame tests -omit = codingame/types +omit = */types/* branch = True [coverage:report] From f4aecdc9540a066c2e4e61577d706706051c5c96 Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 14:15:30 +0100 Subject: [PATCH 6/8] Update type hinting --- codingame/http/base.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/codingame/http/base.py b/codingame/http/base.py index 98e0bcc..cd5ec07 100644 --- a/codingame/http/base.py +++ b/codingame/http/base.py @@ -1,14 +1,13 @@ import typing from abc import ABC, abstractmethod -if typing.TYPE_CHECKING: - from codingame.types import ( - ClashOfCode, - CodinGamerFromID, - Follower, - Following, - PointsStatsFromHandle, - ) +from ..types import ( + ClashOfCode, + CodinGamerFromID, + Follower, + Following, + PointsStatsFromHandle, +) __all__ = ("BaseHTTPClient",) From c1ab081d16d19a66a3ba997c03174a877e5d5e82 Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 14:15:37 +0100 Subject: [PATCH 7/8] Update coverage setup --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 53b1e84..c53642e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,6 @@ addopts = --cov source = codingame tests -omit = */types/* branch = True [coverage:report] From 5dd6f7b98e0ca2ac7ed9be9ec121d6ca9f1f7031 Mon Sep 17 00:00:00 2001 From: Takos22 Date: Sun, 7 Nov 2021 14:16:27 +0100 Subject: [PATCH 8/8] Update type hinting --- codingame/http/base.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/codingame/http/base.py b/codingame/http/base.py index cd5ec07..5a4e153 100644 --- a/codingame/http/base.py +++ b/codingame/http/base.py @@ -65,25 +65,23 @@ def login(self, email: str, password: str): "CodinGamer", "loginSite", [email, password, True, "CODINGAME", ""] ) - def get_codingamer_from_handle( - self, handle: str - ) -> "PointsStatsFromHandle": + def get_codingamer_from_handle(self, handle: str) -> PointsStatsFromHandle: return self.request( "CodinGamer", "findCodingamePointsStatsByHandle", [handle] ) - def get_codingamer_from_id(self, id: int) -> "CodinGamerFromID": + def get_codingamer_from_id(self, id: int) -> CodinGamerFromID: return self.request( "CodinGamer", "findCodinGamerPublicInformations", [id] ) - def get_codingamer_followers(self, id: int) -> typing.List["Follower"]: + def get_codingamer_followers(self, id: int) -> typing.List[Follower]: return self.request("CodinGamer", "findFollowers", [id, id, None]) def get_codingamer_follower_ids(self, id: int) -> typing.List[int]: return self.request("CodinGamer", "findFollowerIds", [id]) - def get_codingamer_following(self, id: int) -> typing.List["Following"]: + def get_codingamer_following(self, id: int) -> typing.List[Following]: return self.request("CodinGamer", "findFollowing", [id, id]) def get_codingamer_following_ids(self, id: int) -> typing.List[int]: @@ -94,10 +92,10 @@ def get_codingamer_following_ids(self, id: int) -> typing.List[int]: def get_codingamer_clash_of_code_rank(self, id: int) -> int: return self.request("ClashOfCode", "getClashRankByCodinGamerId", [id]) - def get_clash_of_code_from_handle(self, handle: str) -> "ClashOfCode": + def get_clash_of_code_from_handle(self, handle: str) -> ClashOfCode: return self.request("ClashOfCode", "findClashByHandle", [handle]) - def get_pending_clash_of_code(self) -> "ClashOfCode": + def get_pending_clash_of_code(self) -> ClashOfCode: return self.request("ClashOfCode", "findPendingClashes") # Notification