ashb commented on a change in pull request #19914:
URL: https://github.com/apache/airflow/pull/19914#discussion_r763879385
##########
File path: airflow/utils/timezone.py
##########
@@ -179,8 +179,7 @@ def coerce_datetime(v: Union[None, dt.datetime, DateTime])
-> Optional[DateTime]
"""Convert whatever is passed in to an timezone-aware
``pendulum.DateTime``."""
if v is None:
return None
- if v.tzinfo is None:
- v = make_aware(v)
if isinstance(v, DateTime):
- return v
- return pendulum.instance(v)
+ return v if v.tzinfo else make_aware(v)
Review comment:
How well covered was this function by tests? I'm not 100% sure this has
the same behaviour
##########
File path: airflow/utils/log/logging_mixin.py
##########
@@ -134,6 +136,56 @@ def isatty(self):
"""
return False
+ def fileno(self) -> int:
+ pass
+
+ def read(self, n: int = ...) -> AnyStr:
+ pass
+
+ def readable(self) -> bool:
+ pass
+
+ def readline(self, limit: int = ...) -> AnyStr:
+ pass
+
+ def readlines(self, hint: int = ...) -> list:
+ pass
+
+ def seek(self, offset: int, whence: int = ...) -> int:
+ pass
+
+ def seekable(self) -> bool:
+ pass
+
+ def tell(self) -> int:
+ pass
+
+ def truncate(self, size: Optional[int] = ...) -> int:
+ pass
+
+ def writable(self) -> bool:
+ pass
+
+ def writelines(self, lines: Iterable[AnyStr]) -> None:
+ pass
+
+ def __next__(self) -> AnyStr:
+ pass
+
+ def __iter__(self) -> Iterator[AnyStr]:
+ pass
+
+ def __enter__(self) -> IO[AnyStr]:
+ pass
+
+ def __exit__(
+ self,
+ t: Optional[Type[BaseException]],
+ value: Optional[BaseException],
+ traceback: Optional[TracebackType],
+ ) -> Optional[bool]:
+ pass
Review comment:
Why do we need all these on a mixin? It seems odd that we'd want every
class that includes LoggingMixin to behave like a IO object.
--
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]