Merging upstream version 3.0.22.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d6d0b498a1
commit
ff76e41cf8
4 changed files with 26 additions and 17 deletions
4
.github/workflows/test.yaml
vendored
4
.github/workflows/test.yaml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
|
python-version: [3.7, 3.8, 3.9, "3.10"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -23,14 +23,12 @@ jobs:
|
||||||
sudo apt remove python3-pip
|
sudo apt remove python3-pip
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install . black isort mypy pytest readme_renderer
|
python -m pip install . black isort mypy pytest readme_renderer
|
||||||
python -m pip install . types-dataclasses # Needed for Python 3.6
|
|
||||||
pip list
|
pip list
|
||||||
- name: Type Checker
|
- name: Type Checker
|
||||||
run: |
|
run: |
|
||||||
mypy ptpython
|
mypy ptpython
|
||||||
isort -c --profile black ptpython examples setup.py
|
isort -c --profile black ptpython examples setup.py
|
||||||
black --check ptpython examples setup.py
|
black --check ptpython examples setup.py
|
||||||
if: matrix.python-version != '3.6'
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
./tests/run_tests.py
|
./tests/run_tests.py
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
3.0.22: 2022-12-06
|
||||||
|
------------------
|
||||||
|
|
||||||
|
New features:
|
||||||
|
- Improve rendering performance when there are many completions.
|
||||||
|
|
||||||
|
|
||||||
3.0.21: 2022-11-25
|
3.0.21: 2022-11-25
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -476,14 +476,22 @@ class DictionaryCompleter(Completer):
|
||||||
Complete dictionary keys.
|
Complete dictionary keys.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def abbr_meta(text: str) -> str:
|
def meta_repr(value: object) -> Callable[[], str]:
|
||||||
"Abbreviate meta text, make sure it fits on one line."
|
"Abbreviate meta text, make sure it fits on one line."
|
||||||
# Take first line, if multiple lines.
|
# We return a function, so that it gets computed when it's needed.
|
||||||
if len(text) > 20:
|
# When there are many completions, that improves the performance
|
||||||
text = text[:20] + "..."
|
# quite a bit (for the multi-column completion menu, we only need
|
||||||
if "\n" in text:
|
# to display one meta text).
|
||||||
text = text.split("\n", 1)[0] + "..."
|
def get_value_repr() -> str:
|
||||||
return text
|
text = self._do_repr(value)
|
||||||
|
|
||||||
|
# Take first line, if multiple lines.
|
||||||
|
if "\n" in text:
|
||||||
|
text = text.split("\n", 1)[0] + "..."
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
|
return get_value_repr
|
||||||
|
|
||||||
match = self.item_lookup_pattern.search(document.text_before_cursor)
|
match = self.item_lookup_pattern.search(document.text_before_cursor)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
|
@ -512,12 +520,8 @@ class DictionaryCompleter(Completer):
|
||||||
k_repr + "]",
|
k_repr + "]",
|
||||||
-len(key),
|
-len(key),
|
||||||
display=f"[{k_repr}]",
|
display=f"[{k_repr}]",
|
||||||
display_meta=abbr_meta(self._do_repr(v)),
|
display_meta=meta_repr(v),
|
||||||
)
|
)
|
||||||
except KeyError:
|
|
||||||
# `result[k]` lookup failed. Trying to complete
|
|
||||||
# broken object.
|
|
||||||
pass
|
|
||||||
except ReprFailedError:
|
except ReprFailedError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -532,7 +536,7 @@ class DictionaryCompleter(Completer):
|
||||||
k_repr + "]",
|
k_repr + "]",
|
||||||
-len(key),
|
-len(key),
|
||||||
display=f"[{k_repr}]",
|
display=f"[{k_repr}]",
|
||||||
display_meta=abbr_meta(self._do_repr(result[k])),
|
display_meta=meta_repr(result[k]),
|
||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# `result[k]` lookup failed. Trying to complete
|
# `result[k]` lookup failed. Trying to complete
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -11,7 +11,7 @@ with open(os.path.join(os.path.dirname(__file__), "README.rst")) as f:
|
||||||
setup(
|
setup(
|
||||||
name="ptpython",
|
name="ptpython",
|
||||||
author="Jonathan Slenders",
|
author="Jonathan Slenders",
|
||||||
version="3.0.21",
|
version="3.0.22",
|
||||||
url="https://github.com/prompt-toolkit/ptpython",
|
url="https://github.com/prompt-toolkit/ptpython",
|
||||||
description="Python REPL build on top of prompt_toolkit",
|
description="Python REPL build on top of prompt_toolkit",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
|
Loading…
Add table
Reference in a new issue