diff --git a/parso/cache.py b/parso/cache.py index 182a8a4..4d9ad32 100644 --- a/parso/cache.py +++ b/parso/cache.py @@ -10,7 +10,7 @@ import errno from jedi import settings from jedi import debug -from jedi._compatibility import FileNotFoundError +from parso._compatibility import FileNotFoundError _PICKLE_VERSION = 30 diff --git a/parso/python/__init__.py b/parso/python/__init__.py index 3657dc2..bf68bf3 100644 --- a/parso/python/__init__.py +++ b/parso/python/__init__.py @@ -5,7 +5,7 @@ import os from jedi import settings from jedi.common import splitlines, source_to_unicode -from jedi._compatibility import FileNotFoundError +from parso._compatibility import FileNotFoundError from parso.pgen2.pgen import generate_grammar from parso.python.parser import Parser, _remove_last_newline from parso.python.diff import DiffParser diff --git a/parso/python/tree.py b/parso/python/tree.py index d41f639..ad01175 100644 --- a/parso/python/tree.py +++ b/parso/python/tree.py @@ -25,7 +25,7 @@ Any subclasses of :class:`Scope`, including :class:`Module` has an attribute [] """ -from jedi._compatibility import utf8_repr, unicode +from parso._compatibility import utf8_repr, unicode from parso.tree import Node, BaseNode, Leaf, ErrorNode, ErrorLeaf, \ search_ancestor diff --git a/parso/token.py b/parso/token.py index 0cb846d..60a1e09 100644 --- a/parso/token.py +++ b/parso/token.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from jedi._compatibility import is_py3, is_py35 +from parso._compatibility import py_version from token import * @@ -12,7 +12,7 @@ NL = N_TOKENS tok_name[NL] = 'NL' N_TOKENS += 1 -if is_py3: +if py_version >= 30: BACKQUOTE = N_TOKENS tok_name[BACKQUOTE] = 'BACKQUOTE' N_TOKENS += 1 @@ -24,7 +24,7 @@ else: tok_name[ELLIPSIS] = 'ELLIPSIS' N_TOKENS += 1 -if not is_py35: +if not py_version >= 35: ATEQUAL = N_TOKENS tok_name[ATEQUAL] = 'ATEQUAL' N_TOKENS += 1 diff --git a/parso/tokenize.py b/parso/tokenize.py index 5134582..ce32e92 100644 --- a/parso/tokenize.py +++ b/parso/tokenize.py @@ -18,14 +18,14 @@ import itertools as _itertools from parso.token import (tok_name, N_TOKENS, ENDMARKER, STRING, NUMBER, opmap, NAME, OP, ERRORTOKEN, NEWLINE, INDENT, DEDENT) -from jedi._compatibility import is_py3, py_version, u +from parso._compatibility import py_version, u from jedi.common import splitlines cookie_re = re.compile("coding[:=]\s*([-\w.]+)") -if is_py3: +if py_version >= 30: # Python 3 has str.isidentifier() to check if a char is a valid identifier is_identifier = str.isidentifier else: @@ -73,7 +73,7 @@ if py_version >= 36: else: Hexnumber = r'0[xX][0-9a-fA-F]+' Binnumber = r'0[bB][01]+' - if is_py3: + if py_version >= 30: Octnumber = r'0[oO][0-7]+' else: Octnumber = '0[0-7]+' diff --git a/parso/tree.py b/parso/tree.py index 690698a..51e1440 100644 --- a/parso/tree.py +++ b/parso/tree.py @@ -1,5 +1,5 @@ from abc import abstractmethod, abstractproperty -from jedi._compatibility import utf8_repr, encoding, is_py3 +from parso._compatibility import utf8_repr, encoding, py_version def search_ancestor(node, *node_types): @@ -283,7 +283,7 @@ class BaseNode(NodeOrLeaf): @utf8_repr def __repr__(self): code = self.get_code().replace('\n', ' ').strip() - if not is_py3: + if not py_version >= 30: code = code.encode(encoding, 'replace') return "<%s: %s@%s,%s>" % \ (type(self).__name__, code, self.start_pos[0], self.start_pos[1])