Skip to content

Commit

Permalink
Adapt to changes in collections.UserList types
Browse files Browse the repository at this point in the history
Signed-off-by: Nikola Forró <nforro@redhat.com>
  • Loading branch information
nforro committed Mar 18, 2022
1 parent bf40a0f commit 59ecb33
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions files/install-requirements-pip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
with_items:
- arrow
- rpm-py-installer
- typing-extensions
become: true
1 change: 1 addition & 0 deletions files/tasks/rpm-deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
dnf:
name:
- python3-arrow
- python3-typing-extensions
become: true
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ install_requires =
arrow
importlib-metadata;python_version<"3.8"
rpm
typing-extensions
python_requires = >=3.6
include_package_data = True
setup_requires =
Expand Down
4 changes: 3 additions & 1 deletion specfile/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import re
from typing import List, Optional, overload

from typing_extensions import SupportsIndex

# valid section names as defined in build/parseSpec.c in RPM source
SECTION_NAMES = {
"package",
Expand Down Expand Up @@ -79,7 +81,7 @@ def __copy__(self) -> "Section":
return Section(self.name, self.data)

@overload
def __getitem__(self, i: int) -> str:
def __getitem__(self, i: SupportsIndex) -> str:
pass

@overload
Expand Down
8 changes: 5 additions & 3 deletions specfile/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import re
from typing import Any, Iterable, List, Optional, Union, overload

from typing_extensions import SupportsIndex

from specfile.sections import Section

# valid tag names extracted from lib/rpmtag.h in RPM source
Expand Down Expand Up @@ -334,7 +336,7 @@ def __contains__(self, item: object) -> bool:
return item in self.data

@overload
def __getitem__(self, i: int) -> Comment:
def __getitem__(self, i: SupportsIndex) -> Comment:
pass

@overload
Expand All @@ -348,7 +350,7 @@ def __getitem__(self, i):
return self.data[i]

@overload
def __setitem__(self, i: int, item: Union[Comment, str]) -> None:
def __setitem__(self, i: SupportsIndex, item: Union[Comment, str]) -> None:
pass

@overload
Expand Down Expand Up @@ -523,7 +525,7 @@ def __repr__(self) -> str:
return f"Tags({data}, {remainder})"

@overload
def __getitem__(self, i: int) -> Tag:
def __getitem__(self, i: SupportsIndex) -> Tag:
pass

@overload
Expand Down

0 comments on commit 59ecb33

Please sign in to comment.