cpython/Include/internal
Dennis Sweeney 80a2a4ed7d
bpo-38530: Refactor and improve AttributeError suggestions (GH-25776)
- Make case-swaps half the cost of any other edit
- Refactor Levenshtein code to not use memory allocator, and to bail early on no match.
- Add comments to Levenshtein distance code
- Add test cases for Levenshtein distance behind a debug macro
- Set threshold to `(name_size + item_size + 3) * MOVE_COST / 6`.
  - Reasoning: similar to `difflib.SequenceMatcher.ratio()` >= 2/3:
```
"Multiset Jaccard similarity" >= 2/3
matching letters / total letters >= 2/3
(name_size - distance + item_size - distance) / (name_size + item_size) >= 2/3
1 - (2*distance) / (name_size + item_size) >= 2/3
1/3 >= (2*distance) / (name_size + item_size)
(name_size + item_size) / 6 >= distance
With rounding:
(name_size + item_size + 3) // 6 >= distance
```

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-05-03 16:47:27 +01:00
..
pycore_abstract.h bpo-40170: Add _PyIndex_Check() internal function (GH-19426) 2020-04-08 02:01:56 +02:00
pycore_accu.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_asdl.h bpo-43244: Remove the pyarena.h header (GH-25007) 2021-03-24 02:23:01 +01:00
pycore_ast.h bpo-43892: Make match patterns explicit in the AST (GH-25585) 2021-04-28 22:58:44 -07:00
pycore_ast_state.h bpo-43892: Make match patterns explicit in the AST (GH-25585) 2021-04-28 22:58:44 -07:00
pycore_atomic.h bpo-39465: Add pycore_atomic_funcs.h header (GH-20766) 2020-12-23 03:41:08 +01:00
pycore_atomic_funcs.h bpo-39465: Add pycore_atomic_funcs.h header (GH-20766) 2020-12-23 03:41:08 +01:00
pycore_bitutils.h bpo-41617: Add _Py__has_builtin() macro (GH-23260) 2020-11-13 15:38:17 +01:00
pycore_blocks_output_buffer.h bpo-41486: Faster bz2/lzma/zlib via new output buffering (GH-21740) 2021-04-27 23:58:54 -07:00
pycore_bytes_methods.h bpo-35081: Move bytes_methods.h to the internal C API (GH-18492) 2020-02-12 22:32:34 +01:00
pycore_call.h bpo-38644: Add _PyObject_Call() (GH-17089) 2019-11-14 13:36:21 +01:00
pycore_ceval.h bpo-37146: Move _PyEval_DeactivateOpCache() to the internal C API (GH-24786) 2021-03-08 22:56:37 +01:00
pycore_code.h bpo-42093: Add opcode cache for LOAD_ATTR (GH-22803) 2020-10-20 06:22:44 +01:00
pycore_compile.h bpo-42609: Check recursion depth in the AST validator and optimizer (GH-23744) 2021-04-25 13:38:00 +03:00
pycore_condvar.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_context.h bpo-43268: Pass interp rather than tstate to internal functions (GH-24580) 2021-02-19 15:10:45 +01:00
pycore_dtoa.h Revert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)" (GH-24964) 2021-03-22 11:58:59 +01:00
pycore_fileutils.h bpo-43667: Fix broken Unicode encoding in non-UTF locales on Solaris (GH-25096) 2021-04-30 15:21:42 +02:00
pycore_format.h bpo-42431: Fix outdated bytes comments (GH-23458) 2020-12-03 12:46:16 +02:00
pycore_gc.h bpo-43268: Pass interp rather than tstate to internal functions (GH-24580) 2021-02-19 15:10:45 +01:00
pycore_getopt.h bpo-36763: Cleanup precmdline in _PyCoreConfig_Read() (GH-13371) 2019-05-17 03:15:12 +02:00
pycore_gil.h bpo-38353: Cleanup includes in the internal C API (GH-16548) 2019-10-02 23:51:20 +02:00
pycore_hamt.h bpo-39573: Add Py_IS_TYPE() function (GH-18488) 2020-02-13 18:37:17 +01:00
pycore_hashtable.h bpo-40602: Write unit tests for _Py_hashtable_t (GH-20091) 2020-05-14 21:55:47 +02:00
pycore_import.h bpo-41994: Fix refcount issues in Python/import.c (GH-22632) 2021-01-12 15:43:32 +01:00
pycore_initconfig.h bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481) 2021-03-29 12:28:14 +09:00
pycore_interp.h bpo-43977: Use tp_flags for collection matching (GH-25723) 2021-04-30 09:50:28 +01:00
pycore_list.h bpo-41078: Add pycore_list.h internal header file (GH-21057) 2020-06-22 17:39:32 +02:00
pycore_long.h bpo-43687: Py_Initialize() creates singletons earlier (GH-25147) 2021-04-02 15:28:13 +02:00
pycore_moduleobject.h bpo-40137: Add pycore_moduleobject.h internal header (GH-25507) 2021-04-22 00:52:52 +02:00
pycore_object.h bpo-43770: Refactor PyType_Ready() function (GH-25336) 2021-04-11 23:57:09 +02:00
pycore_parser.h bpo-43244: Remove parser_interface.h header file (GH-25001) 2021-03-24 01:29:09 +01:00
pycore_pathconfig.h bpo-29778: test_embed tests the path configuration (GH-21306) 2020-07-08 00:20:37 +02:00
pycore_pyarena.h bpo-43244: Remove the pyarena.h header (GH-25007) 2021-03-24 02:23:01 +01:00
pycore_pyerrors.h bpo-38530: Refactor and improve AttributeError suggestions (GH-25776) 2021-05-03 16:47:27 +01:00
pycore_pyhash.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_pylifecycle.h bpo-43687: Py_Initialize() creates singletons earlier (GH-25147) 2021-04-02 15:28:13 +02:00
pycore_pymem.h bpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901) 2020-06-16 01:28:07 +02:00
pycore_pystate.h bpo-43268: _Py_IsMainInterpreter() now expects interp (GH-24577) 2021-02-19 13:33:31 +01:00
pycore_runtime.h bpo-42882: _PyRuntimeState_Init() leaves unicode next_index unchanged (GH-24193) 2021-01-12 10:29:45 +01:00
pycore_structseq.h bpo-43916: Move the _PyStructSequence_InitType function to the internal API (GH-25854) 2021-05-03 15:50:24 +01:00
pycore_symtable.h bpo-42725: Render annotations effectless on symbol table with PEP 563 (GH-25583) 2021-05-03 10:43:00 +03:00
pycore_sysmodule.h bpo-38644: Add _PySys_Audit() which takes tstate (GH-19180) 2020-03-26 18:57:32 +01:00
pycore_traceback.h bpo-42923: _Py_DumpExtensionModules() ignores stdlib ext (GH-24254) 2021-01-19 23:35:27 +01:00
pycore_tuple.h bpo-41078: Rename pycore_tupleobject.h to pycore_tuple.h (GH-21056) 2020-06-22 17:27:35 +02:00
pycore_ucnhash.h bpo-42157: Rename unicodedata.ucnhash_CAPI (GH-22994) 2020-10-27 04:36:22 +01:00
pycore_unionobject.h bpo-42233: Add union type expression support for GenericAlias and fix de-duplicating of GenericAlias (GH-23077) 2020-11-08 20:00:13 -08:00
pycore_warnings.h bpo-43268: Pass interp rather than tstate to internal functions (GH-24580) 2021-02-19 15:10:45 +01:00