MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / _match_admin_file

Method _match_admin_file

apps/admin/services.py:1339–1370  ·  view source on GitHub ↗
(
        self,
        item: dict[str, Any],
        keyword: str,
        status: str,
        file_type: str,
        health: str,
    )

Source from the content-addressed store, hash-verified

1337 return value
1338
1339 def _match_admin_file(
1340 self,
1341 item: dict[str, Any],
1342 keyword: str,
1343 status: str,
1344 file_type: str,
1345 health: str,
1346 ) -> bool:
1347 if status == "active" and item["isExpired"]:
1348 return False
1349 if status == "expired" and not item["isExpired"]:
1350 return False
1351 if file_type == "text" and not item["isText"]:
1352 return False
1353 if file_type == "file" and item["isText"]:
1354 return False
1355 if file_type == "chunked" and not item["isChunked"]:
1356 return False
1357 if not self._match_admin_file_health(item, health):
1358 return False
1359 if not keyword:
1360 return True
1361
1362 search_values = [
1363 item.get("code"),
1364 item.get("name"),
1365 item.get("prefix"),
1366 item.get("suffix"),
1367 item.get("fileHash"),
1368 item.get("text"),
1369 ]
1370 return any(keyword in str(value).lower() for value in search_values if value)
1371
1372 def _match_admin_file_health(self, item: dict[str, Any], health: str) -> bool:
1373 if not health or health == "all":

Callers 1

list_filesMethod · 0.95

Calls 1

Tested by

no test coverage detected