Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup and prepare deprecation messages
- Loading branch information
Showing
4 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,26 @@ | ||
""" | ||
lexicon - a DNS provider agnostic api to manipulate records. | ||
""" | ||
__author__ = "Jason Kulatunga" | ||
import sys | ||
import warnings | ||
from types import ModuleType | ||
|
||
from lexicon._private import cli as _cli | ||
from lexicon._private import discovery as _discovery | ||
from lexicon._private import parser as _parser | ||
|
||
|
||
class DeprecatedModule(ModuleType): | ||
def __init__(self, module: ModuleType, name: str): | ||
super().__init__(name) | ||
self._module = module | ||
|
||
def __getattr__(self, item): | ||
warnings.warn( | ||
f"Module {self.__name__} is deprecated and will be removed in Lexicon 4>=", | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) | ||
return getattr(self._module, item) | ||
|
||
|
||
sys.modules["lexicon.cli"] = DeprecatedModule(_cli, "lexicon.cli") | ||
sys.modules["lexicon.parser"] = DeprecatedModule(_parser, "lexicon.parser") | ||
sys.modules["lexicon.discovery"] = DeprecatedModule(_discovery, "lexicon.discovery") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
"""General configuration of lexicon._private.providers package""" | ||
__author__ = "Jason Kulatunga" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters