@@ -61,7 +61,7 @@ def _check(error: int) -> int:
6161 return error
6262
6363
64- def _check_p (pointer : T ) -> T :
64+ def _check_p [ T ] (pointer : T ) -> T :
6565 """Treats NULL pointers as errors and raises a libtcod exception."""
6666 if not pointer :
6767 _raise_tcod_error ()
@@ -94,13 +94,13 @@ def _int(int_or_str: SupportsInt | str | bytes) -> int:
9494 return int (int_or_str )
9595
9696
97- def _bytes (string : AnyStr ) -> bytes :
97+ def _bytes (string : AnyStr ) -> bytes : # noqa: UP047
9898 if isinstance (string , str ):
9999 return string .encode ("utf-8" )
100100 return string
101101
102102
103- def _unicode (string : AnyStr , stacklevel : int = 2 ) -> str :
103+ def _unicode (string : AnyStr , stacklevel : int = 2 ) -> str : # noqa: UP047
104104 if isinstance (string , bytes ):
105105 warnings .warn (
106106 "Passing byte strings as parameters to Unicode functions is deprecated." ,
@@ -129,8 +129,7 @@ def _path_encode(path: Path) -> bytes:
129129 try :
130130 return str (path ).encode (locale .getlocale ()[1 ] or "utf-8" ) # Stay classy, Windows
131131 except UnicodeEncodeError as exc :
132- if sys .version_info >= (3 , 11 ):
133- exc .add_note ("""Consider calling 'locale.setlocale(locale.LC_CTYPES, ".UTF8")' to support Unicode paths.""" )
132+ exc .add_note ("""Consider calling 'locale.setlocale(locale.LC_CTYPES, ".UTF8")' to support Unicode paths.""" )
134133 raise
135134
136135
0 commit comments