misc: remove some pylints warnings

This commit is contained in:
souliane 2014-06-15 18:18:36 +02:00
commit ba3deb4c3e
3 changed files with 5 additions and 7 deletions

View file

@ -21,7 +21,6 @@ from sat.core.i18n import _, D_
from sat.core.log import getLogger from sat.core.log import getLogger
log = getLogger(__name__) log = getLogger(__name__)
from wokkel import disco, pubsub
from twisted.internet import defer from twisted.internet import defer
from twisted.internet.threads import deferToThread from twisted.internet.threads import deferToThread
from sat.core import exceptions from sat.core import exceptions

View file

@ -126,14 +126,14 @@ class XEP_0054(object):
if name == "avatar": if name == "avatar":
self.avatars_cache[jid.userhost()] = value self.avatars_cache[jid.userhost()] = value
def get_cache(self, jid, name, profile): def get_cache(self, entity_jid, name, profile):
"""return cached value for jid """return cached value for jid
@param jid: target contact @param entity_jid: target contact
@param name: name of the value ('nick' or 'avatar') @param name: name of the value ('nick' or 'avatar')
@param profile: %(doc_profile)s @param profile: %(doc_profile)s
@return: wanted value or None""" @return: wanted value or None"""
try: try:
data = self.host.memory.getEntityData(jid, [name], profile) data = self.host.memory.getEntityData(entity_jid, [name], profile)
except exceptions.UnknownEntityError: except exceptions.UnknownEntityError:
return None return None
return data.get(name) return data.get(name)
@ -149,8 +149,8 @@ class XEP_0054(object):
image_hash = sha1(decoded).hexdigest() image_hash = sha1(decoded).hexdigest()
filename = self.avatar_path + '/' + image_hash filename = self.avatar_path + '/' + image_hash
if not os.path.exists(filename): if not os.path.exists(filename):
with open(filename, 'wb') as file: with open(filename, 'wb') as file_:
file.write(decoded) file_.write(decoded)
log.debug(_("file saved to %s") % image_hash) log.debug(_("file saved to %s") % image_hash)
else: else:
log.debug(_("file [%s] already in cache") % image_hash) log.debug(_("file [%s] already in cache") % image_hash)

View file

@ -23,7 +23,6 @@ from sat.test import helpers
from sat.plugins import plugin_xep_0277 from sat.plugins import plugin_xep_0277
from sat.plugins import plugin_misc_text_syntaxes from sat.plugins import plugin_misc_text_syntaxes
from sat.tools.xml_tools import ElementParser from sat.tools.xml_tools import ElementParser
import re
class XEP_0277Test(helpers.SatTestCase): class XEP_0277Test(helpers.SatTestCase):