Upload n8n-sync.py with huggingface_hub
Browse files- n8n-sync.py +4 -4
n8n-sync.py
CHANGED
|
@@ -64,7 +64,7 @@ def metadata_marker(root: Path) -> tuple[int, int, int]:
|
|
| 64 |
if not path.is_file():
|
| 65 |
continue
|
| 66 |
rel = path.relative_to(root).as_posix()
|
| 67 |
-
if rel.startswith(".cache/"):
|
| 68 |
continue
|
| 69 |
try:
|
| 70 |
stat = path.stat()
|
|
@@ -113,7 +113,7 @@ def fingerprint_dir(root: Path) -> str:
|
|
| 113 |
|
| 114 |
for path in sorted(p for p in root.rglob("*") if p.is_file()):
|
| 115 |
rel = path.relative_to(root).as_posix()
|
| 116 |
-
if rel.startswith(".cache/"):
|
| 117 |
continue
|
| 118 |
hasher.update(rel.encode("utf-8"))
|
| 119 |
with path.open("rb") as handle:
|
|
@@ -129,7 +129,7 @@ def create_snapshot_dir(source_root: Path) -> Path:
|
|
| 129 |
for path in sorted(source_root.rglob("*")):
|
| 130 |
rel = path.relative_to(source_root)
|
| 131 |
rel_posix = rel.as_posix()
|
| 132 |
-
if rel_posix.startswith(".cache/"):
|
| 133 |
continue
|
| 134 |
target = staging_root / rel
|
| 135 |
if path.is_dir():
|
|
@@ -247,7 +247,7 @@ def sync_once(
|
|
| 247 |
repo_type="dataset",
|
| 248 |
token=HF_TOKEN,
|
| 249 |
commit_message=f"Hugging8n sync {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())}",
|
| 250 |
-
ignore_patterns=[".cache/*"],
|
| 251 |
)
|
| 252 |
finally:
|
| 253 |
shutil.rmtree(snapshot_dir, ignore_errors=True)
|
|
|
|
| 64 |
if not path.is_file():
|
| 65 |
continue
|
| 66 |
rel = path.relative_to(root).as_posix()
|
| 67 |
+
if rel.startswith(".cache/") or rel.startswith(".n8n/") or rel == ".n8n":
|
| 68 |
continue
|
| 69 |
try:
|
| 70 |
stat = path.stat()
|
|
|
|
| 113 |
|
| 114 |
for path in sorted(p for p in root.rglob("*") if p.is_file()):
|
| 115 |
rel = path.relative_to(root).as_posix()
|
| 116 |
+
if rel.startswith(".cache/") or rel.startswith(".n8n/") or rel == ".n8n":
|
| 117 |
continue
|
| 118 |
hasher.update(rel.encode("utf-8"))
|
| 119 |
with path.open("rb") as handle:
|
|
|
|
| 129 |
for path in sorted(source_root.rglob("*")):
|
| 130 |
rel = path.relative_to(source_root)
|
| 131 |
rel_posix = rel.as_posix()
|
| 132 |
+
if rel_posix.startswith(".cache/") or rel_posix.startswith(".n8n/") or rel_posix == ".n8n":
|
| 133 |
continue
|
| 134 |
target = staging_root / rel
|
| 135 |
if path.is_dir():
|
|
|
|
| 247 |
repo_type="dataset",
|
| 248 |
token=HF_TOKEN,
|
| 249 |
commit_message=f"Hugging8n sync {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())}",
|
| 250 |
+
ignore_patterns=[".cache/*", ".n8n/*"],
|
| 251 |
)
|
| 252 |
finally:
|
| 253 |
shutil.rmtree(snapshot_dir, ignore_errors=True)
|