mirror of
https://github.com/hwchase17/langchain.git
synced 2025-11-02 17:16:34 +00:00
committed by
GitHub
parent
451c90fefa
commit
a46a2b8bda
@@ -1,12 +1,11 @@
|
||||
def split_package(package: str) -> tuple[str, str]:
|
||||
"""Split a package name into the containing package and the final name"""
|
||||
"""Split a package name into the containing package and the final name."""
|
||||
parts = package.split(".")
|
||||
return ".".join(parts[:-1]), parts[-1]
|
||||
|
||||
|
||||
def dump_migrations_as_grit(name: str, migration_pairs: list[tuple[str, str]]):
|
||||
def dump_migrations_as_grit(name: str, migration_pairs: list[tuple[str, str]]) -> str:
|
||||
"""Dump the migration pairs as a Grit file."""
|
||||
output = "language python"
|
||||
remapped = ",\n".join(
|
||||
[
|
||||
f"""
|
||||
@@ -21,7 +20,7 @@ def dump_migrations_as_grit(name: str, migration_pairs: list[tuple[str, str]]):
|
||||
]
|
||||
)
|
||||
pattern_name = f"langchain_migrate_{name}"
|
||||
output = f"""
|
||||
return f"""
|
||||
language python
|
||||
|
||||
// This migration is generated automatically - do not manually edit this file
|
||||
@@ -34,4 +33,3 @@ pattern {pattern_name}() {{
|
||||
// Add this for invoking directly
|
||||
{pattern_name}()
|
||||
"""
|
||||
return output
|
||||
|
||||
Reference in New Issue
Block a user