Commit Graph

9 Commits

Author SHA1 Message Date
Sebastian Rittau
006a79220f Flake8 fixes (#2549)
* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Rebecca Chen
ea0a0fd17e Fix _StrType in difflib in Python 2. (#2514)
difflib functions accept unicode as well.
2018-10-12 14:39:24 +02:00
John Reese
40b176b195 Fix annotation for difflib.SequenceMatcher.find_longest_match (#2253) 2018-06-20 10:52:39 -07:00
Stephen Thorne
a25ff0bddf get_grouped_opcodes() returns an iterable of groups, not an iterable of opcodes. (#2183)
The type signature of get_grouped_opcodes() was incorrect. Resulting in type errors when checking return values.

The usage of this function is like this:
groups = sm.get_grouped_opcodes() # groups is Iterable[List[Tuple[str, int, int, int, int]]]
for group in groups:  #  group is List[Tuple[str, int, int, int, int]]
  for opcode in group:  # opcode is Tuple[str, int, int, int, int]
2018-06-01 09:59:57 -07:00
Michael J. Sullivan
c55cf13d8e make difflib use str on 3 and AnyStr on 2 (#2160) 2018-05-24 13:53:42 -07:00
Jelle Zijlstra
46f0bb8b91 support unicode in Python 2 for difflib (#2055)
Fixes #1961.

I mostly just replaced all str annotations with Text, including in return types. This is
only broadly correct; diffing a str and a unicode sequence actually results in a mixed
output of str and unicode. We could also keep the return types as str if using Text
causes errors in real code. For callbacks that take str, I introduced a Union alias
because a callable taking a str would not be a compatible with a parameter of type
Callable[[Text], bool].

I also fixed the return type of difflib.restore.
2018-04-27 14:39:18 -07:00
Freek Dijkstra
55a3bad0f8 fix signature for difflib.get_close_matches (#2064)
Fixes #2063.

The second argument to difflib.get_close_matches not only accepts a List, but any Iterator.
2018-04-17 14:24:27 -07:00
Jelle Zijlstra
9bbcb0822d add difflib.diff_bytes and difflib.Match (#1336) 2017-05-26 09:32:34 -07:00
Jelle Zijlstra
9ae9a9e741 merge Python 2 and 3 stubs for difflib (#1313)
These were already virtually identical.

I didn't review the stubs themselves for correctness. I'll make some changes after this
PR is in.
2017-05-23 15:01:30 -07:00