Skip to content

Commit

Permalink
fix typechecker
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Jan 29, 2024
1 parent b11b8e7 commit 9108898
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
10 changes: 6 additions & 4 deletions gweatherrouting/core/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import json
import latlon
from geojson_utils import point_in_polygon
from typing import Dict, Callable

try:
from .storage import * # noqa: F401, F403
Expand Down Expand Up @@ -181,7 +182,7 @@ def __delitem__(self, key):


class EventDispatcher:
handlers = {}
handlers: Dict[str, Callable] = {}

def connect(self, evt, f):
if evt not in self.handlers:
Expand All @@ -199,9 +200,10 @@ def dispatch(self, evt, e):
x(e)



class dotdict(dict):
"""dot.notation access to dictionary attributes"""

__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
__getattr__ = dict.get # type: ignore
__setattr__ = dict.__setitem__ # type: ignore
__delattr__ = dict.__delitem__ # type: ignore
22 changes: 11 additions & 11 deletions gweatherrouting/data/extract_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@

icons = []

for x in gladeFiles:
f = open(x, "r")
for g_file in gladeFiles:
f = open(g_file, "r")
data = f.read()
f.close()

# Get all strings surrounded by property
strings = []

dataIName = data.split('<property name="icon-name">')[1:]
for x in dataIName:
if x.find("</property>") == -1:
for iprop in dataIName:
if iprop.find("</property>") == -1:
continue

strings += [x.split("</property>")[0]]
strings += [iprop.split("</property>")[0]]

dataStock = data.split('<property name="icon-name">')[1:]
for x in dataStock:
if x.find("</property>") == -1:
for data in dataStock:
if data.find("</property>") == -1:
continue

strings += [x.split("</property>")[0]]
strings += [data.split("</property>")[0]]

for y in strings:
if y in icons:
Expand All @@ -50,10 +50,10 @@ def findIcon(x):
return os.path.join(y[0], z)


for x in icons:
l_icn = findIcon(x + ".svg")
for icn in icons:
l_icn = findIcon(icn + ".svg")
if not l_icn:
print("NOTFOUND:", x)
print("NOTFOUND:", icn)
continue

# copy l to ../data/icons/
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ commands =
black .

[testenv:typecheck]
allowlist_externals = mypy # TODO: why?
; allowlist_externals = mypy # TODO: why?
deps =
; {[testenv]deps}
mypy
Expand Down

0 comments on commit 9108898

Please sign in to comment.