codinsight 0.3.0__tar.gz → 0.4.1__tar.gz
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.
- {codinsight-0.3.0 → codinsight-0.4.1}/PKG-INFO +3 -2
- {codinsight-0.3.0 → codinsight-0.4.1}/pyproject.toml +3 -2
- codinsight-0.4.1/src/code_insight/code_analysis/vector.py +80 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/core.py +11 -3
- {codinsight-0.3.0 → codinsight-0.4.1}/src/codinsight.egg-info/PKG-INFO +3 -2
- {codinsight-0.3.0 → codinsight-0.4.1}/src/codinsight.egg-info/SOURCES.txt +1 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/codinsight.egg-info/requires.txt +1 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/README.md +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/setup.cfg +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/__init__.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/__init__.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/abstract.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/algorithm.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/complexity.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/quality.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/readability.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/redundancy.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/security.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/struct.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/code_analysis/style.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/multi_analysis.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/py.typed +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/trend_analysis/__init__.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/code_insight/trend_analysis/trend_analysis.py +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/codinsight.egg-info/dependency_links.txt +0 -0
- {codinsight-0.3.0 → codinsight-0.4.1}/src/codinsight.egg-info/top_level.txt +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codinsight
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Add your description here
|
|
5
|
-
Requires-Python: >=3.
|
|
5
|
+
Requires-Python: >=3.13
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: codetovec==0.0.2
|
|
7
8
|
Requires-Dist: matplotlib>=3.10.5
|
|
8
9
|
Requires-Dist: pandas>=2.3.1
|
|
9
10
|
Requires-Dist: pycodestyle>=2.14.0
|
|
@@ -4,11 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codinsight"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.1"
|
|
8
8
|
description = "Add your description here"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.13"
|
|
11
11
|
dependencies = [
|
|
12
|
+
"codetovec==0.0.2",
|
|
12
13
|
"matplotlib>=3.10.5",
|
|
13
14
|
"pandas>=2.3.1",
|
|
14
15
|
"pycodestyle>=2.14.0",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
|
|
2
|
+
from code_insight.code_analysis.abstract import (
|
|
3
|
+
AbstractAnalysis,
|
|
4
|
+
BaseAnalysisConfig,
|
|
5
|
+
BaseAnalysisResult,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
from codetovec import CodeToVec
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class VectorAnalysisConfig(BaseAnalysisConfig):
|
|
12
|
+
"""
|
|
13
|
+
ベクトル解析の設定
|
|
14
|
+
|
|
15
|
+
Attributes
|
|
16
|
+
----------
|
|
17
|
+
remove_comments : bool
|
|
18
|
+
コメントを削除するかどうか, by default False
|
|
19
|
+
remove_docstrings : bool
|
|
20
|
+
Docstringを削除するかどうか, by default False
|
|
21
|
+
remove_blank_lines : bool
|
|
22
|
+
空行を削除するかどうか, by default False
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
remove_comments: bool = False
|
|
26
|
+
remove_docstrings: bool = False
|
|
27
|
+
remove_blank_lines: bool = False
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class VectorAnalysisResult(BaseAnalysisResult):
|
|
31
|
+
"""
|
|
32
|
+
ベクトル解析結果
|
|
33
|
+
|
|
34
|
+
Attributes
|
|
35
|
+
----------
|
|
36
|
+
vector : list[float]
|
|
37
|
+
抽出されたベクトル表現
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
vector: list[float]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class Vector(AbstractAnalysis[VectorAnalysisResult, VectorAnalysisConfig]):
|
|
44
|
+
"""
|
|
45
|
+
ベクトル解析クラス
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def get_default_config(self) -> VectorAnalysisConfig:
|
|
49
|
+
"""
|
|
50
|
+
デフォルト設定を取得
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
VectorAnalysisConfig
|
|
55
|
+
デフォルトのベクトル解析設定
|
|
56
|
+
"""
|
|
57
|
+
return VectorAnalysisConfig()
|
|
58
|
+
|
|
59
|
+
def analyze(self, source_code: str) -> VectorAnalysisResult:
|
|
60
|
+
"""
|
|
61
|
+
ソースコードからベクトルを抽出する
|
|
62
|
+
|
|
63
|
+
Parameters
|
|
64
|
+
----------
|
|
65
|
+
source_code : str
|
|
66
|
+
解析対象のソースコード
|
|
67
|
+
|
|
68
|
+
Returns
|
|
69
|
+
-------
|
|
70
|
+
VectorAnalysisResult
|
|
71
|
+
抽出されたベクトル表現
|
|
72
|
+
"""
|
|
73
|
+
codetovec = CodeToVec()
|
|
74
|
+
vector = codetovec.execute(
|
|
75
|
+
text=source_code,
|
|
76
|
+
remove_comments=self.config.remove_comments,
|
|
77
|
+
remove_docstrings=self.config.remove_docstrings,
|
|
78
|
+
remove_blank_lines=self.config.remove_blank_lines,
|
|
79
|
+
)
|
|
80
|
+
return VectorAnalysisResult(vector=vector)
|
|
@@ -18,7 +18,8 @@ from code_insight.code_analysis.readability import (
|
|
|
18
18
|
from code_insight.code_analysis.redundancy import Redundancy, RedundancyAnalysisConfig
|
|
19
19
|
from code_insight.code_analysis.security import Security, SecurityAnalysisConfig
|
|
20
20
|
from code_insight.code_analysis.struct import Struct, StructAnalysisConfig
|
|
21
|
-
from code_insight.code_analysis.style import Style, StyleAnalysisConfig
|
|
21
|
+
from code_insight.code_analysis.style import Style, StyleAnalysisConfig
|
|
22
|
+
from code_insight.code_analysis.vector import Vector, VectorAnalysisConfig
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class AnalysisConfigs(BaseModel):
|
|
@@ -52,7 +53,8 @@ class AnalysisConfigs(BaseModel):
|
|
|
52
53
|
algorithm: AlgorithmAnalysisConfig | None = None
|
|
53
54
|
complexity: ComplexityAnalysisConfig | None = None
|
|
54
55
|
quality: QualityAnalysisConfig | None = None
|
|
55
|
-
security: SecurityAnalysisConfig | None = None
|
|
56
|
+
security: SecurityAnalysisConfig | None = None
|
|
57
|
+
vector: VectorAnalysisConfig | None = None
|
|
56
58
|
|
|
57
59
|
|
|
58
60
|
class CodeAnalysisType(StrEnum):
|
|
@@ -77,6 +79,8 @@ class CodeAnalysisType(StrEnum):
|
|
|
77
79
|
品質解析
|
|
78
80
|
SECURITY : str
|
|
79
81
|
セキュリティ解析
|
|
82
|
+
VECTOR : str
|
|
83
|
+
ベクトル解析
|
|
80
84
|
"""
|
|
81
85
|
|
|
82
86
|
STYLE = auto()
|
|
@@ -87,6 +91,7 @@ class CodeAnalysisType(StrEnum):
|
|
|
87
91
|
COMPLEXITY = auto()
|
|
88
92
|
QUALITY = auto()
|
|
89
93
|
SECURITY = auto()
|
|
94
|
+
VECTOR = auto()
|
|
90
95
|
|
|
91
96
|
@staticmethod
|
|
92
97
|
def get_code_analysis_class(
|
|
@@ -128,6 +133,8 @@ class CodeAnalysisType(StrEnum):
|
|
|
128
133
|
return Quality(config) # type: ignore
|
|
129
134
|
elif type == CodeAnalysisType.SECURITY:
|
|
130
135
|
return Security(config) # type: ignore
|
|
136
|
+
elif type == CodeAnalysisType.VECTOR:
|
|
137
|
+
return Vector(config) # type: ignore
|
|
131
138
|
else:
|
|
132
139
|
raise ValueError(f"Invalid code analysis type: {type}")
|
|
133
140
|
|
|
@@ -214,6 +221,7 @@ class CodeAnalysis:
|
|
|
214
221
|
CodeAnalysisType.ALGORITHM: self.configs.algorithm,
|
|
215
222
|
CodeAnalysisType.COMPLEXITY: self.configs.complexity,
|
|
216
223
|
CodeAnalysisType.QUALITY: self.configs.quality,
|
|
217
|
-
CodeAnalysisType.SECURITY: self.configs.security,
|
|
224
|
+
CodeAnalysisType.SECURITY: self.configs.security,
|
|
225
|
+
CodeAnalysisType.VECTOR: self.configs.vector,
|
|
218
226
|
}
|
|
219
227
|
return config_map.get(analysis_type)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codinsight
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Add your description here
|
|
5
|
-
Requires-Python: >=3.
|
|
5
|
+
Requires-Python: >=3.13
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: codetovec==0.0.2
|
|
7
8
|
Requires-Dist: matplotlib>=3.10.5
|
|
8
9
|
Requires-Dist: pandas>=2.3.1
|
|
9
10
|
Requires-Dist: pycodestyle>=2.14.0
|
|
@@ -14,6 +14,7 @@ src/code_insight/code_analysis/redundancy.py
|
|
|
14
14
|
src/code_insight/code_analysis/security.py
|
|
15
15
|
src/code_insight/code_analysis/struct.py
|
|
16
16
|
src/code_insight/code_analysis/style.py
|
|
17
|
+
src/code_insight/code_analysis/vector.py
|
|
17
18
|
src/code_insight/trend_analysis/__init__.py
|
|
18
19
|
src/code_insight/trend_analysis/trend_analysis.py
|
|
19
20
|
src/codinsight.egg-info/PKG-INFO
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|