Skip to content

Commit

Permalink
Merge pull request #194 from Andrene/upstream
Browse files Browse the repository at this point in the history
fstrings and fix deprecation of logger.warn
  • Loading branch information
StoicLoofah authored Sep 23, 2023
2 parents 4d39959 + 56169d8 commit c314bfe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions sc2reader/factories/plugins/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def SelectionTracker(replay):
if error:
person.selection_errors += 1
if debug:
logger.warn(
"Error detected in deselection mode {}.".format(event.mask_type)
logger.warning(
f"Error detected in deselection mode {event.mask_type}."
)

person.selection = player_selections
Expand Down
2 changes: 1 addition & 1 deletion sc2reader/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def createLock(self):
LEVEL_MAP = dict(
DEBUG=logging.DEBUG,
INFO=logging.INFO,
WARN=logging.WARN,
WARN=logging.WARNING,
ERROR=logging.ERROR,
CRITICAL=logging.CRITICAL,
)
Expand Down
4 changes: 2 additions & 2 deletions sc2reader/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def __init__(self, contents):
data = ByteDecoder(contents, endian="LITTLE")
magic = data.read_string(4)
if magic != "MapI":
self.logger.warn(f"Invalid MapInfo file: {magic}")
self.logger.warning(f"Invalid MapInfo file: {magic}")
return

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

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

def __str__(self):
return self.map_name
4 changes: 2 additions & 2 deletions sc2reader/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def get_team(team_id):
if team.result == "Win":
self.winner = team
else:
self.logger.warn(
self.logger.warning(
f"Conflicting results for Team {team.number}: {results}"
)
team.result = "Unknown"
Expand Down Expand Up @@ -1336,7 +1336,7 @@ def load_player_stats(self):
)
)
elif stat_id != 83886080: # We know this one is always bad.
self.logger.warn(f"Untranslatable key = {stat_id}")
self.logger.warning(f"Untranslatable key = {stat_id}")

# Once we've compiled all the build commands we need to make
# sure they are properly sorted for presentation.
Expand Down
4 changes: 2 additions & 2 deletions sc2reader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Color:
def __init__(self, name=None, r=0, g=0, b=0, a=255):
if name:
if name not in COLOR_CODES_INV:
self.logger.warn("Invalid color name: " + name)
self.logger.warning(f"Invalid color name: {name}")
hexstr = COLOR_CODES_INV.get(name, "000000")
self.r = int(hexstr[0:2], 16)
self.g = int(hexstr[2:4], 16)
Expand All @@ -78,7 +78,7 @@ def __init__(self, name=None, r=0, g=0, b=0, a=255):
self.b = b
self.a = a
if self.hex not in COLOR_CODES:
self.logger.warn("Invalid color hex value: " + self.hex)
self.logger.warning(f"Invalid color hex value: {self.hex}")
self.name = COLOR_CODES.get(self.hex, self.hex)

@property
Expand Down

0 comments on commit c314bfe

Please sign in to comment.