uranusjr commented on a change in pull request #20482:
URL: https://github.com/apache/airflow/pull/20482#discussion_r774916244
##########
File path: airflow/utils/python_virtualenv.py
##########
@@ -118,6 +118,7 @@ def write_python_script(
to a native Python object
"""
template_loader =
jinja2.FileSystemLoader(searchpath=os.path.dirname(__file__))
+ template_env: Union[jinja2.nativetypes.NativeEnvironment,
jinja2.Environment]
Review comment:
```suggestion
template_env: jinja2.Environment
```
Because `NativeEnvironment` is a subclass of `Environment`
##########
File path: airflow/utils/timezone.py
##########
@@ -102,16 +102,18 @@ def convert_to_utc(value):
@overload
-def make_aware(v: None, timezone: Optional["Timezone"] = None) -> None:
+def make_aware(value: None, timezone: Optional[Union["Timezone", dt.tzinfo]] =
None) -> None:
Review comment:
```suggestion
def make_aware(value: None, timezone: Optional[dt.tzinfo] = None) -> None:
```
Because `pendulum.tz.Timezone` is a subclass of `datetime.tzinfo`.
##########
File path: airflow/utils/timezone.py
##########
@@ -195,11 +201,11 @@ def coerce_datetime(v: None) -> None:
@overload
-def coerce_datetime(v: dt.datetime) -> DateTime:
+def coerce_datetime(v: dt.datetime) -> dt.datetime:
...
-def coerce_datetime(v: Optional[dt.datetime]) -> Optional[DateTime]:
+def coerce_datetime(v: Optional[dt.datetime]) -> Optional[dt.datetime]:
Review comment:
This shouldn’t be necessary; `coerce_datetime` always returns a
`pendulum.DateTime`. Also I believe this will cause some errors to pop up
elsewhere because there are functions expecting this to return a
`pendulum.DateTime` specifically.
--
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]