aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-12-12 09:18:27 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-12-12 09:48:31 +0300
commit1823321f2d789b9ae9ff875a4861d998c6071ed9 (patch)
tree2da1df1e1ac754832736590154522e4f461c6323
parent42cbb3b39d4aa621abbc2d84558807bdb68265ce (diff)
downloadydb-1823321f2d789b9ae9ff875a4861d998c6071ed9.tar.gz
Update contrib/python/traitlets/py3 to 5.14.0
-rw-r--r--contrib/python/traitlets/py3/.dist-info/METADATA4
-rw-r--r--contrib/python/traitlets/py3/tests/test_typing.py4
-rw-r--r--contrib/python/traitlets/py3/traitlets/_version.py2
-rw-r--r--contrib/python/traitlets/py3/traitlets/config/application.py30
-rw-r--r--contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py6
-rw-r--r--contrib/python/traitlets/py3/ya.make2
6 files changed, 36 insertions, 12 deletions
diff --git a/contrib/python/traitlets/py3/.dist-info/METADATA b/contrib/python/traitlets/py3/.dist-info/METADATA
index 2e66ab27bc..527825535a 100644
--- a/contrib/python/traitlets/py3/.dist-info/METADATA
+++ b/contrib/python/traitlets/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: traitlets
-Version: 5.13.0
+Version: 5.14.0
Summary: Traitlets Python configuration system
Project-URL: Homepage, https://github.com/ipython/traitlets
Project-URL: Documentation, https://traitlets.readthedocs.io
@@ -56,7 +56,7 @@ Requires-Dist: pydata-sphinx-theme; extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Provides-Extra: test
Requires-Dist: argcomplete>=3.0.3; extra == 'test'
-Requires-Dist: mypy>=1.6.0; extra == 'test'
+Requires-Dist: mypy>=1.7.0; extra == 'test'
Requires-Dist: pre-commit; extra == 'test'
Requires-Dist: pytest-mock; extra == 'test'
Requires-Dist: pytest-mypy-testing; extra == 'test'
diff --git a/contrib/python/traitlets/py3/tests/test_typing.py b/contrib/python/traitlets/py3/tests/test_typing.py
index 04f027af12..8329feb837 100644
--- a/contrib/python/traitlets/py3/tests/test_typing.py
+++ b/contrib/python/traitlets/py3/tests/test_typing.py
@@ -102,9 +102,9 @@ def mypy_list_typing() -> None:
t = T()
reveal_type(List(["foo"])) # R: traitlets.traitlets.List[builtins.str]
reveal_type(List([""]).tag(sync=True)) # R: traitlets.traitlets.List[builtins.str]
- reveal_type(List(None, allow_none=True)) # R: traitlets.traitlets.List[<nothing>]
+ reveal_type(List(None, allow_none=True)) # R: traitlets.traitlets.List[Never]
reveal_type(
- List(None, allow_none=True).tag(sync=True) # R: traitlets.traitlets.List[<nothing>]
+ List(None, allow_none=True).tag(sync=True) # R: traitlets.traitlets.List[Never]
)
reveal_type(T.latex_command) # R: traitlets.traitlets.List[builtins.str]
reveal_type(t.latex_command) # R: builtins.list[builtins.str]
diff --git a/contrib/python/traitlets/py3/traitlets/_version.py b/contrib/python/traitlets/py3/traitlets/_version.py
index 6c7ba3eff1..7a5c6e1005 100644
--- a/contrib/python/traitlets/py3/traitlets/_version.py
+++ b/contrib/python/traitlets/py3/traitlets/_version.py
@@ -5,7 +5,7 @@ import re
from typing import List
# Version string must appear intact for hatch versioning
-__version__ = "5.13.0"
+__version__ = "5.14.0"
# Build up version_info tuple for backwards compatibility
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
diff --git a/contrib/python/traitlets/py3/traitlets/config/application.py b/contrib/python/traitlets/py3/traitlets/config/application.py
index a62701a504..9a3fcc949e 100644
--- a/contrib/python/traitlets/py3/traitlets/config/application.py
+++ b/contrib/python/traitlets/py3/traitlets/config/application.py
@@ -23,6 +23,7 @@ from traitlets.config.loader import (
ArgumentError,
Config,
ConfigFileNotFound,
+ DeferredConfigString,
JSONFileConfigLoader,
KVArgParseConfigLoader,
PyFileConfigLoader,
@@ -96,7 +97,7 @@ else:
IS_PYTHONW = sys.executable and sys.executable.endswith("pythonw.exe")
T = t.TypeVar("T", bound=t.Callable[..., t.Any])
-AnyLogger = t.Union[logging.Logger, logging.LoggerAdapter]
+AnyLogger = t.Union[logging.Logger, "logging.LoggerAdapter[t.Any]"]
StrDict = t.Dict[str, t.Any]
ArgvType = t.Optional[t.List[str]]
ClassesType = t.List[t.Type[Configurable]]
@@ -713,12 +714,12 @@ class Application(SingletonConfigurable):
self.subapp = subapp.instance(parent=self)
elif callable(subapp):
# or ask factory to create it...
- self.subapp = subapp(self) # type:ignore[call-arg]
+ self.subapp = subapp(self)
else:
raise AssertionError("Invalid mappings for subcommand '%s'!" % subc)
# ... and finally initialize subapp.
- self.subapp.initialize(argv) # type:ignore[union-attr]
+ self.subapp.initialize(argv)
def flatten_flags(self) -> tuple[dict[str, t.Any], dict[str, t.Any]]:
"""Flatten flags and aliases for loaders, so cl-args override as expected.
@@ -970,6 +971,29 @@ class Application(SingletonConfigurable):
new_config.merge(self.cli_config)
self.update_config(new_config)
+ @catch_config_error
+ def load_config_environ(self) -> None:
+ """Load config files by environment."""
+
+ PREFIX = self.name.upper()
+ new_config = Config()
+
+ self.log.debug('Looping through config variables with prefix "%s"', PREFIX)
+
+ for k, v in os.environ.items():
+ if k.startswith(PREFIX):
+ self.log.debug('Seeing environ "%s"="%s"', k, v)
+ # use __ instead of . as separator in env variable.
+ # Warning, case sensitive !
+ _, *path, key = k.split("__")
+ section = new_config
+ for p in path:
+ section = section[p]
+ setattr(section, key, DeferredConfigString(v))
+
+ new_config.merge(self.cli_config)
+ self.update_config(new_config)
+
def _classes_with_config_traits(
self, classes: ClassesType | None = None
) -> t.Generator[type[Configurable], None, None]:
diff --git a/contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py b/contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py
index 0d63e75fbe..6c04fd5675 100644
--- a/contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py
+++ b/contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py
@@ -45,7 +45,7 @@ def get_argcomplete_cwords() -> t.Optional[t.List[str]]:
cword_suffix,
comp_words,
last_wordbreak_pos,
- ) = argcomplete.split_line(comp_line, comp_point) # type:ignore[attr-defined]
+ ) = argcomplete.split_line(comp_line, comp_point) # type:ignore[attr-defined,no-untyped-call]
except ModuleNotFoundError:
return None
@@ -73,7 +73,7 @@ def increment_argcomplete_index() -> None:
os.environ["_ARGCOMPLETE"] = str(int(os.environ["_ARGCOMPLETE"]) + 1)
except Exception:
try:
- argcomplete.debug("Unable to increment $_ARGCOMPLETE", os.environ["_ARGCOMPLETE"]) # type:ignore[attr-defined]
+ argcomplete.debug("Unable to increment $_ARGCOMPLETE", os.environ["_ARGCOMPLETE"]) # type:ignore[attr-defined,no-untyped-call]
except (KeyError, ModuleNotFoundError):
pass
@@ -196,7 +196,7 @@ class ExtendedCompletionFinder(CompletionFinder):
# Instead, check if comp_words only consists of the script,
# if so check if any subcommands start with cword_prefix.
if self.subcommands and len(comp_words) == 1:
- argcomplete.debug("Adding subcommands for", cword_prefix) # type:ignore[attr-defined]
+ argcomplete.debug("Adding subcommands for", cword_prefix) # type:ignore[attr-defined,no-untyped-call]
completions.extend(subc for subc in self.subcommands if subc.startswith(cword_prefix))
return completions
diff --git a/contrib/python/traitlets/py3/ya.make b/contrib/python/traitlets/py3/ya.make
index 6bd3d32e7c..2384990112 100644
--- a/contrib/python/traitlets/py3/ya.make
+++ b/contrib/python/traitlets/py3/ya.make
@@ -4,7 +4,7 @@ PY3_LIBRARY()
PROVIDES(python_traitlets)
-VERSION(5.13.0)
+VERSION(5.14.0)
LICENSE(BSD-3-Clause)