Commit Graph

14 Commits

Author SHA1 Message Date
Shantanu
8e03f33d84 difflib: update for py39 (#4067)
Adds default values, the hi params can now be None

Co-authored-by: hauntsaninja <>
2020-05-24 17:41:45 -07:00
Jelle Zijlstra
23e380ac83 add overload to difflib.get_close_matches (#3908)
Fixes #3906. Fixes #2067.
2020-04-05 14:12:29 +02:00
Shantanu
d104386b40 difflib: fix various types (#3755) 2020-02-21 21:20:15 -08:00
Shantanu
d2da7d17c2 difflib: various fixes (#3629)
- add undocumented parameters to IS_LINE_JUNK and IS_CHARACTER_JUNK
- add kw-only charset to make_file
2020-01-21 19:30:05 +01:00
Sebastian Rittau
ec7960a8cb Convert namedtuples to class syntax (#3321) 2019-10-20 10:37:33 +02:00
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