We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FURB111
asyncio.get_running_loop()
master
import asyncio from pydantic import BaseModel, Field class Foo(BaseModel): start_time: float = Field( default_factory=lambda: asyncio.get_running_loop().time() )
This code with refurb will want to be Field(default_factory=asyncio.get_running_loop().time) per FURB111.
refurb
Field(default_factory=asyncio.get_running_loop().time)
The issue is that asyncio.get_running_loop can throw RuntimeError: no running event loop depending on when it's invoked.
asyncio.get_running_loop
RuntimeError: no running event loop
So the bug report is that if asyncio.get_running_loop is part of a factory, perhaps FURB111 should not be raised.
Refurb: v2.0.0 Mypy: v1.10.0
Python 3.12.3
# N/A
None
The text was updated successfully, but these errors were encountered:
dosisod
No branches or pull requests
Has your issue already been fixed?
master
branch? See the docs for instructions on how to setup a local build of Refurb.The Bug
This code with
refurb
will want to beField(default_factory=asyncio.get_running_loop().time)
perFURB111
.The issue is that
asyncio.get_running_loop
can throwRuntimeError: no running event loop
depending on when it's invoked.So the bug report is that if
asyncio.get_running_loop
is part of a factory, perhapsFURB111
should not be raised.Version Info
Python Version
Python 3.12.3
Config File
# N/A
Extra Info
None
The text was updated successfully, but these errors were encountered: