clear-skies-cortex 2.0.2__py3-none-any.whl → 2.0.3__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.
- {clear_skies_cortex-2.0.2.dist-info → clear_skies_cortex-2.0.3.dist-info}/METADATA +2 -2
- {clear_skies_cortex-2.0.2.dist-info → clear_skies_cortex-2.0.3.dist-info}/RECORD +6 -6
- clearskies_cortex/backends/cortex_backend.py +4 -3
- clearskies_cortex/backends/cortex_team_relationship_backend.py +20 -13
- {clear_skies_cortex-2.0.2.dist-info → clear_skies_cortex-2.0.3.dist-info}/WHEEL +0 -0
- {clear_skies_cortex-2.0.2.dist-info → clear_skies_cortex-2.0.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clear-skies-cortex
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: Cortex module for Clearskies
|
|
5
5
|
Project-URL: Docs, https://https://clearskies.info/modules/clear-skies-cortex
|
|
6
6
|
Project-URL: Repository, https://github.com/clearskies-py/cortex
|
|
@@ -14,7 +14,7 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Requires-Python: <4.0,>=3.11
|
|
17
|
-
Requires-Dist: clear-skies<3.0.0,>=2.0.
|
|
17
|
+
Requires-Dist: clear-skies<3.0.0,>=2.0.37
|
|
18
18
|
Requires-Dist: dacite>=1.9.2
|
|
19
19
|
Provides-Extra: dev
|
|
20
20
|
Requires-Dist: types-requests>=2.32.4; extra == 'dev'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
clearskies_cortex/__init__.py,sha256=SwFkNfKLJgcq2qE6YJ_78_JfeoRGojlKuR_3DymZZSQ,142
|
|
2
2
|
clearskies_cortex/dataclasses.py,sha256=rmSwJkMPwyfQltHuGzRRn9OrwMXKHajkG1jA39ix9lU,1446
|
|
3
3
|
clearskies_cortex/backends/__init__.py,sha256=Ek74kpJLE7ERY-6yhH2KwFO25gm3Yjz51laUApnhgnU,179
|
|
4
|
-
clearskies_cortex/backends/cortex_backend.py,sha256=
|
|
5
|
-
clearskies_cortex/backends/cortex_team_relationship_backend.py,sha256=
|
|
4
|
+
clearskies_cortex/backends/cortex_backend.py,sha256=kmF54P0W3eK2BpCAh4dpIBPmo6iWKU7oUYSPB-IG7IE,4149
|
|
5
|
+
clearskies_cortex/backends/cortex_team_relationship_backend.py,sha256=UiMZp0jcKvpx3tLbR8aMBS8-KIfECxJGiwM3fz8DmuM,7648
|
|
6
6
|
clearskies_cortex/columns/__init__.py,sha256=BpoVCEVXRtKcsyRFnAYLtlwYtHBjciUbzuzaBxmfH00,87
|
|
7
7
|
clearskies_cortex/columns/string_list.py,sha256=khsJS_0T4XZvTeXFpRvZsFX8iNTWbx_urCEa9Tv0Bmo,754
|
|
8
8
|
clearskies_cortex/defaults/__init__.py,sha256=tulZSvFgp4YUKj_bnArIevmlpC8z_AQKO0okYs4hCDo,216
|
|
@@ -22,7 +22,7 @@ clearskies_cortex/models/cortex_scorecard.py,sha256=YlINfUGudmqQHe-0ZpD2qOzAUKWs
|
|
|
22
22
|
clearskies_cortex/models/cortex_team.py,sha256=LXqHx_lwBvuVMyUlj1l2Sfpngj0zTZGpVi0WrJP-o3E,2246
|
|
23
23
|
clearskies_cortex/models/cortex_team_category_tree.py,sha256=PLC-9E5kuMeItow7RKFX7jKUiAfJ-7ehXIy3eeaFzr8,721
|
|
24
24
|
clearskies_cortex/models/cortex_team_department.py,sha256=DL3k91462-R0VVqbUQgBfYM_TndE5MKmDPBSF448XYw,639
|
|
25
|
-
clear_skies_cortex-2.0.
|
|
26
|
-
clear_skies_cortex-2.0.
|
|
27
|
-
clear_skies_cortex-2.0.
|
|
28
|
-
clear_skies_cortex-2.0.
|
|
25
|
+
clear_skies_cortex-2.0.3.dist-info/METADATA,sha256=aDSWFEtcMWOw5fGdQGg1B--y7ECfX89nyI1WRa-36jg,2117
|
|
26
|
+
clear_skies_cortex-2.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
27
|
+
clear_skies_cortex-2.0.3.dist-info/licenses/LICENSE,sha256=MkEX8JF8kZxdyBpTTcB0YTd-xZpWnHvbRlw-pQh8u58,1069
|
|
28
|
+
clear_skies_cortex-2.0.3.dist-info/RECORD,,
|
|
@@ -7,6 +7,7 @@ from clearskies.authentication import Authentication
|
|
|
7
7
|
from clearskies.decorators import parameters_to_properties
|
|
8
8
|
from clearskies.di import inject
|
|
9
9
|
from clearskies.query import Query
|
|
10
|
+
from clearskies.query.result import CountQueryResult
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class CortexBackend(clearskies.backends.ApiBackend):
|
|
@@ -39,7 +40,7 @@ class CortexBackend(clearskies.backends.ApiBackend):
|
|
|
39
40
|
):
|
|
40
41
|
self.finalize_and_validate_configuration()
|
|
41
42
|
|
|
42
|
-
def count(self, query: Query) ->
|
|
43
|
+
def count(self, query: Query) -> CountQueryResult:
|
|
43
44
|
"""Return count of records matching query."""
|
|
44
45
|
self.check_query(query)
|
|
45
46
|
(url, method, body, headers) = self.build_records_request(query)
|
|
@@ -47,9 +48,9 @@ class CortexBackend(clearskies.backends.ApiBackend):
|
|
|
47
48
|
response.raise_for_status()
|
|
48
49
|
data = response.json()
|
|
49
50
|
if "total" in data:
|
|
50
|
-
return data["total"]
|
|
51
|
+
return CountQueryResult(count=data["total"])
|
|
51
52
|
data = self.map_records_response(data, query)
|
|
52
|
-
return len(data)
|
|
53
|
+
return CountQueryResult(count=len(data))
|
|
53
54
|
|
|
54
55
|
def map_records_response(
|
|
55
56
|
self, response_data: Any, query: Query, query_data: dict[str, Any] | None = None
|
|
@@ -9,6 +9,7 @@ from clearskies.backends.memory_backend import MemoryBackend, MemoryTable
|
|
|
9
9
|
from clearskies.columns import String, Uuid
|
|
10
10
|
from clearskies.di import inject
|
|
11
11
|
from clearskies.query import Condition, Query
|
|
12
|
+
from clearskies.query.result import RecordsQueryResult
|
|
12
13
|
|
|
13
14
|
from clearskies_cortex.backends import cortex_backend as rest_backend
|
|
14
15
|
|
|
@@ -34,7 +35,7 @@ class CortexTeamRelationshipBackend(MemoryBackend, Configurable):
|
|
|
34
35
|
# or we need to let the di system build the CortexBackend. This change does both:
|
|
35
36
|
self.cortex_backend = cortex_backend
|
|
36
37
|
|
|
37
|
-
def records(self, query: Query
|
|
38
|
+
def records(self, query: Query) -> RecordsQueryResult:
|
|
38
39
|
"""Accept either a model or a model class and creates a "table" for it."""
|
|
39
40
|
table_name = query.model_class.destination_name()
|
|
40
41
|
if table_name not in self._tables:
|
|
@@ -45,7 +46,7 @@ class CortexTeamRelationshipBackend(MemoryBackend, Configurable):
|
|
|
45
46
|
# we don't need since we built the data ourselves. In short, it will be a lot slower, so I cheat.
|
|
46
47
|
self._tables[table_name]._rows = records # type: ignore[assignment]
|
|
47
48
|
self._tables[table_name]._id_index = id_index # type: ignore[assignment]
|
|
48
|
-
return super().records(query
|
|
49
|
+
return super().records(query)
|
|
49
50
|
|
|
50
51
|
def _fetch_and_map_relationship_data(self, table_name: str) -> tuple[list[dict[str, str | int]], dict[str, int]]:
|
|
51
52
|
class RelationshipModel(Model):
|
|
@@ -75,11 +76,14 @@ class CortexTeamRelationshipBackend(MemoryBackend, Configurable):
|
|
|
75
76
|
root_categories: dict[str, str] = {}
|
|
76
77
|
known_children: dict[str, str] = {}
|
|
77
78
|
relationships: dict[str, set[str]] = {}
|
|
78
|
-
for relationship in
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
for relationship in (
|
|
80
|
+
self._get_cortex_backend()
|
|
81
|
+
.records(
|
|
82
|
+
Query(
|
|
83
|
+
model_class=RelationshipModel,
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
.records
|
|
83
87
|
):
|
|
84
88
|
child_category = relationship["child_team_tag"]
|
|
85
89
|
parent_category = relationship["parent_team_tag"]
|
|
@@ -153,12 +157,15 @@ class CortexTeamRelationshipBackend(MemoryBackend, Configurable):
|
|
|
153
157
|
from clearskies_cortex.models.cortex_team import CortexTeam
|
|
154
158
|
|
|
155
159
|
teams: dict[str, dict[str, Any]] = {}
|
|
156
|
-
for team in
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
for team in (
|
|
161
|
+
self._get_cortex_backend()
|
|
162
|
+
.records(
|
|
163
|
+
Query(
|
|
164
|
+
model_class=CortexTeam,
|
|
165
|
+
conditions=[Condition("include_teams_without_members=true")],
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
.records
|
|
162
169
|
):
|
|
163
170
|
teams[team["team_tag"]] = team
|
|
164
171
|
self._cached_teams = teams
|
|
File without changes
|
|
File without changes
|