Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
-
5e326b3e
by lovetox at 2020-03-10T21:20:35+01:00
-
a89e9a52
by lovetox at 2020-03-10T21:26:04+01:00
-
6afd49a5
by lovetox at 2020-03-10T21:30:28+01:00
-
234379a6
by lovetox at 2020-03-10T21:31:25+01:00
6 changed files:
- .pylintrc
- nbxmpp/connection.py
- nbxmpp/old_dispatcher.py
- nbxmpp/resolver.py
- nbxmpp/util.py
- nbxmpp/websocket.py
Changes:
| ... | ... | @@ -50,7 +50,9 @@ confidence= |
| 50 | 50 |
# --enable=similarities". If you want to run only the classes checker, but have
|
| 51 | 51 |
# no Warning level messages displayed, use"--disable=all --enable=classes
|
| 52 | 52 |
# --disable=W"
|
| 53 |
-disable=C0111,C0301,R1710,R0912,R0914,R0915,W0511,W0231,W0233
|
|
| 53 |
+# C0111 missing-docstring
|
|
| 54 |
+# W0511 fix-me
|
|
| 55 |
+disable=C0111,W0511
|
|
| 54 | 56 |
|
| 55 | 57 |
# Enable the message, report, category or checker with the given id(s). You can
|
| 56 | 58 |
# either give multiple identifier separated by comma (,) or put this option
|
| ... | ... | @@ -94,7 +96,7 @@ max-nested-blocks=5 |
| 94 | 96 |
|
| 95 | 97 |
# List of additional names supposed to be defined in builtins. Remember that
|
| 96 | 98 |
# you should avoid to define new builtins when possible.
|
| 97 |
-additional-builtins=_
|
|
| 99 |
+additional-builtins=
|
|
| 98 | 100 |
|
| 99 | 101 |
# Tells whether unused global variables should be treated as a violation.
|
| 100 | 102 |
allow-global-unused-variables=yes
|
| ... | ... | @@ -138,7 +140,7 @@ ignore-mixin-members=yes |
| 138 | 140 |
# List of class names for which member attributes should not be checked (useful
|
| 139 | 141 |
# for classes with dynamically set attributes). This supports the use of
|
| 140 | 142 |
# qualified names.
|
| 141 |
-ignored-classes=optparse.Values,thread._local,_thread._local
|
|
| 143 |
+ignored-classes=optparse.Values,thread._local,_thread._local,gi.repository.GLib.Error
|
|
| 142 | 144 |
|
| 143 | 145 |
# List of module names for which member attributes should not be checked
|
| 144 | 146 |
# (useful for modules/projects where namespaces are manipulated during runtime
|
| ... | ... | @@ -220,10 +222,10 @@ indent-after-paren=4 |
| 220 | 222 |
indent-string=' '
|
| 221 | 223 |
|
| 222 | 224 |
# Maximum number of characters on a single line.
|
| 223 |
-max-line-length=100
|
|
| 225 |
+max-line-length=80
|
|
| 224 | 226 |
|
| 225 | 227 |
# Maximum number of lines in a module
|
| 226 |
-max-module-lines=1000
|
|
| 228 |
+max-module-lines=3000
|
|
| 227 | 229 |
|
| 228 | 230 |
# List of optional constructs for which whitespace checking is disabled. `dict-
|
| 229 | 231 |
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
| ... | ... | @@ -357,7 +359,7 @@ known-third-party=enchant |
| 357 | 359 |
[DESIGN]
|
| 358 | 360 |
|
| 359 | 361 |
# Maximum number of arguments for function / method
|
| 360 |
-max-args=10
|
|
| 362 |
+max-args=15
|
|
| 361 | 363 |
|
| 362 | 364 |
# Maximum number of attributes for a class (see R0902).
|
| 363 | 365 |
max-attributes=9999
|
| ... | ... | @@ -366,22 +368,22 @@ max-attributes=9999 |
| 366 | 368 |
max-bool-expr=5
|
| 367 | 369 |
|
| 368 | 370 |
# Maximum number of branch for function / method body
|
| 369 |
-max-branches=12
|
|
| 371 |
+max-branches=50
|
|
| 370 | 372 |
|
| 371 | 373 |
# Maximum number of locals for function / method body
|
| 372 |
-max-locals=15
|
|
| 374 |
+max-locals=50
|
|
| 373 | 375 |
|
| 374 | 376 |
# Maximum number of parents for a class (see R0901).
|
| 375 | 377 |
max-parents=7
|
| 376 | 378 |
|
| 377 | 379 |
# Maximum number of public methods for a class (see R0904).
|
| 378 |
-max-public-methods=20
|
|
| 380 |
+max-public-methods=50
|
|
| 379 | 381 |
|
| 380 | 382 |
# Maximum number of return / yield for function / method body
|
| 381 | 383 |
max-returns=100
|
| 382 | 384 |
|
| 383 | 385 |
# Maximum number of statements in function / method body
|
| 384 |
-max-statements=50
|
|
| 386 |
+max-statements=100
|
|
| 385 | 387 |
|
| 386 | 388 |
# Minimum number of public methods for a class (see R0903).
|
| 387 | 389 |
min-public-methods=0
|
| ... | ... | @@ -88,12 +88,12 @@ class Connection(Observable): |
| 88 | 88 |
|
| 89 | 89 |
if self._ignored_tls_errors:
|
| 90 | 90 |
log.warning('Ignore TLS certificate errors: %s',
|
| 91 |
- self._ignored_tls_errors)
|
|
| 91 |
+ self._ignored_tls_errors)
|
|
| 92 | 92 |
self._peer_certificate_errors -= self._ignored_tls_errors
|
| 93 | 93 |
|
| 94 | 94 |
if Gio.TlsCertificateFlags.UNKNOWN_CA in self._peer_certificate_errors:
|
| 95 | 95 |
for accepted_certificate in self._accepted_certificates:
|
| 96 |
- if certificate.is_same(accepted_certificate):
|
|
| 96 |
+ if self._peer_certificate.is_same(accepted_certificate):
|
|
| 97 | 97 |
self._peer_certificate_errors.discard(
|
| 98 | 98 |
Gio.TlsCertificateFlags.UNKNOWN_CA)
|
| 99 | 99 |
break
|
| ... | ... | @@ -20,7 +20,6 @@ different handlers to different XMPP stanzas and namespaces |
| 20 | 20 |
"""
|
| 21 | 21 |
|
| 22 | 22 |
import sys
|
| 23 |
-import locale
|
|
| 24 | 23 |
import re
|
| 25 | 24 |
import uuid
|
| 26 | 25 |
import logging
|
| ... | ... | @@ -127,6 +127,7 @@ class GioResolver(metaclass=Singleton): |
| 127 | 127 |
for result in result_list:
|
| 128 | 128 |
if result.startswith('_xmpp-client-websocket'):
|
| 129 | 129 |
return result.split('=')[1]
|
| 130 |
+ return None
|
|
| 130 | 131 |
|
| 131 | 132 |
|
| 132 | 133 |
if __name__ == '__main__':
|
| ... | ... | @@ -21,7 +21,6 @@ import weakref |
| 21 | 21 |
import hashlib
|
| 22 | 22 |
import uuid
|
| 23 | 23 |
import binascii
|
| 24 |
-import ipaddress
|
|
| 25 | 24 |
import os
|
| 26 | 25 |
import re
|
| 27 | 26 |
from collections import defaultdict
|
| ... | ... | @@ -29,7 +28,6 @@ from collections import defaultdict |
| 29 | 28 |
from functools import wraps
|
| 30 | 29 |
from functools import lru_cache
|
| 31 | 30 |
|
| 32 |
-import precis_i18n.codec
|
|
| 33 | 31 |
from gi.repository import Gio
|
| 34 | 32 |
|
| 35 | 33 |
from nbxmpp.protocol import DiscoInfoMalformed
|
| ... | ... | @@ -37,7 +35,6 @@ from nbxmpp.protocol import isErrorNode |
| 37 | 35 |
from nbxmpp.protocol import NS_DATA
|
| 38 | 36 |
from nbxmpp.protocol import NS_HTTPUPLOAD_0
|
| 39 | 37 |
from nbxmpp.const import GIO_TLS_ERRORS
|
| 40 |
-from nbxmpp.const import StreamState
|
|
| 41 | 38 |
from nbxmpp.protocol import NS_STREAMS
|
| 42 | 39 |
from nbxmpp.protocol import NS_CLIENT
|
| 43 | 40 |
from nbxmpp.protocol import NS_FRAMING
|
| ... | ... | @@ -128,7 +128,7 @@ class WebsocketConnection(Connection): |
| 128 | 128 |
def _on_websocket_closing(_websocket):
|
| 129 | 129 |
log.info('Closing')
|
| 130 | 130 |
|
| 131 |
- def _on_websocket_error(self, websocket, error):
|
|
| 131 |
+ def _on_websocket_error(self, _websocket, error):
|
|
| 132 | 132 |
log.error(error)
|
| 133 | 133 |
if self._state not in (TCPState.DISCONNECTED, TCPState.DISCONNECTING):
|
| 134 | 134 |
self._finalize('disconnected')
|