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
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2020-03-11 00:27:00 +0300
committerlovetox <philipp@hoerist.com>2020-03-11 00:28:02 +0300
commit656aa457c04aafc54dae3d2232960907d328d384 (patch)
treeaf25a122cf01551f07308c6f42b42de6c483a175 /nbxmpp/modules
parent9cd576ebf095652ee8d8f6058fb6fab3836d9a2f (diff)
Fix pylint errors
- inconsistent-return-statements
Diffstat (limited to 'nbxmpp/modules')
-rw-r--r--nbxmpp/modules/activity.py1
-rw-r--r--nbxmpp/modules/bookmarks.py8
-rw-r--r--nbxmpp/modules/dataforms.py1
-rw-r--r--nbxmpp/modules/date_and_time.py8
-rw-r--r--nbxmpp/modules/location.py2
-rw-r--r--nbxmpp/modules/muc.py42
-rw-r--r--nbxmpp/modules/nickname.py2
-rw-r--r--nbxmpp/modules/pubsub.py3
-rw-r--r--nbxmpp/modules/tune.py2
9 files changed, 38 insertions, 31 deletions
diff --git a/nbxmpp/modules/activity.py b/nbxmpp/modules/activity.py
index 9e1f0b3..09e5026 100644
--- a/nbxmpp/modules/activity.py
+++ b/nbxmpp/modules/activity.py
@@ -81,6 +81,7 @@ class Activity:
for sub in activity.getChildren():
if sub.getName() in sub_activities:
return sub.getName()
+ return None
def set_activity(self, data):
item = Node('activity', {'xmlns': NS_ACTIVITY})
diff --git a/nbxmpp/modules/bookmarks.py b/nbxmpp/modules/bookmarks.py
index 5b6d8c3..0642566 100644
--- a/nbxmpp/modules/bookmarks.py
+++ b/nbxmpp/modules/bookmarks.py
@@ -168,20 +168,20 @@ class Bookmarks:
jid = item.getAttr('id')
if jid is None:
log.warning('No id attr found')
- return
+ return None
try:
jid = JID(jid)
except Exception as error:
log.warning('Invalid JID: %s', error)
log.warning(item)
- return
+ return None
conference = item.getTag('conference', namespace=NS_BOOKMARKS_2)
if conference is None:
log.warning('No conference node found')
log.warning(item)
- return
+ return None
autojoin = conference.getAttr('autojoin') in ('True', 'true', '1')
name = conference.getAttr('name')
@@ -215,6 +215,7 @@ class Bookmarks:
if type_ == BookmarkStoreType.PRIVATE:
log.info('Request bookmarks (Private Storage)')
return self.get_private_request(), {'type_': type_}
+ return None
@callback
def _bookmarks_received(self, stanza, type_):
@@ -418,3 +419,4 @@ class Bookmarks:
def _on_private_store_result(_client, stanza):
if not isResultNode(stanza):
return raise_error(log.info, stanza)
+ return None
diff --git a/nbxmpp/modules/dataforms.py b/nbxmpp/modules/dataforms.py
index 2e5cbcf..1f4f54d 100644
--- a/nbxmpp/modules/dataforms.py
+++ b/nbxmpp/modules/dataforms.py
@@ -227,6 +227,7 @@ class DataField(ExtendedNode):
media = self.getTag('media', namespace=NS_DATA_MEDIA)
if media:
return Media(media)
+ return None
@media.setter
def media(self, value):
diff --git a/nbxmpp/modules/date_and_time.py b/nbxmpp/modules/date_and_time.py
index 0f49ae6..ed10a79 100644
--- a/nbxmpp/modules/date_and_time.py
+++ b/nbxmpp/modules/date_and_time.py
@@ -108,19 +108,19 @@ def create_tzinfo(hours=0, minutes=0, tz_string=None):
hours, minutes = map(int, tz_string.split(':'))
except Exception:
log.warning('Wrong tz string: %s', tz_string)
- return
+ return None
if hours not in range(-24, 24):
log.warning('Wrong tz string: %s', tz_string)
- return
+ return None
if minutes not in range(0, 59):
log.warning('Wrong tz string: %s', tz_string)
- return
+ return None
if hours in (24, -24) and minutes != 0:
log.warning('Wrong tz string: %s', tz_string)
- return
+ return None
return timezone(timedelta(hours=hours, minutes=minutes))
diff --git a/nbxmpp/modules/location.py b/nbxmpp/modules/location.py
index 88ac35d..872014c 100644
--- a/nbxmpp/modules/location.py
+++ b/nbxmpp/modules/location.py
@@ -66,7 +66,7 @@ class Location:
def set_location(self, data):
item = Node('geoloc', {'xmlns': NS_LOCATION})
if data is None:
- return item
+ return
data = data._asdict()
for tag, value in data:
diff --git a/nbxmpp/modules/muc.py b/nbxmpp/modules/muc.py
index 28c96e1..0792dd4 100644
--- a/nbxmpp/modules/muc.py
+++ b/nbxmpp/modules/muc.py
@@ -531,23 +531,25 @@ class MUC:
@staticmethod
def _parse_muc_user(muc_user):
item = muc_user.getTag('item')
- if item is not None:
- item_dict = item.getAttrs(copy=True)
- if 'role' in item_dict:
- item_dict['role'] = Role(item_dict['role'])
- else:
- item_dict['role'] = None
-
- if 'affiliation' in item_dict:
- item_dict['affiliation'] = Affiliation(item_dict['affiliation'])
- else:
- item_dict['affiliation'] = None
-
- if 'jid' in item_dict:
- item_dict['jid'] = JID(item_dict['jid'])
- else:
- item_dict['jid'] = None
-
- item_dict['actor'] = item.getTagAttr('actor', 'nick')
- item_dict['reason'] = item.getTagData('reason')
- return MucUserData(**item_dict)
+ if item is None:
+ return None
+
+ item_dict = item.getAttrs(copy=True)
+ if 'role' in item_dict:
+ item_dict['role'] = Role(item_dict['role'])
+ else:
+ item_dict['role'] = None
+
+ if 'affiliation' in item_dict:
+ item_dict['affiliation'] = Affiliation(item_dict['affiliation'])
+ else:
+ item_dict['affiliation'] = None
+
+ if 'jid' in item_dict:
+ item_dict['jid'] = JID(item_dict['jid'])
+ else:
+ item_dict['jid'] = None
+
+ item_dict['actor'] = item.getTagAttr('actor', 'nick')
+ item_dict['reason'] = item.getTagData('reason')
+ return MucUserData(**item_dict)
diff --git a/nbxmpp/modules/nickname.py b/nbxmpp/modules/nickname.py
index 1da02cb..c9be9bc 100644
--- a/nbxmpp/modules/nickname.py
+++ b/nbxmpp/modules/nickname.py
@@ -81,7 +81,7 @@ class Nickname:
def _parse_nickname(stanza):
nickname = stanza.getTag('nick', namespace=NS_NICK)
if nickname is None:
- return
+ return None
return nickname.getData() or None
def set_nickname(self, nickname):
diff --git a/nbxmpp/modules/pubsub.py b/nbxmpp/modules/pubsub.py
index 3967568..52754f1 100644
--- a/nbxmpp/modules/pubsub.py
+++ b/nbxmpp/modules/pubsub.py
@@ -214,10 +214,11 @@ def get_pubsub_items(stanza, node=None):
pubsub_node = stanza.getTag('pubsub')
items_node = pubsub_node.getTag('items')
if node is not None and items_node.getAttr('node') != node:
- return
+ return None
if items_node is not None:
return items_node.getTags('item')
+ return None
def get_publish_options(config):
diff --git a/nbxmpp/modules/tune.py b/nbxmpp/modules/tune.py
index 15bc610..c8fde03 100644
--- a/nbxmpp/modules/tune.py
+++ b/nbxmpp/modules/tune.py
@@ -67,7 +67,7 @@ class Tune:
def set_tune(self, data):
item = Node('tune', {'xmlns': NS_TUNE})
if data is None:
- return item
+ return
data = data._asdict()
for tag, value in data.items():