ositah 24.4.dev1__py3-none-any.whl → 24.7.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {ositah-24.4.dev1.dist-info → ositah-24.7.dev1.dist-info}/METADATA +1 -1
  2. ositah-24.7.dev1.dist-info/RECORD +6 -0
  3. {ositah-24.4.dev1.dist-info → ositah-24.7.dev1.dist-info}/WHEEL +1 -1
  4. ositah/__init__.py +0 -0
  5. ositah/app.py +0 -17
  6. ositah/apps/__init__.py +0 -0
  7. ositah/apps/analysis.py +0 -774
  8. ositah/apps/configuration/__init__.py +0 -0
  9. ositah/apps/configuration/callbacks.py +0 -917
  10. ositah/apps/configuration/main.py +0 -542
  11. ositah/apps/configuration/parameters.py +0 -74
  12. ositah/apps/configuration/tools.py +0 -112
  13. ositah/apps/export.py +0 -1172
  14. ositah/apps/validation/__init__.py +0 -0
  15. ositah/apps/validation/callbacks.py +0 -240
  16. ositah/apps/validation/main.py +0 -89
  17. ositah/apps/validation/parameters.py +0 -25
  18. ositah/apps/validation/tables.py +0 -654
  19. ositah/apps/validation/tools.py +0 -533
  20. ositah/assets/arrow_down_up.svg +0 -4
  21. ositah/assets/ositah.css +0 -54
  22. ositah/assets/sort_ascending.svg +0 -5
  23. ositah/assets/sort_descending.svg +0 -6
  24. ositah/assets/sorttable.js +0 -499
  25. ositah/main.py +0 -449
  26. ositah/ositah.example.cfg +0 -215
  27. ositah/static/style.css +0 -54
  28. ositah/templates/base.html +0 -22
  29. ositah/templates/bootstrap_login.html +0 -38
  30. ositah/templates/login_form.html +0 -27
  31. ositah/utils/__init__.py +0 -0
  32. ositah/utils/agents.py +0 -117
  33. ositah/utils/authentication.py +0 -287
  34. ositah/utils/cache.py +0 -19
  35. ositah/utils/core.py +0 -13
  36. ositah/utils/exceptions.py +0 -64
  37. ositah/utils/hito_db.py +0 -51
  38. ositah/utils/hito_db_model.py +0 -245
  39. ositah/utils/menus.py +0 -339
  40. ositah/utils/period.py +0 -135
  41. ositah/utils/projects.py +0 -1175
  42. ositah/utils/teams.py +0 -42
  43. ositah/utils/utils.py +0 -459
  44. ositah-24.4.dev1.dist-info/RECORD +0 -46
  45. {ositah-24.4.dev1.dist-info → ositah-24.7.dev1.dist-info}/LICENSE +0 -0
  46. {ositah-24.4.dev1.dist-info → ositah-24.7.dev1.dist-info}/entry_points.txt +0 -0
  47. {ositah-24.4.dev1.dist-info → ositah-24.7.dev1.dist-info}/top_level.txt +0 -0
ositah/utils/period.py DELETED
@@ -1,135 +0,0 @@
1
- # Module providing functions related to declaration period
2
-
3
- from datetime import datetime
4
- from typing import List
5
-
6
- from ositah.utils.exceptions import ValidationPeriodAmbiguous, ValidationPeriodMissing
7
-
8
-
9
- class OSITAHDeclarationPeriod:
10
- def __init__(self, name: str, start_date: str, end_date: str, validation_date: str):
11
- self._name = name
12
- self._start_date = start_date
13
- self._end_date = end_date
14
- self._validation_date = validation_date
15
-
16
- @property
17
- def name(self):
18
- return self._name
19
-
20
- @property
21
- def dates(self):
22
- return self.start_date, self.end_date
23
-
24
- @property
25
- def label(self):
26
- return f"{self.name} ({' au '.join(self.dates)})"
27
-
28
- @property
29
- def end_date(self):
30
- return self._end_date
31
-
32
- @property
33
- def start_date(self):
34
- return self._start_date
35
-
36
- @property
37
- def validation_date(self):
38
- return self._validation_date
39
-
40
-
41
- def get_validation_period_data(period_date: str):
42
- """
43
- Return the current declaration period object.
44
-
45
- :param period_date: a date that must be inside the declaration period
46
- :return: declaration period object (OSITAHValidationPeriod)
47
- """
48
-
49
- from ositah.utils.hito_db_model import OSITAHValidationPeriod
50
-
51
- selection_date = datetime.fromisoformat(period_date)
52
- period_id = OSITAHValidationPeriod.query.filter(
53
- OSITAHValidationPeriod.start_date <= selection_date,
54
- OSITAHValidationPeriod.end_date >= selection_date,
55
- ).all()
56
- if len(period_id) == 1:
57
- return period_id[0]
58
- elif len(period_id) > 1:
59
- raise ValidationPeriodAmbiguous(selection_date)
60
- else:
61
- raise ValidationPeriodMissing(selection_date)
62
-
63
-
64
- def get_validation_period_dates(period_date: str):
65
- """
66
- Return the start and end date of the current declaration period.
67
-
68
- :param period_date: a date that must be inside the declaration period
69
- :return: UUID
70
- """
71
-
72
- validation_period = get_validation_period_data(period_date)
73
- return validation_period.start_date, validation_period.end_date
74
-
75
-
76
- def get_validation_period_id(period_date: str):
77
- """
78
- Return the current declaration period ID.
79
-
80
- :param period_date: a date that must be inside the declaration period
81
- :return: UUID
82
- """
83
-
84
- return get_validation_period_data(period_date).id
85
-
86
-
87
- def get_declaration_periods(descending: bool = True) -> List[OSITAHDeclarationPeriod]:
88
- """
89
- Return a list of declaration period name and dates, sorted by start date in descending order.
90
- Dates are strings, without the time information.
91
-
92
- :param descending: if True, sort in descending order (default), else in ascending order
93
- :return: list of OSITAHDeclarationPeriod
94
- """
95
-
96
- from ositah.utils.hito_db_model import OSITAHValidationPeriod
97
-
98
- periods = []
99
-
100
- periods_data = OSITAHValidationPeriod.query.order_by(
101
- OSITAHValidationPeriod.start_date.desc()
102
- if descending
103
- else OSITAHValidationPeriod.start_date.asc()
104
- ).all()
105
-
106
- for row in periods_data:
107
- periods.append(
108
- OSITAHDeclarationPeriod(
109
- row.name,
110
- row.start_date.date().isoformat(),
111
- row.end_date.date().isoformat(),
112
- row.validation_date.date().isoformat(),
113
- )
114
- )
115
-
116
- return periods
117
-
118
-
119
- def get_default_period_date(periods: List[OSITAHDeclarationPeriod], date: datetime.date):
120
- """
121
- Return the start date of the default period. The default period is selected by passing a date
122
- that must be between period start and end dates (included).
123
-
124
- :param periods: period list
125
- :param date: date that must be inside the period (string)
126
- :return: period start date (string) or None if not found
127
- """
128
-
129
- period_date = date.isoformat()
130
-
131
- for p in periods:
132
- if period_date >= p.start_date and period_date <= p.end_date:
133
- return p.start_date
134
-
135
- return None