ashb commented on a change in pull request #20322:
URL: https://github.com/apache/airflow/pull/20322#discussion_r770958858
##########
File path: airflow/utils/context.py
##########
@@ -191,7 +191,14 @@ def items(self):
def values(self):
return ValuesView(self._context)
- def copy_only(self, keys: Container[str]) -> "Context":
- new = type(self)({k: v for k, v in self._context.items() if k in keys})
- new._deprecation_replacements = self._deprecation_replacements.copy()
- return new
+
+def context_copy_partial(source: Context, keys: Container[str]) -> "Context":
+ """Create a context by copying items under selected keys in ``source``.
+
+ This is implemented as a free function because the ``Context`` type is
+ "faked" as a ``TypedDict`` in ``context.pyi``, which cannot have custom
+ functions.
Review comment:
```suggestion
functions.
:meta private:
```
as we probably don't want this to be part of the "public API".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]