Skip to content

Commit 5b0664c

Browse files
committed
Version bump v10.2.2-beta.4
+ Passing many more tests: Python 2.7: 4 skips, 80 failures Python 3.6: 4 skips, 126 failures, 1 error
1 parent 21a5e24 commit 5b0664c

17 files changed

Lines changed: 49 additions & 38 deletions

codeintel/HTMLTreeParser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def add(self, name, reg, mods=None ):
111111
a("attrfinderRE" , "(?:[\n \t]*)(%(Name)s)(?:%(S)s)?=(?:%(S)s)?(%(AttValSE)s)", re.S|re.U)
112112
return g_collector
113113

114-
is_not_ascii = re.compile(eval(r'u"[\u0080-\uffff]"')).search
115114

116115
def parseiter(data, markuponly=0):
117116
if markuponly:
@@ -271,9 +270,9 @@ def end_tag(self, tag, loc=None):
271270
return self._last
272271

273272
def data(self, data):
274-
if isinstance(data, type('')) and is_not_ascii(data):
273+
if not isinstance(data, six.text_type):
275274
# convert to unicode, but only if necessary
276-
data = six.text_type(data, self.encoding, "ignore")
275+
data = data.decode('utf-8', 'ignore')
277276
ElementTree.TreeBuilder.data(self, data)
278277

279278
def close(self):

codeintel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '10.2.2-beta.3'
1+
__version__ = '10.2.2-beta.4'

codeintel/codeintel2/accessor.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,10 @@ def tokens(self):
175175
def _char_pos_from_byte_pos(self, byte_pos):
176176
line = self.line_from_pos(byte_pos)
177177
byte_offset, char_offset = self.__position_data[line][:2]
178-
next_byte_offset = (byte_offset + len(self.content[char_offset].encode("utf-8")))
179178
try:
180-
while next_byte_offset <= byte_pos:
181-
byte_offset = next_byte_offset
179+
while byte_offset < byte_pos:
180+
byte_offset += len(self.content[char_offset].encode("utf-8"))
182181
char_offset += 1
183-
next_byte_offset += len(self.content[char_offset].encode("utf-8"))
184182
except IndexError:
185183
pass # running past EOF
186184
return char_offset

codeintel/codeintel2/css_linter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class _CSSLexer(Lexer):
162162
def __init__(self, code, language):
163163
Lexer.__init__(self)
164164
# We don't care about any JS operators in `...` escapes
165-
terms = '@{ ${ ~= |= ::'
165+
terms = r'@{ ${ ~= |= ::'
166166
if language == "Less":
167167
terms += ' || &&'
168168
self.multi_char_ops = self.build_dict(terms)
@@ -259,7 +259,9 @@ def _add_result(self, message, tok, status=1):
259259
status)
260260

261261
def _add_result_tok_parts(self, message, line_start, col_start, line_end, col_end, text, status=1):
262-
if not self._results or self._results[-1].line_end < line_start:
262+
if (not self._results or
263+
self._results[-1].line_end is not None and line_start is not None and
264+
self._results[-1].line_end < line_start):
263265
if not "got" in message:
264266
if line_start is None:
265267
message += ", reached end of file"

codeintel/codeintel2/database/projlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(self, mgr, db, proj):
9494

9595
self.name = basename(proj.path)
9696
self.base_dir = join(self.db.base_dir, "db", "projs",
97-
md5(proj.path).hexdigest())
97+
md5(proj.path.encode('utf-8')).hexdigest())
9898
self._proj_lib_from_lang = weakref.WeakValueDictionary()
9999
self._idx_lock = threading.RLock()
100100
self._dirs_from_basename = None

codeintel/codeintel2/lang_css.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ def async_eval_at_trg(self, buf, trg, ctlr):
973973
def _get_all_anchors_names_in_project(self):
974974
#anchors = []
975975
#pos = 0
976-
#LENGTH = accessor.length
976+
#LENGTH = accessor.length()
977977
#style = 0
978978
#func_style_at_pos = accessor.style_at_pos
979979
#func_char_at_pos = accessor.char_at_pos

codeintel/codeintel2/lang_perl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ def async_eval_at_trg(self, buf, trg, ctlr):
10541054
citdl_expr = citdl_expr[1:]
10551055
if trg.id[1] == TRG_FORM_DEFN and citdl_expr[0] == '$':
10561056
current_pos = trg.pos
1057-
lim = buf.accessor.length
1057+
lim = buf.accessor.length()
10581058
style = buf.accessor.style_at_pos(current_pos)
10591059
while (style == ScintillaConstants.SCE_PL_SCALAR or
10601060
ScintillaConstants.SCE_PL_REGEX_VAR <= style <= ScintillaConstants.SCE_PL_STRING_QR_VAR) and current_pos < lim:

codeintel/codeintel2/lang_php.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _functionCalltipTrigger(self, ac, pos, DEBUG=False):
135135
paren_count = 0
136136
p = pos
137137
min_p = max(0, p - 200) # look back max 200 chars
138-
while p > min_p:
138+
while p and p > min_p:
139139
p, c, style = ac.getPrecedingPosCharStyle(ignore_styles=self.comment_styles)
140140
if style == self.operator_style:
141141
if c == ")":

codeintel/codeintel2/lang_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ def trg_from_pos(self, pos, implicit=True):
948948
if beforeChar and beforeChar in " \t":
949949
if text.endswith("def"):
950950
posttext = accessor.text_range(pos,
951-
min(accessor.length, pos+20)
951+
min(accessor.length(), pos+20)
952952
).replace(" ", "")
953953
if DEBUG:
954954
print("trg_from_pos:: magic-symbols - def")

codeintel/codeintel2/parser_cix.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def get_common_attrs(node):
7575
return attrs
7676

7777
def sort_by_lines(adict):
78-
intermed = [(adict[k].line_num, adict[k].type, k) for k in adict.keys()]
79-
intermed.sort()
78+
intermed = sorted((adict[k].line_num or 0, adict[k].type or "", k or "") for k in adict.keys())
8079
return intermed
8180

8281

0 commit comments

Comments
 (0)