Skip to content

Commit 884f53b

Browse files
committed
chore: ruff linkn
ignore some ruff complaints replace func(l) as parameter with func(size) use is rather than == for type comparisons.
1 parent f30e6f9 commit 884f53b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

roundup/anypy/random_.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: ARG001
12
try:
23
from secrets import choice, randbelow, token_bytes
34

@@ -20,6 +21,7 @@ def seed(v=None):
2021
# don't completely throw away the existing state, but add some
2122
# more random state to the existing state
2223
def seed(v=None):
24+
# ruff: noqa: PLC0415
2325
import os
2426
import time
2527
_r.seed((_r.getstate(),
@@ -39,9 +41,9 @@ def randbelow(i):
3941
return _r.randint(0, i - 1)
4042

4143
if hasattr(_os, 'urandom'):
42-
def token_bytes(l):
43-
return _os.urandom(l)
44+
def token_bytes(size):
45+
return _os.urandom(size)
4446
else:
45-
def token_bytes(l):
46-
_bchr = chr if str == bytes else lambda x: bytes((x,))
47-
return b''.join([_bchr(_r.getrandbits(8)) for i in range(l)])
47+
def token_bytes(size):
48+
_bchr = chr if str is bytes else lambda x: bytes((x,))
49+
return b''.join([_bchr(_r.getrandbits(8)) for i in range(size)])

0 commit comments

Comments
 (0)