Skip to content

Commit 05e717a

Browse files
committed
[portage] fix methods in dbapi.porttree and add comments about allowlist entries
1 parent 1cbb95d commit 05e717a

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

stubs/portage/@tests/stubtest_allowlist.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
portage.dbapi.dbapi.aux_get
2-
portage.dbapi.dbapi.match
1+
# Don't stub the deprecated params (root, virtual; _unused_param; mydep; _unused)
32
portage.dbapi.porttree.portagetree.__init__
43
portage.dbapi.porttree.portdbapi.__init__
54
portage.dbapi.porttree.portdbapi.xmatch
Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
11
from _typeshed import Incomplete
2-
from typing import Literal
2+
from collections.abc import Sequence
3+
from typing import Literal, TypeAlias
4+
5+
_MyListString: TypeAlias = Literal[
6+
"DEFINED_PHASES",
7+
"DEPEND",
8+
"EAPI",
9+
"HDEPEND",
10+
"HOMEPAGE",
11+
"INHERITED",
12+
"IUSE",
13+
"KEYWORDS",
14+
"LICENSE",
15+
"PDEPEND",
16+
"PROPERTIES",
17+
"PROVIDE",
18+
"RDEPEND",
19+
"REQUIRED_USE",
20+
"repository",
21+
"RESTRICT",
22+
"SRC_URI",
23+
"SLOT",
24+
]
325

426
class dbapi:
5-
def aux_get(
6-
self,
7-
mycpv: str,
8-
mylist: list[
9-
Literal[
10-
"DEFINED_PHASES",
11-
"DEPEND",
12-
"EAPI",
13-
"HDEPEND",
14-
"HOMEPAGE",
15-
"INHERITED",
16-
"IUSE",
17-
"KEYWORDS",
18-
"LICENSE",
19-
"PDEPEND",
20-
"PROPERTIES",
21-
"PROVIDE",
22-
"RDEPEND",
23-
"REQUIRED_USE",
24-
"repository",
25-
"RESTRICT",
26-
"SRC_URI",
27-
"SLOT",
28-
]
29-
],
30-
mytree: str | None = None,
31-
myrepo: str | None = None,
32-
) -> list[str]: ...
33-
def match(self, mydep: str, use_cache: Literal[0, 1] = 1) -> list[str] | str: ...
27+
def aux_get(self, mycpv: str, mylist: Sequence[_MyListString], myrepo: str | None = None) -> list[str]: ...
28+
def match(self, origdep: str, use_cache: Literal[0, 1] = 1) -> list[str] | str: ...
3429

3530
def __getattr__(name: str) -> Incomplete: ... # incomplete module

stubs/portage/portage/dbapi/porttree.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
22
from collections.abc import Sequence
33
from typing import Literal
44

5-
from portage.dbapi import dbapi
5+
from portage.dbapi import _MyListString, dbapi
66

77
class portdbapi(dbapi):
88
def getFetchMap(
@@ -25,6 +25,11 @@ class portdbapi(dbapi):
2525
def findname2(
2626
self, mycpv: str, mytree: str | None = None, myrepo: str | None = None
2727
) -> tuple[None, Literal[0]] | tuple[str, str] | tuple[str, None]: ...
28+
# This method overrides in an incompatible way
29+
def aux_get( # type: ignore[override]
30+
self, mycpv: str, mylist: Sequence[_MyListString], mytree: str | None = None, myrepo: str | None = None
31+
) -> list[str]: ...
32+
def match(self, mydep: str, use_cache: Literal[0, 1] = 1) -> list[str] | str: ...
2833

2934
class portagetree:
3035
dbapi: portdbapi

0 commit comments

Comments
 (0)