Get a metadata by account, container and filepath Parameters ---------- account : str The account name. container : str The container name. filepath : str The filepath Returns ------- Metadata The Sigmf metadata.
(account, container, filepath, access_allowed=Depends(check_access))
| 22 | |
| 23 | |
| 24 | async def get(account, container, filepath, access_allowed=Depends(check_access)) -> Metadata | None: |
| 25 | """ |
| 26 | Get a metadata by account, container and filepath |
| 27 | |
| 28 | Parameters |
| 29 | ---------- |
| 30 | account : str |
| 31 | The account name. |
| 32 | container : str |
| 33 | The container name. |
| 34 | filepath : str |
| 35 | The filepath |
| 36 | |
| 37 | Returns |
| 38 | ------- |
| 39 | Metadata |
| 40 | The Sigmf metadata. |
| 41 | """ |
| 42 | if access_allowed is None: |
| 43 | return None |
| 44 | |
| 45 | metadata_collection: AgnosticCollection = collection() |
| 46 | metadata = await metadata_collection.find_one( |
| 47 | { |
| 48 | "global.traceability:origin.account": account, |
| 49 | "global.traceability:origin.container": container, |
| 50 | "global.traceability:origin.file_path": filepath, |
| 51 | } |
| 52 | ) |
| 53 | if not metadata: |
| 54 | return None |
| 55 | return Metadata(**metadata) |
| 56 | |
| 57 | |
| 58 | async def exists(account, container, filepath, access_allowed=Depends(check_access)) -> bool: |
nothing calls this directly
no test coverage detected