uranusjr commented on issue #27903:
URL: https://github.com/apache/airflow/issues/27903#issuecomment-1327146705
The next line is probably what causes the confusion. `pendulum.instance()`
honours the first argument’s `tzinfo` by default, so if `start_date.tzinfo` is
not None, `tz` can be anything and it does not matter. You can as well do
```python
tzinfo = 123 if start_date.tzinfo else settings.TIMEZONE
tz = pendulum.instance(start_date, tz=tzinfo).timezone
```
and the result would still be the same.
I guess a “less magical” way to write this would be
```python
if start_date.tzinfo is None:
tz = pendulum.instance(start_date, tz=settings.TIMEZONE).timezone
else:
tz = pendulum.instance(start_date).timezone
```
--
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]