This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9571d37cad Refactor integer division (#34180)
9571d37cad is described below

commit 9571d37cad376ab931dadf02304387c5286c1938
Author: Miroslav Šedivý <[email protected]>
AuthorDate: Mon Sep 11 17:53:11 2023 +0000

    Refactor integer division (#34180)
---
 airflow/www/utils.py                                      | 2 +-
 dev/stats/calculate_statistics_provider_testing_issues.py | 4 ++--
 scripts/in_container/update_quarantined_test_status.py    | 2 +-
 tests/models/test_dagcode.py                              | 2 +-
 tests/www/test_utils.py                                   | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index a415c03911..321e343fa4 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -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:
diff --git a/dev/stats/calculate_statistics_provider_testing_issues.py 
b/dev/stats/calculate_statistics_provider_testing_issues.py
index 18a64daad6..5d306389c4 100755
--- a/dev/stats/calculate_statistics_provider_testing_issues.py
+++ b/dev/stats/calculate_statistics_provider_testing_issues.py
@@ -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))
@@ -90,7 +90,7 @@ class Stats:
         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 (
diff --git a/scripts/in_container/update_quarantined_test_status.py 
b/scripts/in_container/update_quarantined_test_status.py
index 526eb2d961..2d589f1f89 100755
--- a/scripts/in_container/update_quarantined_test_status.py
+++ b/scripts/in_container/update_quarantined_test_status.py
@@ -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"
 
diff --git a/tests/models/test_dagcode.py b/tests/models/test_dagcode.py
index 1ae47b1df8..d3b38761ca 100644
--- a/tests/models/test_dagcode.py
+++ b/tests/models/test_dagcode.py
@@ -81,7 +81,7 @@ class TestDagCode:
         """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()
diff --git a/tests/www/test_utils.py b/tests/www/test_utils.py
index e4e186d36a..78f3104dc2 100644
--- a/tests/www/test_utils.py
+++ b/tests/www/test_utils.py
@@ -69,7 +69,7 @@ class TestUtils:
         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 = []
 

Reply via email to