cartograph-python 0.2.0__cp38-abi3-win_amd64.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.
cartograph/__init__.py ADDED
@@ -0,0 +1,69 @@
1
+ """Cartograph: High-performance code graph engine and graph data science SDK."""
2
+ from __future__ import annotations
3
+
4
+ from cartograph.aio import AsyncCodeGraph
5
+ from cartograph.codegraph import CodeGraph
6
+ from cartograph.models import (
7
+ AnalysisError,
8
+ BoundaryViolation,
9
+ BusinessRule,
10
+ CartographError,
11
+ ComplexityRecord,
12
+ ComplexityReport,
13
+ DatabaseError,
14
+ DeadCodeReport,
15
+ DeadSymbolItem,
16
+ DependencyCycle,
17
+ DiagnosisReport,
18
+ DiagramResult,
19
+ Edge,
20
+ FaultCandidate,
21
+ GraphStats,
22
+ GraphStreamer,
23
+ ImpactResult,
24
+ ImpactRoot,
25
+ IndexStats,
26
+ LintArchReport,
27
+ LocateResult,
28
+ LogicReport,
29
+ Node,
30
+ RouteTrace,
31
+ SelectedTest,
32
+ SymbolNotFoundError,
33
+ TestSelectorResult,
34
+ )
35
+
36
+ __version__ = "0.2.0"
37
+
38
+ __all__ = [
39
+ "__version__",
40
+ "CodeGraph",
41
+ "AsyncCodeGraph",
42
+ "CartographError",
43
+ "SymbolNotFoundError",
44
+ "DatabaseError",
45
+ "AnalysisError",
46
+ "Node",
47
+ "Edge",
48
+ "GraphStats",
49
+ "GraphStreamer",
50
+ "IndexStats",
51
+ "LocateResult",
52
+ "ImpactResult",
53
+ "ImpactRoot",
54
+ "TestSelectorResult",
55
+ "SelectedTest",
56
+ "RouteTrace",
57
+ "LintArchReport",
58
+ "BoundaryViolation",
59
+ "DependencyCycle",
60
+ "ComplexityReport",
61
+ "ComplexityRecord",
62
+ "DeadCodeReport",
63
+ "DeadSymbolItem",
64
+ "LogicReport",
65
+ "BusinessRule",
66
+ "DiagnosisReport",
67
+ "FaultCandidate",
68
+ "DiagramResult",
69
+ ]
@@ -0,0 +1,483 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from typing import Any, Literal, Mapping
5
+
6
+ import networkx as nx
7
+ import igraph as ig
8
+ import pandas as pd
9
+ import polars as pl
10
+
11
+ __version__: str
12
+
13
+ class CartographError(Exception): ...
14
+ class SymbolNotFoundError(CartographError): ...
15
+ class DatabaseError(CartographError): ...
16
+ class AnalysisError(CartographError): ...
17
+
18
+ class Node:
19
+ @property
20
+ def id(self) -> str: ...
21
+ @property
22
+ def name(self) -> str: ...
23
+ @property
24
+ def kind(self) -> str: ...
25
+ @property
26
+ def filepath(self) -> str: ...
27
+ @property
28
+ def scope(self) -> str: ...
29
+ @property
30
+ def start_line(self) -> int | None: ...
31
+ @property
32
+ def end_line(self) -> int | None: ...
33
+ @property
34
+ def signature(self) -> str | None: ...
35
+ def to_dict(self) -> dict[str, Any]: ...
36
+
37
+ class Edge:
38
+ @property
39
+ def source(self) -> str: ...
40
+ @property
41
+ def target(self) -> str: ...
42
+ @property
43
+ def kind(self) -> str: ...
44
+ @property
45
+ def confidence(self) -> float: ...
46
+ def to_dict(self) -> dict[str, Any]: ...
47
+
48
+ class GraphStats:
49
+ @property
50
+ def total_nodes(self) -> int: ...
51
+ @property
52
+ def total_edges(self) -> int: ...
53
+ @property
54
+ def file_count(self) -> int: ...
55
+ @property
56
+ def node_kinds(self) -> dict[str, int]: ...
57
+ @property
58
+ def edge_kinds(self) -> dict[str, int]: ...
59
+ def to_dict(self) -> dict[str, Any]: ...
60
+
61
+ class IndexStats:
62
+ @property
63
+ def files_indexed(self) -> int: ...
64
+ @property
65
+ def nodes_added(self) -> int: ...
66
+ @property
67
+ def edges_added(self) -> int: ...
68
+ @property
69
+ def elapsed_ms(self) -> float: ...
70
+ def to_dict(self) -> dict[str, Any]: ...
71
+
72
+ class LocateResult:
73
+ @property
74
+ def nodes(self) -> list[Node]: ...
75
+ @property
76
+ def edges(self) -> list[Edge]: ...
77
+ @property
78
+ def root_id(self) -> str: ...
79
+ @property
80
+ def rendered_output(self) -> str: ...
81
+ @property
82
+ def elapsed_ms(self) -> float: ...
83
+ def to_dict(self) -> dict[str, Any]: ...
84
+
85
+ class ImpactRoot:
86
+ @property
87
+ def target(self) -> str: ...
88
+ @property
89
+ def node_id(self) -> str: ...
90
+ @property
91
+ def upstream_nodes(self) -> list[Node]: ...
92
+ @property
93
+ def affected_files(self) -> list[str]: ...
94
+ @property
95
+ def risk_score(self) -> float: ...
96
+ @property
97
+ def risk_level(self) -> str: ...
98
+ def to_dict(self) -> dict[str, Any]: ...
99
+
100
+ class ImpactResult:
101
+ @property
102
+ def roots(self) -> list[ImpactRoot]: ...
103
+ @property
104
+ def total_affected_files(self) -> int: ...
105
+ @property
106
+ def overall_risk_score(self) -> float: ...
107
+ @property
108
+ def overall_risk_level(self) -> str: ...
109
+ def to_dict(self) -> dict[str, Any]: ...
110
+
111
+ class SelectedTest:
112
+ @property
113
+ def test_id(self) -> str: ...
114
+ @property
115
+ def test_name(self) -> str: ...
116
+ @property
117
+ def test_file(self) -> str: ...
118
+ @property
119
+ def confidence(self) -> float: ...
120
+ @property
121
+ def hop_distance(self) -> int: ...
122
+ def to_dict(self) -> dict[str, Any]: ...
123
+
124
+ class TestSelectorResult:
125
+ @property
126
+ def tests(self) -> list[SelectedTest]: ...
127
+ @property
128
+ def total_tests_selected(self) -> int: ...
129
+ @property
130
+ def affected_targets(self) -> list[str]: ...
131
+ def to_dict(self) -> dict[str, Any]: ...
132
+
133
+ class RouteTrace:
134
+ @property
135
+ def method(self) -> str: ...
136
+ @property
137
+ def path(self) -> str: ...
138
+ @property
139
+ def route_id(self) -> str: ...
140
+ @property
141
+ def downstream_hops(self) -> int: ...
142
+ @property
143
+ def auth_kind(self) -> str | None: ...
144
+ def to_dict(self) -> dict[str, Any]: ...
145
+
146
+ class BoundaryViolation:
147
+ @property
148
+ def source_module(self) -> str: ...
149
+ @property
150
+ def target_module(self) -> str: ...
151
+ @property
152
+ def rule_name(self) -> str: ...
153
+ @property
154
+ def severity(self) -> str: ...
155
+ @property
156
+ def message(self) -> str: ...
157
+ def to_dict(self) -> dict[str, Any]: ...
158
+
159
+ class DependencyCycle:
160
+ @property
161
+ def cycle_length(self) -> int: ...
162
+ @property
163
+ def path(self) -> list[str]: ...
164
+ def to_dict(self) -> dict[str, Any]: ...
165
+
166
+ class LintArchReport:
167
+ @property
168
+ def passed(self) -> bool: ...
169
+ @property
170
+ def violations(self) -> list[BoundaryViolation]: ...
171
+ @property
172
+ def cycles(self) -> list[DependencyCycle]: ...
173
+ @property
174
+ def total_violations(self) -> int: ...
175
+ def to_dict(self) -> dict[str, Any]: ...
176
+
177
+ class ComplexityRecord:
178
+ @property
179
+ def name(self) -> str: ...
180
+ @property
181
+ def filepath(self) -> str: ...
182
+ @property
183
+ def start_line(self) -> int | None: ...
184
+ @property
185
+ def end_line(self) -> int | None: ...
186
+ @property
187
+ def cyclomatic(self) -> u32: ...
188
+ @property
189
+ def cognitive(self) -> u32: ...
190
+ @property
191
+ def loc(self) -> usize: ...
192
+ @property
193
+ def hotspot_score(self) -> float: ...
194
+ @property
195
+ def is_danger_zone(self) -> bool: ...
196
+ def to_dict(self) -> dict[str, Any]: ...
197
+
198
+ class ComplexityReport:
199
+ @property
200
+ def top_hotspots(self) -> list[ComplexityRecord]: ...
201
+ @property
202
+ def danger_zone_count(self) -> int: ...
203
+ @property
204
+ def total_analyzed_symbols(self) -> int: ...
205
+ def to_dict(self) -> dict[str, Any]: ...
206
+
207
+ class DeadSymbolItem:
208
+ @property
209
+ def symbol_id(self) -> str: ...
210
+ @property
211
+ def name(self) -> str: ...
212
+ @property
213
+ def filepath(self) -> str: ...
214
+ @property
215
+ def kind(self) -> str: ...
216
+ @property
217
+ def confidence(self) -> float: ...
218
+ def to_dict(self) -> dict[str, Any]: ...
219
+
220
+ class DeadCodeReport:
221
+ @property
222
+ def dead_symbols(self) -> list[DeadSymbolItem]: ...
223
+ @property
224
+ def ghost_dependencies(self) -> list[str]: ...
225
+ @property
226
+ def total_dead_loc(self) -> int: ...
227
+ def to_dict(self) -> dict[str, Any]: ...
228
+
229
+ class BusinessRule:
230
+ @property
231
+ def name(self) -> str: ...
232
+ @property
233
+ def description(self) -> str: ...
234
+ @property
235
+ def rule_type(self) -> str: ...
236
+ @property
237
+ def target_symbol(self) -> str: ...
238
+ @property
239
+ def confidence(self) -> float: ...
240
+ def to_dict(self) -> dict[str, Any]: ...
241
+
242
+ class LogicReport:
243
+ @property
244
+ def rules(self) -> list[BusinessRule]: ...
245
+ @property
246
+ def total_rules(self) -> int: ...
247
+ def to_dict(self) -> dict[str, Any]: ...
248
+
249
+ class FaultCandidate:
250
+ @property
251
+ def rank(self) -> int: ...
252
+ @property
253
+ def score(self) -> float: ...
254
+ @property
255
+ def function_name(self) -> str: ...
256
+ @property
257
+ def file_path(self) -> str: ...
258
+ @property
259
+ def line_number(self) -> int: ...
260
+ @property
261
+ def explanation(self) -> str: ...
262
+ def to_dict(self) -> dict[str, Any]: ...
263
+
264
+ class DiagnosisReport:
265
+ @property
266
+ def crash_type(self) -> str: ...
267
+ @property
268
+ def crash_message(self) -> str: ...
269
+ @property
270
+ def candidates(self) -> list[FaultCandidate]: ...
271
+ @property
272
+ def execution_mode(self) -> str: ...
273
+ @property
274
+ def execution_time_ms(self) -> float: ...
275
+ def to_dict(self) -> dict[str, Any]: ...
276
+
277
+ class DiagramResult:
278
+ @property
279
+ def content(self) -> str: ...
280
+ @property
281
+ def format(self) -> str: ...
282
+ @property
283
+ def diagram_type(self) -> str: ...
284
+ @property
285
+ def node_count(self) -> int: ...
286
+ @property
287
+ def edge_count(self) -> int: ...
288
+ def to_dict(self) -> dict[str, Any]: ...
289
+ def _repr_html_(self) -> str: ...
290
+
291
+ class CodeGraph:
292
+ def __init__(
293
+ self,
294
+ path: str | Path | None = ...,
295
+ profile: str = ...,
296
+ in_memory: bool = ...,
297
+ ) -> None: ...
298
+ @classmethod
299
+ def open(
300
+ cls,
301
+ path: str | Path | None = ...,
302
+ profile: str = ...,
303
+ in_memory: bool = ...,
304
+ ) -> CodeGraph: ...
305
+ def __enter__(self) -> CodeGraph: ...
306
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
307
+ def close(self) -> None: ...
308
+ @property
309
+ def is_open(self) -> bool: ...
310
+ @property
311
+ def profile(self) -> str: ...
312
+ def index(
313
+ self,
314
+ force: bool = ...,
315
+ staged: bool = ...,
316
+ branch: str | None = ...,
317
+ threads: int | None = ...,
318
+ ) -> IndexStats: ...
319
+ def status(self) -> GraphStats: ...
320
+ def locate(
321
+ self,
322
+ query: str,
323
+ code: bool = ...,
324
+ limit: int = ...,
325
+ ) -> LocateResult: ...
326
+ def impact(
327
+ self,
328
+ target: str,
329
+ branch: str | None = ...,
330
+ staged: bool = ...,
331
+ depth: int = ...,
332
+ ) -> ImpactResult: ...
333
+ def test_selector(
334
+ self,
335
+ target: str,
336
+ branch: str | None = ...,
337
+ ) -> TestSelectorResult: ...
338
+ def routes(
339
+ self,
340
+ filter_query: str | None = ...,
341
+ ) -> list[RouteTrace]: ...
342
+ def lint_arch(
343
+ self,
344
+ strict: bool = ...,
345
+ ) -> LintArchReport: ...
346
+ def complexity(
347
+ self,
348
+ top: int = ...,
349
+ danger_zone: bool = ...,
350
+ ) -> ComplexityReport: ...
351
+ def deadcode(
352
+ self,
353
+ min_lines: int = ...,
354
+ ) -> DeadCodeReport: ...
355
+ def extract_logic(
356
+ self,
357
+ query: str | None = ...,
358
+ symbol: str | None = ...,
359
+ concept: str | None = ...,
360
+ deep: bool = ...,
361
+ ) -> LogicReport: ...
362
+ def diagnose(
363
+ self,
364
+ trace_or_log: str,
365
+ file_path: str | None = ...,
366
+ deep: bool = ...,
367
+ offline: bool = ...,
368
+ ) -> DiagnosisReport: ...
369
+ def diagram(
370
+ self,
371
+ symbol_or_concept: str | None = ...,
372
+ diagram_type: str = ...,
373
+ format: str = ...,
374
+ depth: int = ...,
375
+ direction: str = ...,
376
+ max_nodes: int = ...,
377
+ collapse_modules: bool = ...,
378
+ theme: str = ...,
379
+ ) -> DiagramResult: ...
380
+ def to_networkx(self) -> nx.DiGraph: ...
381
+ def to_igraph(self) -> ig.Graph: ...
382
+ def nodes_df(self, engine: Literal["polars", "pandas"] = ...) -> Any: ...
383
+ def edges_df(self, engine: Literal["polars", "pandas"] = ...) -> Any: ...
384
+ def complexity_df(self, engine: Literal["polars", "pandas"] = ...) -> Any: ...
385
+ def to_polars(self) -> dict[str, pl.DataFrame]: ...
386
+ def to_pandas(self) -> dict[str, pd.DataFrame]: ...
387
+
388
+ class AsyncCodeGraph:
389
+ def __init__(
390
+ self,
391
+ path: str | Path | None = ...,
392
+ profile: str = ...,
393
+ in_memory: bool = ...,
394
+ ) -> None: ...
395
+ @classmethod
396
+ async def open(
397
+ cls,
398
+ path: str | Path | None = ...,
399
+ profile: str = ...,
400
+ in_memory: bool = ...,
401
+ ) -> AsyncCodeGraph: ...
402
+ async def __aenter__(self) -> AsyncCodeGraph: ...
403
+ async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
404
+ async def close(self) -> None: ...
405
+ @property
406
+ def is_open(self) -> bool: ...
407
+ @property
408
+ def profile(self) -> str: ...
409
+ async def index(
410
+ self,
411
+ force: bool = ...,
412
+ staged: bool = ...,
413
+ branch: str | None = ...,
414
+ threads: int | None = ...,
415
+ ) -> IndexStats: ...
416
+ async def status(self) -> GraphStats: ...
417
+ async def locate(
418
+ self,
419
+ query: str,
420
+ code: bool = ...,
421
+ limit: int = ...,
422
+ ) -> LocateResult: ...
423
+ async def impact(
424
+ self,
425
+ target: str,
426
+ branch: str | None = ...,
427
+ staged: bool = ...,
428
+ depth: int = ...,
429
+ ) -> ImpactResult: ...
430
+ async def test_selector(
431
+ self,
432
+ target: str,
433
+ branch: str | None = ...,
434
+ ) -> TestSelectorResult: ...
435
+ async def routes(
436
+ self,
437
+ filter_query: str | None = ...,
438
+ ) -> list[RouteTrace]: ...
439
+ async def lint_arch(
440
+ self,
441
+ strict: bool = ...,
442
+ ) -> LintArchReport: ...
443
+ async def complexity(
444
+ self,
445
+ top: int = ...,
446
+ danger_zone: bool = ...,
447
+ ) -> ComplexityReport: ...
448
+ async def deadcode(
449
+ self,
450
+ min_lines: int = ...,
451
+ ) -> DeadCodeReport: ...
452
+ async def extract_logic(
453
+ self,
454
+ query: str | None = ...,
455
+ symbol: str | None = ...,
456
+ concept: str | None = ...,
457
+ deep: bool = ...,
458
+ ) -> LogicReport: ...
459
+ async def diagnose(
460
+ self,
461
+ trace_or_log: str,
462
+ file_path: str | None = ...,
463
+ deep: bool = ...,
464
+ offline: bool = ...,
465
+ ) -> DiagnosisReport: ...
466
+ async def diagram(
467
+ self,
468
+ symbol_or_concept: str | None = ...,
469
+ diagram_type: str = ...,
470
+ format: str = ...,
471
+ depth: int = ...,
472
+ direction: str = ...,
473
+ max_nodes: int = ...,
474
+ collapse_modules: bool = ...,
475
+ theme: str = ...,
476
+ ) -> DiagramResult: ...
477
+ async def to_networkx(self) -> nx.DiGraph: ...
478
+ async def to_igraph(self) -> ig.Graph: ...
479
+ async def nodes_df(self, engine: Literal["polars", "pandas"] = ...) -> Any: ...
480
+ async def edges_df(self, engine: Literal["polars", "pandas"] = ...) -> Any: ...
481
+ async def complexity_df(self, engine: Literal["polars", "pandas"] = ...) -> Any: ...
482
+ async def to_polars(self) -> dict[str, pl.DataFrame]: ...
483
+ async def to_pandas(self) -> dict[str, pd.DataFrame]: ...
Binary file