Coverage for laskea/laskea.py: 73.33%
33 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-10 22:19:18 +00:00
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-10 22:19:18 +00:00
1"""Calculate (Finnish: laskea) some parts."""
2import sys
3from typing import Mapping, Sequence
5from atlassian import Jira # type: ignore # noqa
6from cogapp import Cog, CogUsageError # type: ignore
8import laskea
9import laskea.config as cfg
12def process(command: str, transaction_mode: str, paths: Sequence[str], options: Mapping[str, bool]) -> int:
13 """Drive the lookup."""
15 if command != 'update' or not paths:
16 print('Usage: laskea update [--help] [-v] [-c config-path] [-n] [-i] source-files*md [other.md]')
17 sys.exit(2)
19 quiet = bool(options.get('quiet', ''))
20 verbose = bool(options.get('verbose', ''))
21 checksums = bool(options.get('checksums', ''))
23 vector = [laskea.APP_ALIAS, '-P']
24 if checksums: 24 ↛ 25line 24 didn't jump to line 25, because the condition on line 24 was never true
25 vector.append('-c')
26 vector.extend(
27 [
28 f'--markers={laskea.BASE_MARKERS}',
29 '-p',
30 'from laskea import *',
31 ]
32 )
33 if transaction_mode == 'commit': 33 ↛ 35line 33 didn't jump to line 35, because the condition on line 33 was never false
34 vector.append('-r')
35 if quiet: 35 ↛ 36line 35 didn't jump to line 36, because the condition on line 35 was never true
36 vector.append('--verbosity=0')
38 cog = Cog()
40 if laskea.DEBUG or verbose: 40 ↛ 41line 40 didn't jump to line 41, because the condition on line 40 was never true
41 cfg.report_context(command, transaction_mode, vector)
43 for path in paths: 43 ↛ 51line 43 didn't jump to line 51, because the loop on line 43 didn't complete
44 single_vector = vector + [path]
45 try:
46 cog.callableMain(single_vector)
47 except CogUsageError as err:
48 print('CodeGen processing usage error:', file=sys.stderr)
49 print(str(err))
50 return 1
51 return 0