Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
9cd576eb by lovetox at 2020-03-10T21:41:31+01:00
Fix pylint errors
- trailing-newlines
- chained-comparison
- trailing-whitespace
- unnecessary-pass
- - - - -
5 changed files:
- nbxmpp/idlequeue.py
- nbxmpp/old_dispatcher.py
- nbxmpp/protocol.py
- nbxmpp/simplexml.py
- nbxmpp/stringprepare.py
Changes:
=====================================
nbxmpp/idlequeue.py
=====================================
@@ -86,25 +86,21 @@ class IdleObject:
"""
Called on stream failure
"""
- pass
def pollin(self):
"""
Called on new read event
"""
- pass
def pollout(self):
"""
Called on new write event (connect in sockets is a pollout)
"""
- pass
def read_timeout(self):
"""
Called when timeout happened
"""
- pass
class IdleCommand(IdleObject):
=====================================
nbxmpp/old_dispatcher.py
=====================================
@@ -458,7 +458,6 @@ class XMPPDispatcher(PlugIn):
log.warning(
'Unregister failed: %s for "%s" type->%s ns->%s(%s)',
handler, name, typ, ns, xmlns)
- pass
def RegisterDefaultHandler(self, handler):
"""
=====================================
nbxmpp/protocol.py
=====================================
@@ -592,13 +592,11 @@ class NodeProcessed(Exception):
Exception that should be raised by handler when the handling should be
stopped
"""
- pass
class StreamError(Exception):
"""
Base exception class for stream errors
"""
- pass
class BadFormat(StreamError):
pass
@@ -2209,4 +2207,3 @@ class DataForm(Node):
Simple dictionary interface for setting datafields values by their names
"""
return self.setField(name).setValue(val)
-
=====================================
nbxmpp/simplexml.py
=====================================
@@ -93,7 +93,7 @@ class Node:
self.nsp_cache = {}
if nsp:
for k, v in nsp.items(): self.nsp_cache[k] = v
-
+
if attrs is not None:
for attr, val in attrs.items():
if attr == 'xmlns':
@@ -688,7 +688,6 @@ class NodeBuilder:
up with the built node as argument. Can be redefined to convert incoming
XML stanzas to program events
"""
- pass
def stream_header_received(self):
"""
@@ -706,7 +705,7 @@ class NodeBuilder:
"""
Return True if at least one end tag was seen (at level)
"""
- return self.__depth <= level and self.__max_depth > level
+ return self.__depth <= level < self.__max_depth
def _inc_depth(self):
self.__last_depth = self.__depth
=====================================
nbxmpp/stringprepare.py
=====================================
@@ -35,7 +35,6 @@ class ILookupTable:
"""
Return whether character is in this table
"""
- pass
class IMappingTable:
@@ -47,7 +46,6 @@ class IMappingTable:
"""
Return mapping for character
"""
- pass
class LookupTableFromFunction:
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/9cd576ebf095652ee8d8f605…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/9cd576ebf095652ee8d8f605…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
5e326b3e by lovetox at 2020-03-10T21:20:35+01:00
Update .pylintrc
- - - - -
a89e9a52 by lovetox at 2020-03-10T21:26:04+01:00
Remove unused imports
- - - - -
6afd49a5 by lovetox at 2020-03-10T21:30:28+01:00
Fix pylint errors
- - - - -
234379a6 by lovetox at 2020-03-10T21:31:25+01:00
Fix undefined var
- - - - -
6 changed files:
- .pylintrc
- nbxmpp/connection.py
- nbxmpp/old_dispatcher.py
- nbxmpp/resolver.py
- nbxmpp/util.py
- nbxmpp/websocket.py
Changes:
=====================================
.pylintrc
=====================================
@@ -50,7 +50,9 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
-disable=C0111,C0301,R1710,R0912,R0914,R0915,W0511,W0231,W0233
+# C0111 missing-docstring
+# W0511 fix-me
+disable=C0111,W0511
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
@@ -94,7 +96,7 @@ max-nested-blocks=5
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
-additional-builtins=_
+additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
@@ -138,7 +140,7 @@ ignore-mixin-members=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
-ignored-classes=optparse.Values,thread._local,_thread._local
+ignored-classes=optparse.Values,thread._local,_thread._local,gi.repository.GLib.Error
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
@@ -220,10 +222,10 @@ indent-after-paren=4
indent-string=' '
# Maximum number of characters on a single line.
-max-line-length=100
+max-line-length=80
# Maximum number of lines in a module
-max-module-lines=1000
+max-module-lines=3000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
@@ -357,7 +359,7 @@ known-third-party=enchant
[DESIGN]
# Maximum number of arguments for function / method
-max-args=10
+max-args=15
# Maximum number of attributes for a class (see R0902).
max-attributes=9999
@@ -366,22 +368,22 @@ max-attributes=9999
max-bool-expr=5
# Maximum number of branch for function / method body
-max-branches=12
+max-branches=50
# Maximum number of locals for function / method body
-max-locals=15
+max-locals=50
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
+max-public-methods=50
# Maximum number of return / yield for function / method body
max-returns=100
# Maximum number of statements in function / method body
-max-statements=50
+max-statements=100
# Minimum number of public methods for a class (see R0903).
min-public-methods=0
=====================================
nbxmpp/connection.py
=====================================
@@ -88,12 +88,12 @@ class Connection(Observable):
if self._ignored_tls_errors:
log.warning('Ignore TLS certificate errors: %s',
- self._ignored_tls_errors)
+ self._ignored_tls_errors)
self._peer_certificate_errors -= self._ignored_tls_errors
if Gio.TlsCertificateFlags.UNKNOWN_CA in self._peer_certificate_errors:
for accepted_certificate in self._accepted_certificates:
- if certificate.is_same(accepted_certificate):
+ if self._peer_certificate.is_same(accepted_certificate):
self._peer_certificate_errors.discard(
Gio.TlsCertificateFlags.UNKNOWN_CA)
break
=====================================
nbxmpp/old_dispatcher.py
=====================================
@@ -20,7 +20,6 @@ different handlers to different XMPP stanzas and namespaces
"""
import sys
-import locale
import re
import uuid
import logging
=====================================
nbxmpp/resolver.py
=====================================
@@ -127,6 +127,7 @@ class GioResolver(metaclass=Singleton):
for result in result_list:
if result.startswith('_xmpp-client-websocket'):
return result.split('=')[1]
+ return None
if __name__ == '__main__':
=====================================
nbxmpp/util.py
=====================================
@@ -21,7 +21,6 @@ import weakref
import hashlib
import uuid
import binascii
-import ipaddress
import os
import re
from collections import defaultdict
@@ -29,7 +28,6 @@ from collections import defaultdict
from functools import wraps
from functools import lru_cache
-import precis_i18n.codec
from gi.repository import Gio
from nbxmpp.protocol import DiscoInfoMalformed
@@ -37,7 +35,6 @@ from nbxmpp.protocol import isErrorNode
from nbxmpp.protocol import NS_DATA
from nbxmpp.protocol import NS_HTTPUPLOAD_0
from nbxmpp.const import GIO_TLS_ERRORS
-from nbxmpp.const import StreamState
from nbxmpp.protocol import NS_STREAMS
from nbxmpp.protocol import NS_CLIENT
from nbxmpp.protocol import NS_FRAMING
=====================================
nbxmpp/websocket.py
=====================================
@@ -128,7 +128,7 @@ class WebsocketConnection(Connection):
def _on_websocket_closing(_websocket):
log.info('Closing')
- def _on_websocket_error(self, websocket, error):
+ def _on_websocket_error(self, _websocket, error):
log.error(error)
if self._state not in (TCPState.DISCONNECTED, TCPState.DISCONNECTING):
self._finalize('disconnected')
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/6113c4f50de7509563e57ba…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/6113c4f50de7509563e57ba…
You're receiving this email because of your account on dev.gajim.org.