Commit c3eb064b authored by Philipp Hörist's avatar Philipp Hörist
Browse files

BaseModule: Add annotations

parent 0c23dfbc
......@@ -15,21 +15,29 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Any
import logging
from nbxmpp.util import LogAdapter
if TYPE_CHECKING:
from nbxmpp.client import Client
class BaseModule:
_depends = {}
_depends: dict[str, str] = {}
def __init__(self, client):
def __init__(self, client: Client):
logger_name = 'nbxmpp.m.%s' % self.__class__.__name__.lower()
self._log = LogAdapter(logging.getLogger(logger_name),
{'context': client.log_context})
def __getattr__(self, name):
def __getattr__(self, name: str) -> Any:
if name not in self._depends:
raise AttributeError('Unknown method: %s' % name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment