changeset 764:d18c0bf11138

Python: Use logger.warning() as logger.warn() is deprecated
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 26 Aug 2022 18:55:39 +0200
parents 468dab1dd683
children 2a5279168d5a
files pytouhou/formats/anm0.py pytouhou/formats/ecl.py pytouhou/formats/msg.py pytouhou/formats/pbg3.py pytouhou/formats/std.py pytouhou/network.py pytouhou/resource/loader.py pytouhou/ui/music.pyx pytouhou/vm/eclrunner.py pytouhou/vm/msgrunner.py
diffstat 10 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/formats/anm0.py
+++ b/pytouhou/formats/anm0.py
@@ -188,7 +188,7 @@ class ANM0(Animation):
                         args = unpack('<%s' % instructions[opcode][0], data)
                     else:
                         args = (data,)
-                        logger.warn('unknown opcode %d', opcode)
+                        logger.warning('unknown opcode %d', opcode)
 
                     self.scripts[i].append((time, opcode, args))
                     if version == 0 and opcode == 0:
--- a/pytouhou/formats/ecl.py
+++ b/pytouhou/formats/ecl.py
@@ -215,7 +215,7 @@ class ECL:
                         args = args[:-1] + (args[-1].decode('shift_jis'),)
                 else:
                     args = (data, )
-                    logger.warn('unknown opcode %d', opcode)
+                    logger.warning('unknown opcode %d', opcode)
 
                 ecl.subs[-1].append((time, opcode, rank_mask, param_mask, args))
 
@@ -252,7 +252,7 @@ class ECL:
                     args = unpack('<%s' % cls._main_instructions[opcode][0], data)
                 else:
                     args = (data,)
-                    logger.warn('unknown main opcode %d', opcode)
+                    logger.warning('unknown main opcode %d', opcode)
 
                 ecl.mains[-1].append((time, sub, opcode, args))
 
--- a/pytouhou/formats/msg.py
+++ b/pytouhou/formats/msg.py
@@ -70,7 +70,7 @@ class MSG:
                         args = args[:-1] + (args[-1].decode('shift_jis'),)
                 else:
                     args = (data, )
-                    logger.warn('unknown msg opcode %d', opcode)
+                    logger.warning('unknown msg opcode %d', opcode)
 
                 msg.msgs[i].append((time, opcode, args))
 
--- a/pytouhou/formats/pbg3.py
+++ b/pytouhou/formats/pbg3.py
@@ -151,5 +151,5 @@ class PBG3:
                 value += c
                 value &= 0xFFFFFFFF
             if value != checksum:
-                logger.warn('corrupted data!')
+                logger.warning('corrupted data!')
         return BytesIO(data)
--- a/pytouhou/formats/std.py
+++ b/pytouhou/formats/std.py
@@ -143,7 +143,7 @@ class Stage:
                 args = unpack('<%s' % cls._instructions[opcode][0], data)
             else:
                 args = (data,)
-                logger.warn('unknown opcode %d', opcode)
+                logger.warning('unknown opcode %d', opcode)
             stage.script.append((frame, opcode, args))
 
         return stage
--- a/pytouhou/network.py
+++ b/pytouhou/network.py
@@ -88,6 +88,6 @@ class Network:
                     raise Exception #TODO
                 self.run_game_iter(game, self.keystate, self.remote_keystate)
             elif game.frame > 2:
-                logger.warn('Message not received in time, dropping frame.')
+                logger.warning('Message not received in time, dropping frame.')
 
 
--- a/pytouhou/resource/loader.py
+++ b/pytouhou/resource/loader.py
@@ -128,7 +128,7 @@ class Loader:
 
     def get_anm(self, name):
         if name in self.loaded_anms:
-            logger.warn('ANM0 %s already loaded', name)
+            logger.warning('ANM0 %s already loaded', name)
         file = self.get_file(name)
         anm = ANM0.read(file)
         self.instanced_anms[name] = anm
--- a/pytouhou/ui/music.pyx
+++ b/pytouhou/ui/music.pyx
@@ -37,7 +37,7 @@ cdef class BGMPlayer(MusicPlayer):
                 track = resource_loader.get_track(posname)
             except KeyError:
                 track = None
-                logger.warn('Music description “%s” not found, continuing without looping data.', posname)
+                logger.warning('Music description “%s” not found, continuing without looping data.', posname)
             globname = join(resource_loader.game_dir, bgm[1]).replace('.mid', '.*')
             filenames = glob(globname)
             for filename in reversed(filenames):
@@ -54,7 +54,7 @@ cdef class BGMPlayer(MusicPlayer):
                     break
             else:
                 self.bgms.append(None)
-                logger.warn('No working music file for “%s”, disabling bgm.', globname)
+                logger.warning('No working music file for “%s”, disabling bgm.', globname)
 
     cpdef play(self, index):
         cdef Music bgm
@@ -89,7 +89,7 @@ cdef class SFXPlayer(MusicPlayer):
                 wave_file = self.loader.get_file(name)
                 chunk = load_chunk(wave_file)
             except (KeyError, sdl.SDLError) as error:
-                logger.warn('Sound “%s” not found: %s', name, error)
+                logger.warning('Sound “%s” not found: %s', name, error)
                 chunk = None
             else:
                 chunk.set_volume(self.volume)
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -1096,7 +1096,7 @@ class ECLRunner(metaclass=MetaRegistry):
                 self.variables[6] = self._game.prng.rand_double() * (self._game.width - 64.) + 32.
                 self.variables[7] = self._game.prng.rand_double() * (self._game.width / 2. - 64.) + 32.
         else:
-            logger.warn("Unimplemented special function %d!", function)
+            logger.warning("Unimplemented special function %d!", function)
 
 
     @instruction(123)
--- a/pytouhou/vm/msgrunner.py
+++ b/pytouhou/vm/msgrunner.py
@@ -60,7 +60,7 @@ class MSGRunner(metaclass=MetaRegistry):
                 try:
                     callback = self.handlers[instr_type]
                 except KeyError:
-                    logger.warn('unhandled msg opcode %d (args: %r)', instr_type, args)
+                    logger.warning('unhandled msg opcode %d (args: %r)', instr_type, args)
                 else:
                     callback(self, *args)