gremlinpython 3.6.8__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.
Files changed (37) hide show
  1. gremlin_python/__init__.py +20 -0
  2. gremlin_python/__version__.py +20 -0
  3. gremlin_python/driver/__init__.py +20 -0
  4. gremlin_python/driver/aiohttp/__init__.py +18 -0
  5. gremlin_python/driver/aiohttp/transport.py +242 -0
  6. gremlin_python/driver/client.py +206 -0
  7. gremlin_python/driver/connection.py +106 -0
  8. gremlin_python/driver/driver_remote_connection.py +183 -0
  9. gremlin_python/driver/protocol.py +259 -0
  10. gremlin_python/driver/remote_connection.py +84 -0
  11. gremlin_python/driver/request.py +25 -0
  12. gremlin_python/driver/resultset.py +100 -0
  13. gremlin_python/driver/serializer.py +294 -0
  14. gremlin_python/driver/transport.py +45 -0
  15. gremlin_python/driver/useragent.py +37 -0
  16. gremlin_python/process/__init__.py +20 -0
  17. gremlin_python/process/anonymous_traversal.py +64 -0
  18. gremlin_python/process/graph_traversal.py +2301 -0
  19. gremlin_python/process/strategies.py +239 -0
  20. gremlin_python/process/translator.py +297 -0
  21. gremlin_python/process/traversal.py +875 -0
  22. gremlin_python/statics.py +117 -0
  23. gremlin_python/structure/__init__.py +20 -0
  24. gremlin_python/structure/graph.py +134 -0
  25. gremlin_python/structure/io/__init__.py +20 -0
  26. gremlin_python/structure/io/graphbinaryV1.py +1153 -0
  27. gremlin_python/structure/io/graphsonV2d0.py +646 -0
  28. gremlin_python/structure/io/graphsonV3d0.py +766 -0
  29. gremlin_python/structure/io/util.py +60 -0
  30. gremlinpython-3.6.8.data/data/LICENSE +202 -0
  31. gremlinpython-3.6.8.data/data/NOTICE +5 -0
  32. gremlinpython-3.6.8.dist-info/LICENSE +202 -0
  33. gremlinpython-3.6.8.dist-info/METADATA +147 -0
  34. gremlinpython-3.6.8.dist-info/NOTICE +5 -0
  35. gremlinpython-3.6.8.dist-info/RECORD +37 -0
  36. gremlinpython-3.6.8.dist-info/WHEEL +5 -0
  37. gremlinpython-3.6.8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,117 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ from types import FunctionType
21
+ from aenum import Enum
22
+
23
+
24
+ class long(int):
25
+ pass
26
+
27
+
28
+ class bigint(int):
29
+ pass
30
+
31
+
32
+ class short(int):
33
+ pass
34
+
35
+
36
+ FloatType = float
37
+ ShortType = short
38
+ IntType = int
39
+ LongType = long
40
+ BigIntType = bigint
41
+ TypeType = type
42
+ ListType = list
43
+ DictType = dict
44
+ SetType = set
45
+ ByteBufferType = bytes
46
+
47
+
48
+ class timestamp(float):
49
+ """
50
+ In Python a timestamp is simply a float. This dummy class (similar to long), allows users to wrap a float
51
+ in a GLV script to make sure the value is serialized as a Gremlin timestamp.
52
+ """
53
+ pass
54
+
55
+
56
+ class SingleByte(int):
57
+ """
58
+ Provides a way to pass a single byte via Gremlin.
59
+ """
60
+ def __new__(cls, b):
61
+ if -128 <= b < 128:
62
+ return int.__new__(cls, b)
63
+ else:
64
+ raise ValueError("value must be between -128 and 127 inclusive")
65
+
66
+
67
+ class SingleChar(str):
68
+ """
69
+ Provides a way to pass a single character via Gremlin.
70
+ """
71
+ def __new__(cls, c):
72
+ if len(c) == 1:
73
+ return str.__new__(cls, c)
74
+ else:
75
+ raise ValueError("string must contain a single character")
76
+
77
+
78
+ class GremlinType(object):
79
+ """
80
+ Provides a way to represent a "Java class" for Gremlin.
81
+ """
82
+ def __init__(self, gremlin_type):
83
+ self.gremlin_type = gremlin_type
84
+
85
+
86
+ class BigDecimal(object):
87
+ def __init__(self, scale, unscaled_value):
88
+ self.scale = scale
89
+ self.unscaled_value = unscaled_value
90
+
91
+
92
+ staticMethods = {}
93
+ staticEnums = {}
94
+ default_lambda_language = "gremlin-groovy"
95
+
96
+
97
+ def add_static(key, value):
98
+ if isinstance(value, Enum):
99
+ staticEnums[key] = value
100
+ else:
101
+ staticMethods[key] = value
102
+
103
+
104
+ def load_statics(global_dict):
105
+ for key in staticMethods:
106
+ global_dict[key] = staticMethods[key]
107
+ for key in staticEnums:
108
+ global_dict[key] = staticEnums[key]
109
+
110
+
111
+ def unload_statics(global_dict):
112
+ for key in staticMethods:
113
+ if key in global_dict:
114
+ del global_dict[key]
115
+ for key in staticEnums:
116
+ if key in global_dict:
117
+ del global_dict[key]
@@ -0,0 +1,20 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
@@ -0,0 +1,134 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
21
+
22
+ from gremlin_python.process.graph_traversal import GraphTraversalSource
23
+ from gremlin_python.process.traversal import TraversalStrategies
24
+ import warnings
25
+
26
+
27
+ class Graph(object):
28
+ def __init__(self):
29
+ if self.__class__ not in TraversalStrategies.global_cache:
30
+ TraversalStrategies.global_cache[self.__class__] = TraversalStrategies()
31
+
32
+ def traversal(self, traversal_source_class=None):
33
+ warnings.warn(
34
+ "As of release 3.3.5, replaced by the gremlin_python.process.anonymous_traversal.traversal() function.",
35
+ DeprecationWarning)
36
+
37
+ if not traversal_source_class:
38
+ traversal_source_class = GraphTraversalSource
39
+ return traversal_source_class(self, TraversalStrategies.global_cache[self.__class__])
40
+
41
+ def __repr__(self):
42
+ return "graph[]"
43
+
44
+
45
+ class Element(object):
46
+ def __init__(self, id, label):
47
+ self.id = id
48
+ self.label = label
49
+
50
+ def __eq__(self, other):
51
+ return isinstance(other, self.__class__) and self.id == other.id
52
+
53
+ def __hash__(self):
54
+ return hash(self.id)
55
+
56
+
57
+ class Vertex(Element):
58
+ def __init__(self, id, label="vertex"):
59
+ Element.__init__(self, id, label)
60
+
61
+ def __repr__(self):
62
+ return "v[" + str(self.id) + "]"
63
+
64
+
65
+ class Edge(Element):
66
+ def __init__(self, id, outV, label, inV):
67
+ Element.__init__(self, id, label)
68
+ self.outV = outV
69
+ self.inV = inV
70
+
71
+ def __repr__(self):
72
+ return "e[" + str(self.id) + "][" + str(self.outV.id) + "-" + self.label + "->" + str(self.inV.id) + "]"
73
+
74
+
75
+ class VertexProperty(Element):
76
+ def __init__(self, id, label, value, vertex):
77
+ Element.__init__(self, id, label)
78
+ self.value = value
79
+ self.key = self.label
80
+ self.vertex = vertex
81
+
82
+ def __repr__(self):
83
+ return "vp[" + str(self.label) + "->" + str(self.value)[0:20] + "]"
84
+
85
+
86
+ class Property(object):
87
+ def __init__(self, key, value, element):
88
+ self.key = key
89
+ self.value = value
90
+ self.element = element
91
+
92
+ def __repr__(self):
93
+ return "p[" + str(self.key) + "->" + str(self.value)[0:20] + "]"
94
+
95
+ def __eq__(self, other):
96
+ return isinstance(other, self.__class__) and \
97
+ self.key == other.key and \
98
+ self.value == other.value and \
99
+ self.element == other.element
100
+
101
+ def __hash__(self):
102
+ return hash(self.key) + hash(self.value)
103
+
104
+
105
+ class Path(object):
106
+ def __init__(self, labels, objects):
107
+ self.labels = labels
108
+ self.objects = objects
109
+
110
+ def __repr__(self):
111
+ return "path[" + ", ".join(map(str, self.objects)) + "]"
112
+
113
+ def __eq__(self, other):
114
+ return isinstance(other, self.__class__) and self.objects == other.objects and self.labels == other.labels
115
+
116
+ def __hash__(self):
117
+ return hash(str(self.objects)) + hash(str(self.labels))
118
+
119
+ def __getitem__(self, key):
120
+ if isinstance(key, str):
121
+ objects = []
122
+ for i, labels in enumerate(self.labels):
123
+ if key in labels:
124
+ objects.append(self.objects[i])
125
+ if 0 == len(objects):
126
+ raise KeyError("The step with label " + key + " does not exist")
127
+ return objects if len(objects) > 1 else objects[0]
128
+ elif isinstance(key, int):
129
+ return self.objects[key]
130
+ else:
131
+ raise TypeError("The path access key must be either a string label or integer index")
132
+
133
+ def __len__(self):
134
+ return len(self.objects)
@@ -0,0 +1,20 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'