Skip to content

Commit 719ca96

Browse files
refactor: Merge
1 parent db9266f commit 719ca96

File tree

7 files changed

+25
-43
lines changed

7 files changed

+25
-43
lines changed

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[settings]
2-
known_third_party = PIL,colorama,keyboard,requests
2+
known_third_party = PIL,attr,colorama,keyboard,requests

factories/item_modifier.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
from typing import Dict
22

3-
from models.item_modifier import ItemModifier
43
from enums.item_modifier_type import ItemModifierType
4+
from models.item_modifier import ItemModifier
55

66

77
def build_from_json(blob: Dict) -> ItemModifier:
8-
return ItemModifier(
9-
id=blob['id'],
10-
text=blob['text'],
11-
type=ItemModifierType(blob['type'].lower())
12-
)
8+
return ItemModifier(id=blob["id"], text=blob["text"], type=ItemModifierType(blob["type"].lower()))

models/item_modifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from attr import attrs, attrib
1+
from attr import attrib, attrs
22

33
from enums.item_modifier_type import ItemModifierType
44

parse.py

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,30 @@
33
import traceback
44
from itertools import chain
55
from tkinter import TclError, Tk
6-
from typing import Dict, List, Tuple, Any, Optional, Iterable, Collection
7-
from tkinter import TclError
8-
from tkinter import Tk
9-
from typing import Dict
10-
from typing import List
6+
from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple
117

128
import requests
13-
from colorama import Fore
14-
from colorama import deinit
15-
from colorama import init
9+
from colorama import Fore, deinit, init
1610

1711
# Local imports
1812
from enums.item_modifier_type import ItemModifierType
1913
from models.item_modifier import ItemModifier
2014
from utils.config import LEAGUE, PROJECT_URL, USE_GUI, USE_HOTKEYS
21-
from utils.currency import (CATALYSTS, CURRENCY, DIV_CARDS, ESSENCES, FOSSILS,
22-
FRAGMENTS_AND_SETS, INCUBATORS, OILS, RESONATORS,
23-
SCARABS, VIALS)
24-
from utils.config import LEAGUE
25-
from utils.config import PROJECT_URL
26-
from utils.config import USE_GUI
27-
from utils.config import USE_HOTKEYS
28-
from utils.currency import CATALYSTS
29-
from utils.currency import CURRENCY
30-
from utils.currency import DIV_CARDS
31-
from utils.currency import ESSENCES
32-
from utils.currency import FOSSILS
33-
from utils.currency import FRAGMENTS_AND_SETS
34-
from utils.currency import INCUBATORS
35-
from utils.currency import OILS
36-
from utils.currency import RESONATORS
37-
from utils.currency import SCARABS
38-
from utils.currency import VIALS
15+
from utils.currency import (
16+
CATALYSTS,
17+
CURRENCY,
18+
DIV_CARDS,
19+
ESSENCES,
20+
FOSSILS,
21+
FRAGMENTS_AND_SETS,
22+
INCUBATORS,
23+
OILS,
24+
RESONATORS,
25+
SCARABS,
26+
VIALS,
27+
)
3928
from utils.exceptions import InvalidAPIResponseException
40-
from utils.trade import get_leagues, get_item_modifiers
29+
from utils.trade import get_item_modifiers, get_leagues
4130

4231
DEBUG = False
4332

@@ -787,7 +776,6 @@ def get_mods_by_type(type: ItemModifierType) -> Iterable[ItemModifier]:
787776
if DEBUG:
788777
print("AFFIX:", affix)
789778

790-
791779
if re.search(r"\((pseudo|implicit|crafted)\)", affix):
792780
# Do these need to be searched in a specific order?
793781
search_order = [ItemModifierType.PSEUDO, ItemModifierType.IMPLICIT, ItemModifierType.CRAFTED]
@@ -808,7 +796,7 @@ def get_mods_by_type(type: ItemModifierType) -> Iterable[ItemModifier]:
808796
if value is not None:
809797
return (enchant.id, value)
810798

811-
raise NotImplementedError('Unable to find matching affix.')
799+
raise NotImplementedError("Unable to find matching affix.")
812800

813801

814802
def stat_translate(jaffix: str) -> ItemModifier:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ exclude = '''
4040
'''
4141

4242
[tool.isort]
43-
force_single_line = true
43+
force_single_line = false
4444
multi_line_output = 3
4545
include_trailing_comma = true
4646
force_grid_wrap = 0

utils/testGui.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import time
33
from tkinter import *
44

5-
from PIL import Image
6-
from PIL import ImageTk
5+
from PIL import Image, ImageTk
76

87
# We do not need this on Linux.
98
# If you are attempting to develop, you will need to install your own version as pypi does not have one.

utils/trade.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import requests
55

6-
from models.item_modifier import ItemModifier
76
from factories.item_modifier import build_from_json
7+
from models.item_modifier import ItemModifier
88

99

1010
def get_leagues() -> Tuple[str, ...]:
@@ -14,6 +14,5 @@ def get_leagues() -> Tuple[str, ...]:
1414

1515
def get_item_modifiers() -> Tuple[ItemModifier, ...]:
1616
json_blob = requests.get(url="https://www.pathofexile.com/api/trade/data/stats").json()
17-
items = tuple(chain(*[[build_from_json(y) for y in x['entries']] for x in json_blob['result']]))
17+
items = tuple(chain(*[[build_from_json(y) for y in x["entries"]] for x in json_blob["result"]]))
1818
return items
19-

0 commit comments

Comments
 (0)