1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 21:14:19 +00:00

📔 Improve logging and documentation

This commit is contained in:
Steffo 2021-01-08 16:14:06 +01:00
parent 68f7025640
commit 59a12c196b
2 changed files with 18 additions and 9 deletions

View file

@ -12,6 +12,8 @@ it is available.
- :data:`None` is returned, meaning that there is no data in that field (if a message is not a reply to anything, - :data:`None` is returned, meaning that there is no data in that field (if a message is not a reply to anything,
:meth:`Message.reply_to` will be :data:`None`. :meth:`Message.reply_to` will be :data:`None`.
- The data is returned. - The data is returned.
To instantiate a new :class:`Bullet` from a bullet, you should use the methods of :attr:`.Bullet.mag`.
""" """
from __future__ import annotations from __future__ import annotations
@ -20,6 +22,7 @@ import royalnet.royaltyping as t
import abc import abc
import datetime import datetime
import sqlalchemy.orm import sqlalchemy.orm
import io
from . import exc from . import exc

View file

@ -1,6 +1,7 @@
# Module docstring # Module docstring
""" """
.. todo:: Document magazines. Magazines are references to the bullet classes used by a specific frontend; they allow bullets to instance each other
without tying the instantiations to specific classes.
""" """
# Special imports # Special imports
@ -8,6 +9,7 @@ from __future__ import annotations
import royalnet.royaltyping as t import royalnet.royaltyping as t
# External imports # External imports
import functools
import logging import logging
# Internal imports # Internal imports
@ -30,20 +32,24 @@ class Magazine:
_CHANNEL = bullet.Channel _CHANNEL = bullet.Channel
@property @property
def Bullet(self) -> bullet.Bullet: def Bullet(self) -> functools.partial[bullet.Bullet]:
return self._BULLET(mag=self) log.debug(f"Extracting Bullet from Magazine: {self._BULLET!r}")
return functools.partial(self._BULLET, mag=self)
@property @property
def User(self) -> bullet.User: def User(self) -> functools.partial[bullet.User]:
return self._USER(mag=self) log.debug(f"Extracting User from Magazine: {self._USER!r}")
return functools.partial(self._USER, mag=self)
@property @property
def Message(self) -> bullet.Message: def Message(self) -> functools.partial[bullet.Message]:
return self._MESSAGE(mag=self) log.debug(f"Extracting Message from Magazine: {self._MESSAGE!r}")
return functools.partial(self._MESSAGE, mag=self)
@property @property
def Channel(self) -> bullet.Channel: def Channel(self) -> functools.partial[bullet.Channel]:
return self._CHANNEL(mag=self) log.debug(f"Extracting Channel from Magazine: {self._CHANNEL!r}")
return functools.partial(self._CHANNEL, mag=self)
# Objects exported by this module # Objects exported by this module