isort, pre-commit

This commit is contained in:
Eriks K 2021-01-05 19:29:20 +02:00
parent 91565d840e
commit 308807d800
6 changed files with 24 additions and 10 deletions

10
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

View File

@ -2,7 +2,7 @@ import re
import sys
import warnings
import weakref
from datetime import datetime, timedelta, time
from datetime import datetime, time, timedelta
from decimal import Decimal
from itertools import product
from threading import Event
@ -11,7 +11,7 @@ from typing import Any, Dict, List, NoReturn, Optional, Set, Tuple, Union
from requests import HTTPError, RequestException, Response
from . import access_points, classes, constants, utils, types
from . import access_points, classes, constants, types, utils
from .classes import OfferItem
@ -2617,17 +2617,21 @@ class Citizen(CitizenAnniversary, CitizenCompanies, CitizenLeaderBoard,
data = self._get_main_weekly_challenge_data().json()
self.details.pp = data.get("player", {}).get("prestigePoints", 0)
self.details.next_pp.clear()
max_collectable_id = data.get('maxRewardId')
should_collect = False
for reward in data.get("rewards", {}).get("normal", {}):
status = reward.get("status", "")
if status == "rewarded":
continue
elif status == "completed":
self._post_main_weekly_challenge_reward(reward.get("id", 0))
should_collect = True
elif reward.get("icon", "") == "energy_booster":
pps = re.search(r"Reach (\d+) Prestige Points to unlock the following reward: \+1 Energy",
reward.get("tooltip", ""))
if pps:
self.details.next_pp.append(int(pps.group(1)))
if should_collect:
self._post_main_weekly_challenge_collect_all(max_collectable_id)
def should_fight(self, silent: bool = True) -> Tuple[int, str, bool]:
count, log_msg, force_fight = super().should_fight()

View File

@ -7,7 +7,7 @@ from typing import Any, Dict, Generator, Iterable, List, NamedTuple, NoReturn, T
from requests import Response, Session, post
from . import constants, utils, types
from . import constants, types, utils
__all__ = ['Battle', 'BattleDivision', 'BattleSide', 'Company', 'Config', 'Details', 'Energy', 'ErepublikException',
'ErepublikNetworkException', 'EnergyToFight',

View File

@ -1,5 +1,5 @@
from datetime import datetime
from typing import Dict, Union, List
from typing import Dict, List, Union
InvFinalItem = Dict[str, Union[str, int, List[Dict[str, Union[int, datetime]]]]]
InvBooster = Dict[str, Dict[int, Dict[int, InvFinalItem]]]

View File

@ -5,14 +5,15 @@ flake8==3.8.4
ipython>=7.19.0
isort==5.7.0
pip==20.3.3
pre-commit==2.9.3
pur==5.3.0
PyInstaller==4.1
pytz>=2020.0
PySocks==1.7.1
pytest==6.2.1
pytz>=2020.5
requests>=2.25.1
responses==0.12.1
setuptools==51.1.1
Sphinx==3.4.2
requests>=2.24.0,<2.26.0
PySocks==1.7.1
twine==3.3.0
wheel==0.36.2
pur==5.3.0

View File

@ -37,4 +37,3 @@ warn_unused_configs = True
[isort]
multi_line_output = 2
line_length = 120
not_skip = __init__.py