mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-12 05:01:40 +08:00
Add defaults for third-party stubs A-D (#9952)
This commit is contained in:
@@ -15,33 +15,33 @@ class Locale:
|
||||
script: str | None
|
||||
variant: str | None
|
||||
def __init__(
|
||||
self, language: str, territory: str | None = ..., script: str | None = ..., variant: str | None = ...
|
||||
self, language: str, territory: str | None = None, script: str | None = None, variant: str | None = None
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def default(cls, category: str | None = ..., aliases: Mapping[str, str] = ...) -> Locale: ...
|
||||
def default(cls, category: str | None = None, aliases: Mapping[str, str] = ...) -> Locale: ...
|
||||
@classmethod
|
||||
def negotiate(
|
||||
cls, preferred: Iterable[str], available: Iterable[str], sep: str = ..., aliases: Mapping[str, str] = ...
|
||||
cls, preferred: Iterable[str], available: Iterable[str], sep: str = "_", aliases: Mapping[str, str] = ...
|
||||
) -> Locale | None: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def parse(cls, identifier: None, sep: str = ..., resolve_likely_subtags: bool = ...) -> None: ...
|
||||
def parse(cls, identifier: None, sep: str = "_", resolve_likely_subtags: bool = True) -> None: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def parse(cls, identifier: str | Locale, sep: str = ..., resolve_likely_subtags: bool = ...) -> Locale: ...
|
||||
def parse(cls, identifier: str | Locale, sep: str = "_", resolve_likely_subtags: bool = True) -> Locale: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def get_display_name(self, locale: Locale | str | None = ...) -> str | None: ...
|
||||
def get_display_name(self, locale: Locale | str | None = None) -> str | None: ...
|
||||
@property
|
||||
def display_name(self) -> str | None: ...
|
||||
def get_language_name(self, locale: Locale | str | None = ...) -> str | None: ...
|
||||
def get_language_name(self, locale: Locale | str | None = None) -> str | None: ...
|
||||
@property
|
||||
def language_name(self) -> str | None: ...
|
||||
def get_territory_name(self, locale: Locale | str | None = ...) -> str | None: ...
|
||||
def get_territory_name(self, locale: Locale | str | None = None) -> str | None: ...
|
||||
@property
|
||||
def territory_name(self) -> str | None: ...
|
||||
def get_script_name(self, locale: Locale | str | None = ...) -> str | None: ...
|
||||
def get_script_name(self, locale: Locale | str | None = None) -> str | None: ...
|
||||
@property
|
||||
def script_name(self) -> str | None: ...
|
||||
@property
|
||||
@@ -123,12 +123,12 @@ class Locale:
|
||||
@property
|
||||
def unit_display_names(self) -> LocaleDataDict: ...
|
||||
|
||||
def default_locale(category: str | None = ..., aliases: Mapping[str, str] = ...) -> str | None: ...
|
||||
def default_locale(category: str | None = None, aliases: Mapping[str, str] = ...) -> str | None: ...
|
||||
def negotiate_locale(
|
||||
preferred: Iterable[str], available: Iterable[str], sep: str = ..., aliases: Mapping[str, str] = ...
|
||||
preferred: Iterable[str], available: Iterable[str], sep: str = "_", aliases: Mapping[str, str] = ...
|
||||
) -> str | None: ...
|
||||
def parse_locale(identifier: str, sep: str = ...) -> tuple[str, str | None, str | None, str | None]: ...
|
||||
def get_locale_identifier(tup: tuple[str, str | None, str | None, str | None], sep: str = ...) -> str: ...
|
||||
def parse_locale(identifier: str, sep: str = "_") -> tuple[str, str | None, str | None, str | None]: ...
|
||||
def get_locale_identifier(tup: tuple[str, str | None, str | None, str | None], sep: str = "_") -> str: ...
|
||||
def get_global(key: _GLOBAL_KEY) -> Mapping[str, Any]: ...
|
||||
|
||||
_GLOBAL_KEY: TypeAlias = Literal[
|
||||
|
||||
@@ -17,67 +17,71 @@ _PredefinedTimeFormat: TypeAlias = Literal["full", "long", "medium", "short"]
|
||||
_Context: TypeAlias = Literal["format", "stand-alone"]
|
||||
|
||||
def format_datetime(
|
||||
datetime: _Instant = ...,
|
||||
format: _PredefinedTimeFormat | str = ...,
|
||||
tzinfo: tzinfo | None = ...,
|
||||
datetime: _Instant = None,
|
||||
format: _PredefinedTimeFormat | str = "medium",
|
||||
tzinfo: tzinfo | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str: ...
|
||||
def format_date(date: date | None = ..., format: _PredefinedTimeFormat | str = ..., locale: Locale | str | None = ...) -> str: ...
|
||||
def format_date(
|
||||
date: date | None = None, format: _PredefinedTimeFormat | str = "medium", locale: Locale | str | None = ...
|
||||
) -> str: ...
|
||||
def format_time(
|
||||
time: time | datetime | float | None = ...,
|
||||
format: _PredefinedTimeFormat | str = ...,
|
||||
tzinfo: tzinfo | None = ...,
|
||||
time: time | datetime | float | None = None,
|
||||
format: _PredefinedTimeFormat | str = "medium",
|
||||
tzinfo: tzinfo | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str: ...
|
||||
def format_timedelta(
|
||||
delta: timedelta | int,
|
||||
granularity: Literal["year", "month", "week", "day", "hour", "minute", "second"] = ...,
|
||||
threshold: float = ...,
|
||||
add_direction: bool = ...,
|
||||
format: Literal["narrow", "short", "medium", "long"] = ...,
|
||||
granularity: Literal["year", "month", "week", "day", "hour", "minute", "second"] = "second",
|
||||
threshold: float = 0.85,
|
||||
add_direction: bool = False,
|
||||
format: Literal["narrow", "short", "medium", "long"] = "long",
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str: ...
|
||||
def format_skeleton(
|
||||
skeleton: str, datetime: _Instant = ..., tzinfo: tzinfo | None = ..., fuzzy: bool = ..., locale: Locale | str | None = ...
|
||||
skeleton: str, datetime: _Instant = None, tzinfo: tzinfo | None = None, fuzzy: bool = True, locale: Locale | str | None = ...
|
||||
) -> str: ...
|
||||
def format_interval(
|
||||
start: _Instant,
|
||||
end: _Instant,
|
||||
skeleton: str | None = ...,
|
||||
tzinfo: tzinfo | None = ...,
|
||||
fuzzy: bool = ...,
|
||||
skeleton: str | None = None,
|
||||
tzinfo: tzinfo | None = None,
|
||||
fuzzy: bool = True,
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str: ...
|
||||
|
||||
# Timezone Functionality
|
||||
@overload
|
||||
def get_timezone(zone: str | BaseTzInfo | None = ...) -> BaseTzInfo: ...
|
||||
def get_timezone(zone: str | BaseTzInfo | None = None) -> BaseTzInfo: ...
|
||||
@overload
|
||||
def get_timezone(zone: tzinfo) -> tzinfo: ...
|
||||
def get_timezone_gmt(
|
||||
datetime: _Instant = ...,
|
||||
width: Literal["long", "short", "iso8601", "iso8601_short"] = ...,
|
||||
datetime: _Instant = None,
|
||||
width: Literal["long", "short", "iso8601", "iso8601_short"] = "long",
|
||||
locale: Locale | str | None = ...,
|
||||
return_z: bool = ...,
|
||||
return_z: bool = False,
|
||||
) -> str: ...
|
||||
|
||||
_DtOrTzinfo: TypeAlias = datetime | tzinfo | str | int | time | None
|
||||
|
||||
def get_timezone_location(dt_or_tzinfo: _DtOrTzinfo = ..., locale: Locale | str | None = ..., return_city: bool = ...) -> str: ...
|
||||
def get_timezone_location(
|
||||
dt_or_tzinfo: _DtOrTzinfo = None, locale: Locale | str | None = ..., return_city: bool = False
|
||||
) -> str: ...
|
||||
def get_timezone_name(
|
||||
dt_or_tzinfo: _DtOrTzinfo = ...,
|
||||
width: Literal["long", "short"] = ...,
|
||||
uncommon: bool = ...,
|
||||
dt_or_tzinfo: _DtOrTzinfo = None,
|
||||
width: Literal["long", "short"] = "long",
|
||||
uncommon: bool = False,
|
||||
locale: Locale | str | None = ...,
|
||||
zone_variant: Literal["generic", "daylight", "standard"] | None = ...,
|
||||
return_zone: bool = ...,
|
||||
zone_variant: Literal["generic", "daylight", "standard"] | None = None,
|
||||
return_zone: bool = False,
|
||||
) -> str: ...
|
||||
|
||||
# Note: While Babel accepts any tzinfo for the most part, the get_next_timeout_transition()
|
||||
# function requires a tzinfo that is produced by get_timezone()/pytz AND has DST info.
|
||||
# The typing here will help you with the first requirement, but will not protect against
|
||||
# pytz tzinfo's without DST info, like what you get from get_timezone("UTC") for instance.
|
||||
def get_next_timezone_transition(zone: BaseTzInfo | None = ..., dt: _Instant = ...) -> TimezoneTransition: ...
|
||||
def get_next_timezone_transition(zone: BaseTzInfo | None = None, dt: _Instant = None) -> TimezoneTransition: ...
|
||||
|
||||
class TimezoneTransition:
|
||||
# This class itself is not included in the documentation, yet it is mentioned by name.
|
||||
@@ -87,7 +91,7 @@ class TimezoneTransition:
|
||||
to_tzinfo: tzinfo
|
||||
reference_date: datetime | None
|
||||
def __init__(
|
||||
self, activates: datetime, from_tzinfo: tzinfo, to_tzinfo: tzinfo, reference_date: datetime | None = ...
|
||||
self, activates: datetime, from_tzinfo: tzinfo, to_tzinfo: tzinfo, reference_date: datetime | None = None
|
||||
) -> None: ...
|
||||
@property
|
||||
def from_tz(self) -> str: ...
|
||||
@@ -100,27 +104,31 @@ class TimezoneTransition:
|
||||
|
||||
# Data Access
|
||||
def get_period_names(
|
||||
width: Literal["abbreviated", "narrow", "wide"] = ..., context: _Context = ..., locale: Locale | str | None = ...
|
||||
width: Literal["abbreviated", "narrow", "wide"] = "wide", context: _Context = "stand-alone", locale: Locale | str | None = ...
|
||||
) -> LocaleDataDict: ...
|
||||
def get_day_names(
|
||||
width: Literal["abbreviated", "narrow", "short", "wide"] = ..., context: _Context = ..., locale: Locale | str | None = ...
|
||||
width: Literal["abbreviated", "narrow", "short", "wide"] = "wide",
|
||||
context: _Context = "format",
|
||||
locale: Locale | str | None = ...,
|
||||
) -> LocaleDataDict: ...
|
||||
def get_month_names(
|
||||
width: Literal["abbreviated", "narrow", "wide"] = ..., context: _Context = ..., locale: Locale | str | None = ...
|
||||
width: Literal["abbreviated", "narrow", "wide"] = "wide", context: _Context = "format", locale: Locale | str | None = ...
|
||||
) -> LocaleDataDict: ...
|
||||
def get_quarter_names(
|
||||
width: Literal["abbreviated", "narrow", "wide"] = ..., context: _Context = ..., locale: Locale | str | None = ...
|
||||
width: Literal["abbreviated", "narrow", "wide"] = "wide", context: _Context = "format", locale: Locale | str | None = ...
|
||||
) -> LocaleDataDict: ...
|
||||
def get_era_names(width: Literal["abbreviated", "narrow", "wide"] = ..., locale: Locale | str | None = ...) -> LocaleDataDict: ...
|
||||
def get_date_format(format: _PredefinedTimeFormat = ..., locale: Locale | str | None = ...) -> DateTimePattern: ...
|
||||
def get_datetime_format(format: _PredefinedTimeFormat = ..., locale: Locale | str | None = ...) -> DateTimePattern: ...
|
||||
def get_time_format(format: _PredefinedTimeFormat = ..., locale: Locale | str | None = ...) -> DateTimePattern: ...
|
||||
def get_era_names(
|
||||
width: Literal["abbreviated", "narrow", "wide"] = "wide", locale: Locale | str | None = ...
|
||||
) -> LocaleDataDict: ...
|
||||
def get_date_format(format: _PredefinedTimeFormat = "medium", locale: Locale | str | None = ...) -> DateTimePattern: ...
|
||||
def get_datetime_format(format: _PredefinedTimeFormat = "medium", locale: Locale | str | None = ...) -> DateTimePattern: ...
|
||||
def get_time_format(format: _PredefinedTimeFormat = "medium", locale: Locale | str | None = ...) -> DateTimePattern: ...
|
||||
|
||||
class ParseError(ValueError): ...
|
||||
|
||||
# Basic Parsing
|
||||
def parse_date(string: str, locale: Locale | str | None = ..., format: _PredefinedTimeFormat = ...) -> date: ...
|
||||
def parse_time(string: str, locale: Locale | str | None = ..., format: _PredefinedTimeFormat = ...) -> time: ...
|
||||
def parse_date(string: str, locale: Locale | str | None = ..., format: _PredefinedTimeFormat = "medium") -> date: ...
|
||||
def parse_time(string: str, locale: Locale | str | None = ..., format: _PredefinedTimeFormat = "medium") -> time: ...
|
||||
def parse_pattern(pattern: str) -> DateTimePattern: ...
|
||||
|
||||
# Undocumented
|
||||
@@ -133,7 +141,7 @@ time_ = time
|
||||
TIMEDELTA_UNITS: tuple[tuple[str, int], ...]
|
||||
|
||||
def get_period_id(
|
||||
time: _Instant, tzinfo: BaseTzInfo | None = ..., type: Literal["selection"] | None = ..., locale: Locale | str | None = ...
|
||||
time: _Instant, tzinfo: BaseTzInfo | None = None, type: Literal["selection"] | None = None, locale: Locale | str | None = ...
|
||||
): ...
|
||||
|
||||
class DateTimePattern:
|
||||
@@ -154,7 +162,7 @@ class DateTimeFormat:
|
||||
def format_quarter(self, char: str, num: int) -> str: ...
|
||||
def format_month(self, char: str, num: int) -> str: ...
|
||||
def format_week(self, char: str, num: int) -> str: ...
|
||||
def format_weekday(self, char: str = ..., num: int = ...) -> str: ...
|
||||
def format_weekday(self, char: str = "E", num: int = 4) -> str: ...
|
||||
def format_day_of_year(self, num: int) -> str: ...
|
||||
def format_day_of_week_in_month(self) -> str: ...
|
||||
def format_period(self, char: str, num: int) -> str: ...
|
||||
@@ -162,8 +170,8 @@ class DateTimeFormat:
|
||||
def format_milliseconds_in_day(self, num: int) -> str: ...
|
||||
def format_timezone(self, char: str, num: int) -> str: ...
|
||||
def format(self, value: SupportsInt, length: int) -> str: ...
|
||||
def get_day_of_year(self, date: date | None = ...) -> int: ...
|
||||
def get_week_number(self, day_of_period: int, day_of_week: int | None = ...) -> int: ...
|
||||
def get_day_of_year(self, date: date | None = None) -> int: ...
|
||||
def get_week_number(self, day_of_period: int, day_of_week: int | None = None) -> int: ...
|
||||
|
||||
PATTERN_CHARS: dict[str, list[int] | None]
|
||||
PATTERN_CHAR_ORDER: str
|
||||
@@ -171,4 +179,4 @@ PATTERN_CHAR_ORDER: str
|
||||
def tokenize_pattern(pattern: str) -> list[tuple[str, str | tuple[str, int]]]: ...
|
||||
def untokenize_pattern(tokens: Iterable[tuple[str, str | tuple[str, int]]]) -> str: ...
|
||||
def split_interval_pattern(pattern: str) -> list[str]: ...
|
||||
def match_skeleton(skeleton: str, options: Iterable[str], allow_different_fields: bool = ...) -> str | None: ...
|
||||
def match_skeleton(skeleton: str, options: Iterable[str], allow_different_fields: bool = False) -> str | None: ...
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
def get_official_languages(territory: str, regional: bool = ..., de_facto: bool = ...) -> tuple[str, ...]: ...
|
||||
def get_official_languages(territory: str, regional: bool = False, de_facto: bool = False) -> tuple[str, ...]: ...
|
||||
def get_territory_language_info(territory: str) -> dict[str, dict[str, float | str | None]]: ...
|
||||
|
||||
@@ -7,6 +7,6 @@ DEFAULT_LOCALE: str | None
|
||||
|
||||
def format_list(
|
||||
lst: Iterable[str],
|
||||
style: Literal["standard", "standard-short", "or", "or-short", "unit", "unit-short", "unit-narrow"] = ...,
|
||||
style: Literal["standard", "standard-short", "or", "or-short", "unit", "unit-short", "unit-narrow"] = "standard",
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ def normalize_locale(name: str) -> str | None: ...
|
||||
def resolve_locale_filename(name: PathLike[str] | str) -> str: ...
|
||||
def exists(name: str) -> bool: ...
|
||||
def locale_identifiers() -> list[str]: ...
|
||||
def load(name: PathLike[str] | str, merge_inherited: bool = ...) -> dict[str, Any]: ...
|
||||
def load(name: PathLike[str] | str, merge_inherited: bool = True) -> dict[str, Any]: ...
|
||||
def merge(dict1: MutableMapping[Any, Any], dict2: Mapping[Any, Any]) -> None: ...
|
||||
|
||||
class Alias:
|
||||
@@ -16,7 +16,7 @@ class Alias:
|
||||
|
||||
class LocaleDataDict(MutableMapping[Any, Any]):
|
||||
base: Mapping[str, Any]
|
||||
def __init__(self, data: Mapping[str | int | None, Any], base: Mapping[str | int | None, Any] | None = ...) -> None: ...
|
||||
def __init__(self, data: Mapping[str | int | None, Any], base: Mapping[str | int | None, Any] | None = None) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str | int | None]: ...
|
||||
def __getitem__(self, key: str | int | None) -> Any: ...
|
||||
|
||||
@@ -22,14 +22,14 @@ class Message:
|
||||
def __init__(
|
||||
self,
|
||||
id: str,
|
||||
string: str = ...,
|
||||
locations: Iterable[tuple[str, int]] = ...,
|
||||
flags: Iterable[str] = ...,
|
||||
auto_comments: Iterable[str] = ...,
|
||||
user_comments: Iterable[str] = ...,
|
||||
previous_id: _MessageID = ...,
|
||||
lineno: int | None = ...,
|
||||
context: str | None = ...,
|
||||
string: str = "",
|
||||
locations: Iterable[tuple[str, int]] = (),
|
||||
flags: Iterable[str] = (),
|
||||
auto_comments: Iterable[str] = (),
|
||||
user_comments: Iterable[str] = (),
|
||||
previous_id: _MessageID = (),
|
||||
lineno: int | None = None,
|
||||
context: str | None = None,
|
||||
) -> None: ...
|
||||
def __cmp__(self, other: Message) -> int: ...
|
||||
def __gt__(self, other: Message) -> bool: ...
|
||||
@@ -40,7 +40,7 @@ class Message:
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def is_identical(self, other: Message) -> bool: ...
|
||||
def clone(self) -> Message: ...
|
||||
def check(self, catalog: Catalog | None = ...) -> list[TranslationError]: ...
|
||||
def check(self, catalog: Catalog | None = None) -> list[TranslationError]: ...
|
||||
@property
|
||||
def fuzzy(self) -> bool: ...
|
||||
@property
|
||||
@@ -65,19 +65,19 @@ class Catalog:
|
||||
obsolete: OrderedDict[str | tuple[str, str], Message]
|
||||
def __init__(
|
||||
self,
|
||||
locale: str | Locale | None = ...,
|
||||
domain: str | None = ...,
|
||||
locale: str | Locale | None = None,
|
||||
domain: str | None = None,
|
||||
header_comment: str | None = ...,
|
||||
project: str | None = ...,
|
||||
version: str | None = ...,
|
||||
copyright_holder: str | None = ...,
|
||||
msgid_bugs_address: str | None = ...,
|
||||
creation_date: datetime.datetime | str | None = ...,
|
||||
revision_date: datetime.datetime | datetime.time | float | str | None = ...,
|
||||
last_translator: str | None = ...,
|
||||
language_team: str | None = ...,
|
||||
charset: str | None = ...,
|
||||
fuzzy: bool = ...,
|
||||
project: str | None = None,
|
||||
version: str | None = None,
|
||||
copyright_holder: str | None = None,
|
||||
msgid_bugs_address: str | None = None,
|
||||
creation_date: datetime.datetime | str | None = None,
|
||||
revision_date: datetime.datetime | datetime.time | float | str | None = None,
|
||||
last_translator: str | None = None,
|
||||
language_team: str | None = None,
|
||||
charset: str | None = None,
|
||||
fuzzy: bool = True,
|
||||
) -> None: ...
|
||||
@property
|
||||
def locale(self) -> Locale | None: ...
|
||||
@@ -108,19 +108,23 @@ class Catalog:
|
||||
def add(
|
||||
self,
|
||||
id: _MessageID,
|
||||
string: _MessageID | None = ...,
|
||||
locations: Iterable[tuple[str, int]] = ...,
|
||||
flags: Iterable[str] = ...,
|
||||
auto_comments: Iterable[str] = ...,
|
||||
user_comments: Iterable[str] = ...,
|
||||
previous_id: _MessageID = ...,
|
||||
lineno: int | None = ...,
|
||||
context: str | None = ...,
|
||||
string: _MessageID | None = None,
|
||||
locations: Iterable[tuple[str, int]] = (),
|
||||
flags: Iterable[str] = (),
|
||||
auto_comments: Iterable[str] = (),
|
||||
user_comments: Iterable[str] = (),
|
||||
previous_id: _MessageID = (),
|
||||
lineno: int | None = None,
|
||||
context: str | None = None,
|
||||
) -> Message: ...
|
||||
def check(self) -> Generator[tuple[Message, list[TranslationError]], None, None]: ...
|
||||
def get(self, id: _MessageID, context: str | None = ...): ...
|
||||
def delete(self, id, context: str | None = ...) -> None: ...
|
||||
def get(self, id: _MessageID, context: str | None = None): ...
|
||||
def delete(self, id, context: str | None = None) -> None: ...
|
||||
def update(
|
||||
self, template: Catalog, no_fuzzy_matching: bool = ..., update_header_comment: bool = ..., keep_user_comments: bool = ...
|
||||
self,
|
||||
template: Catalog,
|
||||
no_fuzzy_matching: bool = False,
|
||||
update_header_comment: bool = False,
|
||||
keep_user_comments: bool = True,
|
||||
) -> None: ...
|
||||
def is_identical(self, other: Catalog) -> bool: ...
|
||||
|
||||
@@ -15,23 +15,23 @@ empty_msgid_warning: str
|
||||
def extract_from_dir(
|
||||
dirname: AnyStr | PathLike[AnyStr],
|
||||
method_map: Iterable[tuple[str, str]] = ...,
|
||||
options_map: SupportsItems[str, dict[str, Any]] | None = ...,
|
||||
options_map: SupportsItems[str, dict[str, Any]] | None = None,
|
||||
keywords: Mapping[str, _Keyword] = ...,
|
||||
comment_tags: Collection[str] = ...,
|
||||
callback: Callable[[AnyStr, str, dict[str, Any]], object] | None = ...,
|
||||
strip_comment_tags: bool = ...,
|
||||
directory_filter: Callable[[str], bool] | None = ...,
|
||||
comment_tags: Collection[str] = (),
|
||||
callback: Callable[[AnyStr, str, dict[str, Any]], object] | None = None,
|
||||
strip_comment_tags: bool = False,
|
||||
directory_filter: Callable[[str], bool] | None = None,
|
||||
) -> Generator[tuple[AnyStr, int, str | tuple[str, ...], list[str], str | None], None, None]: ...
|
||||
@overload
|
||||
def extract_from_dir(
|
||||
dirname: None = ..., # No dirname causes os.getcwd() to be used, producing str.
|
||||
dirname: None = None, # No dirname causes os.getcwd() to be used, producing str.
|
||||
method_map: Iterable[tuple[str, str]] = ...,
|
||||
options_map: SupportsItems[str, dict[str, Any]] | None = ...,
|
||||
options_map: SupportsItems[str, dict[str, Any]] | None = None,
|
||||
keywords: Mapping[str, _Keyword] = ...,
|
||||
comment_tags: Collection[str] = ...,
|
||||
callback: Callable[[str, str, dict[str, Any]], object] | None = ...,
|
||||
strip_comment_tags: bool = ...,
|
||||
directory_filter: Callable[[str], bool] | None = ...,
|
||||
comment_tags: Collection[str] = (),
|
||||
callback: Callable[[str, str, dict[str, Any]], object] | None = None,
|
||||
strip_comment_tags: bool = False,
|
||||
directory_filter: Callable[[str], bool] | None = None,
|
||||
) -> Generator[tuple[str, int, str | tuple[str, ...], list[str], str | None], None, None]: ...
|
||||
def check_and_call_extract_file(
|
||||
filepath: AnyStr | PathLike[AnyStr],
|
||||
@@ -41,15 +41,15 @@ def check_and_call_extract_file(
|
||||
keywords: Mapping[str, _Keyword],
|
||||
comment_tags: Collection[str],
|
||||
strip_comment_tags,
|
||||
dirpath: Incomplete | None = ...,
|
||||
dirpath: Incomplete | None = None,
|
||||
) -> Generator[tuple[AnyStr, int, str | tuple[str, ...], list[str], str | None], None, None]: ...
|
||||
def extract_from_file(
|
||||
method,
|
||||
filename: AnyStr | PathLike[AnyStr],
|
||||
keywords: Mapping[str, _Keyword] = ...,
|
||||
comment_tags: Collection[str] = ...,
|
||||
options: dict[str, Any] | None = ...,
|
||||
strip_comment_tags: bool = ...,
|
||||
comment_tags: Collection[str] = (),
|
||||
options: dict[str, Any] | None = None,
|
||||
strip_comment_tags: bool = False,
|
||||
) -> list[tuple[AnyStr, int, str | tuple[str, ...], list[str], str | None]]: ...
|
||||
|
||||
class _FileObj(SupportsRead[bytes], SupportsReadline[bytes], Protocol):
|
||||
@@ -60,9 +60,9 @@ def extract(
|
||||
method,
|
||||
fileobj: _FileObj,
|
||||
keywords: Mapping[str, _Keyword] = ...,
|
||||
comment_tags: Collection[str] = ...,
|
||||
options: dict[str, Any] | None = ...,
|
||||
strip_comment_tags: bool = ...,
|
||||
comment_tags: Collection[str] = (),
|
||||
options: dict[str, Any] | None = None,
|
||||
strip_comment_tags: bool = False,
|
||||
) -> Iterable[tuple[int, str | tuple[str, ...], list[str], str | None]]: ...
|
||||
def extract_nothing(
|
||||
fileobj: _FileObj, keywords: Mapping[str, _Keyword], comment_tags: Collection[str], options: dict[str, Any]
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import Incomplete
|
||||
from distutils.cmd import Command as _Command
|
||||
from typing import Any
|
||||
|
||||
def listify_value(arg, split: Incomplete | None = ...): ...
|
||||
def listify_value(arg, split: Incomplete | None = None): ...
|
||||
|
||||
class Command(_Command, metaclass=abc.ABCMeta):
|
||||
as_args: Any
|
||||
@@ -17,7 +17,7 @@ class Command(_Command, metaclass=abc.ABCMeta):
|
||||
force: Any
|
||||
help: int
|
||||
finalized: int
|
||||
def __init__(self, dist: Incomplete | None = ...) -> None: ...
|
||||
def __init__(self, dist: Incomplete | None = None) -> None: ...
|
||||
|
||||
class compile_catalog(Command):
|
||||
description: str
|
||||
@@ -112,8 +112,8 @@ class CommandLineInterface:
|
||||
command_classes: Any
|
||||
log: Any
|
||||
parser: Any
|
||||
def run(self, argv: Incomplete | None = ...): ...
|
||||
def run(self, argv: Incomplete | None = None): ...
|
||||
|
||||
def main(): ...
|
||||
def parse_mapping(fileobj, filename: Incomplete | None = ...): ...
|
||||
def parse_keywords(strings=...): ...
|
||||
def parse_mapping(fileobj, filename: Incomplete | None = None): ...
|
||||
def parse_keywords(strings=[]): ...
|
||||
|
||||
@@ -21,4 +21,6 @@ class Token(NamedTuple):
|
||||
def get_rules(jsx: bool, dotted: bool, template_string: bool) -> list[tuple[str | None, Pattern[str]]]: ... # undocumented
|
||||
def indicates_division(token: Token) -> bool: ...
|
||||
def unquote_string(string: str) -> str: ...
|
||||
def tokenize(source: str, jsx: bool = ..., dotted: bool = ..., template_string: bool = ...) -> Generator[Token, None, None]: ...
|
||||
def tokenize(
|
||||
source: str, jsx: bool = True, dotted: bool = True, template_string: bool = True
|
||||
) -> Generator[Token, None, None]: ...
|
||||
|
||||
@@ -6,4 +6,4 @@ LE_MAGIC: int
|
||||
BE_MAGIC: int
|
||||
|
||||
def read_mo(fileobj: SupportsRead[bytes]) -> Catalog: ...
|
||||
def write_mo(fileobj: SupportsWrite[bytes], catalog: Catalog, use_fuzzy: bool = ...) -> None: ...
|
||||
def write_mo(fileobj: SupportsWrite[bytes], catalog: Catalog, use_fuzzy: bool = False) -> None: ...
|
||||
|
||||
@@ -10,4 +10,4 @@ class _PluralTuple(tuple[int, str]):
|
||||
@property
|
||||
def plural_forms(self) -> str: ...
|
||||
|
||||
def get_plural(locale: str = ...) -> _PluralTuple: ...
|
||||
def get_plural(locale: str | None = ...) -> _PluralTuple: ...
|
||||
|
||||
@@ -46,31 +46,31 @@ class PoFileParser:
|
||||
in_msgid: bool
|
||||
in_msgstr: bool
|
||||
in_msgctxt: bool
|
||||
def __init__(self, catalog, ignore_obsolete: bool = ..., abort_invalid: bool = ...) -> None: ...
|
||||
def __init__(self, catalog, ignore_obsolete: bool = False, abort_invalid: bool = False) -> None: ...
|
||||
def parse(self, fileobj: Iterable[str | bytes]) -> None: ...
|
||||
|
||||
def read_po(
|
||||
fileobj: Iterable[str | bytes],
|
||||
locale: str | Locale | None = ...,
|
||||
domain: str | None = ...,
|
||||
ignore_obsolete: bool = ...,
|
||||
charset: str | None = ...,
|
||||
abort_invalid: bool = ...,
|
||||
locale: str | Locale | None = None,
|
||||
domain: str | None = None,
|
||||
ignore_obsolete: bool = False,
|
||||
charset: str | None = None,
|
||||
abort_invalid: bool = False,
|
||||
) -> Catalog: ...
|
||||
|
||||
WORD_SEP: Pattern[str]
|
||||
|
||||
def escape(string: str) -> str: ...
|
||||
def normalize(string: str, prefix: str = ..., width: int = ...) -> str: ...
|
||||
def normalize(string: str, prefix: str = "", width: int = 76) -> str: ...
|
||||
def write_po(
|
||||
fileobj: SupportsWrite[bytes],
|
||||
catalog: Catalog,
|
||||
width: int | None = ...,
|
||||
no_location: bool = ...,
|
||||
omit_header: bool = ...,
|
||||
sort_output: bool = ...,
|
||||
sort_by_file: bool = ...,
|
||||
ignore_obsolete: bool = ...,
|
||||
include_previous: bool = ...,
|
||||
include_lineno: bool = ...,
|
||||
width: int | None = 76,
|
||||
no_location: bool = False,
|
||||
omit_header: bool = False,
|
||||
sort_output: bool = False,
|
||||
sort_by_file: bool = False,
|
||||
ignore_obsolete: bool = False,
|
||||
include_previous: bool = False,
|
||||
include_lineno: bool = True,
|
||||
) -> None: ...
|
||||
|
||||
@@ -16,17 +16,17 @@ def list_currencies(locale: Locale | str | None = ...) -> set[str]: ...
|
||||
def validate_currency(currency: str, locale: Locale | str | None = ...) -> None: ...
|
||||
def is_currency(currency: str, locale: Locale | str | None = ...) -> bool: ...
|
||||
def normalize_currency(currency: str, locale: Locale | str | None = ...) -> str | None: ...
|
||||
def get_currency_name(currency: str, count: float | decimal.Decimal | None = ..., locale: Locale | str | None = ...) -> str: ...
|
||||
def get_currency_name(currency: str, count: float | decimal.Decimal | None = None, locale: Locale | str | None = ...) -> str: ...
|
||||
def get_currency_symbol(currency: str, locale: Locale | str | None = ...) -> str: ...
|
||||
def get_currency_precision(currency: str) -> int: ...
|
||||
def get_currency_unit_pattern(currency: str, count: float | None = ..., locale: Locale | str | None = ...) -> str: ...
|
||||
def get_currency_unit_pattern(currency: str, count: float | None = None, locale: Locale | str | None = ...) -> str: ...
|
||||
def get_territory_currencies(
|
||||
territory: str,
|
||||
start_date: date | None = ...,
|
||||
end_date: date | None = ...,
|
||||
tender: bool = ...,
|
||||
non_tender: bool = ...,
|
||||
include_details: bool = ...,
|
||||
start_date: date | None = None,
|
||||
end_date: date | None = None,
|
||||
tender: bool = True,
|
||||
non_tender: bool = False,
|
||||
include_details: bool = False,
|
||||
) -> list[str]: ...
|
||||
def get_decimal_symbol(locale: Locale | str | None = ...) -> str: ...
|
||||
def get_plus_sign_symbol(locale: Locale | str | None = ...) -> str: ...
|
||||
@@ -38,13 +38,13 @@ def get_decimal_precision(number: decimal.Decimal) -> int: ...
|
||||
def get_decimal_quantum(precision: int | decimal.Decimal) -> decimal.Decimal: ...
|
||||
def format_decimal(
|
||||
number: float | decimal.Decimal | str,
|
||||
format: str | None = ...,
|
||||
format: str | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
decimal_quantization: bool = ...,
|
||||
group_separator: bool = ...,
|
||||
decimal_quantization: bool = True,
|
||||
group_separator: bool = True,
|
||||
): ...
|
||||
def format_compact_decimal(
|
||||
number: float, *, format_type: Literal["short", "long"] = ..., locale: Locale | str | None = ..., fraction_digits: int = ...
|
||||
number: float, *, format_type: Literal["short", "long"] = "short", locale: Locale | str | None = ..., fraction_digits: int = 0
|
||||
) -> str: ...
|
||||
|
||||
class UnknownCurrencyFormatError(KeyError): ...
|
||||
@@ -52,33 +52,33 @@ class UnknownCurrencyFormatError(KeyError): ...
|
||||
def format_currency(
|
||||
number: float | decimal.Decimal | str,
|
||||
currency: str,
|
||||
format: str | None = ...,
|
||||
format: str | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
currency_digits: bool = ...,
|
||||
format_type: Literal["name", "standard", "accounting"] = ...,
|
||||
decimal_quantization: bool = ...,
|
||||
group_separator: bool = ...,
|
||||
currency_digits: bool = True,
|
||||
format_type: Literal["name", "standard", "accounting"] = "standard",
|
||||
decimal_quantization: bool = True,
|
||||
group_separator: bool = True,
|
||||
) -> str: ...
|
||||
def format_percent(
|
||||
number: float | decimal.Decimal | str,
|
||||
format: str | None = ...,
|
||||
format: str | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
decimal_quantization: bool = ...,
|
||||
group_separator: bool = ...,
|
||||
decimal_quantization: bool = True,
|
||||
group_separator: bool = True,
|
||||
) -> str: ...
|
||||
def format_scientific(
|
||||
number: float | decimal.Decimal | str,
|
||||
format: str | None = ...,
|
||||
format: str | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
decimal_quantization: bool = ...,
|
||||
decimal_quantization: bool = True,
|
||||
) -> str: ...
|
||||
|
||||
class NumberFormatError(ValueError):
|
||||
suggestions: str | None
|
||||
def __init__(self, message: str, suggestions: str | None = ...) -> None: ...
|
||||
def __init__(self, message: str, suggestions: str | None = None) -> None: ...
|
||||
|
||||
def parse_number(string: str, locale: Locale | str | None = ...) -> int: ...
|
||||
def parse_decimal(string: str, locale: Locale | str | None = ..., strict: bool = ...) -> decimal.Decimal: ...
|
||||
def parse_decimal(string: str, locale: Locale | str | None = ..., strict: bool = False) -> decimal.Decimal: ...
|
||||
|
||||
PREFIX_END: str
|
||||
NUMBER_TOKEN: str
|
||||
@@ -119,9 +119,9 @@ class NumberPattern:
|
||||
self,
|
||||
value: float | decimal.Decimal,
|
||||
locale: Locale | str | None,
|
||||
currency: str | None = ...,
|
||||
currency_digits: bool = ...,
|
||||
decimal_quantization: bool = ...,
|
||||
force_frac: int | None = ...,
|
||||
group_separator: bool = ...,
|
||||
currency: str | None = None,
|
||||
currency_digits: bool = True,
|
||||
decimal_quantization: bool = True,
|
||||
force_frac: int | None = None,
|
||||
group_separator: bool = True,
|
||||
) -> str: ...
|
||||
|
||||
@@ -26,8 +26,8 @@ def cldr_modulo(a, b): ...
|
||||
class RuleError(Exception): ...
|
||||
|
||||
def tokenize_rule(s): ...
|
||||
def test_next_token(tokens, type_, value: Incomplete | None = ...): ...
|
||||
def skip_token(tokens, type_, value: Incomplete | None = ...): ...
|
||||
def test_next_token(tokens, type_, value: Incomplete | None = None): ...
|
||||
def skip_token(tokens, type_, value: Incomplete | None = None): ...
|
||||
def value_node(value): ...
|
||||
def ident_node(name): ...
|
||||
def range_list_node(range_list): ...
|
||||
@@ -37,7 +37,7 @@ class _Parser:
|
||||
tokens: Any
|
||||
ast: Any
|
||||
def __init__(self, string) -> None: ...
|
||||
def expect(self, type_, value: Incomplete | None = ..., term: Incomplete | None = ...): ...
|
||||
def expect(self, type_, value: Incomplete | None = None, term: Incomplete | None = None): ...
|
||||
def condition(self): ...
|
||||
def and_condition(self): ...
|
||||
def relation(self): ...
|
||||
@@ -96,4 +96,4 @@ class _UnicodeCompiler(_Compiler):
|
||||
compile_or: Any
|
||||
compile_mod: Any
|
||||
def compile_not(self, relation): ...
|
||||
def compile_relation(self, method, expr, range_list, negated: bool = ...): ...
|
||||
def compile_relation(self, method, expr, range_list, negated: bool = False): ...
|
||||
|
||||
@@ -13,22 +13,22 @@ from .dates import _PredefinedTimeFormat
|
||||
class Format:
|
||||
locale: Locale
|
||||
tzinfo: BaseTzInfo | None
|
||||
def __init__(self, locale: Locale | str, tzinfo: BaseTzInfo | None = ...) -> None: ...
|
||||
def date(self, date: _date | None = ..., format: _PredefinedTimeFormat | str = ...) -> str: ...
|
||||
def datetime(self, datetime: _date | None = ..., format: _PredefinedTimeFormat | str = ...) -> str: ...
|
||||
def time(self, time: _time | _datetime | None = ..., format: _PredefinedTimeFormat | str = ...) -> str: ...
|
||||
def __init__(self, locale: Locale | str, tzinfo: BaseTzInfo | None = None) -> None: ...
|
||||
def date(self, date: _date | None = None, format: _PredefinedTimeFormat | str = "medium") -> str: ...
|
||||
def datetime(self, datetime: _date | None = None, format: _PredefinedTimeFormat | str = "medium") -> str: ...
|
||||
def time(self, time: _time | _datetime | None = None, format: _PredefinedTimeFormat | str = "medium") -> str: ...
|
||||
def timedelta(
|
||||
self,
|
||||
delta: _timedelta | int,
|
||||
granularity: Literal["year", "month", "week", "day", "hour", "minute", "second"] = ...,
|
||||
threshold: float = ...,
|
||||
format: _PredefinedTimeFormat = ...,
|
||||
add_direction: bool = ...,
|
||||
granularity: Literal["year", "month", "week", "day", "hour", "minute", "second"] = "second",
|
||||
threshold: float = 0.85,
|
||||
format: _PredefinedTimeFormat = "long",
|
||||
add_direction: bool = False,
|
||||
) -> str: ...
|
||||
def number(self, number: float | Decimal | str) -> str: ...
|
||||
def decimal(self, number: float | Decimal | str, format: str | None = ...) -> str: ...
|
||||
def decimal(self, number: float | Decimal | str, format: str | None = None) -> str: ...
|
||||
def currency(self, number: float | Decimal | str, currency: str) -> str: ...
|
||||
def percent(self, number: float | Decimal | str, format: str | None = ...) -> str: ...
|
||||
def percent(self, number: float | Decimal | str, format: str | None = None) -> str: ...
|
||||
def scientific(self, number: float | Decimal | str) -> str: ...
|
||||
|
||||
class LazyProxy:
|
||||
@@ -67,7 +67,7 @@ class NullTranslations(gettext.NullTranslations):
|
||||
plural: Any
|
||||
files: Any
|
||||
domain: Any
|
||||
def __init__(self, fp: Incomplete | None = ...): ...
|
||||
def __init__(self, fp: Incomplete | None = None): ...
|
||||
def dgettext(self, domain, message): ...
|
||||
def ldgettext(self, domain, message): ...
|
||||
def udgettext(self, domain, message): ...
|
||||
@@ -97,10 +97,10 @@ class NullTranslations(gettext.NullTranslations):
|
||||
class Translations(NullTranslations, gettext.GNUTranslations):
|
||||
DEFAULT_DOMAIN: str
|
||||
domain: Any
|
||||
def __init__(self, fp: Incomplete | None = ..., domain: Incomplete | None = ...) -> None: ...
|
||||
def __init__(self, fp: Incomplete | None = None, domain: Incomplete | None = None) -> None: ...
|
||||
ugettext: Any
|
||||
ungettext: Any
|
||||
@classmethod
|
||||
def load(cls, dirname: Incomplete | None = ..., locales: Incomplete | None = ..., domain: Incomplete | None = ...): ...
|
||||
def add(self, translations, merge: bool = ...): ...
|
||||
def load(cls, dirname: Incomplete | None = None, locales: Incomplete | None = None, domain: Incomplete | None = None): ...
|
||||
def add(self, translations, merge: bool = True): ...
|
||||
def merge(self, translations): ...
|
||||
|
||||
@@ -7,21 +7,21 @@ class UnknownUnitError(ValueError):
|
||||
def __init__(self, unit: str, locale: Locale) -> None: ...
|
||||
|
||||
def get_unit_name(
|
||||
measurement_unit: str, length: Literal["short", "long", "narrow"] = ..., locale: Locale | str | None = ...
|
||||
measurement_unit: str, length: Literal["short", "long", "narrow"] = "long", locale: Locale | str | None = ...
|
||||
) -> str: ...
|
||||
def format_unit(
|
||||
value: float | decimal.Decimal,
|
||||
measurement_unit: str,
|
||||
length: Literal["short", "long", "narrow"] = ...,
|
||||
format: str | None = ...,
|
||||
length: Literal["short", "long", "narrow"] = "long",
|
||||
format: str | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str: ...
|
||||
def format_compound_unit(
|
||||
numerator_value: float | decimal.Decimal,
|
||||
numerator_unit: str | None = ...,
|
||||
denominator_value: float | decimal.Decimal = ...,
|
||||
denominator_unit: str | None = ...,
|
||||
length: Literal["short", "long", "narrow"] = ...,
|
||||
format: str | None = ...,
|
||||
numerator_unit: str | None = None,
|
||||
denominator_value: float | decimal.Decimal = 1,
|
||||
denominator_unit: str | None = None,
|
||||
length: Literal["short", "long", "narrow"] = "long",
|
||||
format: str | None = None,
|
||||
locale: Locale | str | None = ...,
|
||||
) -> str | None: ...
|
||||
|
||||
@@ -20,19 +20,19 @@ def parse_encoding(fp: IO[bytes]) -> str | None: ...
|
||||
|
||||
PYTHON_FUTURE_IMPORT_re: Pattern[str]
|
||||
|
||||
def parse_future_flags(fp: IO[bytes], encoding: str = ...) -> int: ...
|
||||
def parse_future_flags(fp: IO[bytes], encoding: str = "latin-1") -> int: ...
|
||||
def pathmatch(pattern: str, filename: str) -> bool: ...
|
||||
|
||||
class TextWrapper(textwrap.TextWrapper):
|
||||
wordsep_re: Pattern[str]
|
||||
|
||||
def wraptext(text, width: int = ..., initial_indent: str = ..., subsequent_indent: str = ...): ...
|
||||
def wraptext(text, width: int = 70, initial_indent: str = "", subsequent_indent: str = ""): ...
|
||||
|
||||
odict = collections.OrderedDict
|
||||
|
||||
class FixedOffsetTimezone(tzinfo):
|
||||
zone: str
|
||||
def __init__(self, offset: float, name: str | None = ...) -> None: ...
|
||||
def __init__(self, offset: float, name: str | None = None) -> None: ...
|
||||
def utcoffset(self, dt: Any) -> timedelta: ...
|
||||
def tzname(self, dt: Any) -> str: ...
|
||||
def dst(self, dt: Any) -> timedelta: ...
|
||||
|
||||
Reference in New Issue
Block a user