kotharcomputing 0.81.0__tar.gz → 0.83.0__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.
- {kotharcomputing-0.81.0/src/kotharcomputing.egg-info → kotharcomputing-0.83.0}/PKG-INFO +1 -1
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/pyproject.toml +1 -1
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/__init__.py +8 -0
- kotharcomputing-0.83.0/src/kotharcomputing/aleph_language_server.py +162 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0/src/kotharcomputing.egg-info}/PKG-INFO +1 -1
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/tests/test_public_api.py +4 -0
- kotharcomputing-0.81.0/src/kotharcomputing/aleph_language_server.py +0 -80
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/LICENSE +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/README.md +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/setup.cfg +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/agents.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/ai.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/api_tokens.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/client.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/common.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/credits.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/errors.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/executions.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/fetch.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/files.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/jobs.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/py.typed +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/runtimes.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/service_prices.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/subscribe_user.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/subscribe_workspace.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/subscriptions.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/users.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/workspaces.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing.egg-info/SOURCES.txt +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing.egg-info/dependency_links.txt +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing.egg-info/requires.txt +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing.egg-info/top_level.txt +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/tests/test_fetch_auth_headers.py +0 -0
- {kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/tests/test_fetch_url_building.py +0 -0
|
@@ -2,6 +2,10 @@ from .aleph_language_server import (
|
|
|
2
2
|
AlephLanguageServerClient,
|
|
3
3
|
AlephLanguageServerClientOptions,
|
|
4
4
|
AnalyzeResult,
|
|
5
|
+
AnalyzeResultWithAst,
|
|
6
|
+
AstNode,
|
|
7
|
+
AstNodeLocation,
|
|
8
|
+
AstNodeType,
|
|
5
9
|
Diagnostic,
|
|
6
10
|
DiagnosticSeverity,
|
|
7
11
|
Position,
|
|
@@ -127,6 +131,10 @@ __all__ = [
|
|
|
127
131
|
"AlephLanguageServerClient",
|
|
128
132
|
"AlephLanguageServerClientOptions",
|
|
129
133
|
"AnalyzeResult",
|
|
134
|
+
"AnalyzeResultWithAst",
|
|
135
|
+
"AstNode",
|
|
136
|
+
"AstNodeLocation",
|
|
137
|
+
"AstNodeType",
|
|
130
138
|
"Diagnostic",
|
|
131
139
|
"DiagnosticSeverity",
|
|
132
140
|
"Position",
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from enum import IntEnum
|
|
5
|
+
from typing import Literal, NotRequired, TypedDict, cast, overload
|
|
6
|
+
|
|
7
|
+
from .fetch import ApiTransport
|
|
8
|
+
|
|
9
|
+
DEFAULT_BASE_URL = "https://lsp.kotharcomputing.com"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass(slots=True)
|
|
13
|
+
class AlephLanguageServerClientOptions:
|
|
14
|
+
base_url: str = DEFAULT_BASE_URL
|
|
15
|
+
timeout: float = 30.0
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AlephLanguageServerClient:
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
options: AlephLanguageServerClientOptions | None = None,
|
|
22
|
+
*,
|
|
23
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
24
|
+
timeout: float = 30.0,
|
|
25
|
+
) -> None:
|
|
26
|
+
if options is None:
|
|
27
|
+
options = AlephLanguageServerClientOptions(
|
|
28
|
+
base_url=base_url,
|
|
29
|
+
timeout=timeout,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
self._transport = ApiTransport(
|
|
33
|
+
base_url=options.base_url,
|
|
34
|
+
access_token=None,
|
|
35
|
+
timeout=options.timeout,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def version(self) -> dict[str, str]:
|
|
39
|
+
return self._transport.get_json("version")
|
|
40
|
+
|
|
41
|
+
@overload
|
|
42
|
+
def analyze(
|
|
43
|
+
self, code: str, *, include_ast: Literal[True]
|
|
44
|
+
) -> AnalyzeResultWithAst: ...
|
|
45
|
+
@overload
|
|
46
|
+
def analyze(self, code: str, *, include_ast: bool = ...) -> AnalyzeResult: ...
|
|
47
|
+
|
|
48
|
+
def analyze(
|
|
49
|
+
self, code: str, *, include_ast: bool = False
|
|
50
|
+
) -> AnalyzeResult | AnalyzeResultWithAst:
|
|
51
|
+
response = self._transport.raw(
|
|
52
|
+
"post",
|
|
53
|
+
"analyze",
|
|
54
|
+
headers={"Content-Type": "application/x-aleph"},
|
|
55
|
+
search_params={"include_ast": "true"} if include_ast else None,
|
|
56
|
+
body=code,
|
|
57
|
+
)
|
|
58
|
+
return cast(
|
|
59
|
+
AnalyzeResultWithAst if include_ast else AnalyzeResult, response.json()
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# -- LSP Diagnostic types (based on LSP 3.17 specification) --
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class DiagnosticSeverity(IntEnum):
|
|
67
|
+
Error = 1
|
|
68
|
+
Warning = 2
|
|
69
|
+
Information = 3
|
|
70
|
+
Hint = 4
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Position(TypedDict):
|
|
74
|
+
line: int
|
|
75
|
+
character: int
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class Range(TypedDict):
|
|
79
|
+
start: Position
|
|
80
|
+
end: Position
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class Diagnostic(TypedDict):
|
|
84
|
+
range: Range
|
|
85
|
+
message: str
|
|
86
|
+
severity: NotRequired[DiagnosticSeverity]
|
|
87
|
+
code: NotRequired[str | int]
|
|
88
|
+
source: NotRequired[str]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class AnalyzeResult(TypedDict):
|
|
92
|
+
diagnostics: list[Diagnostic]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class AnalyzeResultWithAst(AnalyzeResult):
|
|
96
|
+
ast: list[AstNode]
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class AstNode(TypedDict):
|
|
100
|
+
type: AstNodeType
|
|
101
|
+
text: NotRequired[str]
|
|
102
|
+
isSynthetic: NotRequired[Literal[True]]
|
|
103
|
+
location: NotRequired[AstNodeLocation]
|
|
104
|
+
children: NotRequired[list[AstNode]]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class AstNodeLocation(TypedDict):
|
|
108
|
+
uri: NotRequired[str]
|
|
109
|
+
range: Range
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
AstNodeType = Literal[
|
|
113
|
+
"Id",
|
|
114
|
+
"Fun_Call",
|
|
115
|
+
"Unused_Return_Fun_Call",
|
|
116
|
+
"Arg_List",
|
|
117
|
+
"Slice_List",
|
|
118
|
+
"Slice",
|
|
119
|
+
"Equation",
|
|
120
|
+
"Var_Decl",
|
|
121
|
+
"Assign_Decl",
|
|
122
|
+
"Array_Call",
|
|
123
|
+
"Dot_Access",
|
|
124
|
+
"Lambda",
|
|
125
|
+
"Block",
|
|
126
|
+
"Scopeless_Block",
|
|
127
|
+
"Include",
|
|
128
|
+
"Def",
|
|
129
|
+
"While",
|
|
130
|
+
"If",
|
|
131
|
+
"For",
|
|
132
|
+
"Ranged_For",
|
|
133
|
+
"Inline_Array",
|
|
134
|
+
"Inline_Map",
|
|
135
|
+
"Return",
|
|
136
|
+
"File",
|
|
137
|
+
"Prefix",
|
|
138
|
+
"Break",
|
|
139
|
+
"Continue",
|
|
140
|
+
"Map_Pair",
|
|
141
|
+
"Value_Range",
|
|
142
|
+
"Inline_Range",
|
|
143
|
+
"Try",
|
|
144
|
+
"Catch",
|
|
145
|
+
"Finally",
|
|
146
|
+
"Method",
|
|
147
|
+
"Attr_Decl",
|
|
148
|
+
"Logical_And",
|
|
149
|
+
"Logical_Or",
|
|
150
|
+
"Reference",
|
|
151
|
+
"Switch",
|
|
152
|
+
"Case",
|
|
153
|
+
"Default",
|
|
154
|
+
"Noop",
|
|
155
|
+
"Class",
|
|
156
|
+
"Binary",
|
|
157
|
+
"Arg",
|
|
158
|
+
"Global_Decl",
|
|
159
|
+
"Constant",
|
|
160
|
+
"Compiled",
|
|
161
|
+
"Error",
|
|
162
|
+
]
|
|
@@ -18,6 +18,10 @@ def test_package_import_and_public_exports() -> None:
|
|
|
18
18
|
"AlephLanguageServerClient",
|
|
19
19
|
"AlephLanguageServerClientOptions",
|
|
20
20
|
"AnalyzeResult",
|
|
21
|
+
"AnalyzeResultWithAst",
|
|
22
|
+
"AstNode",
|
|
23
|
+
"AstNodeLocation",
|
|
24
|
+
"AstNodeType",
|
|
21
25
|
"Diagnostic",
|
|
22
26
|
"DiagnosticSeverity",
|
|
23
27
|
"Position",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from enum import IntEnum
|
|
5
|
-
from typing import NotRequired, TypedDict, cast
|
|
6
|
-
|
|
7
|
-
from .fetch import ApiTransport
|
|
8
|
-
|
|
9
|
-
DEFAULT_BASE_URL = "https://lsp.kotharcomputing.com"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@dataclass(slots=True)
|
|
13
|
-
class AlephLanguageServerClientOptions:
|
|
14
|
-
base_url: str = DEFAULT_BASE_URL
|
|
15
|
-
timeout: float = 30.0
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class AlephLanguageServerClient:
|
|
19
|
-
def __init__(
|
|
20
|
-
self,
|
|
21
|
-
options: AlephLanguageServerClientOptions | None = None,
|
|
22
|
-
*,
|
|
23
|
-
base_url: str = DEFAULT_BASE_URL,
|
|
24
|
-
timeout: float = 30.0,
|
|
25
|
-
) -> None:
|
|
26
|
-
if options is None:
|
|
27
|
-
options = AlephLanguageServerClientOptions(
|
|
28
|
-
base_url=base_url,
|
|
29
|
-
timeout=timeout,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
self._transport = ApiTransport(
|
|
33
|
-
base_url=options.base_url,
|
|
34
|
-
access_token=None,
|
|
35
|
-
timeout=options.timeout,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
def version(self) -> dict[str, str]:
|
|
39
|
-
return self._transport.get_json("version")
|
|
40
|
-
|
|
41
|
-
def analyze(self, code: str) -> AnalyzeResult:
|
|
42
|
-
response = self._transport.raw(
|
|
43
|
-
"post",
|
|
44
|
-
"analyze",
|
|
45
|
-
headers={"Content-Type": "application/x-aleph"},
|
|
46
|
-
body=code,
|
|
47
|
-
)
|
|
48
|
-
return cast(AnalyzeResult, response.json())
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# -- LSP Diagnostic types (based on LSP 3.17 specification) --
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class DiagnosticSeverity(IntEnum):
|
|
55
|
-
Error = 1
|
|
56
|
-
Warning = 2
|
|
57
|
-
Information = 3
|
|
58
|
-
Hint = 4
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class Position(TypedDict):
|
|
62
|
-
line: int
|
|
63
|
-
character: int
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
class Range(TypedDict):
|
|
67
|
-
start: Position
|
|
68
|
-
end: Position
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class Diagnostic(TypedDict):
|
|
72
|
-
range: Range
|
|
73
|
-
message: str
|
|
74
|
-
severity: NotRequired[DiagnosticSeverity]
|
|
75
|
-
code: NotRequired[str | int]
|
|
76
|
-
source: NotRequired[str]
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class AnalyzeResult(TypedDict):
|
|
80
|
-
diagnostics: list[Diagnostic]
|
|
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
|
{kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing/subscribe_workspace.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{kotharcomputing-0.81.0 → kotharcomputing-0.83.0}/src/kotharcomputing.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|