codeanalyzer-python 0.1.1__py3-none-any.whl → 0.1.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.
Files changed (27) hide show
  1. codeanalyzer/__init__.py +0 -0
  2. codeanalyzer/__main__.py +84 -0
  3. codeanalyzer/core.py +321 -0
  4. codeanalyzer/jedi/__init__.py +0 -0
  5. codeanalyzer/jedi/jedi.py +0 -0
  6. codeanalyzer/py.typed +0 -0
  7. codeanalyzer/schema/__init__.py +23 -0
  8. codeanalyzer/schema/py_schema.py +360 -0
  9. codeanalyzer/semantic_analysis/__init__.py +0 -0
  10. codeanalyzer/semantic_analysis/codeql/__init__.py +26 -0
  11. codeanalyzer/semantic_analysis/codeql/codeql_analysis.py +133 -0
  12. codeanalyzer/semantic_analysis/codeql/codeql_exceptions.py +12 -0
  13. codeanalyzer/semantic_analysis/codeql/codeql_loader.py +74 -0
  14. codeanalyzer/semantic_analysis/codeql/codeql_query_runner.py +164 -0
  15. codeanalyzer/semantic_analysis/wala/__init__.py +15 -0
  16. codeanalyzer/syntactic_analysis/__init__.py +0 -0
  17. codeanalyzer/syntactic_analysis/symbol_table_builder.py +903 -0
  18. codeanalyzer/utils/__init__.py +5 -0
  19. codeanalyzer/utils/logging.py +18 -0
  20. codeanalyzer/utils/progress_bar.py +69 -0
  21. {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.3.dist-info}/METADATA +3 -3
  22. codeanalyzer_python-0.1.3.dist-info/RECORD +26 -0
  23. codeanalyzer_python-0.1.1.dist-info/RECORD +0 -6
  24. {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.3.dist-info}/WHEEL +0 -0
  25. {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.3.dist-info}/entry_points.txt +0 -0
  26. {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.3.dist-info}/licenses/LICENSE +0 -0
  27. {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.3.dist-info}/licenses/NOTICE +0 -0
@@ -0,0 +1,5 @@
1
+ from .logging import logger
2
+ from .logging import _set_log_level
3
+ from .progress_bar import ProgressBar
4
+
5
+ __all__ = ["logger", "_set_log_level", "ProgressBar"]
@@ -0,0 +1,18 @@
1
+ from rich.console import Console
2
+ from rich.logging import RichHandler
3
+ import logging
4
+
5
+ # Set up base logger with RichHandler
6
+ console = Console()
7
+ handler = RichHandler(console=console, show_time=True, show_level=True, show_path=False)
8
+
9
+ logger = logging.getLogger("codeanalyzer")
10
+ logger.setLevel(logging.ERROR) # Default level
11
+ logger.addHandler(handler)
12
+ logger.propagate = False # Prevent double logs
13
+
14
+
15
+ def _set_log_level(verbosity: int) -> None:
16
+ levels = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
17
+ level = levels[min(verbosity, len(levels) - 1)]
18
+ logger.setLevel(level)
@@ -0,0 +1,69 @@
1
+ from rich.console import Console
2
+ from rich.progress import (
3
+ Progress,
4
+ SpinnerColumn,
5
+ TextColumn,
6
+ BarColumn,
7
+ TimeElapsedColumn,
8
+ TimeRemainingColumn,
9
+ TaskID,
10
+ )
11
+ from typing import Optional
12
+ import logging
13
+
14
+
15
+ class ProgressBar:
16
+ def __init__(
17
+ self, total_files: int, description: str = "Processing files..."
18
+ ) -> None:
19
+ self.total_files = total_files
20
+ self.description = description
21
+ self.console = Console(stderr=True)
22
+
23
+ logger = logging.getLogger("codeanalyzer")
24
+ current_level = logger.getEffectiveLevel()
25
+
26
+ # Disable progress if logger level is higher than INFO (e.g., WARNING or ERROR)
27
+ self.disabled = current_level >= logging.ERROR
28
+
29
+ self._progress: Optional[Progress] = None
30
+ self._task_id: Optional[TaskID] = None
31
+
32
+ def __enter__(self):
33
+ if not self.disabled:
34
+ self._progress = Progress(
35
+ SpinnerColumn(spinner_name="dots"),
36
+ TextColumn("[progress.description]{task.description}"),
37
+ BarColumn(),
38
+ TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
39
+ TextColumn("[blue]{task.completed}/{task.total} files"),
40
+ TimeElapsedColumn(),
41
+ TimeRemainingColumn(),
42
+ transient=False,
43
+ console=self.console, # <-- Use stderr-safe console
44
+ )
45
+ self._progress.start()
46
+ self._task_id = self._progress.add_task(
47
+ description=self.description, total=self.total_files
48
+ )
49
+ return self
50
+
51
+ def update_description(self, message: str) -> None:
52
+ if not self.disabled and self._progress and self._task_id is not None:
53
+ self._progress.update(self._task_id, description=message)
54
+
55
+ def advance(self, n: int = 1) -> None:
56
+ if not self.disabled and self._progress and self._task_id is not None:
57
+ self._progress.advance(self._task_id, n)
58
+
59
+ def finish(self, message: Optional[str] = None) -> None:
60
+ if not self.disabled and self._progress and self._task_id is not None:
61
+ if not self._progress.finished:
62
+ self._progress.update(self._task_id, completed=self.total_files)
63
+ self._progress.stop()
64
+
65
+ if message:
66
+ logging.getLogger("codeanalyzer").info(message)
67
+
68
+ def __exit__(self, exc_type, exc_val, exc_tb):
69
+ self.finish()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codeanalyzer-python
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Static Analysis on Python source code using Jedi, CodeQL and Treesitter.
5
5
  Author-email: Rahul Krishna <i.m.ralk@gmail.com>
6
6
  License-File: LICENSE
@@ -20,9 +20,9 @@ Requires-Dist: toml>=0.10.2
20
20
  Requires-Dist: typer>=0.16.0
21
21
  Description-Content-Type: text/markdown
22
22
 
23
- ![logo](./docs/assets/logo.png)
23
+ ![logo](https://github.com/codellm-devkit/codeanalyzer-python/blob/main/docs/assets/logo.png?raw=true)
24
24
 
25
- Python Static Analysis Backend for CLDK
25
+ # A Python Static Analysis Toolkit (and Library)
26
26
 
27
27
  A comprehensive static analysis tool for Python source code that provides symbol table generation, call graph analysis, and semantic analysis using Jedi, CodeQL, and Tree-sitter.
28
28
 
@@ -0,0 +1,26 @@
1
+ codeanalyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ codeanalyzer/__main__.py,sha256=vfASpqZsadwzxNkdHIlqb6r6ERT7O_JlqEIP8KKg1Z4,2580
3
+ codeanalyzer/core.py,sha256=fR6ffVc74IH-5kwGR4iqg4kNXFVoblXHVSDZ4Z__zQo,12521
4
+ codeanalyzer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ codeanalyzer/jedi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ codeanalyzer/jedi/jedi.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ codeanalyzer/schema/__init__.py,sha256=YWGFbLLCOqc94VXA6NaBKKOKf7TBFbx_DyOgmWucZFQ,388
8
+ codeanalyzer/schema/py_schema.py,sha256=xOvzmyv-3VHQAe5FtirM04bfD5ZKKs2jG011UiV7jH0,13148
9
+ codeanalyzer/semantic_analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ codeanalyzer/semantic_analysis/codeql/__init__.py,sha256=JYeyTli9aa-V1gpdGKdwr2e927G72_dgcUw25Pagt3o,1022
11
+ codeanalyzer/semantic_analysis/codeql/codeql_analysis.py,sha256=zr3sXkKmBXyRUCRy2u6OZD1CXYRol8_D2p8cbX0NoXA,5324
12
+ codeanalyzer/semantic_analysis/codeql/codeql_exceptions.py,sha256=PnJOasW9rP68SEX158jSqQFdqjW_Q_Fx3vbH6vNiCQs,474
13
+ codeanalyzer/semantic_analysis/codeql/codeql_loader.py,sha256=GwPIItrzyuEIDuet9txgrgkP1yGO2vTsjTWBt6z1EWM,2689
14
+ codeanalyzer/semantic_analysis/codeql/codeql_query_runner.py,sha256=fBNbdQhIH8vnHNYNHQgel2tVpowmXmP_Vi5qF4JL_cY,6519
15
+ codeanalyzer/semantic_analysis/wala/__init__.py,sha256=JSDvkrpJ2U90Ikex34EluSHmoGutlmRhV2xvInt6tB8,743
16
+ codeanalyzer/syntactic_analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ codeanalyzer/syntactic_analysis/symbol_table_builder.py,sha256=b9IlM-WsCO_p2a0jUpHPHhf_XWpSvWmx6G-3oJgu75s,37026
18
+ codeanalyzer/utils/__init__.py,sha256=Ipgq2cSoNgTMSi-BamJoIAWo_1LN2IyaYW4Ms1z-qnI,157
19
+ codeanalyzer/utils/logging.py,sha256=UkSKx9IyBd7mCGcgXTR-PX-Rw-x_0tZDRRnwDyrGeuY,600
20
+ codeanalyzer/utils/progress_bar.py,sha256=4BmrOVEzZt2rOvGNoP-j_8rCapDZU36VibUA8S7--9A,2442
21
+ codeanalyzer_python-0.1.3.dist-info/METADATA,sha256=eFLmP0pz3-NBuVqz5BBwytwkYNmloNtdVBr6WIBGEGU,7474
22
+ codeanalyzer_python-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ codeanalyzer_python-0.1.3.dist-info/entry_points.txt,sha256=eUrB7Jq5Oav6RblMX_RYfVLSw_h15NbzC3fNSnGsPuM,59
24
+ codeanalyzer_python-0.1.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ codeanalyzer_python-0.1.3.dist-info/licenses/NOTICE,sha256=YU0Z9NDWqKY-2jfFcbxeZ6fbnzz0oZeKmnUcO8a-bcQ,901
26
+ codeanalyzer_python-0.1.3.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- codeanalyzer_python-0.1.1.dist-info/METADATA,sha256=tSMiuaj8MK9W1k-ZS1wVGXMd2R8QURWtWgF_6qGQxqY,7394
2
- codeanalyzer_python-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
3
- codeanalyzer_python-0.1.1.dist-info/entry_points.txt,sha256=eUrB7Jq5Oav6RblMX_RYfVLSw_h15NbzC3fNSnGsPuM,59
4
- codeanalyzer_python-0.1.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
- codeanalyzer_python-0.1.1.dist-info/licenses/NOTICE,sha256=YU0Z9NDWqKY-2jfFcbxeZ6fbnzz0oZeKmnUcO8a-bcQ,901
6
- codeanalyzer_python-0.1.1.dist-info/RECORD,,