fix: improve TOML error handing and docs for Windows paths (#31)

* fix: improve TOML error handing and documentation for Windows paths

* build(linting): pash ruff v2.0.260
This commit is contained in:
Nathaniel Landau
2023-03-30 10:33:51 -04:00
committed by GitHub
parent 5a4643ea8f
commit 4df10e785e
8 changed files with 42 additions and 29 deletions

View File

@@ -319,7 +319,7 @@ class Vault:
return num_changed
def export_metadata(self, path: str, export_format: str = "csv") -> None:
def export_metadata(self, path: str, export_format: str = "csv") -> None: # noqa: C901
"""Write metadata to a csv file.
Args:
@@ -333,7 +333,7 @@ class Vault:
match export_format:
case "csv":
with export_file.open(mode="w", encoding="UTF8") as f:
with export_file.open(mode="w", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["Metadata Type", "Key", "Value"])
@@ -361,7 +361,7 @@ class Vault:
"tags": self.metadata.tags,
}
with export_file.open(mode="w", encoding="UTF8") as f:
with export_file.open(mode="w", encoding="utf-8") as f:
json.dump(dict_to_dump, f, indent=4, ensure_ascii=False, sort_keys=True)
def export_notes_to_csv(self, path: str) -> None:
@@ -375,7 +375,7 @@ class Vault:
alerts.error(f"Path does not exist: {export_file.parent}")
raise typer.Exit(code=1)
with export_file.open(mode="w", encoding="UTF8") as f:
with export_file.open(mode="w", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["path", "type", "key", "value"])