mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-23 11:30:37 +00:00
cli: Add ruff rule UP (pyupgrade) (#31843)
See https://docs.astral.sh/ruff/rules/#pyupgrade-up All auto-fixed Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
committed by
GitHub
parent
cd7dce687a
commit
b8e9b4adfc
@@ -1,5 +1,5 @@
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional, Set, TypedDict
|
||||
from typing import Any, Optional, TypedDict
|
||||
|
||||
from tomlkit import load
|
||||
|
||||
@@ -7,7 +7,7 @@ from tomlkit import load
|
||||
def get_package_root(cwd: Optional[Path] = None) -> Path:
|
||||
# traverse path for routes to host (any directory holding a pyproject.toml file)
|
||||
package_root = Path.cwd() if cwd is None else cwd
|
||||
visited: Set[Path] = set()
|
||||
visited: set[Path] = set()
|
||||
while package_root not in visited:
|
||||
visited.add(package_root)
|
||||
|
||||
@@ -35,7 +35,7 @@ class LangServeExport(TypedDict):
|
||||
|
||||
def get_langserve_export(filepath: Path) -> LangServeExport:
|
||||
with open(filepath) as f:
|
||||
data: Dict[str, Any] = load(f)
|
||||
data: dict[str, Any] = load(f)
|
||||
try:
|
||||
module = data["tool"]["langserve"]["export_module"]
|
||||
attr = data["tool"]["langserve"]["export_attr"]
|
||||
|
Reference in New Issue
Block a user