codeanalyzer-python 0.1.3__py3-none-any.whl → 0.1.5__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/__main__.py +53 -13
- codeanalyzer/core.py +5 -12
- codeanalyzer/schema/__init__.py +6 -6
- codeanalyzer/schema/py_schema.py +103 -125
- codeanalyzer/semantic_analysis/codeql/__init__.py +2 -2
- codeanalyzer/semantic_analysis/codeql/codeql_analysis.py +2 -2
- codeanalyzer/semantic_analysis/codeql/codeql_loader.py +3 -14
- codeanalyzer/semantic_analysis/codeql/codeql_query_runner.py +2 -1
- codeanalyzer/syntactic_analysis/symbol_table_builder.py +159 -162
- codeanalyzer/utils/__init__.py +1 -2
- codeanalyzer/utils/logging.py +2 -1
- codeanalyzer/utils/progress_bar.py +5 -4
- codeanalyzer_python-0.1.5.dist-info/METADATA +392 -0
- codeanalyzer_python-0.1.5.dist-info/RECORD +26 -0
- codeanalyzer_python-0.1.3.dist-info/METADATA +0 -198
- codeanalyzer_python-0.1.3.dist-info/RECORD +0 -26
- {codeanalyzer_python-0.1.3.dist-info → codeanalyzer_python-0.1.5.dist-info}/WHEEL +0 -0
- {codeanalyzer_python-0.1.3.dist-info → codeanalyzer_python-0.1.5.dist-info}/entry_points.txt +0 -0
- {codeanalyzer_python-0.1.3.dist-info → codeanalyzer_python-0.1.5.dist-info}/licenses/LICENSE +0 -0
- {codeanalyzer_python-0.1.3.dist-info → codeanalyzer_python-0.1.5.dist-info}/licenses/NOTICE +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import ast
|
|
2
|
+
import tokenize
|
|
3
|
+
from ast import AST, ClassDef
|
|
1
4
|
from io import StringIO
|
|
2
5
|
from pathlib import Path
|
|
3
|
-
import tokenize
|
|
4
6
|
from typing import Dict, List, Optional
|
|
5
|
-
|
|
7
|
+
|
|
6
8
|
import jedi
|
|
7
|
-
from codeanalyzer.utils import logger
|
|
8
|
-
from jedi.api.project import Project
|
|
9
9
|
from jedi.api import Script
|
|
10
|
-
from
|
|
10
|
+
from jedi.api.project import Project
|
|
11
|
+
|
|
11
12
|
from codeanalyzer.schema.py_schema import (
|
|
12
13
|
PyCallable,
|
|
13
14
|
PyCallableParameter,
|
|
@@ -20,9 +21,7 @@ from codeanalyzer.schema.py_schema import (
|
|
|
20
21
|
PySymbol,
|
|
21
22
|
PyVariableDeclaration,
|
|
22
23
|
)
|
|
23
|
-
import
|
|
24
|
-
from ast import AST, ClassDef
|
|
25
|
-
|
|
24
|
+
from codeanalyzer.utils import logger
|
|
26
25
|
from codeanalyzer.utils.progress_bar import ProgressBar
|
|
27
26
|
|
|
28
27
|
|
|
@@ -98,13 +97,13 @@ class SymbolTableBuilder:
|
|
|
98
97
|
|
|
99
98
|
return (
|
|
100
99
|
PyModule.builder()
|
|
101
|
-
.
|
|
102
|
-
.
|
|
103
|
-
.
|
|
104
|
-
.
|
|
105
|
-
.
|
|
106
|
-
.
|
|
107
|
-
.
|
|
100
|
+
.file_path(str(py_file))
|
|
101
|
+
.module_name(py_file.stem)
|
|
102
|
+
.comments(self._pycomments(module, source))
|
|
103
|
+
.imports(self._imports(module))
|
|
104
|
+
.variables(self._module_variables(module, script))
|
|
105
|
+
.classes(classes)
|
|
106
|
+
.functions(functions)
|
|
108
107
|
.build()
|
|
109
108
|
)
|
|
110
109
|
|
|
@@ -126,13 +125,13 @@ class SymbolTableBuilder:
|
|
|
126
125
|
for alias in node.names:
|
|
127
126
|
imports.append(
|
|
128
127
|
PyImport.builder()
|
|
129
|
-
.
|
|
130
|
-
.
|
|
131
|
-
.
|
|
132
|
-
.
|
|
133
|
-
.
|
|
134
|
-
.
|
|
135
|
-
.
|
|
128
|
+
.module(alias.name) # for "import os", alias.name = "os"
|
|
129
|
+
.name(alias.asname or alias.name) # name in local scope
|
|
130
|
+
.alias(alias.name if alias.asname else None)
|
|
131
|
+
.start_line(getattr(node, "lineno", -1))
|
|
132
|
+
.end_line(getattr(node, "end_lineno", node.lineno))
|
|
133
|
+
.start_column(getattr(node, "col_offset", -1))
|
|
134
|
+
.end_column(getattr(node, "end_col_offset", -1))
|
|
136
135
|
.build()
|
|
137
136
|
)
|
|
138
137
|
|
|
@@ -145,13 +144,13 @@ class SymbolTableBuilder:
|
|
|
145
144
|
qualified_module = "." * node.level + (module_name or "")
|
|
146
145
|
imports.append(
|
|
147
146
|
PyImport.builder()
|
|
148
|
-
.
|
|
149
|
-
.
|
|
150
|
-
.
|
|
151
|
-
.
|
|
152
|
-
.
|
|
153
|
-
.
|
|
154
|
-
.
|
|
147
|
+
.module(qualified_module)
|
|
148
|
+
.name(alias.asname or alias.name)
|
|
149
|
+
.alias(alias.name if alias.asname else None)
|
|
150
|
+
.start_line(getattr(node, "lineno", -1))
|
|
151
|
+
.end_line(getattr(node, "end_lineno", node.lineno))
|
|
152
|
+
.start_column(getattr(node, "col_offset", -1))
|
|
153
|
+
.end_column(getattr(node, "end_col_offset", -1))
|
|
155
154
|
.build()
|
|
156
155
|
)
|
|
157
156
|
|
|
@@ -183,30 +182,30 @@ class SymbolTableBuilder:
|
|
|
183
182
|
f"{script.path.__str__().replace('/', '.').replace('.py', '')}.{class_node.name}",
|
|
184
183
|
)
|
|
185
184
|
|
|
186
|
-
code: str =
|
|
185
|
+
code: str = ast.unparse(class_node).strip()
|
|
187
186
|
|
|
188
187
|
py_class = (
|
|
189
188
|
PyClass.builder()
|
|
190
|
-
.
|
|
191
|
-
.
|
|
192
|
-
.
|
|
193
|
-
.
|
|
189
|
+
.name(class_node.name)
|
|
190
|
+
.signature(signature)
|
|
191
|
+
.start_line(class_node.lineno)
|
|
192
|
+
.end_line(
|
|
194
193
|
getattr(
|
|
195
194
|
class_node, "end_lineno", class_node.lineno + len(class_node.body)
|
|
196
195
|
)
|
|
197
196
|
)
|
|
198
|
-
.
|
|
199
|
-
.
|
|
200
|
-
.
|
|
197
|
+
.comments(self._pycomments(class_node, code))
|
|
198
|
+
.code(code)
|
|
199
|
+
.base_classes(
|
|
201
200
|
[
|
|
202
201
|
ast.unparse(base)
|
|
203
202
|
for base in class_node.bases
|
|
204
203
|
if isinstance(base, ast.expr)
|
|
205
204
|
]
|
|
206
205
|
)
|
|
207
|
-
.
|
|
208
|
-
.
|
|
209
|
-
.
|
|
206
|
+
.methods(self._callables(class_node, script))
|
|
207
|
+
.attributes(self._class_attributes(class_node, script))
|
|
208
|
+
.inner_classes(
|
|
210
209
|
{
|
|
211
210
|
k: v
|
|
212
211
|
for child in class_node.body
|
|
@@ -243,7 +242,7 @@ class SymbolTableBuilder:
|
|
|
243
242
|
child, "end_lineno", start_line + len(child.body)
|
|
244
243
|
)
|
|
245
244
|
code_start_line = child.body[0].lineno if child.body else start_line
|
|
246
|
-
code =
|
|
245
|
+
code: str = ast.unparse(child).strip()
|
|
247
246
|
decorators = [ast.unparse(d) for d in child.decorator_list]
|
|
248
247
|
|
|
249
248
|
try:
|
|
@@ -260,27 +259,27 @@ class SymbolTableBuilder:
|
|
|
260
259
|
|
|
261
260
|
callables[method_name] = (
|
|
262
261
|
PyCallable.builder()
|
|
263
|
-
.
|
|
264
|
-
.
|
|
265
|
-
.
|
|
266
|
-
.
|
|
267
|
-
.
|
|
268
|
-
.
|
|
269
|
-
.
|
|
270
|
-
.
|
|
271
|
-
.
|
|
272
|
-
.
|
|
273
|
-
.
|
|
274
|
-
.
|
|
275
|
-
.
|
|
276
|
-
.
|
|
262
|
+
.name(method_name)
|
|
263
|
+
.path(script.path.__str__())
|
|
264
|
+
.signature(signature)
|
|
265
|
+
.decorators(decorators)
|
|
266
|
+
.code(code)
|
|
267
|
+
.start_line(start_line)
|
|
268
|
+
.end_line(end_line)
|
|
269
|
+
.code_start_line(code_start_line)
|
|
270
|
+
.accessed_symbols(self._accessed_symbols(child, script))
|
|
271
|
+
.call_sites(self._call_sites(child, script))
|
|
272
|
+
.local_variables(self._local_variables(child, script))
|
|
273
|
+
.cyclomatic_complexity(self._cyclomatic_complexity(child))
|
|
274
|
+
.parameters(self._callable_parameters(child, script))
|
|
275
|
+
.return_type(
|
|
277
276
|
ast.unparse(child.returns)
|
|
278
277
|
if child.returns
|
|
279
278
|
else self._infer_type(
|
|
280
279
|
script, child.lineno, child.col_offset
|
|
281
280
|
)
|
|
282
281
|
)
|
|
283
|
-
.
|
|
282
|
+
.comments(self._pycomments(child, code))
|
|
284
283
|
.build()
|
|
285
284
|
)
|
|
286
285
|
|
|
@@ -327,12 +326,12 @@ class SymbolTableBuilder:
|
|
|
327
326
|
|
|
328
327
|
comments.append(
|
|
329
328
|
PyComment.builder()
|
|
330
|
-
.
|
|
331
|
-
.
|
|
332
|
-
.
|
|
333
|
-
.
|
|
334
|
-
.
|
|
335
|
-
.
|
|
329
|
+
.content(docstring_content)
|
|
330
|
+
.start_line(start_line)
|
|
331
|
+
.end_line(end_line)
|
|
332
|
+
.start_column(start_column)
|
|
333
|
+
.end_column(end_column)
|
|
334
|
+
.is_docstring(True)
|
|
336
335
|
.build()
|
|
337
336
|
)
|
|
338
337
|
|
|
@@ -348,12 +347,12 @@ class SymbolTableBuilder:
|
|
|
348
347
|
comment_text = tok.string.lstrip("#").strip()
|
|
349
348
|
comments.append(
|
|
350
349
|
PyComment.builder()
|
|
351
|
-
.
|
|
352
|
-
.
|
|
353
|
-
.
|
|
354
|
-
.
|
|
355
|
-
.
|
|
356
|
-
.
|
|
350
|
+
.content(comment_text)
|
|
351
|
+
.start_line(tok_line)
|
|
352
|
+
.end_line(tok_line)
|
|
353
|
+
.start_column(tok_col)
|
|
354
|
+
.end_column(tok_col + len(tok.string))
|
|
355
|
+
.is_docstring(False)
|
|
357
356
|
.build()
|
|
358
357
|
)
|
|
359
358
|
|
|
@@ -380,14 +379,14 @@ class SymbolTableBuilder:
|
|
|
380
379
|
if isinstance(target, ast.Name):
|
|
381
380
|
attributes[target.id] = (
|
|
382
381
|
PyClassAttribute.builder()
|
|
383
|
-
.
|
|
384
|
-
.
|
|
382
|
+
.name(target.id)
|
|
383
|
+
.type(
|
|
385
384
|
self._infer_type(
|
|
386
385
|
script, target.lineno, target.col_offset
|
|
387
386
|
)
|
|
388
387
|
)
|
|
389
|
-
.
|
|
390
|
-
.
|
|
388
|
+
.start_line(getattr(target, "lineno", -1))
|
|
389
|
+
.end_line(getattr(stmt, "end_lineno", stmt.lineno))
|
|
391
390
|
.build()
|
|
392
391
|
)
|
|
393
392
|
|
|
@@ -396,16 +395,16 @@ class SymbolTableBuilder:
|
|
|
396
395
|
if isinstance(target, ast.Name):
|
|
397
396
|
attributes[target.id] = (
|
|
398
397
|
PyClassAttribute.builder()
|
|
399
|
-
.
|
|
400
|
-
.
|
|
398
|
+
.name(target.id)
|
|
399
|
+
.type(
|
|
401
400
|
ast.unparse(stmt.annotation)
|
|
402
401
|
if stmt.annotation
|
|
403
402
|
else self._infer_type(
|
|
404
403
|
script, target.lineno, target.col_offset
|
|
405
404
|
)
|
|
406
405
|
)
|
|
407
|
-
.
|
|
408
|
-
.
|
|
406
|
+
.start_line(getattr(target, "lineno", -1))
|
|
407
|
+
.end_line(getattr(stmt, "end_lineno", stmt.lineno))
|
|
409
408
|
.build()
|
|
410
409
|
)
|
|
411
410
|
# We may also encounter `__slots__` in class definitions.
|
|
@@ -428,10 +427,10 @@ class SymbolTableBuilder:
|
|
|
428
427
|
value = elt.s if isinstance(elt, ast.Str) else elt.value
|
|
429
428
|
attributes[value] = (
|
|
430
429
|
PyClassAttribute.builder()
|
|
431
|
-
.
|
|
432
|
-
.
|
|
433
|
-
.
|
|
434
|
-
.
|
|
430
|
+
.name(value)
|
|
431
|
+
.type("slot")
|
|
432
|
+
.start_line(getattr(stmt, "lineno", -1))
|
|
433
|
+
.end_line(getattr(stmt, "end_lineno", stmt.lineno))
|
|
435
434
|
.build()
|
|
436
435
|
)
|
|
437
436
|
|
|
@@ -472,15 +471,15 @@ class SymbolTableBuilder:
|
|
|
472
471
|
) -> PyCallableParameter:
|
|
473
472
|
return (
|
|
474
473
|
PyCallableParameter.builder()
|
|
475
|
-
.
|
|
476
|
-
.
|
|
477
|
-
.
|
|
478
|
-
.
|
|
479
|
-
.
|
|
474
|
+
.name(arg_node.arg)
|
|
475
|
+
.type(resolve_type(arg_node))
|
|
476
|
+
.default_value(ast.unparse(default) if default else None)
|
|
477
|
+
.start_line(getattr(arg_node, "lineno", -1))
|
|
478
|
+
.end_line(
|
|
480
479
|
getattr(arg_node, "end_lineno", getattr(arg_node, "lineno", -1))
|
|
481
480
|
)
|
|
482
|
-
.
|
|
483
|
-
.
|
|
481
|
+
.start_column(getattr(arg_node, "col_offset", -1))
|
|
482
|
+
.end_column(getattr(arg_node, "end_col_offset", -1))
|
|
484
483
|
.build()
|
|
485
484
|
)
|
|
486
485
|
|
|
@@ -559,17 +558,17 @@ class SymbolTableBuilder:
|
|
|
559
558
|
|
|
560
559
|
call_sites.append(
|
|
561
560
|
PyCallsite.builder()
|
|
562
|
-
.
|
|
563
|
-
.
|
|
564
|
-
.
|
|
565
|
-
.
|
|
566
|
-
.
|
|
567
|
-
.
|
|
568
|
-
.
|
|
569
|
-
.
|
|
570
|
-
.
|
|
571
|
-
.
|
|
572
|
-
.
|
|
561
|
+
.method_name(method_name)
|
|
562
|
+
.receiver_expr(receiver_expr)
|
|
563
|
+
.receiver_type(receiver_type)
|
|
564
|
+
.argument_types(argument_types)
|
|
565
|
+
.return_type(return_type)
|
|
566
|
+
.callee_signature(callee_signature)
|
|
567
|
+
.is_constructor_call(method_name == "__init__")
|
|
568
|
+
.start_line(getattr(node, "lineno", -1))
|
|
569
|
+
.start_column(getattr(node, "col_offset", -1))
|
|
570
|
+
.end_line(getattr(node, "end_lineno", -1))
|
|
571
|
+
.end_column(getattr(node, "end_col_offset", -1))
|
|
573
572
|
.build()
|
|
574
573
|
)
|
|
575
574
|
|
|
@@ -611,23 +610,23 @@ class SymbolTableBuilder:
|
|
|
611
610
|
if isinstance(target, ast.Name):
|
|
612
611
|
module_vars.append(
|
|
613
612
|
PyVariableDeclaration.builder()
|
|
614
|
-
.
|
|
615
|
-
.
|
|
613
|
+
.name(target.id)
|
|
614
|
+
.type(
|
|
616
615
|
self._infer_type(
|
|
617
616
|
script, target.lineno, target.col_offset
|
|
618
617
|
)
|
|
619
618
|
)
|
|
620
|
-
.
|
|
619
|
+
.initializer(
|
|
621
620
|
ast.unparse(node.value) if node.value else None
|
|
622
621
|
)
|
|
623
|
-
.
|
|
624
|
-
.
|
|
625
|
-
.
|
|
626
|
-
.
|
|
622
|
+
.value(None)
|
|
623
|
+
.scope("module")
|
|
624
|
+
.start_line(getattr(target, "lineno", -1))
|
|
625
|
+
.end_line(
|
|
627
626
|
getattr(node, "end_lineno", getattr(node, "lineno", -1))
|
|
628
627
|
)
|
|
629
|
-
.
|
|
630
|
-
.
|
|
628
|
+
.start_column(getattr(target, "col_offset", -1))
|
|
629
|
+
.end_column(getattr(target, "end_col_offset", -1))
|
|
631
630
|
.build()
|
|
632
631
|
)
|
|
633
632
|
|
|
@@ -638,23 +637,21 @@ class SymbolTableBuilder:
|
|
|
638
637
|
if isinstance(target, ast.Name):
|
|
639
638
|
module_vars.append(
|
|
640
639
|
PyVariableDeclaration.builder()
|
|
641
|
-
.
|
|
642
|
-
.
|
|
640
|
+
.name(target.id)
|
|
641
|
+
.type(
|
|
643
642
|
ast.unparse(node.annotation)
|
|
644
643
|
if node.annotation
|
|
645
644
|
else self._infer_type(script, node.lineno, node.col_offset)
|
|
646
645
|
)
|
|
647
|
-
.
|
|
648
|
-
|
|
649
|
-
)
|
|
650
|
-
.
|
|
651
|
-
.
|
|
652
|
-
.with_start_line(getattr(target, "lineno", -1))
|
|
653
|
-
.with_end_line(
|
|
646
|
+
.initializer(ast.unparse(node.value) if node.value else None)
|
|
647
|
+
.value(None)
|
|
648
|
+
.scope("module")
|
|
649
|
+
.start_line(getattr(target, "lineno", -1))
|
|
650
|
+
.end_line(
|
|
654
651
|
getattr(node, "end_lineno", getattr(node, "lineno", -1))
|
|
655
652
|
)
|
|
656
|
-
.
|
|
657
|
-
.
|
|
653
|
+
.start_column(getattr(target, "col_offset", -1))
|
|
654
|
+
.end_column(getattr(target, "end_col_offset", -1))
|
|
658
655
|
.build()
|
|
659
656
|
)
|
|
660
657
|
|
|
@@ -682,23 +679,23 @@ class SymbolTableBuilder:
|
|
|
682
679
|
if isinstance(target, ast.Name):
|
|
683
680
|
local_vars.append(
|
|
684
681
|
PyVariableDeclaration.builder()
|
|
685
|
-
.
|
|
686
|
-
.
|
|
682
|
+
.name(target.id)
|
|
683
|
+
.type(
|
|
687
684
|
self._infer_type(
|
|
688
685
|
script, target.lineno, target.col_offset
|
|
689
686
|
)
|
|
690
687
|
)
|
|
691
|
-
.
|
|
688
|
+
.initializer(
|
|
692
689
|
ast.unparse(node.value) if node.value else None
|
|
693
690
|
)
|
|
694
|
-
.
|
|
695
|
-
.
|
|
696
|
-
.
|
|
697
|
-
.
|
|
691
|
+
.value(None)
|
|
692
|
+
.scope("function")
|
|
693
|
+
.start_line(getattr(target, "lineno", -1))
|
|
694
|
+
.end_line(
|
|
698
695
|
getattr(node, "end_lineno", getattr(node, "lineno", -1))
|
|
699
696
|
)
|
|
700
|
-
.
|
|
701
|
-
.
|
|
697
|
+
.start_column(getattr(target, "col_offset", -1))
|
|
698
|
+
.end_column(getattr(target, "end_col_offset", -1))
|
|
702
699
|
.build()
|
|
703
700
|
)
|
|
704
701
|
# This handles instance attribute assignments like self.attr = value
|
|
@@ -709,23 +706,23 @@ class SymbolTableBuilder:
|
|
|
709
706
|
):
|
|
710
707
|
local_vars.append(
|
|
711
708
|
PyVariableDeclaration.builder()
|
|
712
|
-
.
|
|
713
|
-
.
|
|
709
|
+
.name(target.attr)
|
|
710
|
+
.type(
|
|
714
711
|
self._infer_type(
|
|
715
712
|
script, target.lineno, target.col_offset
|
|
716
713
|
)
|
|
717
714
|
)
|
|
718
|
-
.
|
|
715
|
+
.initializer(
|
|
719
716
|
ast.unparse(node.value) if node.value else None
|
|
720
717
|
)
|
|
721
|
-
.
|
|
722
|
-
.
|
|
723
|
-
.
|
|
724
|
-
.
|
|
718
|
+
.value(None)
|
|
719
|
+
.scope("class")
|
|
720
|
+
.start_line(getattr(target, "lineno", -1))
|
|
721
|
+
.end_line(
|
|
725
722
|
getattr(node, "end_lineno", getattr(node, "lineno", -1))
|
|
726
723
|
)
|
|
727
|
-
.
|
|
728
|
-
.
|
|
724
|
+
.start_column(getattr(target, "col_offset", -1))
|
|
725
|
+
.end_column(getattr(target, "end_col_offset", -1))
|
|
729
726
|
.build()
|
|
730
727
|
)
|
|
731
728
|
|
|
@@ -741,17 +738,17 @@ class SymbolTableBuilder:
|
|
|
741
738
|
if isinstance(target, ast.Name):
|
|
742
739
|
local_vars.append(
|
|
743
740
|
PyVariableDeclaration.builder()
|
|
744
|
-
.
|
|
745
|
-
.
|
|
746
|
-
.
|
|
747
|
-
.
|
|
748
|
-
.
|
|
749
|
-
.
|
|
750
|
-
.
|
|
741
|
+
.name(target.id)
|
|
742
|
+
.type(annotation_str)
|
|
743
|
+
.initializer(initializer_str)
|
|
744
|
+
.value(None)
|
|
745
|
+
.scope("function")
|
|
746
|
+
.start_line(getattr(target, "lineno", -1))
|
|
747
|
+
.end_line(
|
|
751
748
|
getattr(node, "end_lineno", getattr(node, "lineno", -1))
|
|
752
749
|
)
|
|
753
|
-
.
|
|
754
|
-
.
|
|
750
|
+
.start_column(getattr(target, "col_offset", -1))
|
|
751
|
+
.end_column(getattr(target, "end_col_offset", -1))
|
|
755
752
|
.build()
|
|
756
753
|
)
|
|
757
754
|
# Annotated instance attribute: self.attr: int = SOME_VALUE
|
|
@@ -762,17 +759,17 @@ class SymbolTableBuilder:
|
|
|
762
759
|
):
|
|
763
760
|
local_vars.append(
|
|
764
761
|
PyVariableDeclaration.builder()
|
|
765
|
-
.
|
|
766
|
-
.
|
|
767
|
-
.
|
|
768
|
-
.
|
|
769
|
-
.
|
|
770
|
-
.
|
|
771
|
-
.
|
|
762
|
+
.name(target.attr)
|
|
763
|
+
.type(annotation_str)
|
|
764
|
+
.initializer(initializer_str)
|
|
765
|
+
.value(None)
|
|
766
|
+
.scope("class")
|
|
767
|
+
.start_line(getattr(target, "lineno", -1))
|
|
768
|
+
.end_line(
|
|
772
769
|
getattr(node, "end_lineno", getattr(node, "lineno", -1))
|
|
773
770
|
)
|
|
774
|
-
.
|
|
775
|
-
.
|
|
771
|
+
.start_column(getattr(target, "col_offset", -1))
|
|
772
|
+
.end_column(getattr(target, "end_col_offset", -1))
|
|
776
773
|
.build()
|
|
777
774
|
)
|
|
778
775
|
|
|
@@ -859,14 +856,14 @@ class SymbolTableBuilder:
|
|
|
859
856
|
|
|
860
857
|
return (
|
|
861
858
|
PySymbol.builder()
|
|
862
|
-
.
|
|
863
|
-
.
|
|
864
|
-
.
|
|
865
|
-
.
|
|
866
|
-
.
|
|
867
|
-
.
|
|
868
|
-
.
|
|
869
|
-
.
|
|
859
|
+
.name(name)
|
|
860
|
+
.scope(scope)
|
|
861
|
+
.kind(kind)
|
|
862
|
+
.type(inferred_type)
|
|
863
|
+
.qualified_name(qname)
|
|
864
|
+
.is_builtin(is_builtin)
|
|
865
|
+
.lineno(lineno)
|
|
866
|
+
.col_offset(col_offset)
|
|
870
867
|
.build()
|
|
871
868
|
)
|
|
872
869
|
|
codeanalyzer/utils/__init__.py
CHANGED
codeanalyzer/utils/logging.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
1
4
|
from rich.console import Console
|
|
2
5
|
from rich.progress import (
|
|
6
|
+
BarColumn,
|
|
3
7
|
Progress,
|
|
4
8
|
SpinnerColumn,
|
|
9
|
+
TaskID,
|
|
5
10
|
TextColumn,
|
|
6
|
-
BarColumn,
|
|
7
11
|
TimeElapsedColumn,
|
|
8
12
|
TimeRemainingColumn,
|
|
9
|
-
TaskID,
|
|
10
13
|
)
|
|
11
|
-
from typing import Optional
|
|
12
|
-
import logging
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class ProgressBar:
|