-
Notifications
You must be signed in to change notification settings - Fork 17.7k
core: Add ruff rules SLF #30666
New issue
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
core: Add ruff rules SLF #30666
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@@ -350,8 +350,8 @@ def _should_stream( | |||
**kwargs: Any, | |||
) -> bool: | |||
"""Determine if a given model call should hit the streaming API.""" | |||
sync_not_implemented = type(self)._stream == BaseChatModel._stream | |||
async_not_implemented = type(self)._astream == BaseChatModel._astream | |||
sync_not_implemented = type(self)._stream == BaseChatModel._stream # noqa: SLF001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -49,8 +49,8 @@ def log_error_once(method: str, exception: Exception) -> None: | |||
|
|||
def wait_for_all_tracers() -> None: | |||
"""Wait for all tracers to finish.""" | |||
if rt._CLIENT is not None: | |||
rt._CLIENT.flush() | |||
if rt._CLIENT is not None: # noqa: SLF001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably something to fix in LangSmith regarding the visibility of the cached client.
Maybe add a def cached_client_exists() -> bool
method ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this would make sense.
7ef9664
to
566457b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just a few nit picks. Thanks so much!
if rt._CLIENT is not None: | ||
rt._CLIENT.flush() | ||
if rt._CLIENT is not None: # noqa: SLF001 | ||
get_client().flush() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is just a ruff rules PR, can we keep the logic as is and implement logical changes in a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: see #30912
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#30912 has been merged and this PR has been rebased.
class _EdgeViewer: | ||
def __init__(self) -> None: | ||
self.pts: list[tuple[float]] = [] | ||
|
||
def setpath(self, pts: list[tuple[float]]) -> None: | ||
self.pts = pts | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as below - happy to implement a logical change here, but let's not do it in a PR where we're just adding a ruff rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#30912 has been merged and this PR has been rebased.
See #30666 --------- Co-authored-by: Eugene Yurtsev <[email protected]>
@sydney-runkle the PR now only adds |
@@ -123,8 +123,8 @@ def _start_trace(self, run: Run) -> None: | |||
run.tags = self.tags.copy() | |||
|
|||
super()._start_trace(run) | |||
if run._client is None: | |||
run._client = self.client # type: ignore[misc] | |||
if run.ls_client is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this breaks with current constraints on the langsmith client. ls_client was available as of 0.1.126. Bumping the requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a PR to update the min constraint and updated the uv lock file
Add ruff rules SLF: https://docs.astral.sh/ruff/rules/#flake8-self-slf