mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 19:09:57 +00:00
ruff: more rules across the board & fixes (#31898)
* standardizes ruff dep version across all `pyproject.toml` files * cli: ruff rules and corrections * langchain: rules and corrections
This commit is contained in:
@@ -20,7 +20,7 @@ def create_events(events: list[EventDict]) -> Optional[Any]:
|
||||
"properties": event.get("properties"),
|
||||
}
|
||||
for event in events
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
conn = http.client.HTTPSConnection("app.firstpartyhq.com")
|
||||
|
@@ -122,7 +122,9 @@ def parse_dependencies(
|
||||
api_path: list[str],
|
||||
) -> list[DependencySource]:
|
||||
num_deps = max(
|
||||
len(dependencies) if dependencies is not None else 0, len(repo), len(branch)
|
||||
len(dependencies) if dependencies is not None else 0,
|
||||
len(repo),
|
||||
len(branch),
|
||||
)
|
||||
if (
|
||||
(dependencies and len(dependencies) != num_deps)
|
||||
@@ -143,7 +145,10 @@ def parse_dependencies(
|
||||
return [
|
||||
parse_dependency_string(iter_dep, iter_repo, iter_branch, iter_api_path)
|
||||
for iter_dep, iter_repo, iter_branch, iter_api_path in zip(
|
||||
inner_deps, inner_repos, inner_branches, inner_api_paths
|
||||
inner_deps,
|
||||
inner_repos,
|
||||
inner_branches,
|
||||
inner_api_paths,
|
||||
)
|
||||
]
|
||||
|
||||
@@ -186,7 +191,7 @@ def copy_repo(
|
||||
source: Path,
|
||||
destination: Path,
|
||||
) -> None:
|
||||
"""Copies a repo, ignoring git folders.
|
||||
"""Copiy a repo, ignoring git folders.
|
||||
|
||||
Raises FileNotFound error if it can't find source
|
||||
"""
|
||||
|
@@ -13,7 +13,9 @@ def list_packages(*, contains: Optional[str] = None):
|
||||
}
|
||||
|
||||
conn.request(
|
||||
"GET", "/repos/langchain-ai/langchain/contents/templates", headers=headers
|
||||
"GET",
|
||||
"/repos/langchain-ai/langchain/contents/templates",
|
||||
headers=headers,
|
||||
)
|
||||
res = conn.getresponse()
|
||||
|
||||
|
@@ -26,6 +26,7 @@ class LangServeExport(TypedDict):
|
||||
module: The module to import from, tool.langserve.export_module
|
||||
attr: The attribute to import from the module, tool.langserve.export_attr
|
||||
package_name: The name of the package, tool.poetry.name
|
||||
|
||||
"""
|
||||
|
||||
module: str
|
||||
|
@@ -14,7 +14,8 @@ def _get_dep_inline_table(path: Path) -> InlineTable:
|
||||
|
||||
|
||||
def add_dependencies_to_pyproject_toml(
|
||||
pyproject_toml: Path, local_editable_dependencies: Iterable[tuple[str, Path]]
|
||||
pyproject_toml: Path,
|
||||
local_editable_dependencies: Iterable[tuple[str, Path]],
|
||||
) -> None:
|
||||
"""Add dependencies to pyproject.toml."""
|
||||
with open(pyproject_toml, encoding="utf-8") as f:
|
||||
@@ -24,14 +25,15 @@ def add_dependencies_to_pyproject_toml(
|
||||
{
|
||||
name: _get_dep_inline_table(loc.relative_to(pyproject_toml.parent))
|
||||
for name, loc in local_editable_dependencies
|
||||
}
|
||||
},
|
||||
)
|
||||
with open(pyproject_toml, "w", encoding="utf-8") as f:
|
||||
dump(pyproject, f)
|
||||
|
||||
|
||||
def remove_dependencies_from_pyproject_toml(
|
||||
pyproject_toml: Path, local_editable_dependencies: Iterable[str]
|
||||
pyproject_toml: Path,
|
||||
local_editable_dependencies: Iterable[str],
|
||||
) -> None:
|
||||
"""Remove dependencies from pyproject.toml."""
|
||||
with open(pyproject_toml, encoding="utf-8") as f:
|
||||
|
Reference in New Issue
Block a user