memorysync-cli 1.2.0__tar.gz → 1.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/PKG-INFO +1 -1
  2. memorysync_cli-1.2.1/src/memorysync_cli/_version.py +1 -0
  3. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/commands/memory.py +28 -2
  4. memorysync_cli-1.2.0/src/memorysync_cli/_version.py +0 -1
  5. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/.gitignore +0 -0
  6. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/LICENSE +0 -0
  7. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/README.md +0 -0
  8. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/pyproject.toml +0 -0
  9. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/__init__.py +0 -0
  10. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/__main__.py +0 -0
  11. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/args.py +0 -0
  12. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/commands/__init__.py +0 -0
  13. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/commands/admin.py +0 -0
  14. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/commands/init.py +0 -0
  15. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/commands/source.py +0 -0
  16. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/commands/tooling.py +0 -0
  17. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/completions.py +0 -0
  18. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/config.py +0 -0
  19. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/credentials.py +0 -0
  20. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/errors.py +0 -0
  21. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/evaluation.py +0 -0
  22. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/http.py +0 -0
  23. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/main.py +0 -0
  24. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/output.py +0 -0
  25. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/registry.json +0 -0
  26. {memorysync_cli-1.2.0 → memorysync_cli-1.2.1}/src/memorysync_cli/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: memorysync-cli
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: MemorySync from your terminal. Zero dependencies.
5
5
  Project-URL: Documentation, https://docs.memorysync.io/cli
6
6
  Project-URL: Homepage, https://memorysync.io/cli
@@ -0,0 +1 @@
1
+ __version__ = "1.2.1"
@@ -505,7 +505,9 @@ def import_memories(ctx: dict) -> dict:
505
505
  try:
506
506
  raw = Path(source_path).read_text(encoding="utf-8")
507
507
  except OSError as error:
508
- raise usage_error(f"Could not read {source_path}: {error}") from None
508
+ raise usage_error(
509
+ f"Could not read {source_path}: {_describe_read_failure(error)}"
510
+ ) from None
509
511
 
510
512
  records: list[dict] = []
511
513
  errors: list[str] = []
@@ -691,6 +693,27 @@ def import_memories(ctx: dict) -> dict:
691
693
  SERVER_BULK_MAX = 50
692
694
 
693
695
 
696
+ def _describe_read_failure(error: OSError) -> str:
697
+ """Why a file could not be read, worded identically to the Node CLI.
698
+
699
+ ``str(error)`` cannot be used directly: Python says
700
+ ``[Errno 2] No such file or directory: 'relative'`` and Node says
701
+ ``ENOENT: no such file or directory, open 'C:\\abs\\path'`` — different
702
+ wording, different casing, and Node leaks an absolute path the user did not
703
+ type. The two packages are published as interchangeable, so the common cases
704
+ are named here and the rest fall back to a sentence neither runtime supplies.
705
+ """
706
+ import errno
707
+
708
+ if isinstance(error, IsADirectoryError) or error.errno == errno.EISDIR:
709
+ return "that is a directory, not a file."
710
+ if isinstance(error, PermissionError) or error.errno in {errno.EACCES, errno.EPERM}:
711
+ return "permission denied."
712
+ if isinstance(error, FileNotFoundError) or error.errno == errno.ENOENT:
713
+ return "no such file or directory."
714
+ return "the file could not be opened."
715
+
716
+
694
717
  def _resolve_batch_size(flags: dict) -> int:
695
718
  """Effective batch size for this run.
696
719
 
@@ -708,9 +731,12 @@ def _resolve_batch_size(flags: dict) -> int:
708
731
  except (TypeError, ValueError):
709
732
  value = 0
710
733
  if value < 1:
734
+ # Quoted by hand rather than with ``!r``. ``repr`` gives single quotes and
735
+ # the Node CLI's idiom gives double ones, and the two are published as
736
+ # interchangeable.
711
737
  raise usage_error(
712
738
  "--batch-size must be a whole number of at least 1.",
713
- f"Got {requested!r}. The server accepts at most "
739
+ f'Got "{requested}". The server accepts at most '
714
740
  f"{SERVER_BULK_MAX} records per request.",
715
741
  )
716
742
  return min(value, SERVER_BULK_MAX)
@@ -1 +0,0 @@
1
- __version__ = "1.2.0"
File without changes
File without changes