Skip to content
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

Merged
merged 2 commits into from
Aug 3, 2023
Merged

Get rid of Python2 numeric relics #33050

merged 2 commits into from
Aug 3, 2023

Conversation

eumiro
Copy link
Contributor

@eumiro eumiro commented Aug 2, 2023

Migration from Python2 to Python3 changes some numeric behavior. In Python3:

  • round(), math.ceil() and math.floor() return int instead of float
  • true division int / int returns float and therefore it is not necessary to convert one of the parts to float or to multiply the expression by 1.0

The code has been simplified. No functionality has been changed.

@boring-cyborg
Copy link

boring-cyborg bot commented Aug 2, 2023

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)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

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))
Copy link
Member

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…

@potiuk potiuk merged commit e3d82c6 into apache:main Aug 3, 2023
61 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 3, 2023

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@ephraimbuddy ephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Aug 4, 2023
ephraimbuddy pushed a commit that referenced this pull request Aug 4, 2023
@eumiro eumiro deleted the integers branch August 5, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools area:providers area:webserver Webserver related Issues provider:celery provider:common-sql provider:docker provider:google Google (including GCP) related issues type:misc/internal Changelog: Misc changes that should appear in change log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants