Coverage for laskea/__init__.py: 100.00%

34 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-08-17 13:24:57 +00:00

1"""Calculate (Finnish: laskea) some parts.""" 

2import os 

3import pathlib 

4 

5# [[[fill git_describe()]]] 

6__version__ = '2023.7.20+parent.g8bf4f662' 

7# [[[end]]] (checksum: c1f0dbc200580a462e0e8b732a2ab333) 

8__version_info__ = tuple( 

9 e if '-' not in e else e.split('-')[0] for part in __version__.split('+') for e in part.split('.') if e != 'parent' 

10) 

11 

12APP_ALIAS = str(pathlib.Path(__file__).parent.name) 

13APP_ENV: str = APP_ALIAS.upper() 

14APP_NAME = locals()['__doc__'] 

15DEBUG = bool(os.getenv(f'{APP_ENV}_DEBUG', '')) 

16VERBOSE = bool(os.getenv(f'{APP_ENV}_VERBOSE', '')) 

17QUIET = False 

18STRICT = bool(os.getenv(f'{APP_ENV}_STRICT', '')) 

19ENCODING = 'utf-8' 

20ENCODING_ERRORS_POLICY = 'ignore' 

21DEFAULT_CONFIG_NAME = f'.{APP_ALIAS}.json' 

22 

23CACHE_EXPIRY_SECONDS = int(os.getenv(f'{APP_ENV}_CACHE_EXPIRY_SECONDS', '180')) 

24REQUESTS_TIMEOUT_SECS = 30 

25 

26FIELD_SEPARATORS = ( 

27 CARET := '^', 

28 COLON := ':', 

29 COMMA := ',', 

30 DASH := '-', 

31 DOT := '.', 

32 PIPE := '|', 

33 PLUS := '+', 

34 RS := '\x1e', 

35 SEMI := ';', 

36 SPACE := ' ', 

37 TAB := '\t', 

38 USCORE := '_', 

39) 

40FS_SLUG = '$FIELD_SEPARATOR$' 

41 

42DRY_RUN = False 

43OPEN_BRACKET = '[' 

44CLOSE_BRACKET = ']' 

45DEFAULT_MARKERS = f'{OPEN_BRACKET * 3}fill {CLOSE_BRACKET * 3} {OPEN_BRACKET * 3}end{CLOSE_BRACKET * 3}' 

46DEFAULT_LF_ONLY = 'YES' 

47DEFAULT_JOIN_STRING = ' <br>' 

48BASE_MARKERS = os.getenv(f'{APP_ENV}_MARKERS', DEFAULT_MARKERS) 

49BASE_LF_ONLY = bool(os.getenv(f'{APP_ENV}_LF_ONLY', DEFAULT_LF_ONLY)) 

50BASE_JOIN_STRING = os.getenv(f'{APP_ENV}_JOIN_STRING', DEFAULT_JOIN_STRING) 

51MASK_DISPLAY = '*' * 13 

52EXCEL = {'mbom': 'mbom.xlsm'} 

53TABULATOR = { 

54 'overview': { 

55 'base_url': 'https://example.com/metrics/', 

56 'path': '$year$/kpi-table-$year$.json', 

57 'years': [2022], 

58 'matrix': [ 

59 ['section', 'Section', False, 'L'], 

60 ['name', 'Name', False, 'L'], 

61 ['unit', 'Unit', False, 'C'], 

62 ['all', 'ALL', True, 'R'], 

63 ['pr1', 'PR1', True, 'R'], 

64 ['pr2', 'PR2', True, 'R'], 

65 ['pr3', 'PR3', True, 'R'], 

66 ['description', 'Description', False, 'L'], 

67 ], 

68 'verify_server_certificate': False, 

69 }, 

70 'metrics': { 

71 'base_url': 'https://example.com/metrics/', 

72 'paths': { 

73 'review_effectivity': '$year$/review_effectivity/kpi-review_effectivity-per_product-report-$year$.json', 

74 'sprint_effectivity': '$year$/sprint_effectivity/kpi-sprint_effectivity-per_product-report-$year$.json', 

75 'task_traceability': '$year$/task_traceability/kpi-task_traceability-per_product-report-$year$.json', 

76 }, 

77 'years': [2021, 2022], 

78 'matrix': [ 

79 ['month', 'Month', False, 'L'], 

80 ['all', 'ALL', True, 'R'], 

81 ['pr1', 'PR1', True, 'R'], 

82 ['pr2', 'PR2', True, 'R'], 

83 ['pr3', 'PR3', True, 'R'], 

84 ['trend_all', '±ALL', True, 'R'], 

85 ['trend_pr1', '±PR1', True, 'R'], 

86 ['trend_pr2', '±PR2', True, 'R'], 

87 ['trend_pr3', '±PR3', True, 'R'], 

88 ], 

89 'verify_server_certificate': False, 

90 }, 

91} 

92 

93from laskea.api.excel import mbom_table # noqa 

94from laskea.api.jira import ( # noqa 

95 login, 

96 markdown_heading, 

97 markdown_list, 

98 markdown_table, 

99 parent_children_sections, 

100 query, 

101 separated_values_list, 

102) 

103from laskea.embed import ( # noqa 

104 dl, 

105 h1, 

106 h2, 

107 h3, 

108 h4, 

109 h5, 

110 h6, 

111 kpi_table, 

112 mbom_table, 

113 metrics_table, 

114 ol, 

115 svl, 

116 table, 

117 test_plans, 

118 ul, 

119) 

120 

121__all__ = [ 

122 'REQUESTS_TIMEOUT_SECS', 

123 'h1', 

124 'h2', 

125 'h3', 

126 'h4', 

127 'h5', 

128 'h6', 

129 'dl', 

130 'login', 

131 'markdown_heading', 

132 'markdown_table', 

133 'markdown_list', 

134 'query', 

135 'ol', 

136 'svl', 

137 'table', 

138 'ul', 

139 'kpi_table', 

140 'mbom_table', 

141 'metrics_table', 

142 'parent_children_sections', 

143 'test_plans', 

144]