Skip to content

Commit

Permalink
Merge pull request #19 from takos22/1.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
takos22 authored Jun 20, 2022
2 parents 17b62d0 + 943e310 commit a169a0c
Show file tree
Hide file tree
Showing 65 changed files with 6,318 additions and 518 deletions.
23 changes: 12 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
title: '[BUG] '
labels: 'bug'
assignees: 'takos22'

---

**Describe the bug**
## Describe the bug
A clear and concise description of what the bug is.

**To Reproduce**
## To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
## Expected behavior
A clear and concise description of what you expected to happen.

**Screenshots**
## Screenshots
If applicable, add screenshots to help explain your problem.

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

**Additional context**
## Additional context
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Security bug report
url: https://mailxto.com/hibec0
about: To avoid leaking the security issues, send me a mail at takos2210@gmail.com.
- name: Need help?
url: https://discord.gg/PGC3eAznJ6
about: Join the discord support server
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
title: '[FR] '
labels: 'enhancement'
assignees: ''

---

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

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

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

**Additional context**
## Additional context
Add any other context or screenshots about the feature request here.
8 changes: 6 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ jobs:
python setup.py --quiet sdist
twine check dist/*
- name: Test with pytest
- name: Test the mocked API endpoints with pytest
run: |
pytest --only-mocked --overwrite-environ -v
- name: Test with pytest without mocking API enpoints
env:
TEST_LOGIN_REMEMBER_ME_COOKIE: ${{ secrets.TEST_LOGIN_REMEMBER_ME_COOKIE }}

Expand All @@ -65,7 +69,7 @@ jobs:

TEST_CLASHOFCODE_PUBLIC_HANDLE: ${{ secrets.TEST_CLASHOFCODE_PUBLIC_HANDLE }}
run: |
pytest
pytest --no-mocking --cov-append -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Convert TODOs to issues"

on: ["push"]

jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@master"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v4.2"
id: "todo"
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The format is based on
`Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`__, and this project
adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`__.

Version 1.3.0 (unreleased)
Version 1.3.0 (2022-06-21)
--------------------------

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

Removed
*******

- Removed `Notification._raw`.

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

Expand Down
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ codingame API wrapper
.. image:: https://img.shields.io/pypi/pyversions/codingame?color=orange
:target: https://pypi.python.org/pypi/codingame
:alt: Supported Python versions
.. image:: https://img.shields.io/github/checks-status/takos22/codingame/master?label=tests
.. image:: https://img.shields.io/github/checks-status/takos22/codingame/dev?label=tests
:target: https://github.com/takos22/codingame/actions/workflows/lint-test.yml
:alt: Lint and test workflow status
.. image:: https://readthedocs.org/projects/codingame/badge/?version=latest
:target: https://codingame.readthedocs.io
:alt: Documentation build status
.. image:: https://codecov.io/gh/takos22/codingame/branch/master/graph/badge.svg?token=HQ3J3034Y2
.. image:: https://codecov.io/gh/takos22/codingame/branch/dev/graph/badge.svg?token=HQ3J3034Y2
:target: https://codecov.io/gh/takos22/codingame
:alt: Code coverage
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
Expand Down Expand Up @@ -83,3 +83,10 @@ Links
- `PyPi <https://pypi.org/project/codingame/>`_
- `Documentation <https://codingame.readthedocs.io/en/latest/index.html>`_
- `Discord support server <https://discord.gg/8HgtN6E>`_

Disclaimer
----------

This extension was developed as a proof of concept and as an exploratory project.
CodinGame is not responsible for any content or security issues that may arise
due to this module, if you do find any, feel free to open an issue or a pull request.
75 changes: 71 additions & 4 deletions codingame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"VersionInfo", major=int, minor=int, micro=int, releaselevel=str, serial=int
)

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

__title__ = "codingame"
__author__ = "takos22"
__version__ = "1.2.4"
__version__ = "1.3.0"

from .clash_of_code import ClashOfCode, Player
from .client import Client
from .codingamer import CodinGamer
from .codingamer import CodinGamer, PartialCodinGamer
from .exceptions import (
ChallengeNotFound,
ClashOfCodeNotFound,
Expand All @@ -45,18 +45,85 @@
PuzzleLeaderboard,
PuzzleRankedCodinGamer,
)
from .notification import Notification
from .notification import (
AchievementUnlockedData,
CareerCandidateData,
ClashInviteData,
ClashOverData,
CommentType,
Contribution,
ContributionData,
ContributionModeratedActionType,
ContributionModeratedData,
ContributionType,
CustomData,
FeatureData,
FriendRegisteredData,
GenericData,
JobAcceptedData,
JobExpiredData,
LanguageMapping,
LeagueData,
NewBlogData,
NewCommentData,
NewHintData,
NewLevelData,
NewPuzzleData,
NewWorkBlogData,
Notification,
NotificationData,
NotificationType,
NotificationTypeGroup,
OfferApplyData,
PuzzleOfTheWeekData,
PuzzleSolution,
QuestCompletedData,
TestFinishedData,
)

__all__ = (
# Client
Client,
# CodinGamer
CodinGamer,
PartialCodinGamer,
# Clash of Code
ClashOfCode,
Player,
# Notification
Notification,
NotificationType,
NotificationTypeGroup,
ContributionType,
CommentType,
ContributionModeratedActionType,
LanguageMapping,
NotificationData,
AchievementUnlockedData,
LeagueData,
NewBlogData,
ClashInviteData,
ClashOverData,
Contribution,
PuzzleSolution,
NewCommentData,
ContributionData,
FeatureData,
NewHintData,
ContributionModeratedData,
NewPuzzleData,
PuzzleOfTheWeekData,
QuestCompletedData,
FriendRegisteredData,
NewLevelData,
GenericData,
CustomData,
CareerCandidateData,
TestFinishedData,
JobAcceptedData,
JobExpiredData,
NewWorkBlogData,
OfferApplyData,
# Leaderboard
GlobalLeaderboard,
GlobalRankedCodinGamer,
Expand Down
21 changes: 21 additions & 0 deletions codingame/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import abc
import typing
from collections.abc import Mapping as BaseMapping

if typing.TYPE_CHECKING:
from .state import ConnectionState
Expand Down Expand Up @@ -69,3 +70,23 @@ def __repr__(self):

def __eq__(self, other):
return self.public_handle == other.public_handle


class Mapping(BaseMapping, BaseObject):
_raw: dict

__slots__ = ("_raw",)

def __init__(self, state: "ConnectionState", data: dict):
self._raw = data

super().__init__(state)

def __getitem__(self, name: str): # pragma: no cover
return self._raw[name]

def __iter__(self): # pragma: no cover
return iter(self._raw)

def __len__(self): # pragma: no cover
return len(self._raw)
Loading

0 comments on commit a169a0c

Please sign in to comment.