Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
python-nbxmpp
Commits
c3eb064b
Commit
c3eb064b
authored
Nov 03, 2021
by
Philipp Hörist
Browse files
BaseModule: Add annotations
parent
0c23dfbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
nbxmpp/modules/base.py
View file @
c3eb064b
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment