Skip to content

Commit 7b67e8f

Browse files
committed
[portage] QA fixes
1 parent 38dd002 commit 7b67e8f

File tree

6 files changed

+54
-30
lines changed

6 files changed

+54
-30
lines changed

stubs/portage/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version = "3.0.*"
2-
upstream_repository = "https://gitweb.gentoo.org/proj/portage.git"
2+
upstream_repository = "https://github.com/gentoo/portage"
33
partial_stub = true
44

55
[tool.stubtest]

stubs/portage/portage/__init__.pyi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
from _typeshed import Incomplete
12
from collections.abc import Mapping
2-
from typing import Any, TypedDict, type_check_only
3+
from typing import TypedDict, type_check_only
34

45
from .dbapi.porttree import portagetree
56
from .package.ebuild.config import config
67

78
@type_check_only
89
class _DBRootDict(TypedDict):
9-
bintree: Any
10+
bintree: Incomplete
1011
porttree: portagetree
11-
virtuals: Any
12+
vartree: Incomplete
13+
virtuals: dict[str, Incomplete]
1214

1315
db: Mapping[str, _DBRootDict]
1416
root: str
1517
settings: config
1618

17-
def __getattr__(name: str): ... # incomplete module
19+
def __getattr__(name: str) -> Incomplete: ... # incomplete module

stubs/portage/portage/dbapi/__init__.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from _typeshed import Incomplete
12
from typing import Literal
23

34
class dbapi:
@@ -29,6 +30,6 @@ class dbapi:
2930
mytree: str | None = ...,
3031
myrepo: str | None = ...,
3132
) -> list[str]: ...
32-
def match(self, mydep: str, use_cache: Literal[0, 1] = ...) -> list[str] | str: ...
33+
def match(self, mydep: str, use_cache: Literal[0, 1] = 1) -> list[str] | str: ...
3334

34-
def __getattr__(name: str): ... # incomplete module
35+
def __getattr__(name: str) -> Incomplete: ... # incomplete module

stubs/portage/portage/package/ebuild/config.pyi

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any
1+
from collections.abc import Hashable, Mapping
2+
from typing import Literal, TypeVar
23

34
class config:
45
def __init__(
@@ -20,4 +21,17 @@ class config:
2021
def __setitem__(self, key: str, value: str) -> None: ...
2122
def __delitem__(self, key: str) -> None: ...
2223
def __iter__(self) -> str: ...
23-
def get(self, k: str, x: Any = ...) -> Any: ...
24+
def get(self, k: str, x=...): ...
25+
26+
_K = TypeVar("_K")
27+
_V = TypeVar("_V")
28+
29+
def best_from_dict(
30+
key: Hashable,
31+
top_dict: Mapping[_K, _V],
32+
key_order,
33+
EmptyOnError: Literal[0, 1] = 1,
34+
FullCopy: Literal[0, 1] = 1,
35+
AllowEmpty: Literal[0, 1] = 1,
36+
) -> Literal[""] | dict[_K, _V]: ...
37+
def autouse(myvartree, use_cache: Literal[0, 1] = 1, mysettings: config | None = None) -> Literal[""]: ...

stubs/portage/portage/package/ebuild/doebuild.pyi

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Literal
1+
from _typeshed import Incomplete
2+
from typing import Literal
23

34
from portage.dbapi.porttree import portdbapi
45

@@ -38,17 +39,19 @@ def doebuild(
3839
"unpack",
3940
],
4041
settings: config | None = ...,
41-
debug: Literal[0, 1] = ...,
42-
listonly: Literal[0, 1] = ...,
43-
fetchonly: Literal[0, 1] = ...,
44-
cleanup: Literal[0, 1] = ...,
45-
use_cache: Literal[0, 1] = ...,
46-
fetchall: Literal[0, 1] = ...,
42+
debug: Literal[0, 1] = 0,
43+
listonly: Literal[0, 1] = 0,
44+
fetchonly: Literal[0, 1] = 0,
45+
cleanup: Literal[0, 1] = 0,
46+
use_cache: Literal[0, 1] = 1,
47+
fetchall: Literal[0, 1] = 0,
4748
tree: Literal["vartree", "porttree", "bintree"] = ...,
4849
mydbapi: portdbapi | None = ...,
49-
vartree: Any = ...,
50-
prev_mtimes: dict[str, Any] | None = ...,
50+
vartree=...,
51+
prev_mtimes: dict[str, Incomplete] | None = ...,
5152
fd_pipes: dict[str, str] | None = ...,
5253
returnproc: int | bool = ...,
5354
) -> Literal[0, 1] | bool | list[int]: # Missing portage.process.MultiprocessingProcess
5455
...
56+
57+
def __getattr__(name: str) -> Incomplete: ... # incomplete module

stubs/portage/portage/versions.pyi

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
from typing import Any, Literal
1+
from _typeshed import Incomplete
2+
from typing import Literal
23
from typing_extensions import Self
34

5+
from .package.ebuild.config import config
6+
47
def vercmp(ver1: str, ver2: str, silent: Literal[0, 1] = ...) -> int | None: ...
58

69
class _pkg_str(str):
@@ -9,36 +12,37 @@ class _pkg_str(str):
912
def __new__(
1013
cls,
1114
cpv: str,
12-
metadata: dict[str, Any] | None = ...,
13-
settings: Any = ...,
14-
eapi: Any = ...,
15+
metadata: dict[str, Incomplete] | None = ...,
16+
settings: config = ...,
17+
eapi=...,
1518
repo: str | None = ...,
1619
slot: str | None = ...,
1720
build_time: int | None = ...,
1821
build_id: str | None = ...,
1922
file_size: int | None = ...,
2023
mtime: int | None = ...,
21-
db: Any = ...,
22-
repoconfig: Any = ...,
24+
db=...,
25+
repoconfig=...,
2326
) -> Self: ...
2427
def __init__(
2528
self,
2629
cpv: str,
27-
metadata: dict[str, Any] | None = ...,
28-
settings: Any = ...,
29-
eapi: Any = ...,
30+
metadata: dict[str, Incomplete] | None = ...,
31+
settings: config = ...,
32+
eapi=...,
3033
repo: str | None = ...,
3134
slot: str | None = ...,
3235
build_time: int | None = ...,
3336
build_id: str | None = ...,
3437
file_size: int | None = ...,
3538
mtime: int | None = ...,
36-
db: Any = ...,
37-
repoconfig: Any = ...,
39+
db=...,
40+
repoconfig=...,
3841
) -> None: ...
3942
@staticmethod
40-
def _long(var: Any, default: int) -> int: ...
43+
def _long(var, default: int) -> int: ...
4144

4245
def catpkgsplit(
4346
mydata: str | _pkg_str, silent: Literal[0, 1] = ..., eapi: str | None = ...
4447
) -> tuple[str | None, str, str, str] | None: ...
48+
def __getattr__(name: str) -> Incomplete: ... # incomplete module

0 commit comments

Comments
 (0)