infra: rm unused # noqa violations (#22049)

Updating #21137
This commit is contained in:
Bagatur
2024-05-22 15:21:08 -07:00
committed by GitHub
parent 45ed5f3f51
commit 50186da0a1
149 changed files with 212 additions and 214 deletions

View File

@@ -6,7 +6,7 @@ a language model is used as a reasoning engine to determine which actions
to take and in which order.
Agents select and use **Tools** and **Toolkits** for actions.
""" # noqa: E501
"""
from langchain_experimental.agents.agent_toolkits import (
create_csv_agent,
create_pandas_dataframe_agent,

View File

@@ -220,7 +220,7 @@ def create_pandas_dataframe_agent(
verbose=True
)
""" # noqa: E501
"""
try:
if engine == "modin":
import modin.pandas as pd

View File

@@ -149,7 +149,7 @@ class Llama2Chat(ChatWrapper):
class Mixtral(ChatWrapper):
"""See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format""" # noqa: E501
"""See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format"""
@property
def _llm_type(self) -> str:

View File

@@ -88,7 +88,7 @@ class BashProcess:
Args:
Prompt(str): the bash command to execute
""" # noqa: E501
"""
pexpect = self._lazy_import_pexpect()
process = pexpect.spawn(
"env", ["-i", "bash", "--norc", "--noprofile"], encoding="utf-8"
@@ -107,7 +107,7 @@ class BashProcess:
Args:
commands(List[str]): a list of commands to
execute in the session
""" # noqa: E501
"""
if isinstance(commands, str):
commands = [commands]
commands = ";".join(commands)
@@ -125,7 +125,7 @@ class BashProcess:
Args:
command: The command to run
""" # noqa: E501
"""
try:
output = subprocess.run(
command,
@@ -149,7 +149,7 @@ class BashProcess:
Args:
output: a process' output string
command: the executed command
""" # noqa: E501
"""
pattern = re.escape(command) + r"\s*\n"
output = re.sub(pattern, "", output, count=1)
return output.strip()
@@ -161,7 +161,7 @@ class BashProcess:
Args:
command: the command to execute
""" # noqa: E501
"""
pexpect = self._lazy_import_pexpect()
if self.process is None:
raise ValueError("Process not initialized")

View File

@@ -3,7 +3,7 @@
See the paper: https://arxiv.org/pdf/2211.10435.pdf.
This chain is vulnerable to [arbitrary code execution](https://github.com/langchain-ai/langchain/issues/5872).
""" # noqa: E501
"""
from langchain_experimental.pal_chain.base import PALChain
__all__ = ["PALChain"]

View File

@@ -3,7 +3,7 @@
[Amazon Personalize](https://docs.aws.amazon.com/personalize/latest/dg/what-is-personalize.html)
is a fully managed machine learning service that uses your data to generate
item recommendations for your users.
""" # noqa: E501
"""
from langchain_experimental.recommenders.amazon_personalize import AmazonPersonalize
from langchain_experimental.recommenders.amazon_personalize_chain import (
AmazonPersonalizeChain,

View File

@@ -475,7 +475,7 @@ class RLChain(Chain, Generic[TEvent]):
def save_progress(self) -> None:
"""
This function should be called to save the state of the learned policy model.
""" # noqa: E501
"""
self.active_policy.save()
def _validate_inputs(self, inputs: Dict[str, Any]) -> None:

View File

@@ -25,7 +25,7 @@ def test_prompt(model: Mixtral) -> None:
actual = model.invoke(messages).content # type: ignore
expected = (
"<s>[INST] sys-msg\nusr-msg-1 [/INST] ai-msg-1 </s> [INST] usr-msg-2 [/INST]" # noqa: E501
"<s>[INST] sys-msg\nusr-msg-1 [/INST] ai-msg-1 </s> [INST] usr-msg-2 [/INST]"
)
assert actual == expected

View File

@@ -78,7 +78,7 @@ string = "racecar"
if string == string[::-1]:
print(string, "is a palindrome") # noqa: T201
else:
print(string, "is not a palindrome")""" # noqa: T201
print(string, "is not a palindrome")"""
tool = PythonAstREPLTool()
assert tool.run(program) == "racecar is a palindrome\n"