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

Refactor integer division #34180

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def generate_pages(

output.append(previous_node.format(href_link=page_link, disabled=is_disabled))

mid = int(window / 2)
mid = window // 2
last_page = num_of_pages - 1

if current_page <= mid or num_of_pages < window:
Expand Down
4 changes: 2 additions & 2 deletions dev/stats/calculate_statistics_provider_testing_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Stats:
users_commented: set[str]

def percent_tested(self) -> int:
return int(100.0 * self.tested_issues / self.num_issues)
return 100 * self.tested_issues // self.num_issues

def num_involved_users_who_commented(self) -> int:
return len(self.users_involved.intersection(self.users_commented))
Expand All @@ -90,7 +90,7 @@ def num_commenting_not_involved(self) -> int:
return len(self.users_commented - self.users_involved)

def percent_commented_among_involved(self) -> int:
return int(100.0 * self.num_involved_users_who_commented() / len(self.users_involved))
return 100 * self.num_involved_users_who_commented() // len(self.users_involved)

def __str__(self):
return (
Expand Down
2 changes: 1 addition & 1 deletion scripts/in_container/update_quarantined_test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def get_history_status(history: TestHistory):
return "Stable"
if all(history.states[0 : num_runs - 1]):
return "Just one more"
if all(history.states[0 : int(num_runs / 2)]):
if all(history.states[0 : num_runs // 2]):
return "Almost there"
return "Flaky"

Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_dagcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_bulk_sync_to_db_half_files(self):
"""Dg code can be bulk written into database."""
example_dags = make_example_dags(example_dags_module)
files = [dag.fileloc for dag in example_dags.values()]
half_files = files[: int(len(files) / 2)]
half_files = files[: len(files) // 2]
with create_session() as session:
DagCode.bulk_sync_to_db(half_files, session=session)
session.commit()
Expand Down
2 changes: 1 addition & 1 deletion tests/www/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def check_generate_pages_html(
assert min(window, total_pages) + extra_links == len(ulist_items)

page_items = ulist_items[2:-2]
mid = int(len(page_items) / 2)
mid = len(page_items) // 2
all_nodes = []
pages = []

Expand Down