mirror of https://github.com/jab/bidict.git
Compare commits
2 Commits
008640e669
...
cc284a7071
Author | SHA1 | Date |
---|---|---|
Joshua Bronson | cc284a7071 | |
Joshua Bronson | 331bc83e8a |
|
@ -39,7 +39,7 @@ jobs:
|
|||
python-version: ${{ matrix.pyversion }}
|
||||
cache: pip
|
||||
cache-dependency-path: dev-deps/test.txt
|
||||
- run: python -m pip install -U pip setuptools wheel tox
|
||||
- run: python -m pip install -U pip setuptools wheel tox==4.0.5
|
||||
- name: cache .hypothesis dir
|
||||
uses: actions/cache@v3.0.11
|
||||
with:
|
||||
|
|
|
@ -29,7 +29,7 @@ repos:
|
|||
args: ["--uri-ignore-words-list", "*"] # https://github.com/codespell-project/codespell/issues/2473
|
||||
|
||||
- repo: https://github.com/RobertCraigie/pyright-python
|
||||
rev: v1.1.278
|
||||
rev: v1.1.283
|
||||
hooks:
|
||||
- id: pyright
|
||||
|
||||
|
@ -40,7 +40,7 @@ repos:
|
|||
exclude: setup.py|docs/conf.py|tests
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: v0.0.156
|
||||
rev: v0.0.172
|
||||
hooks:
|
||||
- id: ruff
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@ from ._iter import iteritems, inverted
|
|||
from ._typing import KT, VT, MISSING, OKT, OVT, IterItems, MapOrIterItems
|
||||
|
||||
|
||||
# Disable pyright strict diagnostics that are causing many false positives or are just not helpful in this file:
|
||||
# pyright: reportPrivateUsage=false, reportUnknownArgumentType=false, reportUnknownMemberType=false, reportUnknownVariableType=false, reportUnnecessaryIsInstance=false
|
||||
|
||||
|
||||
OldKV = t.Tuple[OKT[KT], OVT[VT]]
|
||||
DedupResult = t.Optional[OldKV[KT, VT]]
|
||||
Write = t.List[t.Callable[[], None]]
|
||||
|
@ -47,10 +43,6 @@ class BidictKeysView(t.KeysView[KT], t.ValuesView[KT]):
|
|||
"""
|
||||
|
||||
|
||||
dict_keys: t.Type[t.KeysView[t.Any]] = type({}.keys())
|
||||
BidictKeysView.register(dict_keys)
|
||||
|
||||
|
||||
def get_arg(*args: MapOrIterItems[KT, VT]) -> MapOrIterItems[KT, VT]:
|
||||
"""Ensure there's only a single arg in *args*, then return it."""
|
||||
if len(args) > 1:
|
||||
|
@ -495,7 +487,7 @@ class BidictBase(BidirectionalMapping[KT, VT]):
|
|||
# If other is a bidict, use its existing backing inverse mapping, otherwise
|
||||
# other could be a generator that's now exhausted, so invert self._fwdm on the fly.
|
||||
inv = other.inverse if isinstance(other, BidictBase) else inverted(self._fwdm)
|
||||
self._invm.update(inv) # pyright: ignore # https://github.com/jab/bidict/pull/242#discussion_r824223403
|
||||
self._invm.update(inv)
|
||||
|
||||
#: Used for the copy protocol.
|
||||
#: *See also* the :mod:`copy` module
|
||||
|
|
|
@ -36,7 +36,7 @@ class FrozenOrderedBidict(OrderedBidictBase[KT, VT]):
|
|||
the ordering of the items can make the ordering dependence more explicit.
|
||||
"""
|
||||
|
||||
__hash__: t.Callable[[t.Any], int] = frozenbidict.__hash__ # pyright: ignore
|
||||
__hash__: t.Callable[[t.Any], int] = frozenbidict.__hash__
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
@property
|
||||
|
|
|
@ -14,9 +14,6 @@ from ._bidict import bidict
|
|||
from ._typing import KT, VT
|
||||
|
||||
|
||||
# pyright: reportPrivateUsage=false, reportUnnecessaryIsInstance=false
|
||||
|
||||
|
||||
class NamedBidictBase:
|
||||
"""Base class that namedbidicts derive from."""
|
||||
|
||||
|
@ -96,4 +93,4 @@ def namedbidict(
|
|||
NamedInv.__doc__ = f'NamedBidictInv({basename}) {typename!r}: {valname} -> {keyname}'
|
||||
caller_module = _getframe(1).f_globals.get('__name__', '__main__')
|
||||
NamedBidict.__module__ = NamedInv.__module__ = caller_module
|
||||
return NamedBidict # pyright: ignore [reportUnknownVariableType]
|
||||
return NamedBidict
|
||||
|
|
|
@ -23,9 +23,6 @@ from ._orderedbase import OrderedBidictBase
|
|||
from ._typing import KT, VT
|
||||
|
||||
|
||||
# pyright: reportPrivateUsage=false
|
||||
|
||||
|
||||
class OrderedBidict(OrderedBidictBase[KT, VT], MutableBidict[KT, VT]):
|
||||
"""Mutable bidict type that maintains items in insertion order."""
|
||||
|
||||
|
@ -60,7 +57,7 @@ class OrderedBidict(OrderedBidictBase[KT, VT], MutableBidict[KT, VT]):
|
|||
korv = self._node_by_korv.inverse[node]
|
||||
if self._bykey:
|
||||
return korv, self._pop(korv)
|
||||
return self.inverse._pop(korv), korv # pyright: ignore [reportGeneralTypeIssues]
|
||||
return self.inverse._pop(korv), korv
|
||||
|
||||
def move_to_end(self, key: KT, last: bool = True) -> None:
|
||||
"""Move the item with the given key to the end if *last* is true, else to the beginning.
|
||||
|
|
|
@ -6,35 +6,40 @@
|
|||
#
|
||||
build==0.9.0
|
||||
# via pip-tools
|
||||
cachetools==5.2.0
|
||||
# via tox
|
||||
chardet==5.1.0
|
||||
# via tox
|
||||
click==8.1.3
|
||||
# via pip-tools
|
||||
colorama==0.4.6
|
||||
# via tox
|
||||
distlib==0.3.6
|
||||
# via virtualenv
|
||||
filelock==3.8.0
|
||||
filelock==3.8.2
|
||||
# via
|
||||
# tox
|
||||
# virtualenv
|
||||
packaging==21.3
|
||||
packaging==22.0
|
||||
# via
|
||||
# build
|
||||
# pyproject-api
|
||||
# tox
|
||||
pep517==0.13.0
|
||||
# via build
|
||||
pip-tools==6.11.0
|
||||
# via bidict (pyproject.toml)
|
||||
platformdirs==2.5.4
|
||||
# via virtualenv
|
||||
platformdirs==2.6.0
|
||||
# via
|
||||
# tox
|
||||
# virtualenv
|
||||
pluggy==1.0.0
|
||||
# via tox
|
||||
py==1.11.0
|
||||
pyproject-api==1.2.1
|
||||
# via tox
|
||||
pyparsing==3.0.9
|
||||
# via packaging
|
||||
six==1.16.0
|
||||
# via tox
|
||||
tox==3.27.1
|
||||
tox==4.0.5
|
||||
# via bidict (pyproject.toml)
|
||||
virtualenv==20.17.0
|
||||
virtualenv==20.17.1
|
||||
# via tox
|
||||
wheel==0.38.4
|
||||
# via pip-tools
|
||||
|
|
|
@ -10,13 +10,13 @@ babel==2.11.0
|
|||
# via sphinx
|
||||
beautifulsoup4==4.11.1
|
||||
# via furo
|
||||
certifi==2022.9.24
|
||||
certifi==2022.12.7
|
||||
# via requests
|
||||
charset-normalizer==2.1.1
|
||||
# via requests
|
||||
docutils==0.19
|
||||
# via sphinx
|
||||
furo==2022.9.29
|
||||
furo==2022.12.7
|
||||
# via bidict (pyproject.toml)
|
||||
idna==3.4
|
||||
# via requests
|
||||
|
@ -26,14 +26,12 @@ jinja2==3.1.2
|
|||
# via sphinx
|
||||
markupsafe==2.1.1
|
||||
# via jinja2
|
||||
packaging==21.3
|
||||
packaging==22.0
|
||||
# via sphinx
|
||||
pygments==2.13.0
|
||||
# via
|
||||
# furo
|
||||
# sphinx
|
||||
pyparsing==3.0.9
|
||||
# via packaging
|
||||
pytz==2022.6
|
||||
# via babel
|
||||
requests==2.28.1
|
||||
|
|
|
@ -8,13 +8,13 @@ cfgv==3.3.1
|
|||
# via pre-commit
|
||||
distlib==0.3.6
|
||||
# via virtualenv
|
||||
filelock==3.8.0
|
||||
filelock==3.8.2
|
||||
# via virtualenv
|
||||
identify==2.5.9
|
||||
# via pre-commit
|
||||
nodeenv==1.7.0
|
||||
# via pre-commit
|
||||
platformdirs==2.5.4
|
||||
platformdirs==2.6.0
|
||||
# via virtualenv
|
||||
pre-commit==2.20.0
|
||||
# via bidict (pyproject.toml)
|
||||
|
@ -22,7 +22,7 @@ pyyaml==6.0
|
|||
# via pre-commit
|
||||
toml==0.10.2
|
||||
# via pre-commit
|
||||
virtualenv==20.17.0
|
||||
virtualenv==20.17.1
|
||||
# via pre-commit
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
|
|
|
@ -12,7 +12,7 @@ attrs==22.1.0
|
|||
# pytest
|
||||
babel==2.11.0
|
||||
# via sphinx
|
||||
certifi==2022.9.24
|
||||
certifi==2022.12.7
|
||||
# via requests
|
||||
charset-normalizer==2.1.1
|
||||
# via requests
|
||||
|
@ -36,7 +36,7 @@ jinja2==3.1.2
|
|||
# via sphinx
|
||||
markupsafe==2.1.1
|
||||
# via jinja2
|
||||
packaging==21.3
|
||||
packaging==22.0
|
||||
# via
|
||||
# pytest
|
||||
# sphinx
|
||||
|
@ -54,8 +54,6 @@ pygaljs==1.0.2
|
|||
# via pytest-benchmark
|
||||
pygments==2.13.0
|
||||
# via sphinx
|
||||
pyparsing==3.0.9
|
||||
# via packaging
|
||||
pytest==7.2.0
|
||||
# via
|
||||
# bidict (pyproject.toml)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
aside.footnote > span { float:left; padding-right: 0.25rem; } // https://github.com/pradyunsg/furo/discussions/489#discussioncomment-3345304
|
|
@ -165,7 +165,7 @@ html_static_path = ['_static']
|
|||
#html_extra_path = []
|
||||
|
||||
# https://docs.readthedocs.io/en/stable/guides/adding-custom-css.html#adding-custom-css-or-javascript-to-sphinx-documentation
|
||||
html_css_files = ['custom.css']
|
||||
# html_css_files = ['custom.css']
|
||||
html_js_files = ['custom.js']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
// vim: set ft=json5:
|
||||
{
|
||||
"include": [
|
||||
"bidict",
|
||||
],
|
||||
"exclude": [
|
||||
"docs",
|
||||
"tests",
|
||||
"run_tests.py",
|
||||
"tests",
|
||||
],
|
||||
"strict": [
|
||||
"bidict",
|
||||
],
|
||||
"typeCheckingMode": "strict",
|
||||
// https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-rule-defaults
|
||||
"reportGeneralTypeIssues": "warning",
|
||||
"reportPrivateUsage": "warning",
|
||||
"reportUnknownArgumentType": "warning",
|
||||
"reportUnknownMemberType": "warning",
|
||||
"reportUnknownVariableType": "warning",
|
||||
"reportUnnecessaryIsInstance": "warning",
|
||||
"reportUnnecessaryTypeIgnoreComment": "warning",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue