diff options
| author | robot-piglet <[email protected]> | 2026-05-20 16:02:28 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2026-05-20 18:07:56 +0300 |
| commit | d167b404f7dec74d9db373c86ee4ec6238724ac6 (patch) | |
| tree | 2b5f094da2fa041f4770e1b5de7da705565c4ae1 /yt/python | |
| parent | 4a4ff781d4a9d3a49658e7aa494b0683dcb73e3b (diff) | |
Intermediate changes
commit_hash:52b6fe1797882f2bbd1764ef8222339d903d3a3f
Diffstat (limited to 'yt/python')
| -rw-r--r-- | yt/python/yt/common.py | 27 | ||||
| -rw-r--r-- | yt/python/yt/ya.make | 1 | ||||
| -rw-r--r-- | yt/python/yt/yson/common.py | 21 | ||||
| -rw-r--r-- | yt/python/yt/yson/convert.py | 44 | ||||
| -rw-r--r-- | yt/python/yt/yson/lexer.py | 19 | ||||
| -rw-r--r-- | yt/python/yt/yson/parser.py | 22 | ||||
| -rw-r--r-- | yt/python/yt/yson/writer.py | 31 | ||||
| -rw-r--r-- | yt/python/yt/yson/ya.make | 2 | ||||
| -rw-r--r-- | yt/python/yt/yson/yson_token.py | 17 | ||||
| -rw-r--r-- | yt/python/yt/yson/yson_types.py | 42 |
10 files changed, 77 insertions, 149 deletions
diff --git a/yt/python/yt/common.py b/yt/python/yt/common.py index 5920393b7e3..a646db661ee 100644 --- a/yt/python/yt/common.py +++ b/yt/python/yt/common.py @@ -1,11 +1,4 @@ try: - from yt.packages.six import iteritems, PY3, text_type, binary_type, string_types - from yt.packages.six.moves import map as imap -except ImportError: - from six import iteritems, PY3, text_type, binary_type, string_types - from six.moves import map as imap - -try: from library.python.prctl import prctl except ImportError: prctl = None @@ -470,7 +463,7 @@ def _pretty_format_escape(value): value.encode("utf-8") return value except UnicodeDecodeError: - return "".join(imap(escape, value)) + return "".join(map(escape, value)) def _pretty_format_bytes(value): @@ -482,7 +475,7 @@ def _pretty_format_bytes(value): try: return value.decode("utf-8") except UnicodeDecodeError: - return "".join(imap(escape, value)) + return "".join(map(escape, value)) def _pretty_format_attribute(name, value, attribute_length_limit): @@ -502,7 +495,7 @@ def _pretty_format_attribute(name, value, attribute_length_limit): if hasattr(value, "_bytes"): value = value._bytes else: - if isinstance(value, string_types): + if isinstance(value, str): value = to_native_str(value) else: value = str(value) @@ -595,7 +588,7 @@ def _pretty_format_full_errors(error, attribute_length_limit): "%(file)s:%(line)d" % attributes, attribute_length_limit=attribute_length_limit)) - for key, value in iteritems(attributes): + for key, value in attributes.items(): if key in origin_keys or key in location_keys or key in origin_cpp_keys: continue lines.append(_pretty_format_attribute( @@ -667,7 +660,7 @@ def require(condition, exception_func): def update_inplace(object: _T, patch) -> _T: """Apply patch to object inplace""" if isinstance(patch, Mapping) and isinstance(object, Mapping): - for key, value in iteritems(patch): + for key, value in patch.items(): if key in object: object[key] = update_inplace(object[key], value) else: @@ -696,13 +689,13 @@ def update(object: _T, patch) -> _T: def flatten(obj, list_types=(list, tuple, set, frozenset, types.GeneratorType)): """Create flat list from all elements.""" if isinstance(obj, list_types): - return list(chain(*imap(flatten, obj))) + return list(chain(*map(flatten, obj))) return [obj] def update_from_env(variables): """Update variables dict from environment (cuts name prefix "YT_").""" - for key, value in iteritems(os.environ): + for key, value in os.environ.items(): prefix = "YT_" if not key.startswith(prefix): continue @@ -733,7 +726,7 @@ def get_value(value, default): def filter_dict(predicate, dictionary): - return dict([(k, v) for (k, v) in iteritems(dictionary) if predicate(k, v)]) + return dict([(k, v) for (k, v) in dictionary.items() if predicate(k, v)]) def set_pdeathsig(signum=None): @@ -806,9 +799,7 @@ def make_non_blocking(fd): def to_native_str(string, encoding="utf-8", errors="strict"): - if not PY3 and isinstance(string, text_type): - return string.encode(encoding) - if PY3 and isinstance(string, binary_type): + if isinstance(string, bytes): return string.decode(encoding, errors=errors) return string diff --git a/yt/python/yt/ya.make b/yt/python/yt/ya.make index f12e6b9cdc3..9aea3b8e7d6 100644 --- a/yt/python/yt/ya.make +++ b/yt/python/yt/ya.make @@ -7,7 +7,6 @@ IF (PYTHON2) ELSE() PEERDIR( contrib/python/simplejson - contrib/python/six yt/python/yt/type_info ) diff --git a/yt/python/yt/yson/common.py b/yt/python/yt/yson/common.py index a50526c0557..5cddcd8203e 100644 --- a/yt/python/yt/yson/common.py +++ b/yt/python/yt/yson/common.py @@ -1,10 +1,5 @@ from yt.common import YtError -try: - from yt.packages.six import int2byte, indexbytes -except ImportError: - from six import int2byte, indexbytes - class YsonError(YtError): pass @@ -34,7 +29,7 @@ class StreamWrap(object): if self.pos == len(self.header): self.state += 1 else: - res = int2byte(indexbytes(self.header, self.pos)) + res = bytes([self.header[self.pos]]) self.pos += 1 return res @@ -50,7 +45,7 @@ class StreamWrap(object): if self.pos == len(self.footer): self.state += 1 else: - res = int2byte(indexbytes(self.footer, self.pos)) + res = bytes([self.footer[self.pos]]) self.pos += 1 return res @@ -61,9 +56,9 @@ class StreamWrap(object): _ENCODING_SENTINEL = object() # Binary literals markers -STRING_MARKER = int2byte(1) -INT64_MARKER = int2byte(2) -DOUBLE_MARKER = int2byte(3) -FALSE_MARKER = int2byte(4) -TRUE_MARKER = int2byte(5) -UINT64_MARKER = int2byte(6) +STRING_MARKER = bytes([1]) +INT64_MARKER = bytes([2]) +DOUBLE_MARKER = bytes([3]) +FALSE_MARKER = bytes([4]) +TRUE_MARKER = bytes([5]) +UINT64_MARKER = bytes([6]) diff --git a/yt/python/yt/yson/convert.py b/yt/python/yt/yson/convert.py index 23bd457e1a2..90923818067 100644 --- a/yt/python/yt/yson/convert.py +++ b/yt/python/yt/yson/convert.py @@ -3,21 +3,12 @@ from .yson_types import ( YsonList, YsonMap, YsonEntity, YsonStringProxy, get_bytes) from .common import YsonError -try: - from yt.packages.six import text_type, binary_type, integer_types, iteritems, PY3 - from yt.packages.six.moves import map as imap -except ImportError: - from six import text_type, binary_type, integer_types, iteritems, PY3 - from six.moves import map as imap - import copy def to_yson_type(value, attributes=None, always_create_attributes=True, encoding="utf-8"): """Wraps value with YSON type.""" if not always_create_attributes and attributes is None: - if isinstance(value, text_type) and not PY3: - return value.encode("utf-8") return value if isinstance(value, YsonType): @@ -26,16 +17,13 @@ def to_yson_type(value, attributes=None, always_create_attributes=True, encoding value.attributes = attributes return value - if isinstance(value, text_type): - if PY3: - result = YsonUnicode(value) - else: # COMPAT - result = YsonString(value.encode("utf-8")) - elif isinstance(value, binary_type): + if isinstance(value, str): + result = YsonUnicode(value) + elif isinstance(value, bytes): result = YsonString(value) elif value is False or value is True: result = YsonBoolean(value) - elif isinstance(value, integer_types): + elif isinstance(value, int): if value < -2 ** 63 or value >= 2 ** 64: raise TypeError("Integer {0} cannot be represented in YSON " "since it is out of range [-2^63, 2^64 - 1])".format(value)) @@ -74,10 +62,10 @@ def json_to_yson(json_tree, use_byte_strings=None): # In yt wrapper we expect here correct keys, but other usages in arcadia could not give this guarantee. # TODO(ignat): fix this usages. if use_byte_strings: - if not isinstance(string, binary_type): + if not isinstance(string, bytes): string = string.encode("ascii") else: - if not isinstance(string, text_type): + if not isinstance(string, str): string = string.decode("ascii") if string.startswith(to_literal("$")): @@ -87,13 +75,13 @@ def json_to_yson(json_tree, use_byte_strings=None): return string if use_byte_strings is None: - use_byte_strings = not PY3 + use_byte_strings = False has_attrs = isinstance(json_tree, dict) and to_literal("$value") in json_tree value = json_tree[to_literal("$value")] if has_attrs else json_tree - if isinstance(value, text_type): + if isinstance(value, str): result = YsonUnicode(value) - elif isinstance(value, binary_type): + elif isinstance(value, bytes): result = YsonString(value) elif value is False or value is True: result = YsonBoolean(value) @@ -106,9 +94,9 @@ def json_to_yson(json_tree, use_byte_strings=None): elif isinstance(value, float): result = YsonDouble(value) elif isinstance(value, list): - result = YsonList(imap(lambda item: json_to_yson(item, use_byte_strings=use_byte_strings), value)) + result = YsonList(map(lambda item: json_to_yson(item, use_byte_strings=use_byte_strings), value)) elif isinstance(value, dict): - result = YsonMap((decode_key(k), json_to_yson(v, use_byte_strings=use_byte_strings)) for k, v in iteritems(YsonMap(value))) + result = YsonMap((decode_key(k), json_to_yson(v, use_byte_strings=use_byte_strings)) for k, v in YsonMap(value).items()) elif value is None: result = YsonEntity() else: @@ -129,7 +117,7 @@ def _yson_to_json(yson_tree, print_attributes=True, attributes_printed=False, an ) def encode_key(key): - if isinstance(key, binary_type): + if isinstance(key, bytes): key = key.decode("ascii") if key and key[0] == "$": return "$" + key @@ -140,7 +128,7 @@ def _yson_to_json(yson_tree, print_attributes=True, attributes_printed=False, an ( encode_key(k), _yson_to_json(v, print_attributes=print_attributes, annotate_with_types=annotate_with_types, use_byte_strings=use_byte_strings), - ) for k, v in iteritems(d) + ) for k, v in d.items() ) def get_type_name(): @@ -156,10 +144,10 @@ def _yson_to_json(yson_tree, print_attributes=True, attributes_printed=False, an return "int64" elif isinstance(yson_tree, float): return "double" - elif isinstance(yson_tree, text_type): + elif isinstance(yson_tree, str): # TODO: "utf8" return "string" - elif isinstance(yson_tree, binary_type): + elif isinstance(yson_tree, bytes): return "string" else: raise RuntimeError("Failed to perform yson to json conversion of {!r}, unknown type {!r} to annotate with types".format( @@ -195,7 +183,7 @@ def _yson_to_json(yson_tree, print_attributes=True, attributes_printed=False, an if not use_byte_strings: tree_value = tree_value.decode("utf-8") return do_annotate_with_types(tree_value) - elif isinstance(yson_tree, binary_type) or isinstance(yson_tree, YsonString): + elif isinstance(yson_tree, bytes) or isinstance(yson_tree, YsonString): if use_byte_strings: tree_value = get_bytes(yson_tree) else: diff --git a/yt/python/yt/yson/lexer.py b/yt/python/yt/yson/lexer.py index e38bdf71974..ce3adf68622 100644 --- a/yt/python/yt/yson/lexer.py +++ b/yt/python/yt/yson/lexer.py @@ -25,18 +25,11 @@ from .common import ( STRING_MARKER, INT64_MARKER, DOUBLE_MARKER, FALSE_MARKER, TRUE_MARKER, UINT64_MARKER) -try: - from yt.packages.six.moves import xrange - from yt.packages.six import int2byte, iterbytes -except ImportError: - from six.moves import xrange - from six import int2byte, iterbytes - import struct -_SEEMS_INT64 = int2byte(0) -_SEEMS_UINT64 = int2byte(1) -_SEEMS_DOUBLE = int2byte(2) +_SEEMS_INT64 = b'\x00' +_SEEMS_UINT64 = b'\x01' +_SEEMS_DOUBLE = b'\x02' PERCENT_LITERALS = [b"true", b"false", b"nan", b"inf", b"-inf", b"+inf"] PERCENT_LITERAL_LENGTH = dict((s[0:1], len(s)) for s in PERCENT_LITERALS) @@ -44,8 +37,8 @@ assert len(PERCENT_LITERALS) == len(PERCENT_LITERAL_LENGTH) def _get_numeric_type(string): - for code in iterbytes(string): - ch = int2byte(code) + for code in string: + ch = bytes([code]) if ch == b"E" or ch == b"e" or ch == b".": return _SEEMS_DOUBLE elif ch == b"u": @@ -176,7 +169,7 @@ class YsonLexer(object): return string result = [] - for i in xrange(char_count): + for i in range(char_count): ch = self._read_char(True) if not ch: raise_yson_error( diff --git a/yt/python/yt/yson/parser.py b/yt/python/yt/yson/parser.py index 746ee6806bf..fd545a65ad7 100644 --- a/yt/python/yt/yson/parser.py +++ b/yt/python/yt/yson/parser.py @@ -20,21 +20,18 @@ from .yson_token import ( TOKEN_END_OF_STREAM, ) -try: - from yt.packages.six import PY3, BytesIO, text_type -except ImportError: - from six import PY3, BytesIO, text_type +from io import BytesIO def _is_text_reader(stream): - return type(stream.read(0)) is text_type + return type(stream.read(0)) is str class YsonParser(object): def __init__(self, stream, encoding, always_create_attributes): # COMPAT: Before porting YSON to Python 3 it supported parsing from # unicode strings. - if _is_text_reader(stream) and PY3: + if _is_text_reader(stream): raise TypeError("Only binary streams are supported by YSON parser") self._tokenizer = YsonTokenizer(stream, encoding) self._always_create_attributes = always_create_attributes @@ -160,7 +157,7 @@ class YsonParser(object): class RawYsonParser(object): def __init__(self, stream): - if _is_text_reader(stream) and PY3: + if _is_text_reader(stream): raise TypeError("Only binary streams are supported by YSON parser") self._buffer = bytearray() self._tokenizer = YsonTokenizer(stream, output_buffer=self._buffer) @@ -256,14 +253,8 @@ def load(stream, yson_type=None, always_create_attributes=True, raw=None, raise YsonError("Raw mode is only supported for list fragments") return RawYsonParser(stream).parse() - if not PY3 and encoding is not _ENCODING_SENTINEL and encoding is not None: - raise YsonError("Encoding parameter is not supported for Python 2") - if encoding is _ENCODING_SENTINEL: - if PY3: - encoding = "utf-8" - else: - encoding = None + encoding = "utf-8" if yson_type == "list_fragment": stream = StreamWrap(stream, b"[", b"]") @@ -280,7 +271,8 @@ def load(stream, yson_type=None, always_create_attributes=True, raw=None, def loads(string, yson_type=None, always_create_attributes=True, raw=None, encoding=_ENCODING_SENTINEL, lazy=False): """Deserializes object from YSON formatted string `string`. See :func:`load <.load>`.""" - if type(string) is text_type and PY3: + if type(string) is str: + string = string.encode(encoding) raise TypeError("Only binary streams are supported by YSON parser") return load(BytesIO(string), yson_type=yson_type, always_create_attributes=always_create_attributes, diff --git a/yt/python/yt/yson/writer.py b/yt/python/yt/yson/writer.py index 294457a89b9..4fc16e001f0 100644 --- a/yt/python/yt/yson/writer.py +++ b/yt/python/yt/yson/writer.py @@ -43,15 +43,6 @@ from .common import (YsonError, FALSE_MARKER, TRUE_MARKER, UINT64_MARKER) from . import yson_types -try: - from yt.packages.six.moves import map as imap - from yt.packages.six import (integer_types, text_type, binary_type, - iteritems, iterkeys, iterbytes, PY3) -except ImportError: - from six.moves import map as imap - from six import (integer_types, text_type, binary_type, - iteritems, iterkeys, iterbytes, PY3) - import math import struct # Python3 compatibility @@ -97,7 +88,7 @@ def _escape_bytes(obj): return b"" res = bytearray() - iterator = iterbytes(obj) + iterator = iter(obj) cur = next(iterator) for nxt in iterator: _escape_byte(cur, nxt, res) @@ -143,7 +134,7 @@ def _raise_error_with_context(message, context): if context.row_index is not None: attributes["row_index"] = context.row_index - path_parts = imap(str, context.path_parts) + path_parts = map(str, context.path_parts) if context.path_parts: attributes["row_key_path"] = "/" + "/".join(path_parts) raise YsonError(message, attributes=attributes) @@ -235,7 +226,7 @@ class Dumper(object): result = b"%true" else: result = TRUE_MARKER - elif isinstance(obj, integer_types): + elif isinstance(obj, int): if obj < -2 ** 63 or obj >= 2 ** 64: _raise_error_with_context("Integer {0} cannot be represented in YSON " "since it is out of range [-2^63, 2^64 - 1])".format(obj), context) @@ -249,7 +240,7 @@ class Dumper(object): result = self._dump_integer(obj, greater_than_max_int64) elif isinstance(obj, float): result = self._dump_float(obj) - elif isinstance(obj, (text_type, binary_type, yson_types.YsonStringProxy)): + elif isinstance(obj, (str, bytes, yson_types.YsonStringProxy)): result = self._dump_string(obj, context) elif isinstance(obj, Mapping): result = self._dump_map(obj, context) @@ -270,8 +261,6 @@ class Dumper(object): obj_str = str(obj) result = obj_str.encode("ascii") - if not PY3: - result = result.rstrip(b"L") if force_uint64 or isinstance(obj, yson_types.YsonUint64): result += b"u" else: @@ -301,9 +290,9 @@ class Dumper(object): return result def _dump_string(self, obj, context): - if isinstance(obj, binary_type): + if isinstance(obj, bytes): result = obj - elif isinstance(obj, text_type): + elif isinstance(obj, str): if self._encoding is None: _raise_error_with_context('Cannot encode unicode object {0!r} to bytes since "encoding" ' 'parameter is None. Consider using byte strings ' @@ -327,7 +316,7 @@ class Dumper(object): result += [b"{", self._format.nextline()] for k, v in self._format.mapping_iter(obj): - if not isinstance(k, (text_type, binary_type, yson_types.YsonStringProxy)): + if not isinstance(k, (str, bytes, yson_types.YsonStringProxy)): _raise_error_with_context("Only string can be Yson map key. Key: {0!r}".format(k), context) @self._circular_check(v) @@ -375,7 +364,7 @@ class Dumper(object): def _dump_attributes(self, obj, context): result = [b"<", self._format.nextline()] for k, v in obj.items(): - if not isinstance(k, (text_type, binary_type)): + if not isinstance(k, (str, bytes)): _raise_error_with_context("Only string can be Yson map key. Key: {0!r}".format(obj), context) @self._circular_check(v) @@ -437,6 +426,6 @@ class FormatDetails(object): def mapping_iter(self, mapping): if self._sort_keys: - return ((key, mapping[key]) for key in sorted(iterkeys(mapping))) + return ((key, mapping[key]) for key in sorted(mapping.keys())) else: - return iteritems(mapping) + return mapping.items() diff --git a/yt/python/yt/yson/ya.make b/yt/python/yt/yson/ya.make index 51b95bb143a..5a8a64ea6bc 100644 --- a/yt/python/yt/yson/ya.make +++ b/yt/python/yt/yson/ya.make @@ -7,8 +7,6 @@ IF (PYTHON2) ELSE() PEERDIR( yt/python/yt - - contrib/python/six ) PY_SRCS( diff --git a/yt/python/yt/yson/yson_token.py b/yt/python/yt/yson/yson_token.py index d536aa1141f..43caa0a673f 100644 --- a/yt/python/yt/yson/yson_token.py +++ b/yt/python/yt/yson/yson_token.py @@ -2,13 +2,6 @@ from .common import YsonError from yt.common import flatten -try: - from yt.packages.six.moves import map as imap - from yt.packages.six import PY3 -except ImportError: - from six.moves import map as imap - from six import PY3 - import string @@ -62,8 +55,7 @@ CHAR_TO_TOKEN_TYPE = { def char_to_token_type(char_or_byte): - if PY3: - char_or_byte = chr(char_or_byte) + char_or_byte = chr(char_or_byte) if char_or_byte not in CHAR_TO_TOKEN_TYPE: return TOKEN_END_OF_STREAM return CHAR_TO_TOKEN_TYPE[char_or_byte] @@ -105,9 +97,8 @@ def token_type_to_string(token): def decode_token_value(value): - if not PY3 or not isinstance(value, bytes): + if not isinstance(value, bytes): return value - chars = [] for byte in value: char = chr(byte) @@ -144,12 +135,12 @@ class YsonToken(object): if token_type not in expected_types: if token_type == TOKEN_END_OF_STREAM: - raise YsonError("Unexpected end of stream; expected types are {0}".format(list(imap(token_type_to_string, expected_types)))) + raise YsonError("Unexpected end of stream; expected types are {0}".format(list(map(token_type_to_string, expected_types)))) else: raise YsonError('Unexpected token "{0}" of type {1}; ' 'expected types are {2}'.format(decode_token_value(self.get_value()), token_type_to_string(token_type), - list(imap(token_type_to_string, expected_types)))) + list(map(token_type_to_string, expected_types)))) def __str__(self): return str(self._value) diff --git a/yt/python/yt/yson/yson_types.py b/yt/python/yt/yson/yson_types.py index eaa6608876e..ed21092f7c6 100644 --- a/yt/python/yt/yson/yson_types.py +++ b/yt/python/yt/yson/yson_types.py @@ -1,8 +1,3 @@ -try: - from yt.packages.six import PY3, integer_types, binary_type, text_type -except ImportError: - from six import PY3, integer_types, binary_type, text_type - from yt.common import YtError @@ -45,41 +40,41 @@ class YsonType(object): return None -class YsonString(binary_type, YsonType): +class YsonString(bytes, YsonType): def __eq__(self, other): # COMPAT: With implicit promotion of str to unicode it can make sense # to compare binary YsonString to unicode string. - if not isinstance(other, (binary_type, text_type)): + if not isinstance(other, (bytes, str)): return NotImplemented - return binary_type(self) == binary_type(other) and YsonType.__eq__(self, other) + return bytes(self) == bytes(other) and YsonType.__eq__(self, other) def __ne__(self, other): return not (self == other) def __hash__(self): - return self.base_hash(binary_type) + return self.base_hash(bytes) def __repr__(self): - return self.to_str(binary_type, repr) + return self.to_str(bytes, repr) def get_yson_type_str(self): return "string" -class YsonUnicode(text_type, YsonType): +class YsonUnicode(str, YsonType): def __eq__(self, other): - if not isinstance(other, text_type): + if not isinstance(other, str): return NotImplemented - return text_type(self) == text_type(other) and YsonType.__eq__(self, other) + return str(self) == str(other) and YsonType.__eq__(self, other) def __ne__(self, other): return not (self == other) def __hash__(self): - return self.base_hash(text_type) + return self.base_hash(str) def __repr__(self): - return self.to_str(text_type, repr) + return self.to_str(str, repr) def get_yson_type_str(self): return "string" @@ -131,8 +126,8 @@ def proxy(cls): "__radd__", ] - for name in dir(text_type): - attr = getattr(text_type, name) + for name in dir(str): + attr = getattr(str, name) if callable(attr) and name not in ALLOWED_METHODS: setattr(cls, name, _make_raise_not_unicode_error(name)) for name in ADDITIONAL_METHODS: @@ -179,15 +174,15 @@ class YsonStringProxy(YsonType): def is_unicode(x): - return isinstance(x, text_type) + return isinstance(x, str) def get_bytes(x, encoding="utf8"): - if isinstance(x, text_type): + if isinstance(x, str): return x.encode(encoding) elif isinstance(x, YsonStringProxy): return x._bytes - elif isinstance(x, binary_type): + elif isinstance(x, bytes): return x else: raise TypeError("get_bytes() expected str, bytes or YsonStringProxy, got <{}>{!r}" @@ -200,15 +195,12 @@ def make_byte_key(s): return proxy -if PY3: - _YsonIntegerBase = int -else: - _YsonIntegerBase = long # noqa +_YsonIntegerBase = int class YsonIntegerBase(_YsonIntegerBase, YsonType): def __eq__(self, other): - if not isinstance(other, integer_types): + if not isinstance(other, int): return NotImplemented return _YsonIntegerBase(self) == _YsonIntegerBase(other) and YsonType.__eq__(self, other) |
