Skip to content

Commit 99e174e

Browse files
Merge pull request #87 from mgineer85/master
fix deprecation warning + some lint errors
2 parents 1b782b3 + 3c3758c commit 99e174e

File tree

8 files changed

+108
-6
lines changed

8 files changed

+108
-6
lines changed

examples/video/v4l2py-ctl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def show_control_status(device: str) -> None:
4141
print(f"\n{control_class.name.decode().title()}\n")
4242

4343
for ctrl in controls:
44-
print("0x%08x:" % ctrl.id, ctrl)
44+
print(f"0x{ctrl.id:08x}:", ctrl)
4545
if isinstance(ctrl, MenuControl):
4646
for key, value in ctrl.items():
4747
print(11 * " ", f" +-- {key}: {value}")
@@ -92,7 +92,7 @@ def set_controls(device: str, controls: list, clipping: bool) -> None:
9292
else:
9393
success = True
9494

95-
result = "%-5s" % ("OK" if success else "ERROR")
95+
result = "{:<5}".format("OK" if success else "ERROR")
9696

9797
if success:
9898
print(f"{result} {control}: {value_old} -> {value_new}\n")
@@ -118,7 +118,7 @@ def reset_controls(device: str, controls: list) -> None:
118118
else:
119119
success = True
120120

121-
result = "%-5s" % ("OK" if success else "ERROR")
121+
result = "{:<5}".format("OK" if success else "ERROR")
122122

123123
if success:
124124
print(f"{result} {control} reset to {ctrl.default}\n")

linuxpy/gpio/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def parse_config_lines(lines: Union[Collection, int]) -> list[dict]:
236236
lines = [lines]
237237
if isinstance(lines, dict):
238238
return [{**cfg, "line": line} for line, cfg in lines.items()]
239-
if isinstance(lines, (list, tuple)):
239+
if isinstance(lines, list | tuple):
240240
return [parse_config_line(line) for line in lines]
241241
raise TypeError("lines must be an int, a sequence of int or dict or dict")
242242

linuxpy/gpio/raw.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class gpiohandle_config(Struct):
195195

196196
class gpiohandle_data(Struct):
197197
_pack_ = True
198+
_layout_ = "ms"
198199

199200

200201
gpiohandle_data._fields_ = [("values", cchar * 64)]

linuxpy/midi/raw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,15 @@ class snd_timer_id(Struct):
222222

223223
class snd_seq_addr(Struct):
224224
_pack_ = True
225+
_layout_ = "ms"
225226

226227

227228
snd_seq_addr._fields_ = [("client", u8), ("port", u8)]
228229

229230

230231
class snd_seq_connect(Struct):
231232
_pack_ = True
233+
_layout_ = "ms"
232234

233235

234236
snd_seq_connect._fields_ = [("sender", snd_seq_addr), ("dest", snd_seq_addr)]
@@ -263,6 +265,7 @@ class snd_seq_ev_ctrl(Struct):
263265

264266
class snd_seq_ev_raw8(Struct):
265267
_pack_ = True
268+
_layout_ = "ms"
266269

267270

268271
snd_seq_ev_raw8._fields_ = [("d", cchar * 12)]
@@ -277,6 +280,7 @@ class snd_seq_ev_raw32(Struct):
277280

278281
class snd_seq_ev_ext(Struct):
279282
_pack_ = True
283+
_layout_ = "ms"
280284

281285

282286
snd_seq_ev_ext._fields_ = [("len", cuint), ("ptr", cvoidp)]
@@ -326,6 +330,7 @@ class M1(Union):
326330

327331
class snd_seq_ev_quote(Struct):
328332
_pack_ = True
333+
_layout_ = "ms"
329334

330335

331336
class snd_seq_event(Struct):
@@ -391,6 +396,7 @@ class snd_seq_system_info(Struct):
391396

392397
class snd_seq_running_info(Struct):
393398
_pack_ = True
399+
_layout_ = "ms"
394400

395401

396402
snd_seq_running_info._fields_ = [

linuxpy/statfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Flag(enum.IntFlag):
8585

8686

8787
def get_statfs_raw(path) -> statfs:
88-
if not isinstance(path, (bytes, ccharp)):
88+
if not isinstance(path, bytes | ccharp):
8989
path = str(path).encode()
9090
result = statfs()
9191
c.statfs(path, pointer(result))

0 commit comments

Comments
 (0)