fss-cli 0.11.0__py3-none-any.whl

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.
fss_cli/__init__.py ADDED
@@ -0,0 +1,24 @@
1
+ """Library-only POSIX-shaped commands for async fsspec filesystems."""
2
+
3
+ import logging
4
+
5
+ from ._app import (
6
+ App,
7
+ AppCapabilities,
8
+ AsyncFilesystemSource,
9
+ CommandCallback,
10
+ CommandContext,
11
+ RecursionCapabilities,
12
+ )
13
+
14
+ # Library default: records reach only the handlers a host configures.
15
+ logging.getLogger(__name__).addHandler(logging.NullHandler())
16
+
17
+ __all__ = [
18
+ "App",
19
+ "AppCapabilities",
20
+ "AsyncFilesystemSource",
21
+ "CommandCallback",
22
+ "CommandContext",
23
+ "RecursionCapabilities",
24
+ ]
fss_cli/_accounts.py ADDED
@@ -0,0 +1,29 @@
1
+ """Best-effort POSIX identity display shared by listing and stat."""
2
+
3
+ try:
4
+ import grp
5
+ import pwd
6
+
7
+ _HAS_ACCOUNT_DB = True
8
+ except ImportError: # pragma: no cover - POSIX-only account databases.
9
+ _HAS_ACCOUNT_DB = False
10
+
11
+
12
+ def owner_name(uid: int) -> str:
13
+ """Resolve ``uid`` to a local ``pwd`` account name, numeric when unavailable."""
14
+ if not _HAS_ACCOUNT_DB:
15
+ return str(uid)
16
+ try:
17
+ return pwd.getpwuid(uid).pw_name
18
+ except (KeyError, OverflowError, OSError):
19
+ return str(uid)
20
+
21
+
22
+ def group_name(gid: int) -> str:
23
+ """Resolve ``gid`` to a local ``grp`` account name, numeric when unavailable."""
24
+ if not _HAS_ACCOUNT_DB:
25
+ return str(gid)
26
+ try:
27
+ return grp.getgrgid(gid).gr_name
28
+ except (KeyError, OverflowError, OSError):
29
+ return str(gid)