implica 1.1.6__cp38-abi3-win32.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.
- implica/__init__.py +40 -0
- implica/__init__.pyi +250 -0
- implica/implica.pyd +0 -0
- implica/py.typed +0 -0
- implica-1.1.6.dist-info/METADATA +12 -0
- implica-1.1.6.dist-info/RECORD +8 -0
- implica-1.1.6.dist-info/WHEEL +4 -0
- implica-1.1.6.dist-info/licenses/LICENSE +21 -0
implica/__init__.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from .implica import (
|
|
2
|
+
Variable,
|
|
3
|
+
Arrow,
|
|
4
|
+
BasicTerm,
|
|
5
|
+
Application,
|
|
6
|
+
Constant,
|
|
7
|
+
TypeSchema,
|
|
8
|
+
TermSchema,
|
|
9
|
+
NodePattern,
|
|
10
|
+
EdgePattern,
|
|
11
|
+
PathPattern,
|
|
12
|
+
Node,
|
|
13
|
+
Edge,
|
|
14
|
+
Graph,
|
|
15
|
+
Query,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from typing import Union
|
|
19
|
+
|
|
20
|
+
Type = Union[Variable, Arrow]
|
|
21
|
+
Term = Union[BasicTerm, Application]
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"Variable",
|
|
25
|
+
"Arrow",
|
|
26
|
+
"Type",
|
|
27
|
+
"Term",
|
|
28
|
+
"Constant",
|
|
29
|
+
"BasicTerm",
|
|
30
|
+
"Application",
|
|
31
|
+
"TypeSchema",
|
|
32
|
+
"TermSchema",
|
|
33
|
+
"NodePattern",
|
|
34
|
+
"EdgePattern",
|
|
35
|
+
"PathPattern",
|
|
36
|
+
"Node",
|
|
37
|
+
"Edge",
|
|
38
|
+
"Graph",
|
|
39
|
+
"Query",
|
|
40
|
+
]
|
implica/__init__.pyi
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
from typing import Dict, Optional, Any, List, Callable
|
|
2
|
+
|
|
3
|
+
# --- TYPING ---
|
|
4
|
+
|
|
5
|
+
## -- Type -----
|
|
6
|
+
class BaseType:
|
|
7
|
+
def uid(self) -> str: ...
|
|
8
|
+
def get_type_vars(self) -> List[Variable]: ...
|
|
9
|
+
def __str__(self) -> str: ...
|
|
10
|
+
def __repr__(self) -> str: ...
|
|
11
|
+
def __eq__(self, value: Type) -> bool: ...
|
|
12
|
+
|
|
13
|
+
class Variable(BaseType):
|
|
14
|
+
name: str
|
|
15
|
+
|
|
16
|
+
def __init__(self, name: str) -> None: ...
|
|
17
|
+
|
|
18
|
+
class Arrow(BaseType):
|
|
19
|
+
left: Type
|
|
20
|
+
right: Type
|
|
21
|
+
|
|
22
|
+
def __init__(self, left: Type, right: Type) -> None: ...
|
|
23
|
+
|
|
24
|
+
Type = Variable | Arrow
|
|
25
|
+
|
|
26
|
+
## -- Term -----
|
|
27
|
+
class BaseTerm:
|
|
28
|
+
def uid(self) -> str: ...
|
|
29
|
+
def type(self) -> Type: ...
|
|
30
|
+
def __str__(self) -> str: ...
|
|
31
|
+
def __repr__(self) -> str: ...
|
|
32
|
+
def __eq__(self, value: Term) -> bool: ...
|
|
33
|
+
def __call__(self, other: Term) -> Term: ...
|
|
34
|
+
|
|
35
|
+
class BasicTerm(BaseTerm):
|
|
36
|
+
|
|
37
|
+
name: str
|
|
38
|
+
type: Type
|
|
39
|
+
|
|
40
|
+
class Application(BaseTerm):
|
|
41
|
+
function: Term
|
|
42
|
+
argument: Term
|
|
43
|
+
|
|
44
|
+
Term = BasicTerm | Application
|
|
45
|
+
|
|
46
|
+
## -- Constant -----
|
|
47
|
+
class Constant:
|
|
48
|
+
name: str
|
|
49
|
+
type_schema: TypeSchema
|
|
50
|
+
|
|
51
|
+
def __init__(self, name: str, type_schema: TypeSchema, func: Callable) -> None: ...
|
|
52
|
+
def __call__(self, *args: Type) -> Term: ...
|
|
53
|
+
|
|
54
|
+
# --- Graph -----
|
|
55
|
+
|
|
56
|
+
## -- Node ------
|
|
57
|
+
|
|
58
|
+
class Node:
|
|
59
|
+
|
|
60
|
+
type: Type
|
|
61
|
+
term: Optional[Term]
|
|
62
|
+
properties: Dict[str, Any]
|
|
63
|
+
|
|
64
|
+
def __init__(
|
|
65
|
+
self, type: Type, term: Optional[Term] = None, properties: Dict[str, Any] = {}
|
|
66
|
+
) -> None: ...
|
|
67
|
+
def uid(self) -> str: ...
|
|
68
|
+
def __eq__(self, value: Node) -> bool: ...
|
|
69
|
+
def __str__(self) -> str: ...
|
|
70
|
+
def __repr__(self) -> str: ...
|
|
71
|
+
|
|
72
|
+
## -- Edge ------
|
|
73
|
+
class Edge:
|
|
74
|
+
|
|
75
|
+
term: Term
|
|
76
|
+
start: Node
|
|
77
|
+
end: Node
|
|
78
|
+
|
|
79
|
+
def __init__(self, term: Term, start: Node, end: Node) -> None: ...
|
|
80
|
+
def uid(self) -> str: ...
|
|
81
|
+
def __eq__(self, value: Edge) -> bool: ...
|
|
82
|
+
def __str__(self) -> str: ...
|
|
83
|
+
def __repr__(self) -> str: ...
|
|
84
|
+
|
|
85
|
+
## -- Graph ------
|
|
86
|
+
class Graph:
|
|
87
|
+
def __init__(self) -> None: ...
|
|
88
|
+
def query(self) -> Query: ...
|
|
89
|
+
def to_dot(self) -> str: ...
|
|
90
|
+
def to_force_graph_json(self) -> str: ...
|
|
91
|
+
def __str__(self) -> str: ...
|
|
92
|
+
def __repr__(self) -> str: ...
|
|
93
|
+
def _get_all_nodes(self) -> List[Node]: ... # discouraged for public use
|
|
94
|
+
def _get_all_edges(self) -> List[Edge]: ... # discouraged for public use
|
|
95
|
+
|
|
96
|
+
# --- Patterns -----
|
|
97
|
+
|
|
98
|
+
Context = Dict[str, Type | Term]
|
|
99
|
+
|
|
100
|
+
## -- TypeSchema ---
|
|
101
|
+
class TypeSchema:
|
|
102
|
+
|
|
103
|
+
pattern: str
|
|
104
|
+
|
|
105
|
+
def __init__(self, pattern: str) -> None: ...
|
|
106
|
+
def matches(
|
|
107
|
+
self, type: Type, context: Context = {}, constants: List[Constant] = []
|
|
108
|
+
) -> bool: ...
|
|
109
|
+
def get_type_vars(self, context: Context = {}) -> List[Variable]: ...
|
|
110
|
+
def as_type(self, context: Context = {}) -> Type: ...
|
|
111
|
+
def __str__(self) -> str: ...
|
|
112
|
+
def __repr__(self) -> str: ...
|
|
113
|
+
|
|
114
|
+
## -- TermSchema ---
|
|
115
|
+
class TermSchema:
|
|
116
|
+
|
|
117
|
+
pattern: str
|
|
118
|
+
|
|
119
|
+
def __init__(self, pattern: str) -> None: ...
|
|
120
|
+
def matches(
|
|
121
|
+
self, term: Term, context: Context = {}, constants: List[Constant] = []
|
|
122
|
+
) -> bool: ...
|
|
123
|
+
def as_term(self, context: Context = {}, constants: List[Constant] = []) -> Term: ...
|
|
124
|
+
def __str__(self) -> str: ...
|
|
125
|
+
def __repr__(self) -> str: ...
|
|
126
|
+
|
|
127
|
+
## -- NodePattern ---
|
|
128
|
+
class NodePattern:
|
|
129
|
+
|
|
130
|
+
variable: Optional[str]
|
|
131
|
+
|
|
132
|
+
type: Optional[TypeSchema]
|
|
133
|
+
type_schema: Optional[TypeSchema]
|
|
134
|
+
|
|
135
|
+
term: Optional[Term]
|
|
136
|
+
term_schema: Optional[TermSchema]
|
|
137
|
+
|
|
138
|
+
properties: Dict[str, Any]
|
|
139
|
+
|
|
140
|
+
def __init__(
|
|
141
|
+
self,
|
|
142
|
+
variable: Optional[str] = None,
|
|
143
|
+
type: Optional[TypeSchema] = None,
|
|
144
|
+
type_schema: Optional[TypeSchema] = None,
|
|
145
|
+
term: Optional[Term] = None,
|
|
146
|
+
term_schema: Optional[TermSchema] = None,
|
|
147
|
+
properties: Dict[str, Any] = {},
|
|
148
|
+
) -> None: ...
|
|
149
|
+
def matches(self, node, context: Context = {}, constants: List[Constant] = []) -> bool: ...
|
|
150
|
+
def __str__(self) -> str: ...
|
|
151
|
+
def __repr__(self) -> str: ...
|
|
152
|
+
|
|
153
|
+
class EdgePattern:
|
|
154
|
+
|
|
155
|
+
variable: Optional[str]
|
|
156
|
+
|
|
157
|
+
type: Optional[Type]
|
|
158
|
+
type_schema: Optional[TypeSchema]
|
|
159
|
+
|
|
160
|
+
term: Optional[Term]
|
|
161
|
+
term_schema: Optional[TermSchema]
|
|
162
|
+
|
|
163
|
+
properties: Dict[str, Any]
|
|
164
|
+
|
|
165
|
+
direction: str
|
|
166
|
+
|
|
167
|
+
def __init__(
|
|
168
|
+
self,
|
|
169
|
+
variable: Optional[str] = None,
|
|
170
|
+
type: Optional[Type] = None,
|
|
171
|
+
type_schema: Optional[TypeSchema] = None,
|
|
172
|
+
term: Optional[Term] = None,
|
|
173
|
+
term_schema: Optional[TermSchema] = None,
|
|
174
|
+
properties: Dict[str, Any] = {},
|
|
175
|
+
direction: str = "forward",
|
|
176
|
+
) -> None: ...
|
|
177
|
+
def matches(self, edge, context: Context = {}, constants: List[Constant] = []) -> bool: ...
|
|
178
|
+
def __str__(self) -> str: ...
|
|
179
|
+
def __repr__(self) -> str: ...
|
|
180
|
+
|
|
181
|
+
## -- PathPattern ---
|
|
182
|
+
class PathPattern:
|
|
183
|
+
|
|
184
|
+
nodes: list[NodePattern]
|
|
185
|
+
edges: list[EdgePattern]
|
|
186
|
+
|
|
187
|
+
def __init__(self, pattern: Optional[str] = None) -> None: ...
|
|
188
|
+
def add_node(self, node_pattern: NodePattern) -> None: ...
|
|
189
|
+
def add_edge(self, edge_pattern: EdgePattern) -> None: ...
|
|
190
|
+
def __str__(self) -> str: ...
|
|
191
|
+
def __repr__(self) -> str: ...
|
|
192
|
+
|
|
193
|
+
# --- Query -----
|
|
194
|
+
|
|
195
|
+
QueryResult = Node | Edge
|
|
196
|
+
|
|
197
|
+
class Query:
|
|
198
|
+
def __init__(self, graph: Graph) -> None: ...
|
|
199
|
+
def match(
|
|
200
|
+
self,
|
|
201
|
+
pattern: Optional[str] = None,
|
|
202
|
+
node: Optional[str] = None,
|
|
203
|
+
edge: Optional[str] = None,
|
|
204
|
+
start: Optional[str] = None,
|
|
205
|
+
end: Optional[str] = None,
|
|
206
|
+
type: Optional[Type] = None,
|
|
207
|
+
type_schema: Optional[TypeSchema] = None,
|
|
208
|
+
term: Optional[Term] = None,
|
|
209
|
+
term_schema: Optional[TermSchema] = None,
|
|
210
|
+
properties: Optional[Dict[str, Any]] = None,
|
|
211
|
+
) -> "Query": ...
|
|
212
|
+
def where(self, condition: str) -> "Query": ...
|
|
213
|
+
def create(
|
|
214
|
+
self,
|
|
215
|
+
pattern: Optional[str] = None,
|
|
216
|
+
node: Optional[str] = None,
|
|
217
|
+
edge: Optional[str] = None,
|
|
218
|
+
start: Optional[str] = None,
|
|
219
|
+
end: Optional[str] = None,
|
|
220
|
+
type: Optional[Type] = None,
|
|
221
|
+
type_schema: Optional[TypeSchema] = None,
|
|
222
|
+
term: Optional[Term] = None,
|
|
223
|
+
term_schema: Optional[TermSchema] = None,
|
|
224
|
+
properties: Optional[Dict[str, Any]] = None,
|
|
225
|
+
) -> "Query": ...
|
|
226
|
+
def merge(
|
|
227
|
+
self,
|
|
228
|
+
pattern: Optional[str] = None,
|
|
229
|
+
node: Optional[str] = None,
|
|
230
|
+
edge: Optional[str] = None,
|
|
231
|
+
start: Optional[str] = None,
|
|
232
|
+
end: Optional[str] = None,
|
|
233
|
+
type: Optional[Type] = None,
|
|
234
|
+
type_schema: Optional[TypeSchema] = None,
|
|
235
|
+
term: Optional[Term] = None,
|
|
236
|
+
term_schema: Optional[TermSchema] = None,
|
|
237
|
+
properties: Optional[Dict[str, Any]] = None,
|
|
238
|
+
) -> "Query": ...
|
|
239
|
+
def add(
|
|
240
|
+
self, variable: str, type: Optional[Type] = None, term: Optional[Term] = None
|
|
241
|
+
) -> "Query": ...
|
|
242
|
+
def set(self, variable: str, properties: Dict[str, Any]) -> "Query": ...
|
|
243
|
+
def delete(self, *variables: str) -> "Query": ...
|
|
244
|
+
def with_(self, *variables: str) -> "Query": ...
|
|
245
|
+
def order_by(self, *variables: str, ascending: bool = True) -> "Query": ...
|
|
246
|
+
def limit(self, count: int) -> "Query": ...
|
|
247
|
+
def skip(self, count: int) -> "Query": ...
|
|
248
|
+
def execute(self) -> "Query": ...
|
|
249
|
+
def return_(self, *variables: str) -> List[Dict[str, QueryResult]]: ...
|
|
250
|
+
def return_count(self) -> int: ...
|
implica/implica.pyd
ADDED
|
Binary file
|
implica/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: implica
|
|
3
|
+
Version: 1.1.6
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Dist: pytest>=9.0.2 ; extra == 'dev'
|
|
8
|
+
Requires-Dist: pytest-cov>=7.0.0 ; extra == 'dev'
|
|
9
|
+
Requires-Dist: black>=25.9.0 ; extra == 'dev'
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Python: >=3.8
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
implica-1.1.6.dist-info/METADATA,sha256=TRz9GS_V3urHj1z910wnF4tvPfkXxX01bG4zTFqAf4s,440
|
|
2
|
+
implica-1.1.6.dist-info/WHEEL,sha256=IGz6Xaz9OKvI_4gtEVDu014b2V6v5eVVRhpT9dYplW4,91
|
|
3
|
+
implica-1.1.6.dist-info/licenses/LICENSE,sha256=pnN2oDeYblNGqpxtiTtQdHVtghYLLp_V1A4Vf_MwPZ0,1098
|
|
4
|
+
implica/__init__.py,sha256=mkD_43hqEiMoheDMBeVTrvInpojg2DAlsopBbk_Bh8Y,618
|
|
5
|
+
implica/__init__.pyi,sha256=AuE8IxC67cF53MQ2pDLfHcC8-e6-Yrmha9SLiEUZ1bQ,7380
|
|
6
|
+
implica/implica.pyd,sha256=jNTFwZg2rWwrR138bWnGAxovV6fsER0bIKgIT-PWshc,5718016
|
|
7
|
+
implica/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
implica-1.1.6.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 implica contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|