<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Python/suggestions.c, branch enum-lost-fixes</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) (GH-27198)</title>
<updated>2021-07-16T21:16:08+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2021-07-16T21:16:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=a0b1d401db52391d13479c53ee3880e6640df98c'/>
<id>a0b1d401db52391d13479c53ee3880e6640df98c</id>
<content type='text'>
(cherry picked from commit 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d)

Co-authored-by: Pablo Galindo Salgado &lt;Pablogsal@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d)

Co-authored-by: Pablo Galindo Salgado &lt;Pablogsal@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Refactor and improve AttributeError suggestions (GH-25776)</title>
<updated>2021-05-03T15:47:27+00:00</updated>
<author>
<name>Dennis Sweeney</name>
<email>36520290+sweeneyde@users.noreply.github.com</email>
</author>
<published>2021-05-03T15:47:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=80a2a4ed7d090fff2584302f07315d567109bca9'/>
<id>80a2a4ed7d090fff2584302f07315d567109bca9</id>
<content type='text'>
- 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()` &gt;= 2/3:
```
"Multiset Jaccard similarity" &gt;= 2/3
matching letters / total letters &gt;= 2/3
(name_size - distance + item_size - distance) / (name_size + item_size) &gt;= 2/3
1 - (2*distance) / (name_size + item_size) &gt;= 2/3
1/3 &gt;= (2*distance) / (name_size + item_size)
(name_size + item_size) / 6 &gt;= distance
With rounding:
(name_size + item_size + 3) // 6 &gt;= distance
```

Co-authored-by: Pablo Galindo &lt;pablogsal@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- 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()` &gt;= 2/3:
```
"Multiset Jaccard similarity" &gt;= 2/3
matching letters / total letters &gt;= 2/3
(name_size - distance + item_size - distance) / (name_size + item_size) &gt;= 2/3
1 - (2*distance) / (name_size + item_size) &gt;= 2/3
1/3 &gt;= (2*distance) / (name_size + item_size)
(name_size + item_size) / 6 &gt;= distance
With rounding:
(name_size + item_size + 3) // 6 &gt;= distance
```

Co-authored-by: Pablo Galindo &lt;pablogsal@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Require 50% similarity in NameError and AttributeError suggestions (GH-25584)</title>
<updated>2021-04-27T00:22:27+00:00</updated>
<author>
<name>Dennis Sweeney</name>
<email>36520290+sweeneyde@users.noreply.github.com</email>
</author>
<published>2021-04-27T00:22:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=284c52da092438522949d6f96d8c1f9ff37f9f00'/>
<id>284c52da092438522949d6f96d8c1f9ff37f9f00</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Cover more error paths in error suggestion functions (GH-25462)</title>
<updated>2021-04-17T22:28:45+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-17T22:28:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=0b1c169c4a009e1094fe5df938d2367e63ebeea0'/>
<id>0b1c169c4a009e1094fe5df938d2367e63ebeea0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Include builtins in NameError suggestions (GH-25460)</title>
<updated>2021-04-17T21:26:54+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-17T21:26:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=3ab4bea5a3ac28820781cf62a768c65370c9054c'/>
<id>3ab4bea5a3ac28820781cf62a768c65370c9054c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Match exactly AttributeError and NameError when offering suggestions (GH-25443)</title>
<updated>2021-04-16T16:12:03+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-16T16:12:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=0ad81d4db2f409d72f469d0b74ab597be772a68e'/>
<id>0ad81d4db2f409d72f469d0b74ab597be772a68e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Optimize the calculation of string sizes when offering suggestions (GH-25412)</title>
<updated>2021-04-14T23:03:43+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-14T23:03:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=3fc65b97d09fd29272fdf60d2e567bfb070da824'/>
<id>3fc65b97d09fd29272fdf60d2e567bfb070da824</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Make sure that failing to generate suggestions on failure will not propagate exceptions (GH-25408)</title>
<updated>2021-04-14T17:58:28+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-14T17:58:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=e07f4ab26aaf08f90ebd9e6004af14fd6ef39351'/>
<id>e07f4ab26aaf08f90ebd9e6004af14fd6ef39351</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Offer suggestions on NameError (GH-25397)</title>
<updated>2021-04-14T14:10:33+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-14T14:10:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=5bf8bf2267cd109970b2d946d43b2e9f71379ba2'/>
<id>5bf8bf2267cd109970b2d946d43b2e9f71379ba2</id>
<content type='text'>
When printing NameError raised by the interpreter, PyErr_Display
will offer suggestions of simmilar variable names in the function that the exception
was raised from:

    &gt;&gt;&gt; schwarzschild_black_hole = None
    &gt;&gt;&gt; schwarschild_black_hole
    Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When printing NameError raised by the interpreter, PyErr_Display
will offer suggestions of simmilar variable names in the function that the exception
was raised from:

    &gt;&gt;&gt; schwarzschild_black_hole = None
    &gt;&gt;&gt; schwarschild_black_hole
    Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38530: Offer suggestions on AttributeError (#16856)</title>
<updated>2021-04-14T01:36:07+00:00</updated>
<author>
<name>Pablo Galindo</name>
<email>Pablogsal@gmail.com</email>
</author>
<published>2021-04-14T01:36:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=37494b441aced0362d7edd2956ab3ea7801e60c8'/>
<id>37494b441aced0362d7edd2956ab3ea7801e60c8</id>
<content type='text'>
When printing AttributeError, PyErr_Display will offer suggestions of similar 
attribute names in the object that the exception was raised from:

&gt;&gt;&gt; collections.namedtoplo
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When printing AttributeError, PyErr_Display will offer suggestions of similar 
attribute names in the object that the exception was raised from:

&gt;&gt;&gt; collections.namedtoplo
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?</pre>
</div>
</content>
</entry>
</feed>
