Coverage for archdocs/settings.py: 100%

20 statements  

« prev     ^ index     » next       coverage.py v7.15.3, created at 2026-08-03 00:00 +0000

1import pathlib 

2import re as py_re 

3import typing 

4 

5 

6FILES_SEARCH_PATTERN: typing.Final = "*.py" 

7# A virtual environment is somebody else's code: the sources of uvicorn, redis and celery 

8# themselves match the very patterns the service is scanned for, and land on the diagram as 

9# its architecture. The walk matches these names relative to the project root rather than to 

10# the filesystem root, otherwise a service living in a `build` directory would skip itself. 

11SKIPPED_DIR_NAMES: typing.Final = frozenset( 

12 ( 

13 ".git", 

14 ".venv", 

15 ".tox", 

16 ".nox", 

17 ".mypy_cache", 

18 ".ruff_cache", 

19 ".pytest_cache", 

20 ".eggs", 

21 "venv", 

22 "node_modules", 

23 "__pycache__", 

24 "site-packages", 

25 "build", 

26 "dist", 

27 ), 

28) 

29MAX_WORKERS: typing.Final = 10 

30SHIFT_LEFT: typing.Final = " " * 4 

31VALUE_FOR_MASS_CONNECTIONS_ILLUSTRATION: typing.Final = 3 

32EXTERNAL_CLIENT_TITLE_FOR_SCHEMA: typing.Final = "User/Client" 

33EXTERNAL_CLIENT_NODE_ID: typing.Final = "external_client" 

34EXTERNAL_API_TITLE_FOR_SCHEMA: typing.Final = "External API" 

35EXTERNAL_API_NODE_ID: typing.Final = "External_API" 

36DIAGRAM_HEADER: typing.Final = "graph TB" 

37FALLBACK_SERVICE_NODE_ID: typing.Final = "archdocs_service" 

38TYPICAL_RE_FLAGS: typing.Final = py_re.IGNORECASE | py_re.MULTILINE | py_re.UNICODE | py_re.DOTALL 

39DEFAULT_PATH: typing.Final = "/docs/architecture/" 

40DEFAULT_ROOT_DIR: typing.Final = pathlib.Path() 

41DEFAULT_SERVICE_NAME: typing.Final = "example-service" 

42UI_PLACEHOLDER_PATTER: typing.Final = py_re.compile( 

43 r"(?P<pre_open><pre[^>]*>)(?P<pre_body>.*?)(?P<pre_close></pre>)", 

44 flags=TYPICAL_RE_FLAGS, 

45) 

46UI_HTML_TEMPLATE: typing.Final = " ".join( 

47 pathlib.Path(__file__).parent.joinpath("template.html").read_text().strip().split(), 

48)