radiens-data-catalog 0.1.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.
@@ -0,0 +1,27 @@
1
+ """
2
+ radiens-data-catalog
3
+ ---------------------
4
+ Programmatic catalog and sync tool for xdat neural recordings stored on
5
+ Google Drive. Recordings are uniquely identified by (drive_path, base_name)
6
+ and queryable by drive_path and/or base_name, each via exact match, prefix,
7
+ or substring (see :data:`MatchMode`).
8
+ """
9
+
10
+ from .catalog import Catalog, MatchMode, PrefetchResult, ScanResult, match_series
11
+ from .config import Config
12
+ from .drive import DriveItemEntry, RecordingEntry
13
+ from .exceptions import AmbiguousRecordingError, CatalogError, EntryNotFoundError
14
+
15
+ __all__ = [
16
+ "AmbiguousRecordingError",
17
+ "Catalog",
18
+ "CatalogError",
19
+ "Config",
20
+ "DriveItemEntry",
21
+ "EntryNotFoundError",
22
+ "MatchMode",
23
+ "PrefetchResult",
24
+ "RecordingEntry",
25
+ "ScanResult",
26
+ "match_series",
27
+ ]
@@ -0,0 +1,30 @@
1
+ """
2
+ auth.py
3
+ -------
4
+ Service account authentication for the Google Drive API.
5
+ """
6
+
7
+ from google.oauth2 import service_account
8
+ from googleapiclient.discovery import build
9
+
10
+ from .drive import DriveService
11
+
12
+ SCOPES: list[str] = ["https://www.googleapis.com/auth/drive.readonly"]
13
+
14
+
15
+ def build_drive_service(credentials_path: str) -> DriveService:
16
+ """Build an authenticated Google Drive API service client.
17
+
18
+ Uses a service account credentials file for authentication. The Drive
19
+ folders you want to access must be shared with the service account email
20
+ found in the credentials JSON.
21
+
22
+ Args:
23
+ credentials_path: Path to the Google service account credentials JSON
24
+ file.
25
+
26
+ Returns:
27
+ An authenticated Drive API service object (read-only scope).
28
+ """
29
+ creds = service_account.Credentials.from_service_account_file(credentials_path, scopes=SCOPES)
30
+ return build("drive", "v3", credentials=creds)