Skip to content

Commit

Permalink
refactor: Add all previous modules for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Jul 14, 2024
1 parent fb860b3 commit a86e44e
Show file tree
Hide file tree
Showing 34 changed files with 617 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/griffe/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.agents` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/agents/inspector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.agents.inspector` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
24 changes: 24 additions & 0 deletions src/griffe/agents/nodes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.agents.nodes` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
if name == "Name":
warnings.warn(
"The `Name` class was renamed `ExportedName`.",
DeprecationWarning,
stacklevel=2,
)
return griffe.ExportedName
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/agents/visitor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.agents.visitor` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/c3linear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.c3linear` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.cli` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/collections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.collections` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/dataclasses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.dataclasses` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.diff` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/docstrings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/docstrings/dataclasses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings.dataclasses` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
24 changes: 24 additions & 0 deletions src/griffe/docstrings/google.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings.google` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
if name == "parse":
warnings.warn(
"The 'parse' function was renamed 'parse_google'.",
DeprecationWarning,
stacklevel=2,
)
return griffe.parse_google
return getattr(griffe, name)
24 changes: 24 additions & 0 deletions src/griffe/docstrings/numpy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings.numpy` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
if name == "parse":
warnings.warn(
"The 'parse' function was renamed 'parse_numpy'.",
DeprecationWarning,
stacklevel=2,
)
return griffe.parse_numpy
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/docstrings/parsers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings.parsers` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
24 changes: 24 additions & 0 deletions src/griffe/docstrings/sphinx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings.sphinx` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
if name == "parse":
warnings.warn(
"The 'parse' function was renamed 'parse_sphinx'.",
DeprecationWarning,
stacklevel=2,
)
return griffe.parse_sphinx
return getattr(griffe, name)
38 changes: 38 additions & 0 deletions src/griffe/docstrings/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.docstrings.utils` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
if name == "WarningCallable":
warnings.warn(
"The 'WarningCallable' class was renamed 'DocstringWarningCallable'.",
DeprecationWarning,
stacklevel=2,
)
return griffe.DocstringWarningCallable
if name == "warning":
warnings.warn(
"The 'warning' function was renamed 'docstring_warning'.",
DeprecationWarning,
stacklevel=2,
)
return griffe.docstring_warning
if name == "parse_annotation":
warnings.warn(
"The 'parse_annotation' function was renamed 'parse_docstring_annotation'.",
DeprecationWarning,
stacklevel=2,
)
return griffe.parse_docstring_annotation
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/encoders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.encoders` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/enumerations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.enumerations` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
17 changes: 17 additions & 0 deletions src/griffe/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Deprecated. Import from `griffe` directly."""

from __future__ import annotations

import warnings
from typing import Any

import griffe


def __getattr__(name: str) -> Any:
warnings.warn(
"Importing from `griffe.exceptions` is deprecated. Import from `griffe` directly instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(griffe, name)
Loading

0 comments on commit a86e44e

Please sign in to comment.