-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of Python2 numeric relics #33050
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
chunksize = max(1, math.floor(math.ceil(1.0 * len(async_results) / self._sync_parallelism))) | ||
chunksize = max(1, math.ceil(len(async_results) / self._sync_parallelism)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the outer floor
existed in the first place. That wouldn’t do anything on Python 2 either…
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
(cherry picked from commit e3d82c6)
Migration from Python2 to Python3 changes some numeric behavior. In Python3:
round()
,math.ceil()
andmath.floor()
returnint
instead offloat
int / int
returnsfloat
and therefore it is not necessary to convert one of the parts tofloat
or to multiply the expression by1.0
The code has been simplified. No functionality has been changed.