changeset 2620:72f6f37ab648

core: some more line limiting
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 07:23:13 +0200
parents e7bd2945518f
children 2f75830a8228
files sat/plugins/plugin_merge_req_mercurial.py setup.py
diffstat 2 files changed, 27 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_merge_req_mercurial.py	Tue Jun 26 22:02:59 2018 +0200
+++ b/sat/plugins/plugin_merge_req_mercurial.py	Wed Jun 27 07:23:13 2018 +0200
@@ -71,15 +71,14 @@
             log.debug(_('Mercurial command succeed'))
             self._deferred.callback(data)
         else:
-            msg = _(u"Can't complete Mercurial command (error code: {code}): {message}").format(
-                code = reason.value.exitCode,
-                message = data)
+            msg = (_(u"Can't complete Mercurial command (error code: {code}): {message}")
+                   .format(code = reason.value.exitCode, message = data))
             log.warning(msg)
             self._deferred.errback(Failure(RuntimeError(msg)))
 
     @classmethod
     def run(cls, path, command, *args, **kwargs):
-        """Create a new MercurialRegisterProtocol and execute the given mercurialctl command.
+        """Create a new MercurialRegisterProtocol and execute the given mercurial command.
 
         @param path(unicode): path to the repository
         @param command(unicode): command to run
@@ -113,7 +112,8 @@
         try:
             MercurialProtocol.hg = which('hg')[0]
         except IndexError:
-            raise exceptions.NotFound(_(u"Mercurial executable (hg) not found, can't use Mercurial handler"))
+            raise exceptions.NotFound(_(u"Mercurial executable (hg) not found, "
+                                        u"can't use Mercurial handler"))
         self.host = host
         self._m = host.plugins['MERGE_REQUESTS']
         self._m.register('mercurial', self, self.data_types, SHORT_DESC)
@@ -125,7 +125,8 @@
         return d
 
     def export(self, repository):
-        return MercurialProtocol.run(repository, 'export', '-g', '-r', 'outgoing()', '--encoding=utf-8')
+        return MercurialProtocol.run(repository, 'export', '-g', '-r', 'outgoing()',
+                                     '--encoding=utf-8')
 
     def import_(self, repository, data, data_type, item_id, service, node, extra):
         parsed_data = self.parse(data)
@@ -134,8 +135,10 @@
             parsed_name = re.sub(ur'[^\w -.]', u'', parsed_name, flags=re.UNICODE)[:40]
         except Exception:
             parsed_name = u''
-        name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id, parsed_name=parsed_name)
-        return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name, '--encoding=utf-8', '-', stdin=data)
+        name = u'mr_{item_id}_{parsed_name}'.format(item_id=item_id,
+                                                    parsed_name=parsed_name)
+        return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name,
+                                     '--encoding=utf-8', '-', stdin=data)
 
     def parse(self, data, data_type=None):
         lines = data.splitlines()
@@ -160,15 +163,18 @@
                             if not elems:
                                 continue
                             last = elems[-1]
-                            if last.startswith(u'<') and last.endswith(u'>') and u'@' in last:
+                            if (last.startswith(u'<') and last.endswith(u'>')
+                                and u'@' in last):
                                 patch[self._m.META_EMAIL] = elems.pop()[1:-1]
                             patch[self._m.META_AUTHOR] = u' '.join(elems)
                         elif line.startswith(u'# Date '):
                             time_data = line[7:].split()
                             if len(time_data) != 2:
-                                log.warning(_(u'unexpected time data: {data}').format(data=line[7:]))
+                                log.warning(_(u'unexpected time data: {data}')
+                                            .format(data=line[7:]))
                                 continue
-                            patch[self._m.META_TIMESTAMP] = int(time_data[0]) + int(time_data[1])
+                            patch[self._m.META_TIMESTAMP] = (int(time_data[0])
+                                                             + int(time_data[1]))
                         elif line.startswith(u'# Node ID '):
                             patch[self._m.META_HASH] = line[10:]
                         elif line.startswith(u'# Parent  '):
--- a/setup.py	Tue Jun 26 22:02:59 2018 +0200
+++ b/setup.py	Wed Jun 27 07:23:13 2018 +0200
@@ -77,19 +77,25 @@
 setup(name=NAME,
       version=VERSION,
       description=u'Salut à Toi multipurpose and multi frontend XMPP client',
-      long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend architecture. Its multi frontend (desktop, web, console interface, CLI, etc) and multipurpose (instant messaging, microblogging, games, file sharing, etc).',
+      long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend '
+                       u'architecture. Its multi frontend (desktop, web, console '
+                       u'interface, CLI, etc) and multipurpose (instant messaging, '
+                       u'microblogging, games, file sharing, etc).',
       author='Association « Salut à Toi »',
       author_email='contact@goffi.org',
       url='https://salut-a-toi.org',
       classifiers=['Development Status :: 3 - Alpha',
                    'Environment :: Console',
                    'Framework :: Twisted',
-                   'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
+                   'License :: OSI Approved :: GNU Affero General Public License v3 '
+                   'or later (AGPLv3+)',
                    'Operating System :: POSIX :: Linux',
                    'Topic :: Communications :: Chat'],
       packages=find_packages() + ['twisted.plugins'],
-      data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
-                  (os.path.join('share/doc', NAME), ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
+      data_files=[(os.path.join(sys.prefix, 'share/locale/fr/LC_MESSAGES'),
+                   ['i18n/fr/LC_MESSAGES/sat.mo']),
+                  (os.path.join('share/doc', NAME),
+                   ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
                   (os.path.join('share', DBUS_DIR), [DBUS_FILE]),
                   ],
       scripts=['sat_frontends/jp/jp', 'sat_frontends/primitivus/primitivus', 'bin/sat'],