codeanalyzer-python 0.1.1__py3-none-any.whl → 0.1.2__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.
- codeanalyzer/__init__.py +0 -0
- codeanalyzer/__main__.py +84 -0
- codeanalyzer/core.py +321 -0
- codeanalyzer/jedi/__init__.py +0 -0
- codeanalyzer/jedi/jedi.py +0 -0
- codeanalyzer/py.typed +0 -0
- codeanalyzer/schema/__init__.py +23 -0
- codeanalyzer/schema/py_schema.py +360 -0
- codeanalyzer/semantic_analysis/__init__.py +0 -0
- codeanalyzer/semantic_analysis/codeql/__init__.py +26 -0
- codeanalyzer/semantic_analysis/codeql/codeql_analysis.py +133 -0
- codeanalyzer/semantic_analysis/codeql/codeql_exceptions.py +12 -0
- codeanalyzer/semantic_analysis/codeql/codeql_loader.py +74 -0
- codeanalyzer/semantic_analysis/codeql/codeql_query_runner.py +164 -0
- codeanalyzer/semantic_analysis/wala/__init__.py +15 -0
- codeanalyzer/syntactic_analysis/__init__.py +0 -0
- codeanalyzer/syntactic_analysis/symbol_table_builder.py +903 -0
- codeanalyzer/utils/__init__.py +5 -0
- codeanalyzer/utils/logging.py +18 -0
- codeanalyzer/utils/progress_bar.py +69 -0
- {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/METADATA +1 -1
- codeanalyzer_python-0.1.2.dist-info/RECORD +26 -0
- codeanalyzer_python-0.1.1.dist-info/RECORD +0 -6
- {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/WHEEL +0 -0
- {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/entry_points.txt +0 -0
- {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/licenses/NOTICE +0 -0
|
@@ -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()
|
|
@@ -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.2.dist-info/METADATA,sha256=27Q1g78MrXf48H5qcJ9SPx8pWVOxY09gEY6EuuuzshE,7394
|
|
22
|
+
codeanalyzer_python-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
23
|
+
codeanalyzer_python-0.1.2.dist-info/entry_points.txt,sha256=eUrB7Jq5Oav6RblMX_RYfVLSw_h15NbzC3fNSnGsPuM,59
|
|
24
|
+
codeanalyzer_python-0.1.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
25
|
+
codeanalyzer_python-0.1.2.dist-info/licenses/NOTICE,sha256=YU0Z9NDWqKY-2jfFcbxeZ6fbnzz0oZeKmnUcO8a-bcQ,901
|
|
26
|
+
codeanalyzer_python-0.1.2.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,,
|
|
File without changes
|
{codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{codeanalyzer_python-0.1.1.dist-info → codeanalyzer_python-0.1.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|