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

kaxilnaik 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 b809ee1e8c Remove deprecated ``ImportError`` from ``airflow.models`` 
(#41367)
b809ee1e8c is described below

commit b809ee1e8c97571ed406c9cc8508a2c07cf7ce86
Author: Jed Cunningham <[email protected]>
AuthorDate: Sun Aug 11 19:03:42 2024 -0600

    Remove deprecated ``ImportError`` from ``airflow.models`` (#41367)
---
 airflow/models/__init__.py          | 25 +++++--------------------
 newsfragments/41367.significant.rst |  4 ++++
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/airflow/models/__init__.py b/airflow/models/__init__.py
index bbf9c13567..9754df4156 100644
--- a/airflow/models/__init__.py
+++ b/airflow/models/__init__.py
@@ -69,28 +69,13 @@ def import_all_models():
 
 def __getattr__(name):
     # PEP-562: Lazy loaded attributes on python modules
-    if name != "ImportError":
-        path = __lazy_imports.get(name)
-        if not path:
-            raise AttributeError(f"module {__name__!r} has no attribute 
{name!r}")
+    path = __lazy_imports.get(name)
+    if not path:
+        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
 
-        from airflow.utils.module_loading import import_string
+    from airflow.utils.module_loading import import_string
 
-        val = import_string(f"{path}.{name}")
-    else:
-        import warnings
-
-        from airflow.exceptions import RemovedInAirflow3Warning
-        from airflow.models.errors import ParseImportError
-
-        warnings.warn(
-            f"Import '{__name__}.ImportError' is deprecated due to shadowing 
with builtin exception "
-            f"ImportError and will be removed in the future. "
-            f"Please consider to use 
'{ParseImportError.__module__}.ParseImportError' instead.",
-            RemovedInAirflow3Warning,
-            stacklevel=2,
-        )
-        val = ParseImportError
+    val = import_string(f"{path}.{name}")
 
     # Store for next time
     globals()[name] = val
diff --git a/newsfragments/41367.significant.rst 
b/newsfragments/41367.significant.rst
new file mode 100644
index 0000000000..410d5941bf
--- /dev/null
+++ b/newsfragments/41367.significant.rst
@@ -0,0 +1,4 @@
+Deprecated ``ImportError`` removed from ``airflow.models``
+
+The deprecated ``ImportError`` class can no longer be imported from 
``airflow.models``.
+It has been moved to ``airflow.models.errors.ParseImportError``.

Reply via email to