Skip to content

Commit c314bfe

Browse files
authored
Merge pull request #194 from Andrene/upstream
fstrings and fix deprecation of logger.warn
2 parents 4d39959 + 56169d8 commit c314bfe

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

sc2reader/factories/plugins/replay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def SelectionTracker(replay):
211211
if error:
212212
person.selection_errors += 1
213213
if debug:
214-
logger.warn(
215-
"Error detected in deselection mode {}.".format(event.mask_type)
214+
logger.warning(
215+
f"Error detected in deselection mode {event.mask_type}."
216216
)
217217

218218
person.selection = player_selections

sc2reader/log_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def createLock(self):
3333
LEVEL_MAP = dict(
3434
DEBUG=logging.DEBUG,
3535
INFO=logging.INFO,
36-
WARN=logging.WARN,
36+
WARN=logging.WARNING,
3737
ERROR=logging.ERROR,
3838
CRITICAL=logging.CRITICAL,
3939
)

sc2reader/objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def __init__(self, contents):
562562
data = ByteDecoder(contents, endian="LITTLE")
563563
magic = data.read_string(4)
564564
if magic != "MapI":
565-
self.logger.warn(f"Invalid MapInfo file: {magic}")
565+
self.logger.warning(f"Invalid MapInfo file: {magic}")
566566
return
567567

568568
#: The map info file format version
@@ -773,7 +773,7 @@ def __init__(self, contents):
773773
self.enemy_flags = data.read_uint(int(math.ceil(self.enemy_flags_length / 8.0)))
774774

775775
if data.length != data.tell():
776-
self.logger.warn("Not all of the MapInfo file was read!")
776+
self.logger.warning("Not all of the MapInfo file was read!")
777777

778778
def __str__(self):
779779
return self.map_name

sc2reader/resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def get_team(team_id):
552552
if team.result == "Win":
553553
self.winner = team
554554
else:
555-
self.logger.warn(
555+
self.logger.warning(
556556
f"Conflicting results for Team {team.number}: {results}"
557557
)
558558
team.result = "Unknown"
@@ -1336,7 +1336,7 @@ def load_player_stats(self):
13361336
)
13371337
)
13381338
elif stat_id != 83886080: # We know this one is always bad.
1339-
self.logger.warn(f"Untranslatable key = {stat_id}")
1339+
self.logger.warning(f"Untranslatable key = {stat_id}")
13401340

13411341
# Once we've compiled all the build commands we need to make
13421342
# sure they are properly sorted for presentation.

sc2reader/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Color:
6565
def __init__(self, name=None, r=0, g=0, b=0, a=255):
6666
if name:
6767
if name not in COLOR_CODES_INV:
68-
self.logger.warn("Invalid color name: " + name)
68+
self.logger.warning(f"Invalid color name: {name}")
6969
hexstr = COLOR_CODES_INV.get(name, "000000")
7070
self.r = int(hexstr[0:2], 16)
7171
self.g = int(hexstr[2:4], 16)
@@ -78,7 +78,7 @@ def __init__(self, name=None, r=0, g=0, b=0, a=255):
7878
self.b = b
7979
self.a = a
8080
if self.hex not in COLOR_CODES:
81-
self.logger.warn("Invalid color hex value: " + self.hex)
81+
self.logger.warning(f"Invalid color hex value: {self.hex}")
8282
self.name = COLOR_CODES.get(self.hex, self.hex)
8383

8484
@property

0 commit comments

Comments
 (0)