MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / exists

Function exists

api/database/metadata_repo.py:58–88  ·  view source on GitHub ↗

Check if a metadata exists by account, container and filepath Parameters ---------- account : str The account name. container : str The container name. filepath : str The filepath Returns ------- bool True if the metadata exists,

(account, container, filepath, access_allowed=Depends(check_access))

Source from the content-addressed store, hash-verified

56
57
58async def exists(account, container, filepath, access_allowed=Depends(check_access)) -> bool:
59 """
60 Check if a metadata exists by account, container and filepath
61
62 Parameters
63 ----------
64 account : str
65 The account name.
66 container : str
67 The container name.
68 filepath : str
69 The filepath
70
71 Returns
72 -------
73 bool
74 True if the metadata exists, False otherwise.
75 """
76 if access_allowed is None:
77 return False
78
79 metadata_collection: AgnosticCollection = collection()
80 metadata = await metadata_collection.find_one(
81 {
82 "global.traceability:origin.account": account,
83 "global.traceability:origin.container": container,
84 "global.traceability:origin.file_path": filepath,
85 },
86 {"_id": 1},
87 )
88 return metadata is not None
89
90
91async def create(metadata: Metadata):

Callers 1

createFunction · 0.70

Calls 1

collectionFunction · 0.70

Tested by

no test coverage detected