:returns: iterable of tuples of the form ``(lineno, message, comments, context)``
:rtype: Iterable[tuple[int, str|tuple[str], list[str], str|None]
"""
- func = None
if callable(method):
func = method
elif ':' in method or '.' in method:
usage=self.usage % (cmdname, ''),
description=self.commands[cmdname],
)
- as_args = getattr(cmdclass, "as_args", ())
+ as_args: str | None = getattr(cmdclass, "as_args", None)
for long, short, help in cmdclass.user_options:
name = long.strip("=")
default = getattr(cmdinst, name.replace("-", "_"))
>>> within_range_list(10.5, [(1, 4), (20, 30)])
False
"""
- return any(num >= min_ and num <= max_ for min_, max_ in range_list)
+ return any(min_ <= num <= max_ for min_, max_ in range_list)
def cldr_modulo(a: float, b: float) -> float:
:return: A key to the `unit_patterns` mapping, or None.
"""
locale = Locale.parse(locale or LC_NUMERIC)
- unit_patterns = locale._data["unit_patterns"]
+ unit_patterns: dict[str, str] = locale._data["unit_patterns"]
if unit_id in unit_patterns:
return unit_id
for unit_pattern in sorted(unit_patterns, key=len):
# history and logs, available at http://babel.edgewall.org/log/.
import os
+import pickle
import sys
from pprint import pprint
-import cPickle as pickle
-
import babel
dirname = os.path.join(os.path.dirname(babel.__file__))
if elem is not None:
language = elem.attrib['type']
- territory = None
+ territory = '001' # world
elem = tree.find('.//identity/territory')
if elem is not None:
territory = elem.attrib['type']
- else:
- territory = '001' # world
regions = territory_containment.get(territory, [])
log.info(