Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current preview style (8daa64a2e10907539094df51f4c51306bb426f07) #2

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions scripts/create_baseline_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,10 @@ def add_pyright_exclusion(stub_dir: str) -> None:


def main() -> None:
parser = argparse.ArgumentParser(
description="""Generate baseline stubs automatically for an installed pip package
parser = argparse.ArgumentParser(description="""Generate baseline stubs automatically for an installed pip package
using stubgen. Also run black, isort and ruff. If the name of
the project is different from the runtime Python package name, you may
need to use --package (example: --package yaml PyYAML)."""
)
need to use --package (example: --package yaml PyYAML).""")
parser.add_argument("project", help="name of PyPI project for which to generate stubs under stubs/")
parser.add_argument("--package", help="generate stubs for this Python package (default is autodetected)")
args = parser.parse_args()
Expand Down
12 changes: 4 additions & 8 deletions scripts/stubsabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,23 +621,19 @@ def get_update_pr_body(update: Update, metadata: dict[str, Any]) -> str:
stubtest_settings: dict[str, Any] = metadata.get("tool", {}).get("stubtest", {})
stubtest_will_run = not stubtest_settings.get("skip", False)
if stubtest_will_run:
body += textwrap.dedent(
"""
body += textwrap.dedent("""

If stubtest fails for this PR:
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
- Fix stubtest failures in another PR, then close this PR

Note that you will need to close and re-open the PR in order to trigger CI
"""
)
""")
else:
body += textwrap.dedent(
f"""
body += textwrap.dedent(f"""

:warning: Review this PR manually, as stubtest is skipped in CI for {update.distribution}! :warning:
"""
)
""")
return body


Expand Down
1 change: 1 addition & 0 deletions stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -551,5 +551,6 @@ if sys.platform != "win32":
major: int
minor: int
patch: int

ncurses_version: _ncurses_version
window = _CursesWindow # undocumented
1 change: 1 addition & 0 deletions stdlib/_msi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if sys.platform == "win32":
# Don't exist at runtime
__new__: None # type: ignore[assignment]
__init__: None # type: ignore[assignment]

def UuidCreate() -> str: ...
def FCICreate(__cabname: str, __files: list[str]) -> None: ...
def OpenDatabase(__path: str, __persist: int) -> _Database: ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/asyncio/sslproto.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if sys.version_info >= (3, 11):
STATE_CON_MADE: str
STATE_EOF: str
STATE_CON_LOST: str

def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ...

else:
Expand Down
2 changes: 2 additions & 0 deletions stdlib/calendar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ if sys.version_info >= (3, 12):
OCTOBER: Literal[10]
NOVEMBER: Literal[11]
DECEMBER: Literal[12]

JANUARY = Month.JANUARY
FEBRUARY = Month.FEBRUARY
MARCH = Month.MARCH
Expand All @@ -187,6 +188,7 @@ if sys.version_info >= (3, 12):
FRIDAY: Literal[4]
SATURDAY: Literal[5]
SUNDAY: Literal[6]

MONDAY = Day.MONDAY
TUESDAY = Day.TUESDAY
WEDNESDAY = Day.WEDNESDAY
Expand Down
1 change: 1 addition & 0 deletions stdlib/dbm/gnu.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ if sys.platform != "win32":
# Don't exist at runtime
__new__: None # type: ignore[assignment]
__init__: None # type: ignore[assignment]

def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _gdbm: ...
1 change: 1 addition & 0 deletions stdlib/dbm/ndbm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ if sys.platform != "win32":
# Don't exist at runtime
__new__: None # type: ignore[assignment]
__init__: None # type: ignore[assignment]

def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _dbm: ...
3 changes: 3 additions & 0 deletions stdlib/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ if sys.version_info >= (3, 11):
def __set_name__(self, ownerclass: type[Enum], name: str) -> None: ...
name: str
clsname: str

_magic_enum_attr = property
else:
_magic_enum_attr = types.DynamicClassAttribute
Expand Down Expand Up @@ -243,6 +244,7 @@ if sys.version_info >= (3, 11):
CONTINUOUS: str
NAMED_FLAGS: str
UNIQUE: str

CONTINUOUS = EnumCheck.CONTINUOUS
NAMED_FLAGS = EnumCheck.NAMED_FLAGS
UNIQUE = EnumCheck.UNIQUE
Expand All @@ -256,6 +258,7 @@ if sys.version_info >= (3, 11):
CONFORM: str
EJECT: str
KEEP: str

STRICT = FlagBoundary.STRICT
CONFORM = FlagBoundary.CONFORM
EJECT = FlagBoundary.EJECT
Expand Down
1 change: 1 addition & 0 deletions stdlib/inspect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ if sys.version_info < (3, 11):
varargs: str | None
keywords: str | None
defaults: tuple[Any, ...]

def getargspec(func: object) -> ArgSpec: ...

class FullArgSpec(NamedTuple):
Expand Down
1 change: 1 addition & 0 deletions stdlib/pstats.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if sys.version_info >= (3, 9):
percall_cumtime: float
file_name: str
line_number: int

@dataclass(unsafe_hash=True)
class StatsProfile:
total_tt: float
Expand Down
1 change: 1 addition & 0 deletions stdlib/signal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ else:
SIG_BLOCK: int
SIG_UNBLOCK: int
SIG_SETMASK: int

SIG_BLOCK = Sigmasks.SIG_BLOCK
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
SIG_SETMASK = Sigmasks.SIG_SETMASK
Expand Down
1 change: 1 addition & 0 deletions stdlib/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,7 @@ if sys.platform == "win32":
hStdError: Any | None
wShowWindow: int
lpAttributeList: Mapping[str, Any]

from _winapi import (
ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS,
BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS,
Expand Down
1 change: 1 addition & 0 deletions stdlib/sys.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ if sys.version_info >= (3, 8):
exc_traceback: TracebackType | None
err_msg: str | None
object: _object

unraisablehook: Callable[[UnraisableHookArgs], Any]
def __unraisablehook__(__unraisable: UnraisableHookArgs) -> Any: ...
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/address.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Address(Resource):
Ground: str
Electronic: str
ShipToStore: str

@staticmethod
def create(params: Incomplete | None = None): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/apple_pay_card.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ApplePayCard(Resource):
AmEx: str
MasterCard: str
Visa: str

is_expired: Any
subscriptions: Any
def __init__(self, gateway, attributes) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/credit_card.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CreditCard(Resource):
Yes: str
No: str
Unknown: str

Commercial: Any
DurbinRegulated: Any
Debit: Any
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/credit_card_verification.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CreditCardVerification(AttributeGetter):
GatewayRejected: str
ProcessorDeclined: str
Verified: str

amount: Any
currency_iso_code: Any
processor_response_code: Any
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/disbursement.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Disbursement(Resource):
class Type:
Credit: str
Debit: str

amount: Any
merchant_account: Any
def __init__(self, gateway, attributes) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/dispute.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Dispute(AttributeGetter):
Effortless: str
Standard: str
NotProtected: str

@staticmethod
def accept(id): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/document_upload.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from braintree.successful_result import SuccessfulResult as SuccessfulResult
class DocumentUpload(Resource):
class Kind:
EvidenceDocument: str

@staticmethod
def create(params: Incomplete | None = None): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/europe_bank_account.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ class EuropeBankAccount(Resource):
class MandateType:
Business: str
Consumer: str

@staticmethod
def signature(): ...
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MerchantAccount(Resource):
Bank: str
Email: str
MobilePhone: str

FundingDestinations: Any
individual_details: Any
business_details: Any
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/subscription.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Subscription(Resource):
Expired: str
PastDue: str
Pending: str

@staticmethod
def create(params: Incomplete | None = None): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/transaction.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Transaction(Resource):
Telephone: str
Laundry: str
Other: str

@staticmethod
def adjust_authorization(transaction_id, amount): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/transaction_line_item.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class TransactionLineItem(AttributeGetter):
class Kind:
Credit: str
Debit: str

def __init__(self, attributes) -> None: ...
@staticmethod
def find_all(transaction_id): ...
1 change: 1 addition & 0 deletions stubs/braintree/braintree/us_bank_account_verification.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class UsBankAccountVerification(AttributeGetter):
IndependentCheck: str
TokenizedCheck: str
MicroTransfers: str

us_bank_account: Any
def __init__(self, gateway, attributes) -> None: ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/util/http.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Http:
Xml: str
Multipart: str
Json: str

@staticmethod
def is_error_status(status): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/braintree/braintree/webhook_notification.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class WebhookNotification(Resource):
TransactionDisbursed: str
TransactionSettled: str
TransactionSettlementDeclined: str

@staticmethod
def parse(signature, payload): ...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions stubs/colorama/colorama/win32.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if sys.platform == "win32":
wAttributes: wintypes.WORD
srWindow: wintypes.SMALL_RECT
dwMaximumWindowSize: COORD

def winapi_test() -> bool: ...
def GetConsoleScreenBufferInfo(stream_id: int = -11) -> CONSOLE_SCREEN_BUFFER_INFO: ...
def SetConsoleTextAttribute(stream_id: int, attrs: wintypes.WORD) -> wintypes.BOOL: ...
Expand Down
2 changes: 2 additions & 0 deletions stubs/pika/pika/adapters/blocking_connection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class BlockingConnection:

class _OnChannelOpenedArgs(NamedTuple):
channel: Incomplete

def __init__(
self, parameters: Parameters | Sequence[Parameters] | None = None, _impl_class: Incomplete | None = None
) -> None: ...
Expand Down Expand Up @@ -164,6 +165,7 @@ class BlockingChannel:

class _FlowOkCallbackResultArgs(NamedTuple):
active: Incomplete

def __init__(self, channel_impl, connection) -> None: ...
def __int__(self) -> int: ...
def __enter__(self): ...
Expand Down
1 change: 1 addition & 0 deletions stubs/psutil/psutil/_psbsd.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class Process:
private: Any
ref_count: Any
shadow_count: Any

def open_files(self): ...
def num_fds(self): ...
def cpu_affinity_get(self): ...
Expand Down
1 change: 1 addition & 0 deletions stubs/psutil/psutil/_pssunos.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class Process:
rss: Incomplete
anon: Incomplete
locked: Incomplete

def memory_maps(self): ...
def num_fds(self): ...
def num_ctx_switches(self): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/pyinstaller/pyi_splash/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def update_text(msg: str) -> None: ...
def close() -> None: ...

CLOSE_CONNECTION: Final = b"\x04"
FLUSH_CHARACTER: Final = b"\x0D"
FLUSH_CHARACTER: Final = b"\x0d"
1 change: 1 addition & 0 deletions stubs/pyserial/serial/tools/list_ports_windows.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if sys.platform == "win32":
ClassGuid: ctypes._CField[Incomplete, Incomplete, Incomplete]
DevInst: ctypes._CField[Incomplete, Incomplete, Incomplete]
Reserved: ctypes._CField[Incomplete, Incomplete, Incomplete]

PSP_DEVINFO_DATA: type[ctypes._Pointer[SP_DEVINFO_DATA]]
PSP_DEVICE_INTERFACE_DETAIL_DATA = ctypes.c_void_p
setupapi: ctypes.WinDLL
Expand Down
6 changes: 6 additions & 0 deletions stubs/pyserial/serial/win32.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if sys.platform == "win32":
nLength: _CField[Incomplete, Incomplete, Incomplete]
lpSecurityDescriptor: _CField[Incomplete, Incomplete, Incomplete]
bInheritHandle: _CField[Incomplete, Incomplete, Incomplete]

LPSECURITY_ATTRIBUTES: type[_Pointer[_SECURITY_ATTRIBUTES]]
CreateEvent: _NamedFuncPointer
CreateFile: _NamedFuncPointer
Expand All @@ -28,6 +29,7 @@ if sys.platform == "win32":
OffsetHigh: _CField[Incomplete, Incomplete, Incomplete]
Pointer: _CField[Incomplete, Incomplete, Incomplete]
hEvent: _CField[Incomplete, Incomplete, Incomplete]

OVERLAPPED: TypeAlias = _OVERLAPPED

class _COMSTAT(Structure):
Expand All @@ -41,6 +43,7 @@ if sys.platform == "win32":
fReserved: _CField[Incomplete, Incomplete, Incomplete]
cbInQue: _CField[Incomplete, Incomplete, Incomplete]
cbOutQue: _CField[Incomplete, Incomplete, Incomplete]

COMSTAT: TypeAlias = _COMSTAT

class _DCB(Structure):
Expand Down Expand Up @@ -72,6 +75,7 @@ if sys.platform == "win32":
EofChar: _CField[Incomplete, Incomplete, Incomplete]
EvtChar: _CField[Incomplete, Incomplete, Incomplete]
wReserved1: _CField[Incomplete, Incomplete, Incomplete]

DCB: TypeAlias = _DCB

class _COMMTIMEOUTS(Structure):
Expand All @@ -80,6 +84,7 @@ if sys.platform == "win32":
ReadTotalTimeoutConstant: _CField[Incomplete, Incomplete, Incomplete]
WriteTotalTimeoutMultiplier: _CField[Incomplete, Incomplete, Incomplete]
WriteTotalTimeoutConstant: _CField[Incomplete, Incomplete, Incomplete]

COMMTIMEOUTS: TypeAlias = _COMMTIMEOUTS

GetLastError: _NamedFuncPointer
Expand Down Expand Up @@ -159,4 +164,5 @@ if sys.platform == "win32":
class N11_OVERLAPPED4DOLLAR_484DOLLAR_49E(Structure):
Offset: _CField[Incomplete, Incomplete, Incomplete]
OffsetHigh: _CField[Incomplete, Incomplete, Incomplete]

PVOID: TypeAlias = c_void_p
1 change: 1 addition & 0 deletions stubs/pyvmomi/pyVmomi/vim/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PerformanceManager:

class EntityMetricBase:
entity: ManagedEntity

def QueryPerfCounterByLevel(self, collection_level: int) -> list[PerformanceManager.PerfCounterInfo]: ...
def QueryPerf(self, querySpec: list[PerformanceManager.QuerySpec]) -> list[PerformanceManager.EntityMetricBase]: ...
def __getattr__(self, name: str) -> Incomplete: ...
Expand Down
1 change: 1 addition & 0 deletions stubs/pyvmomi/pyVmomi/vmodl/query.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PropertyCollector:
def __init__(self, *, objects: list[PropertyCollector.ObjectContent] = ..., token: str | None = ...) -> None: ...
objects: list[PropertyCollector.ObjectContent]
token: str | None

def RetrievePropertiesEx(
self, specSet: list[PropertyCollector.FilterSpec], options: PropertyCollector.RetrieveOptions
) -> PropertyCollector.RetrieveResult: ...
Expand Down
Loading