Skip to content

Commit 06cd021

Browse files
Apply ruff rule RUF046
RUF046 Value being cast to `int` is already an integer
1 parent d80f363 commit 06cd021

6 files changed

Lines changed: 19 additions & 9 deletions

File tree

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@ def finalize_options(self):
119119
import Cython
120120
except ImportError:
121121
raise RuntimeError(
122-
f'please install {CYTHON_DEPENDENCY} to compile uvloop from source')
122+
f'please install {CYTHON_DEPENDENCY} to compile uvloop '
123+
'from source'
124+
)
123125

124126
cython_dep = Requirement(CYTHON_DEPENDENCY)
125127
if not cython_dep.specifier.contains(Cython.__version__):
126128
raise RuntimeError(
127-
f'uvloop requires {CYTHON_DEPENDENCY}, got Cython=={Cython.__version__}')
129+
f'uvloop requires {CYTHON_DEPENDENCY}, '
130+
f'got Cython=={Cython.__version__}'
131+
)
128132

129133
from Cython.Build import cythonize
130134

tests/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ def cb():
215215

216216
for i in range(8):
217217
self.loop.call_later(0.06 + 0.01, cb) # 0.06999999999999999
218-
started = int(round(self.loop.time() * 1000))
218+
started = round(self.loop.time() * 1000)
219219
self.loop.run_forever()
220-
finished = int(round(self.loop.time() * 1000))
220+
finished = round(self.loop.time() * 1000)
221221
self.assertGreaterEqual(finished - started, 69)
222222

223223
def test_call_at(self):

tests/test_context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def get_buffer(self, sizehint):
6161
if self.buffered_ctx is None:
6262
self.buffered_ctx = self.cvar.get()
6363
elif self.cvar.get() != self.buffered_ctx:
64-
self.data_received_fut.set_exception(ValueError(f"{self.buffered_ctx} != {self.cvar.get()}"))
64+
self.data_received_fut.set_exception(
65+
ValueError(f"{self.buffered_ctx} != {self.cvar.get()}")
66+
)
6567
return bytearray(65536)
6668

6769
def buffer_updated(self, nbytes):

tests/test_executors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def run_pool_test(self, pool_factory):
1818
async def run():
1919
pool = pool_factory()
2020
with pool:
21-
coros = [self.loop.run_in_executor(pool, fib, i) for i in range(10)]
21+
coros = [
22+
self.loop.run_in_executor(pool, fib, i)
23+
for i in range(10)
24+
]
2225
res = await asyncio.gather(*coros)
2326
self.assertEqual(res, fib10)
2427
await asyncio.sleep(0.01)

uvloop/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ def get_event_loop(self) -> _AbstractEventLoop:
204204
"""
205205
if self._local._loop is None:
206206
raise RuntimeError(
207-
f'There is no current event loop in thread {threading.current_thread().name!r}.'
207+
'There is no current event loop in '
208+
f'thread {threading.current_thread().name!r}.'
208209
)
209210

210211
return self._local._loop

uvloop/_testbase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def __new__(mcls, name, bases, dct):
5252
for base in bases:
5353
if hasattr(base, test_name):
5454
raise RuntimeError(
55-
f'duplicate test {name}.{test_name} (also defined in {base.__name__} '
56-
'parent class)')
55+
f'duplicate test {name}.{test_name} (also defined in '
56+
f'{base.__name__} parent class)')
5757

5858
return super().__new__(mcls, name, bases, dict(dct))
5959

0 commit comments

Comments
 (0)