Coverage for graphqler / utils / cli_utils.py: 36%
11 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-20 10:09 -0400
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-20 10:09 -0400
1from graphqler import config
2from pathlib import Path
5def set_auth_token_constant(auth_argument: str) -> None:
6 """Sets the constants for auth token argument.
7 If it has a space, it will be used as is, otherwise it will be prepended with "Bearer "
9 Args:
10 auth_token (str): The auth token argument
11 """
12 if len(auth_argument.split(" ")) >= 2:
13 config.AUTHORIZATION = auth_argument
14 else:
15 config.AUTHORIZATION = f"Bearer {auth_argument}"
18def is_compiled(path: str | Path) -> bool:
19 """Checks if the compiled directory exists
21 Args:
22 path (str): The path to the compiled directory
24 Returns:
25 bool: True if the compiled directory exists, False otherwise
26 """
27 if path is None:
28 return False
29 path = Path(path)
30 return (
31 (path / config.COMPILED_DIR_NAME).exists()
32 and (path / config.COMPILED_OBJECTS_FILE_NAME).exists()
33 and (path / config.COMPILED_QUERIES_FILE_NAME).exists()
34 and (path / config.COMPILED_MUTATIONS_FILE_NAME).exists()
35 and (path / config.INTROSPECTION_RESULT_FILE_NAME).exists()
36 )