Skip to content

Commit

Permalink
Fix type declaration; tuple -> typing.Tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
joolean committed Mar 2, 2023
1 parent 717b334 commit 9e0bc72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions hearthstone/bountyxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def region_name(self):
XML_URL = "https://api.hearthstonejson.com/v1/latest/BountyDefs.xml"


def _bootstrap_from_web(parse: Callable[[Iterator[tuple[str, Any]]], None]):
def _bootstrap_from_web(parse: Callable[[Iterator[Tuple[str, Any]]], None]):
with tempfile.TemporaryFile(mode="rb+") as fp:
if download_to_tempfile_retry(XML_URL, fp):
fp.flush()
Expand All @@ -71,7 +71,7 @@ def _bootstrap_from_web(parse: Callable[[Iterator[tuple[str, Any]]], None]):
parse(ElementTree.iterparse(fp, events=("start", "end",)))


def _bootstrap_from_library(parse: Callable[[Iterator[tuple[str, Any]]], None], path=None):
def _bootstrap_from_library(parse: Callable[[Iterator[Tuple[str, Any]]], None], path=None):
from hearthstone_data import get_bountydefs_path

if path is None:
Expand All @@ -86,7 +86,7 @@ def load(path=None, locale="enUS"):
if cache_key not in bounty_cache:
db = {}

def parse(context: Iterator[tuple[str, Any]]):
def parse(context: Iterator[Tuple[str, Any]]):
nonlocal db
root = None
for action, elem in context:
Expand Down
8 changes: 4 additions & 4 deletions hearthstone/cardxml.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tempfile
from typing import Any, Callable, Iterator
from typing import Any, Callable, Iterator, Tuple

from .enums import (
CardClass, CardSet, CardType, Faction, GameTag,
Expand Down Expand Up @@ -409,7 +409,7 @@ def races(self):
XML_URL = "https://api.hearthstonejson.com/v1/latest/CardDefs.xml"


def _bootstrap_from_web(parse: Callable[[Iterator[tuple[str, Any]]], None]):
def _bootstrap_from_web(parse: Callable[[Iterator[Tuple[str, Any]]], None]):
with tempfile.TemporaryFile(mode="rb+") as fp:
if download_to_tempfile_retry(XML_URL, fp):
fp.flush()
Expand All @@ -418,7 +418,7 @@ def _bootstrap_from_web(parse: Callable[[Iterator[tuple[str, Any]]], None]):
parse(ElementTree.iterparse(fp, events=("start", "end",)))


def _bootstrap_from_library(parse: Callable[[Iterator[tuple[str, Any]]], None], path=None):
def _bootstrap_from_library(parse: Callable[[Iterator[Tuple[str, Any]]], None], path=None):
from hearthstone_data import get_carddefs_path

if path is None:
Expand All @@ -433,7 +433,7 @@ def _load(path, locale, cache, attr):
if cache_key not in cache:
db = {}

def parse(context: Iterator[tuple[str, Any]]):
def parse(context: Iterator[Tuple[str, Any]]):
nonlocal db
root = None
for action, elem in context:
Expand Down
6 changes: 3 additions & 3 deletions hearthstone/mercenaryxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def to_xml(self):
XML_URL = "https://api.hearthstonejson.com/v1/latest/MercenaryDefs.xml"


def _bootstrap_from_web(parse: Callable[[Iterator[tuple[str, Any]]], None]):
def _bootstrap_from_web(parse: Callable[[Iterator[Tuple[str, Any]]], None]):
with tempfile.TemporaryFile(mode="rb+") as fp:
if download_to_tempfile_retry(XML_URL, fp):
fp.flush()
Expand All @@ -200,7 +200,7 @@ def _bootstrap_from_web(parse: Callable[[Iterator[tuple[str, Any]]], None]):
parse(ElementTree.iterparse(fp, events=("start", "end",)))


def _bootstrap_from_library(parse: Callable[[Iterator[tuple[str, Any]]], None], path=None):
def _bootstrap_from_library(parse: Callable[[Iterator[Tuple[str, Any]]], None], path=None):
from hearthstone_data import get_mercenarydefs_path

if path is None:
Expand All @@ -215,7 +215,7 @@ def load(path=None, locale="enUS"):
if cache_key not in mercenary_cache:
db = {}

def parse(context: Iterator[tuple[str, Any]]):
def parse(context: Iterator[Tuple[str, Any]]):
nonlocal db
root = None
for action, elem in context:
Expand Down

0 comments on commit 9e0bc72

Please sign in to comment.