gremlinpython
Advanced tools
@@ -21,2 +21,2 @@ # | ||
| __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)' | ||
| __version__ = '3.7.5' | ||
| __version__ = '3.8.0' |
@@ -21,3 +21,3 @@ # | ||
| gremlin_version = "3.7.5" # DO NOT MODIFY - Configured automatically by Maven Replacer Plugin | ||
| gremlin_version = "3.8.0" # DO NOT MODIFY - Configured automatically by Maven Replacer Plugin | ||
@@ -24,0 +24,0 @@ def _generate_user_agent(): |
@@ -39,21 +39,18 @@ # | ||
| def withGraph(self, graph): | ||
| warnings.warn( | ||
| "gremlin_python.process.AnonymousTraversalSource.withGraph will be replaced by " | ||
| "gremlin_python.process.AnonymousTraversalSource.with_graph.", | ||
| DeprecationWarning) | ||
| return self.with_graph(graph) | ||
| def with_(self, remote_connection): | ||
| return self.traversal_source_class(Graph(), TraversalStrategies(), None, remote_connection) | ||
| def with_graph(self, graph): | ||
| return self.traversal_source_class(graph, TraversalStrategies.global_cache[graph.__class__]) | ||
| def withRemote(self, remote_connection): | ||
| warnings.warn( | ||
| "gremlin_python.process.AnonymousTraversalSource.withRemote will be replaced by " | ||
| "gremlin_python.process.AnonymousTraversalSource.with_remote.", | ||
| "gremlin_python.process.AnonymousTraversalSource.with_.", | ||
| DeprecationWarning) | ||
| return self.with_remote(remote_connection) | ||
| return self.with_(remote_connection) | ||
| def with_remote(self, remote_connection): | ||
| return self.with_graph(Graph()).with_remote(remote_connection) | ||
| warnings.warn( | ||
| "gremlin_python.process.AnonymousTraversalSource.with_remote will be replaced by " | ||
| "gremlin_python.process.AnonymousTraversalSource.with_.", | ||
| DeprecationWarning) | ||
| return self.with_(remote_connection) | ||
@@ -60,0 +57,0 @@ |
@@ -22,3 +22,3 @@ # | ||
| from gremlin_python.process.traversal import TraversalStrategy | ||
| from .traversal import TraversalStrategy | ||
@@ -45,2 +45,3 @@ base_namespace = 'org.apache.tinkerpop.gremlin.process.traversal.strategy.' | ||
| TraversalStrategy.__init__(self, fqcn=decoration_namespace + 'ElementIdStrategy') | ||
| self.configuration = {} | ||
@@ -58,3 +59,3 @@ | ||
| class OptionsStrategy(TraversalStrategy): | ||
| def __init__(self, options=None): | ||
| def __init__(self, **options): | ||
| TraversalStrategy.__init__(self, configuration=options, fqcn=decoration_namespace + 'OptionsStrategy') | ||
@@ -93,3 +94,3 @@ | ||
| if check_adjacent_vertices is not None: | ||
| self.configuration["checkAdjacentProperties"] = check_adjacent_vertices | ||
| self.configuration["checkAdjacentVertices"] = check_adjacent_vertices | ||
@@ -116,3 +117,16 @@ | ||
| class ReferenceElementStrategy(TraversalStrategy): | ||
| def __init__(self, options=None): | ||
| TraversalStrategy.__init__(self, configuration=options, fqcn=decoration_namespace + 'ReferenceElementStrategy') | ||
| class ComputerFinalizationStrategy(TraversalStrategy): | ||
| def __init__(self, options=None): | ||
| TraversalStrategy.__init__(self, configuration=options, fqcn=decoration_namespace + 'ComputerFinalizationStrategy') | ||
| class ProfileStrategy(TraversalStrategy): | ||
| def __init__(self, options=None): | ||
| TraversalStrategy.__init__(self, configuration=options, fqcn=decoration_namespace + 'ProfileStrategy') | ||
| ########################### | ||
@@ -140,3 +154,3 @@ # FINALIZATION STRATEGIES # | ||
| def __init__(self): | ||
| TraversalStrategy.__init__(self, fqcn="org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ByModulatorOptimizationStrategy") | ||
| TraversalStrategy.__init__(self, fqcn=optimization_namespace + 'ByModulatorOptimizationStrategy') | ||
@@ -146,3 +160,3 @@ | ||
| def __init__(self): | ||
| TraversalStrategy.__init__(self, fqcn="org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.CountStrategy") | ||
| TraversalStrategy.__init__(self, fqcn=optimization_namespace + 'CountStrategy') | ||
@@ -220,2 +234,7 @@ | ||
| class MessagePassingReductionStrategy(TraversalStrategy): | ||
| def __init__(self, options=None): | ||
| TraversalStrategy.__init__(self, configuration=options, fqcn=optimization_namespace + 'MessagePassingReductionStrategy') | ||
| ########################### | ||
@@ -225,3 +244,7 @@ # VERIFICATION STRATEGIES # | ||
| class ComputerVerificationStrategy(TraversalStrategy): | ||
| def __init__(self, options=None): | ||
| TraversalStrategy.__init__(self, configuration=options, fqcn=verification_namespace + 'ComputerVerificationStrategy') | ||
| class LambdaRestrictionStrategy(TraversalStrategy): | ||
@@ -249,1 +272,11 @@ def __init__(self): | ||
| self.configuration["keys"] = keys | ||
| class VertexProgramRestrictionStrategy(TraversalStrategy): | ||
| def __init__(self): | ||
| TraversalStrategy.__init__(self, fqcn=verification_namespace + 'VertexProgramRestrictionStrategy') | ||
| class StandardVerificationStrategy(TraversalStrategy): | ||
| def __init__(self): | ||
| TraversalStrategy.__init__(self, fqcn=verification_namespace + 'StandardVerificationStrategy') |
@@ -78,3 +78,3 @@ # | ||
| def iterate(self): | ||
| self.bytecode.add_step("none") | ||
| self.bytecode.add_step("discard") | ||
| while True: | ||
@@ -218,6 +218,7 @@ try: self.next_traverser() | ||
| Pick = Enum('Pick', ' any_ none') | ||
| Pick = Enum('Pick', ' any_ none unproductive') | ||
| statics.add_static('any_', Pick.any_) | ||
| statics.add_static('none', Pick.none) | ||
| statics.add_static('unproductive', Pick.unproductive) | ||
@@ -263,2 +264,33 @@ Pop = Enum('Pop', ' all_ first last mixed') | ||
| GType = Enum('GType', ' BIGDECIMAL BIGINT BINARY BOOLEAN BYTE CHAR DATETIME DOUBLE DURATION EDGE FLOAT GRAPH INT LIST LONG MAP NULL NUMBER PATH PROPERTY SET SHORT STRING TREE UUID VERTEX VPROPERTY') | ||
| statics.add_static('BIGDECIMAL', GType.BIGDECIMAL) | ||
| statics.add_static('BIGINT', GType.BIGINT) | ||
| statics.add_static('BINARY', GType.BINARY) | ||
| statics.add_static('BOOLEAN', GType.BOOLEAN) | ||
| statics.add_static('BYTE', GType.BYTE) | ||
| statics.add_static('CHAR', GType.CHAR) | ||
| statics.add_static('DATETIME', GType.DATETIME) | ||
| statics.add_static('DOUBLE', GType.DOUBLE) | ||
| statics.add_static('DURATION', GType.DURATION) | ||
| statics.add_static('EDGE', GType.EDGE) | ||
| statics.add_static('FLOAT', GType.FLOAT) | ||
| statics.add_static('GRAPH', GType.GRAPH) | ||
| statics.add_static('INT', GType.INT) | ||
| statics.add_static('LIST', GType.LIST) | ||
| statics.add_static('LONG', GType.LONG) | ||
| statics.add_static('MAP', GType.MAP) | ||
| statics.add_static('NULL', GType.NULL) | ||
| statics.add_static('NUMBER', GType.NUMBER) | ||
| statics.add_static('PATH', GType.PATH) | ||
| statics.add_static('PROPERTY', GType.PROPERTY) | ||
| statics.add_static('SET', GType.SET) | ||
| statics.add_static('SHORT', GType.SHORT) | ||
| statics.add_static('STRING', GType.STRING) | ||
| statics.add_static('TREE', GType.TREE) | ||
| statics.add_static('UUID', GType.UUID) | ||
| statics.add_static('VERTEX', GType.VERTEX) | ||
| statics.add_static('VPROPERTY', GType.VPROPERTY) | ||
| class P(object): | ||
@@ -315,2 +347,6 @@ def __init__(self, operator, value, other=None): | ||
| @staticmethod | ||
| def type_of(*args): | ||
| return P("typeOf", *args) | ||
| @staticmethod | ||
| def within(*args): | ||
@@ -394,2 +430,6 @@ if len(args) == 1 and type(args[0]) == list: | ||
| def type_of(*args): | ||
| return P.type_of(*args) | ||
| statics.add_static('between', between) | ||
@@ -419,3 +459,5 @@ | ||
| statics.add_static('typeOf', type_of) | ||
| class TextP(P): | ||
@@ -697,3 +739,2 @@ def __init__(self, operator, value, other=None): | ||
| class TraversalStrategies(object): | ||
| global_cache = {} | ||
@@ -700,0 +741,0 @@ def __init__(self, traversal_strategies=None): |
@@ -19,3 +19,3 @@ # | ||
| # | ||
| import decimal | ||
| from types import FunctionType | ||
@@ -88,2 +88,5 @@ from aenum import Enum | ||
| class BigDecimal(object): | ||
| """ | ||
| Provides a way to represent a BigDecimal for Gremlin. | ||
| """ | ||
| def __init__(self, scale, unscaled_value): | ||
@@ -93,3 +96,38 @@ self.scale = scale | ||
| @property | ||
| def value(self): | ||
| self._as_decimal = decimal.Decimal(self.unscaled_value) | ||
| precision = len(self._as_decimal.as_tuple().digits) | ||
| with decimal.localcontext(decimal.Context(prec=precision)): | ||
| return self._as_decimal.scaleb(-self.scale) | ||
| def __eq__(self, other): | ||
| if not isinstance(other, BigDecimal): | ||
| return False | ||
| return self.scale == other.scale and self.unscaled_value == other.unscaled_value | ||
| def __hash__(self): | ||
| return hash((self.scale, self.unscaled_value)) | ||
| def __repr__(self): | ||
| return f"BigDecimal(scale={self.scale}, unscaled_value={self.unscaled_value})" | ||
| def __str__(self): | ||
| return str(self.value) | ||
| """ | ||
| Create a BigDecimal from a number that can be converted to a Decimal. Note precision may be lost during the conversion. | ||
| """ | ||
| def bigdecimal(value): | ||
| try: | ||
| decimal_value = value if isinstance(value, decimal.Decimal) else decimal.Decimal(str(value)) | ||
| scale = -decimal_value.as_tuple().exponent | ||
| unscaled_value = int("".join(map(str, decimal_value.as_tuple().digits))) | ||
| except TypeError: | ||
| raise ValueError("BigDecimal does not support NaN, Infinity or -Infinity") | ||
| except Exception as err: | ||
| raise ValueError(f'Encountered error: {err}. Value must be able to convert to a Decimal.') | ||
| return BigDecimal(scale, unscaled_value if decimal_value >= 0 else -unscaled_value) | ||
| staticMethods = {} | ||
@@ -96,0 +134,0 @@ staticEnums = {} |
@@ -28,15 +28,3 @@ # | ||
| class Graph(object): | ||
| def __init__(self): | ||
| if self.__class__ not in TraversalStrategies.global_cache: | ||
| TraversalStrategies.global_cache[self.__class__] = TraversalStrategies() | ||
| def traversal(self, traversal_source_class=None): | ||
| warnings.warn( | ||
| "As of release 3.3.5, replaced by the gremlin_python.process.anonymous_traversal.traversal() function.", | ||
| DeprecationWarning) | ||
| if not traversal_source_class: | ||
| traversal_source_class = GraphTraversalSource | ||
| return traversal_source_class(self, TraversalStrategies.global_cache[self.__class__]) | ||
| def __repr__(self): | ||
@@ -50,3 +38,3 @@ return "graph[]" | ||
| self.label = label | ||
| self.properties = properties | ||
| self.properties = [] if properties is None else properties | ||
@@ -53,0 +41,0 @@ def __eq__(self, other): |
@@ -36,4 +36,4 @@ """ | ||
| SingleChar | ||
| from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, DT, Merge, \ | ||
| Operator, Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \ | ||
| from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, DT, GType, \ | ||
| Merge,Operator, Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \ | ||
| TraversalStrategy, T | ||
@@ -102,2 +102,3 @@ from gremlin_python.process.graph_traversal import GraphTraversal | ||
| dt = 0x2f | ||
| gtype = 0x30 | ||
| char = 0x80 | ||
@@ -111,3 +112,3 @@ duration = 0x81 | ||
| monthday = 0x87 # todo | ||
| offsetdatetime = 0x88 # todo | ||
| offsetdatetime = 0x88 | ||
| offsettime = 0x89 # todo | ||
@@ -349,2 +350,40 @@ period = 0x8a # todo | ||
| class OffsetDateTimeIO(_GraphBinaryTypeIO): | ||
| python_type = datetime.datetime | ||
| graphbinary_type = DataType.offsetdatetime | ||
| @classmethod | ||
| def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): | ||
| if obj.tzinfo is None: | ||
| return DateIO.dictify(obj, writer, to_extend, as_value, nullable) | ||
| cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) | ||
| IntIO.dictify(obj.year, writer, to_extend, True, False) | ||
| ByteIO.dictify(obj.month, writer, to_extend, True, False) | ||
| ByteIO.dictify(obj.day, writer, to_extend, True, False) | ||
| # construct time of day in nanoseconds | ||
| h = obj.time().hour | ||
| m = obj.time().minute | ||
| s = obj.time().second | ||
| ms = obj.time().microsecond | ||
| ns = round((h*60*60*1e9) + (m*60*1e9) + (s*1e9) + (ms*1e3)) | ||
| LongIO.dictify(ns, writer, to_extend, True, False) | ||
| os = round(obj.utcoffset().total_seconds()) | ||
| IntIO.dictify(os, writer, to_extend, True, False) | ||
| return to_extend | ||
| @classmethod | ||
| def objectify(cls, buff, reader, nullable=True): | ||
| return cls.is_null(buff, reader, cls._read_dt, nullable) | ||
| @classmethod | ||
| def _read_dt(cls, b, r): | ||
| year = r.to_object(b, DataType.int, False) | ||
| month = r.to_object(b, DataType.byte, False) | ||
| day = r.to_object(b, DataType.byte, False) | ||
| ns = r.to_object(b, DataType.long, False) | ||
| offset = r.to_object(b, DataType.int, False) | ||
| tz = datetime.timezone(timedelta(seconds=offset)) | ||
| return datetime.datetime(year, month, day, tzinfo=tz) + timedelta(microseconds=ns/1000) | ||
| # Based on current implementation, this class must always be declared before FloatIO. | ||
@@ -956,2 +995,7 @@ # Seems pretty fragile for future maintainers. Maybe look into this. | ||
| class GTYPEIO(_EnumIO): | ||
| graphbinary_type = DataType.gtype | ||
| python_type = GType | ||
| class TraverserIO(_GraphBinaryTypeIO): | ||
@@ -958,0 +1002,0 @@ graphbinary_type = DataType.traverser |
@@ -33,3 +33,4 @@ # | ||
| from gremlin_python import statics | ||
| from gremlin_python.statics import FloatType, FunctionType, ShortType, IntType, LongType, TypeType, SingleByte, ByteBufferType, SingleChar | ||
| from gremlin_python.statics import FloatType, FunctionType, ShortType, IntType, LongType, TypeType, SingleByte, \ | ||
| ByteBufferType, SingleChar, BigDecimal, bigdecimal | ||
| from gremlin_python.process.traversal import Binding, Bytecode, P, TextP, Traversal, Traverser, TraversalStrategy | ||
@@ -240,3 +241,8 @@ from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path | ||
| def dictify(cls, strategy, writer): | ||
| return GraphSONUtil.typed_value(strategy.strategy_name, writer.to_dict(strategy.configuration)) | ||
| strat_dict = {} | ||
| strat_dict["fqcn"] = strategy.fqcn | ||
| strat_dict["conf"] = {} | ||
| for key in strategy.configuration: | ||
| strat_dict["conf"][key] = writer.to_dict(strategy.configuration[key]) | ||
| return GraphSONUtil.typed_value(strategy.strategy_name, strat_dict) | ||
@@ -344,3 +350,2 @@ | ||
| class DateIO(_GraphSONTypeIO): | ||
| python_type = datetime.datetime | ||
| graphson_type = "g:Date" | ||
@@ -366,2 +371,20 @@ graphson_base_type = "Date" | ||
| class OffsetDateTimeIO(_GraphSONTypeIO): | ||
| python_type = datetime.datetime | ||
| graphson_type = "gx:OffsetDateTime" | ||
| graphson_base_type = "OffsetDateTime" | ||
| @classmethod | ||
| def dictify(cls, obj, writer): | ||
| if obj.tzinfo is None: | ||
| return DateIO.dictify(obj, writer) | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, obj.isoformat(), "gx") | ||
| @classmethod | ||
| def objectify(cls, dt, reader): | ||
| # specially handling as python isoformat does not support zulu until 3.11 | ||
| dt_iso = dt[:-1] + '+00:00' if dt.endswith('Z') else dt | ||
| return datetime.datetime.fromisoformat(dt_iso) | ||
| # Based on current implementation, this class must always be declared before FloatIO. | ||
@@ -432,3 +455,3 @@ # Seems pretty fragile for future maintainers. Maybe look into this. | ||
| class BigDecimalIO(_NumberIO): | ||
| python_type = Decimal | ||
| python_type = BigDecimal | ||
| graphson_type = "gx:BigDecimal" | ||
@@ -439,26 +462,9 @@ graphson_base_type = "BigDecimal" | ||
| def dictify(cls, n, writer): | ||
| if isinstance(n, bool): # because isinstance(False, int) and isinstance(True, int) | ||
| return n | ||
| elif math.isnan(n): | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, "NaN", "gx") | ||
| elif math.isinf(n) and n > 0: | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, "Infinity", "gx") | ||
| elif math.isinf(n) and n < 0: | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, "-Infinity", "gx") | ||
| else: | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, str(n), "gx") | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, str(n.value), "gx") | ||
| @classmethod | ||
| def objectify(cls, v, _): | ||
| if isinstance(v, str): | ||
| if v == 'NaN': | ||
| return Decimal('nan') | ||
| elif v == "Infinity": | ||
| return Decimal('inf') | ||
| elif v == "-Infinity": | ||
| return Decimal('-inf') | ||
| return bigdecimal(v) | ||
| return Decimal(v) | ||
| class DoubleIO(FloatIO): | ||
@@ -594,3 +600,3 @@ graphson_type = "g:Double" | ||
| def objectify(cls, d, reader): | ||
| properties = None | ||
| properties = [] | ||
| if "properties" in d: | ||
@@ -608,3 +614,3 @@ properties = reader.to_object(d["properties"]) | ||
| def objectify(cls, d, reader): | ||
| properties = None | ||
| properties = [] | ||
| if "properties" in d: | ||
@@ -626,3 +632,3 @@ properties = reader.to_object(d["properties"]) | ||
| def objectify(cls, d, reader): | ||
| properties = None | ||
| properties = [] | ||
| if "properties" in d: | ||
@@ -629,0 +635,0 @@ properties = reader.to_object(d["properties"]) |
@@ -32,3 +32,4 @@ # Licensed to the Apache Software Foundation (ASF) under one | ||
| from gremlin_python import statics | ||
| from gremlin_python.statics import FloatType, FunctionType, ShortType, IntType, LongType, TypeType, DictType, ListType, SetType, SingleByte, ByteBufferType, SingleChar | ||
| from gremlin_python.statics import FloatType, FunctionType, ShortType, IntType, LongType, TypeType, DictType, ListType, \ | ||
| SetType, SingleByte, ByteBufferType, SingleChar, BigDecimal, bigdecimal | ||
| from gremlin_python.process.traversal import Binding, Bytecode, Direction, P, TextP, Traversal, Traverser, TraversalStrategy, T | ||
@@ -244,6 +245,8 @@ from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path | ||
| def dictify(cls, strategy, writer): | ||
| configuration = {} | ||
| strat_dict = {} | ||
| strat_dict["fqcn"] = strategy.fqcn | ||
| strat_dict["conf"] = {} | ||
| for key in strategy.configuration: | ||
| configuration[key] = writer.to_dict(strategy.configuration[key]) | ||
| return GraphSONUtil.typed_value(strategy.strategy_name, configuration) | ||
| strat_dict["conf"][key] = writer.to_dict(strategy.configuration[key]) | ||
| return GraphSONUtil.typed_value(strategy.strategy_name, strat_dict) | ||
@@ -351,3 +354,2 @@ | ||
| class DateIO(_GraphSONTypeIO): | ||
| python_type = datetime.datetime | ||
| graphson_type = "g:Date" | ||
@@ -373,2 +375,20 @@ graphson_base_type = "Date" | ||
| class OffsetDateTimeIO(_GraphSONTypeIO): | ||
| python_type = datetime.datetime | ||
| graphson_type = "gx:OffsetDateTime" | ||
| graphson_base_type = "OffsetDateTime" | ||
| @classmethod | ||
| def dictify(cls, obj, writer): | ||
| if obj.tzinfo is None: | ||
| return DateIO.dictify(obj, writer) | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, obj.isoformat(), "gx") | ||
| @classmethod | ||
| def objectify(cls, dt, reader): | ||
| # specially handling as python isoformat does not support zulu until 3.11 | ||
| dt_iso = dt[:-1] + '+00:00' if dt.endswith('Z') else dt | ||
| return datetime.datetime.fromisoformat(dt_iso) | ||
| # Based on current implementation, this class must always be declared before FloatIO. | ||
@@ -532,3 +552,3 @@ # Seems pretty fragile for future maintainers. Maybe look into this. | ||
| class BigDecimalIO(_NumberIO): | ||
| python_type = Decimal | ||
| python_type = BigDecimal | ||
| graphson_type = "gx:BigDecimal" | ||
@@ -539,26 +559,9 @@ graphson_base_type = "BigDecimal" | ||
| def dictify(cls, n, writer): | ||
| if isinstance(n, bool): # because isinstance(False, int) and isinstance(True, int) | ||
| return n | ||
| elif math.isnan(n): | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, "NaN", "gx") | ||
| elif math.isinf(n) and n > 0: | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, "Infinity", "gx") | ||
| elif math.isinf(n) and n < 0: | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, "-Infinity", "gx") | ||
| else: | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, str(n), "gx") | ||
| return GraphSONUtil.typed_value(cls.graphson_base_type, str(n.value), "gx") | ||
| @classmethod | ||
| def objectify(cls, v, _): | ||
| if isinstance(v, str): | ||
| if v == 'NaN': | ||
| return Decimal('nan') | ||
| elif v == "Infinity": | ||
| return Decimal('inf') | ||
| elif v == "-Infinity": | ||
| return Decimal('-inf') | ||
| return bigdecimal(v) | ||
| return Decimal(v) | ||
| class DoubleIO(FloatIO): | ||
@@ -694,3 +697,3 @@ graphson_type = "g:Double" | ||
| def objectify(cls, d, reader): | ||
| properties = None | ||
| properties = [] | ||
| if "properties" in d: | ||
@@ -708,3 +711,3 @@ properties = reader.to_object(d["properties"]) | ||
| def objectify(cls, d, reader): | ||
| properties = None | ||
| properties = [] | ||
| if "properties" in d: | ||
@@ -726,3 +729,3 @@ properties = reader.to_object(d["properties"]) | ||
| def objectify(cls, d, reader): | ||
| properties = None | ||
| properties = [] | ||
| if "properties" in d: | ||
@@ -729,0 +732,0 @@ properties = reader.to_object(d["properties"]) |
| Metadata-Version: 2.4 | ||
| Name: gremlinpython | ||
| Version: 3.7.5 | ||
| Version: 3.8.0 | ||
| Summary: Gremlin-Python for Apache TinkerPop | ||
@@ -12,3 +12,3 @@ Maintainer-email: Apache TinkerPop <dev@tinkerpop.apache.org> | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Requires-Python: >=3.9 | ||
| Requires-Python: >=3.10 | ||
| Description-Content-Type: text/x-rst | ||
@@ -27,3 +27,3 @@ License-File: LICENSE | ||
| Provides-Extra: test | ||
| Requires-Dist: pytest<7.2.0,>=4.6.4; extra == "test" | ||
| Requires-Dist: pytest<8.0.0,>=6.2.5; extra == "test" | ||
| Requires-Dist: radish-bdd==0.18.2; extra == "test" | ||
@@ -30,0 +30,0 @@ Requires-Dist: PyHamcrest<3.0.0,>=1.9.0; extra == "test" |
@@ -11,3 +11,3 @@ nest_asyncio | ||
| [test] | ||
| pytest<7.2.0,>=4.6.4 | ||
| pytest<8.0.0,>=6.2.5 | ||
| radish-bdd==0.18.2 | ||
@@ -14,0 +14,0 @@ PyHamcrest<3.0.0,>=1.9.0 |
+3
-3
| Metadata-Version: 2.4 | ||
| Name: gremlinpython | ||
| Version: 3.7.5 | ||
| Version: 3.8.0 | ||
| Summary: Gremlin-Python for Apache TinkerPop | ||
@@ -12,3 +12,3 @@ Maintainer-email: Apache TinkerPop <dev@tinkerpop.apache.org> | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Requires-Python: >=3.9 | ||
| Requires-Python: >=3.10 | ||
| Description-Content-Type: text/x-rst | ||
@@ -27,3 +27,3 @@ License-File: LICENSE | ||
| Provides-Extra: test | ||
| Requires-Dist: pytest<7.2.0,>=4.6.4; extra == "test" | ||
| Requires-Dist: pytest<8.0.0,>=6.2.5; extra == "test" | ||
| Requires-Dist: radish-bdd==0.18.2; extra == "test" | ||
@@ -30,0 +30,0 @@ Requires-Dist: PyHamcrest<3.0.0,>=1.9.0; extra == "test" |
+2
-2
@@ -29,3 +29,3 @@ # Licensed to the Apache Software Foundation (ASF) under one | ||
| maintainers = [{name = "Apache TinkerPop", email = "dev@tinkerpop.apache.org"}] | ||
| requires-python = ">=3.9" | ||
| requires-python = ">=3.10" | ||
| dependencies = [ | ||
@@ -52,3 +52,3 @@ "nest_asyncio", | ||
| test = [ | ||
| "pytest>=4.6.4,<7.2.0", | ||
| "pytest>=6.2.5,<8.0.0", | ||
| "radish-bdd==0.18.2", | ||
@@ -55,0 +55,0 @@ "PyHamcrest>=1.9.0,<3.0.0", |
@@ -22,2 +22,4 @@ # | ||
| from decimal import Decimal | ||
| from gremlin_python import statics | ||
@@ -67,1 +69,17 @@ from gremlin_python.process.traversal import Cardinality | ||
| pass | ||
| def test_bigdecimal(self): | ||
| assert statics.bigdecimal(1.23456).value == statics.BigDecimal(5,123456).value | ||
| assert statics.bigdecimal(-1.23456).value == statics.BigDecimal(5,-123456).value | ||
| # make sure the precision isn't changed globally | ||
| assert Decimal("123456789").scaleb(-5) == Decimal('1234.56789') | ||
| try: | ||
| statics.bigdecimal('NaN') | ||
| raise Exception("to_bigdecimal should throw a value error with NaN, Infinity or -Infinity") | ||
| except ValueError: | ||
| pass | ||
| try: | ||
| statics.bigdecimal('abc') | ||
| raise Exception("to_bigdecimal should throw a value error if input is not a convertable to Decimal") | ||
| except ValueError: | ||
| pass |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
325706
2.11%6952
2.12%