Skip to content

Commit a169a0c

Browse files
authored
Merge pull request #19 from takos22/1.3.x
2 parents 17b62d0 + 943e310 commit a169a0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+6318
-518
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: 'takos22'
77

88
---
99

10-
**Describe the bug**
10+
## Describe the bug
1111
A clear and concise description of what the bug is.
1212

13-
**To Reproduce**
13+
## To Reproduce
1414
Steps to reproduce the behavior:
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
1818
4. See error
1919

20-
**Expected behavior**
20+
## Expected behavior
2121
A clear and concise description of what you expected to happen.
2222

23-
**Screenshots**
23+
## Screenshots
2424
If applicable, add screenshots to help explain your problem.
2525

26-
**Python (please complete the following information):**
27-
- Version [e.g. 3.7]
28-
- OS: [e.g. Windows]
26+
## Environment information:
27+
- OS: [e.g. Windows 10]
28+
- Python version: [e.g. 3.7.6]
29+
- codingame module version: [e.g. 1.0.1]
2930

30-
**Additional context**
31+
## Additional context
3132
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Security bug report
4+
url: https://mailxto.com/hibec0
5+
about: To avoid leaking the security issues, send me a mail at takos2210@gmail.com.
6+
- name: Need help?
7+
url: https://discord.gg/PGC3eAznJ6
8+
about: Join the discord support server
+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
4+
title: '[FR] '
5+
labels: 'enhancement'
66
assignees: ''
77

88
---
99

10-
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10+
## Related problem
11+
A clear and concise description of a problem this feature request is related to. Ex. I'm always frustrated when [...]
1212

13-
**Describe the solution you'd like**
13+
## Wanted solution
1414
A clear and concise description of what you want to happen.
1515

16-
**Describe alternatives you've considered**
16+
## Considered alternatives
1717
A clear and concise description of any alternative solutions or features you've considered.
1818

19-
**Additional context**
19+
## Additional context
2020
Add any other context or screenshots about the feature request here.

.github/workflows/lint-test.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ jobs:
5555
python setup.py --quiet sdist
5656
twine check dist/*
5757
58-
- name: Test with pytest
58+
- name: Test the mocked API endpoints with pytest
59+
run: |
60+
pytest --only-mocked --overwrite-environ -v
61+
62+
- name: Test with pytest without mocking API enpoints
5963
env:
6064
TEST_LOGIN_REMEMBER_ME_COOKIE: ${{ secrets.TEST_LOGIN_REMEMBER_ME_COOKIE }}
6165

@@ -65,7 +69,7 @@ jobs:
6569

6670
TEST_CLASHOFCODE_PUBLIC_HANDLE: ${{ secrets.TEST_CLASHOFCODE_PUBLIC_HANDLE }}
6771
run: |
68-
pytest
72+
pytest --no-mocking --cov-append -v
6973
7074
- name: Upload coverage to Codecov
7175
uses: codecov/codecov-action@v1

.github/workflows/todo.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "Convert TODOs to issues"
2+
3+
on: ["push"]
4+
5+
jobs:
6+
build:
7+
runs-on: "ubuntu-latest"
8+
steps:
9+
- uses: "actions/checkout@master"
10+
- name: "TODO to Issue"
11+
uses: "alstr/todo-to-issue-action@v4.2"
12+
id: "todo"

CHANGELOG.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ 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.3.0 (unreleased)
10+
Version 1.3.0 (2022-06-21)
1111
--------------------------
1212

1313
Added
@@ -29,6 +29,11 @@ Changed
2929
- Deprecated `Notification.creation_time <https://codingame.readthedocs.io/en/latest/api.html#codingame.Notification.creation_time>`__ in favor of
3030
`Notification.date <https://codingame.readthedocs.io/en/latest/api.html#codingame.Notification.date>`__
3131

32+
Removed
33+
*******
34+
35+
- Removed `Notification._raw`.
36+
3237
Version 1.2.4 (2022-06-17)
3338
--------------------------
3439

README.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ codingame API wrapper
77
.. image:: https://img.shields.io/pypi/pyversions/codingame?color=orange
88
:target: https://pypi.python.org/pypi/codingame
99
:alt: Supported Python versions
10-
.. image:: https://img.shields.io/github/checks-status/takos22/codingame/master?label=tests
10+
.. image:: https://img.shields.io/github/checks-status/takos22/codingame/dev?label=tests
1111
:target: https://github.com/takos22/codingame/actions/workflows/lint-test.yml
1212
:alt: Lint and test workflow status
1313
.. image:: https://readthedocs.org/projects/codingame/badge/?version=latest
1414
:target: https://codingame.readthedocs.io
1515
:alt: Documentation build status
16-
.. image:: https://codecov.io/gh/takos22/codingame/branch/master/graph/badge.svg?token=HQ3J3034Y2
16+
.. image:: https://codecov.io/gh/takos22/codingame/branch/dev/graph/badge.svg?token=HQ3J3034Y2
1717
:target: https://codecov.io/gh/takos22/codingame
1818
:alt: Code coverage
1919
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
@@ -83,3 +83,10 @@ Links
8383
- `PyPi <https://pypi.org/project/codingame/>`_
8484
- `Documentation <https://codingame.readthedocs.io/en/latest/index.html>`_
8585
- `Discord support server <https://discord.gg/8HgtN6E>`_
86+
87+
Disclaimer
88+
----------
89+
90+
This extension was developed as a proof of concept and as an exploratory project.
91+
CodinGame is not responsible for any content or security issues that may arise
92+
due to this module, if you do find any, feel free to open an issue or a pull request.

codingame/__init__.py

+71-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
"VersionInfo", major=int, minor=int, micro=int, releaselevel=str, serial=int
1212
)
1313

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

1616
__title__ = "codingame"
1717
__author__ = "takos22"
18-
__version__ = "1.2.4"
18+
__version__ = "1.3.0"
1919

2020
from .clash_of_code import ClashOfCode, Player
2121
from .client import Client
22-
from .codingamer import CodinGamer
22+
from .codingamer import CodinGamer, PartialCodinGamer
2323
from .exceptions import (
2424
ChallengeNotFound,
2525
ClashOfCodeNotFound,
@@ -45,18 +45,85 @@
4545
PuzzleLeaderboard,
4646
PuzzleRankedCodinGamer,
4747
)
48-
from .notification import Notification
48+
from .notification import (
49+
AchievementUnlockedData,
50+
CareerCandidateData,
51+
ClashInviteData,
52+
ClashOverData,
53+
CommentType,
54+
Contribution,
55+
ContributionData,
56+
ContributionModeratedActionType,
57+
ContributionModeratedData,
58+
ContributionType,
59+
CustomData,
60+
FeatureData,
61+
FriendRegisteredData,
62+
GenericData,
63+
JobAcceptedData,
64+
JobExpiredData,
65+
LanguageMapping,
66+
LeagueData,
67+
NewBlogData,
68+
NewCommentData,
69+
NewHintData,
70+
NewLevelData,
71+
NewPuzzleData,
72+
NewWorkBlogData,
73+
Notification,
74+
NotificationData,
75+
NotificationType,
76+
NotificationTypeGroup,
77+
OfferApplyData,
78+
PuzzleOfTheWeekData,
79+
PuzzleSolution,
80+
QuestCompletedData,
81+
TestFinishedData,
82+
)
4983

5084
__all__ = (
5185
# Client
5286
Client,
5387
# CodinGamer
5488
CodinGamer,
89+
PartialCodinGamer,
5590
# Clash of Code
5691
ClashOfCode,
5792
Player,
5893
# Notification
5994
Notification,
95+
NotificationType,
96+
NotificationTypeGroup,
97+
ContributionType,
98+
CommentType,
99+
ContributionModeratedActionType,
100+
LanguageMapping,
101+
NotificationData,
102+
AchievementUnlockedData,
103+
LeagueData,
104+
NewBlogData,
105+
ClashInviteData,
106+
ClashOverData,
107+
Contribution,
108+
PuzzleSolution,
109+
NewCommentData,
110+
ContributionData,
111+
FeatureData,
112+
NewHintData,
113+
ContributionModeratedData,
114+
NewPuzzleData,
115+
PuzzleOfTheWeekData,
116+
QuestCompletedData,
117+
FriendRegisteredData,
118+
NewLevelData,
119+
GenericData,
120+
CustomData,
121+
CareerCandidateData,
122+
TestFinishedData,
123+
JobAcceptedData,
124+
JobExpiredData,
125+
NewWorkBlogData,
126+
OfferApplyData,
60127
# Leaderboard
61128
GlobalLeaderboard,
62129
GlobalRankedCodinGamer,

codingame/abc.py

+21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import abc
44
import typing
5+
from collections.abc import Mapping as BaseMapping
56

67
if typing.TYPE_CHECKING:
78
from .state import ConnectionState
@@ -69,3 +70,23 @@ def __repr__(self):
6970

7071
def __eq__(self, other):
7172
return self.public_handle == other.public_handle
73+
74+
75+
class Mapping(BaseMapping, BaseObject):
76+
_raw: dict
77+
78+
__slots__ = ("_raw",)
79+
80+
def __init__(self, state: "ConnectionState", data: dict):
81+
self._raw = data
82+
83+
super().__init__(state)
84+
85+
def __getitem__(self, name: str): # pragma: no cover
86+
return self._raw[name]
87+
88+
def __iter__(self): # pragma: no cover
89+
return iter(self._raw)
90+
91+
def __len__(self): # pragma: no cover
92+
return len(self._raw)

0 commit comments

Comments
 (0)