Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/nbxmpp
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2020-04-19 10:14:33 +0300
committerlovetox <philipp@hoerist.com>2020-04-19 10:14:33 +0300
commitc82a4634f45a34d3dcd65a883c17e2a68e185a43 (patch)
tree3cbfaaf984d9865836b0742211d1891e51261b5f /nbxmpp
parent2609572a74a30e329c04b8fa8c1a96877047ca6f (diff)
Fix pylint errors
- line-too-long
Diffstat (limited to 'nbxmpp')
-rw-r--r--nbxmpp/client.py9
-rw-r--r--nbxmpp/dispatcher.py15
-rw-r--r--nbxmpp/idlequeue.py21
-rw-r--r--nbxmpp/modules/dataforms.py4
-rw-r--r--nbxmpp/modules/http_upload.py6
-rw-r--r--nbxmpp/modules/ibb.py4
-rw-r--r--nbxmpp/modules/muclumbus.py3
-rw-r--r--nbxmpp/modules/omemo.py9
-rw-r--r--nbxmpp/plugin.py4
-rw-r--r--nbxmpp/smacks.py15
-rw-r--r--nbxmpp/third_party/hsluv.py6
11 files changed, 59 insertions, 37 deletions
diff --git a/nbxmpp/client.py b/nbxmpp/client.py
index 2c7eb72..6b355f2 100644
--- a/nbxmpp/client.py
+++ b/nbxmpp/client.py
@@ -430,7 +430,8 @@ class Client(Observable):
else:
self._set_error(StreamError.CONNECTION_FAILED,
'connection-failed',
- 'Unable to connect to last successful address: %s' % str(self._current_address))
+ (f'Unable to connect to last '
+ 'successful address: {self._current_address}'))
self.notify('connection-failed')
def _disconnect_with_error(self, error_domain, error, text=None):
@@ -475,11 +476,13 @@ class Client(Observable):
return self._dispatcher.get_module(name)
def _on_bad_certificate(self, connection, _signal_name):
- self._peer_certificate, self._peer_certificate_errors = connection.peer_certificate
+ self._peer_certificate, self._peer_certificate_errors = \
+ connection.peer_certificate
self._set_error(StreamError.BAD_CERTIFICATE, 'bad certificate')
def _on_certificate_set(self, connection, _signal_name):
- self._peer_certificate, self._peer_certificate_errors = connection.peer_certificate
+ self._peer_certificate, self._peer_certificate_errors = \
+ connection.peer_certificate
def accept_certificate(self):
self._log.info('Certificate accepted')
diff --git a/nbxmpp/dispatcher.py b/nbxmpp/dispatcher.py
index 3852045..a44a395 100644
--- a/nbxmpp/dispatcher.py
+++ b/nbxmpp/dispatcher.py
@@ -274,8 +274,9 @@ class StanzaDispatcher(Observable):
if not typ and not ns:
typ = 'default'
- self._log.debug('Register handler %s for "%s" type->%s ns->%s(%s) priority->%s',
- handler, name, typ, ns, xmlns, priority)
+ self._log.debug(
+ 'Register handler %s for "%s" type->%s ns->%s(%s) priority->%s',
+ handler, name, typ, ns, xmlns, priority)
if xmlns not in self._handlers:
self._register_namespace(xmlns)
@@ -315,11 +316,13 @@ class StanzaDispatcher(Observable):
try:
self._handlers[xmlns][name][specific].remove(handler_dict)
except ValueError:
- self._log.warning('Unregister failed: %s for "%s" type->%s ns->%s(%s)',
- handler, name, typ, ns, xmlns)
+ self._log.warning(
+ 'Unregister failed: %s for "%s" type->%s ns->%s(%s)',
+ handler, name, typ, ns, xmlns)
else:
- self._log.debug('Unregister handler %s for "%s" type->%s ns->%s(%s)',
- handler, name, typ, ns, xmlns)
+ self._log.debug(
+ 'Unregister handler %s for "%s" type->%s ns->%s(%s)',
+ handler, name, typ, ns, xmlns)
def _default_handler(self, stanza):
"""
diff --git a/nbxmpp/idlequeue.py b/nbxmpp/idlequeue.py
index e11b38f..a923708 100644
--- a/nbxmpp/idlequeue.py
+++ b/nbxmpp/idlequeue.py
@@ -46,7 +46,7 @@ if HAVE_GLIB:
GLib.IOCondition.PRI | GLib.IOCondition.HUP
FLAG_CLOSE = GLib.IOCondition.HUP
PENDING_READ = GLib.IOCondition.IN # There is data to read.
- PENDING_WRITE = GLib.IOCondition.OUT # Data CAN be written without blocking.
+ PENDING_WRITE = GLib.IOCondition.OUT # Data CAN be written without blocking
IS_CLOSED = GLib.IOCondition.HUP # Hung up (connection broken)
else:
FLAG_WRITE = 20 # write only 10100
@@ -222,7 +222,8 @@ class IdleQueue:
"""
# (timeout, boolean)
- # Boolean is True if timeout is specified in seconds, False means miliseconds
+ # Boolean is True if timeout is specified in seconds,
+ # False means miliseconds
PROCESS_TIMEOUT = (100, False)
def __init__(self):
@@ -438,8 +439,9 @@ class SelectIdleQueue(IdleQueue):
def checkQueue(self):
"""
- Iterates through all known file descriptors and uses os.stat to check if they're valid.
- Greatly improves performance if the caller hands us and expects notification on an invalid file handle.
+ Iterates through all known file descriptors and uses os.stat to
+ check if they're valid. Greatly improves performance if the caller
+ hands us and expects notification on an invalid file handle.
"""
bad_fds=[]
union={}
@@ -480,8 +482,8 @@ class SelectIdleQueue(IdleQueue):
def _remove_idle(self, fd):
"""
- This method is called when we unplug a new idle object. Remove descriptor
- from read/write/error lists
+ This method is called when we unplug a new idle object.
+ Remove descriptor from read/write/error lists
"""
if fd in self.read_fds:
del(self.read_fds[fd])
@@ -525,7 +527,8 @@ class GlibIdleQueue(IdleQueue):
"""
# (timeout, boolean)
- # Boolean is True if timeout is specified in seconds, False means miliseconds
+ # Boolean is True if timeout is specified in seconds,
+ # False means miliseconds
PROCESS_TIMEOUT = (2, True)
def _init_idle(self):
@@ -536,8 +539,8 @@ class GlibIdleQueue(IdleQueue):
def _add_idle(self, fd, flags):
"""
- This method is called when we plug a new idle object. Start listening for
- events from fd
+ This method is called when we plug a new idle object.
+ Start listening for events from fd
"""
res = GLib.io_add_watch(fd, GLib.PRIORITY_LOW, flags,
self._process_events)
diff --git a/nbxmpp/modules/dataforms.py b/nbxmpp/modules/dataforms.py
index e29ac79..f0fb408 100644
--- a/nbxmpp/modules/dataforms.py
+++ b/nbxmpp/modules/dataforms.py
@@ -108,8 +108,8 @@ def extend_form(node):
class DataField(ExtendedNode):
"""
Keeps data about one field - var, field type, labels, instructions... Base
- class for different kinds of fields. Use create_field() function to construct one
- of these
+ class for different kinds of fields. Use create_field() function to
+ construct one of these
"""
def __init__(self, typ=None, var=None, value=None, label=None, desc=None,
diff --git a/nbxmpp/modules/http_upload.py b/nbxmpp/modules/http_upload.py
index 12251a7..93ef094 100644
--- a/nbxmpp/modules/http_upload.py
+++ b/nbxmpp/modules/http_upload.py
@@ -70,11 +70,13 @@ class HTTPUpload(BaseModule):
for header in slot.getTag('put').getTags('header'):
name = header.getAttr('name')
if name not in ALLOWED_HEADERS:
- return raise_error(self._log.warning, stanza, 'stanza-malformed',
+ return raise_error(self._log.warning, stanza,
+ 'stanza-malformed',
'Not allowed header found: %s' % name)
data = header.getData()
if '\n' in data:
- return raise_error(self._log.warning, stanza, 'stanza-malformed',
+ return raise_error(self._log.warning, stanza,
+ 'stanza-malformed',
'NNewline in header data found')
headers[name] = data
diff --git a/nbxmpp/modules/ibb.py b/nbxmpp/modules/ibb.py
index 000c07a..2773965 100644
--- a/nbxmpp/modules/ibb.py
+++ b/nbxmpp/modules/ibb.py
@@ -149,7 +149,9 @@ class IBB(BaseModule):
@call_on_response('_default_response')
def send_data(self, jid, sid, seq, data):
iq = Iq('set', to=jid)
- ibb_data = iq.addChild('data', {'sid': sid, 'seq': seq}, namespace=NS_IBB)
+ ibb_data = iq.addChild('data',
+ {'sid': sid, 'seq': seq},
+ namespace=NS_IBB)
ibb_data.setData(b64encode(data))
return iq
diff --git a/nbxmpp/modules/muclumbus.py b/nbxmpp/modules/muclumbus.py
index feb3af2..039f974 100644
--- a/nbxmpp/modules/muclumbus.py
+++ b/nbxmpp/modules/muclumbus.py
@@ -142,7 +142,8 @@ class Muclumbus(BaseModule):
is_open = item.getTag('is-open') is not None
try:
- anonymity_mode = AnonymityMode(item.getTagData('anonymity-mode'))
+ anonymity_mode = AnonymityMode(
+ item.getTagData('anonymity-mode'))
except ValueError:
anonymity_mode = AnonymityMode.UNKNOWN
results.append(MuclumbusItem(jid=jid,
diff --git a/nbxmpp/modules/omemo.py b/nbxmpp/modules/omemo.py
index 29a122d..97c244a 100644
--- a/nbxmpp/modules/omemo.py
+++ b/nbxmpp/modules/omemo.py
@@ -336,7 +336,8 @@ class OMEMO(BaseModule):
result = {}
signed_prekey_node = bundle.getTag('signedPreKeyPublic')
try:
- result['spk'] = {'key': b64decode(signed_prekey_node.getData(), bytes)}
+ result['spk'] = {'key': b64decode(signed_prekey_node.getData(),
+ bytes)}
except Exception as error:
raise StanzaMalformed('Failed to decode '
'signedPreKeyPublic: %s' % error)
@@ -349,7 +350,8 @@ class OMEMO(BaseModule):
signed_signature_node = bundle.getTag('signedPreKeySignature')
try:
- result['spk_signature'] = b64decode(signed_signature_node.getData(), bytes)
+ result['spk_signature'] = b64decode(signed_signature_node.getData(),
+ bytes)
except Exception as error:
raise StanzaMalformed('Failed to decode '
'signedPreKeySignature: %s' % error)
@@ -375,7 +377,8 @@ class OMEMO(BaseModule):
try:
key = b64decode(prekey.getData(), bytes)
except Exception as error:
- raise StanzaMalformed('Failed to decode preKeyPublic: %s' % error)
+ raise StanzaMalformed(
+ 'Failed to decode preKeyPublic: %s' % error)
result['otpks'].append({'key': key, 'id': id_})
diff --git a/nbxmpp/plugin.py b/nbxmpp/plugin.py
index 54a8593..8868e47 100644
--- a/nbxmpp/plugin.py
+++ b/nbxmpp/plugin.py
@@ -66,8 +66,8 @@ class PlugIn:
def PlugOut(self, *args, **kwargs):
"""
Unregister our _exported_methods from owner and detach from it.
- If defined by a subclass, call self.plugout() after unplugging to execute
- hook code
+ If defined by a subclass, call self.plugout() after unplugging to
+ execute hook code
"""
log.info('Plugging %s __OUT__ of %s.', self, self._owner)
for method in self._exported_methods:
diff --git a/nbxmpp/smacks.py b/nbxmpp/smacks.py
index ab80b6c..563b993 100644
--- a/nbxmpp/smacks.py
+++ b/nbxmpp/smacks.py
@@ -109,8 +109,9 @@ class Smacks:
self._location = stanza.getAttr('location')
self.enabled = True
- self._log.info('Received enabled, location: %s, resume supported: %s, '
- 'session-id: %s', self._location, resume, self._session_id)
+ self._log.info(
+ 'Received enabled, location: %s, resume supported: %s, '
+ 'session-id: %s', self._location, resume, self._session_id)
def count_incoming(self, name):
if not self.enabled:
@@ -248,15 +249,17 @@ class Smacks:
diff = self._out_h - count_server
queue_size = len(queue)
if diff < 0:
- self._log.error('Mismatch detected, our h: %d, server h: %d, queue: %d',
- self._out_h, count_server, queue_size)
+ self._log.error(
+ 'Mismatch detected, our h: %d, server h: %d, queue: %d',
+ self._out_h, count_server, queue_size)
# Don't accumulate all messages in this case
# (they would otherwise all be resent on the next reconnect)
queue = []
elif queue_size < diff:
- self._log.error('Mismatch detected, our h: %d, server h: %d, queue: %d',
- self._out_h, count_server, queue_size)
+ self._log.error(
+ 'Mismatch detected, our h: %d, server h: %d, queue: %d',
+ self._out_h, count_server, queue_size)
else:
self._log.debug('Validate ack, our h: %d, server h: %d, queue: %d',
self._out_h, count_server, queue_size)
diff --git a/nbxmpp/third_party/hsluv.py b/nbxmpp/third_party/hsluv.py
index 7bed22b..efcb1b6 100644
--- a/nbxmpp/third_party/hsluv.py
+++ b/nbxmpp/third_party/hsluv.py
@@ -42,7 +42,8 @@ def _distance_line_from_origin(line):
def _length_of_ray_until_intersect(theta, line):
- return line['intercept'] / (math.sin(theta) - line['slope'] * math.cos(theta))
+ return line['intercept'] / (math.sin(theta) -
+ line['slope'] * math.cos(theta))
def _get_bounds(l):
@@ -64,7 +65,8 @@ def _get_bounds(l):
t = _g1
_g1 = _g1 + 1
top1 = (284517 * m1 - 94839 * m3) * sub2
- top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * l * sub2 - (769860 * t) * l
+ top2 = ((838422 * m3 + 769860 * m2 + 731718 * m1) *
+ l * sub2 - (769860 * t) * l)
bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t
result.append({'slope': top1 / bottom, 'intercept': top2 / bottom})
return result