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

Function get_code_file_by_code

apps/base/views.py:200–211  ·  view source on GitHub ↗
(
    code: str, check: bool = True
)

Source from the content-addressed store, hash-verified

198
199
200async def get_code_file_by_code(
201 code: str, check: bool = True
202) -> Tuple[bool, Union[FileCodes, str]]:
203 normalized_code = normalize_share_code(code)
204 if not normalized_code:
205 return False, "文件不存在"
206 file_code = await FileCodes.filter(code=normalized_code).first()
207 if not file_code:
208 return False, "文件不存在"
209 if await file_code.is_expired() and check:
210 return False, "文件已过期"
211 return True, file_code
212
213
214async def update_file_usage(file_code: FileCodes) -> None:

Callers 5

get_file_metadataFunction · 0.85
post_file_metadataFunction · 0.85
get_code_fileFunction · 0.85
select_fileFunction · 0.85
download_fileFunction · 0.85

Calls 4

normalize_share_codeFunction · 0.85
firstMethod · 0.45
filterMethod · 0.45
is_expiredMethod · 0.45

Tested by

no test coverage detected