diff -Nru logilab-common-1.8.1/debian/changelog logilab-common-1.8.2/debian/changelog --- logilab-common-1.8.1/debian/changelog 2021-01-10 06:19:35.000000000 +0000 +++ logilab-common-1.8.2/debian/changelog 2021-12-05 06:20:54.000000000 +0000 @@ -1,3 +1,11 @@ +logilab-common (1.8.2-1) unstable; urgency=medium + + * New upstream release + * debian/control + - bump Standards-Version to 4.6.0.1 (no changes needed) + + -- Sandro Tosi Sun, 05 Dec 2021 01:20:54 -0500 + logilab-common (1.8.1-1) unstable; urgency=medium * New upstream release diff -Nru logilab-common-1.8.1/debian/control logilab-common-1.8.2/debian/control --- logilab-common-1.8.1/debian/control 2021-01-10 06:19:35.000000000 +0000 +++ logilab-common-1.8.2/debian/control 2021-12-05 06:20:54.000000000 +0000 @@ -13,7 +13,7 @@ python3-typing-extensions , python3-tz , XS-Python-Version: all -Standards-Version: 4.5.1 +Standards-Version: 4.6.0.1 Homepage: https://www.logilab.org/project/logilab-common Vcs-Git: https://salsa.debian.org/python-team/packages/logilab-common.git Vcs-Browser: https://salsa.debian.org/python-team/packages/logilab-common diff -Nru logilab-common-1.8.1/logilab/common/changelog.py logilab-common-1.8.2/logilab/common/changelog.py --- logilab-common-1.8.1/logilab/common/changelog.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/changelog.py 2021-11-23 14:37:54.000000000 +0000 @@ -134,7 +134,7 @@ raise NotImplementedError("sub message to specific key " "are not implemented yet") def write(self, stream: StringIO = sys.stdout) -> None: - """write the entry to file """ + """write the entry to file""" stream.write("%s -- %s\n" % (self.date or "", self.version or "")) for msg, sub_msgs in self.messages: stream.write("%s%s %s\n" % (INDENT, BULLET, msg[0])) @@ -193,7 +193,7 @@ entry.add_message(msg) def load(self) -> None: - """ read a logilab's ChangeLog from file """ + """read a logilab's ChangeLog from file""" try: stream = codecs.open(self.file, encoding="utf-8") except IOError: diff -Nru logilab-common-1.8.1/logilab/common/clcommands.py logilab-common-1.8.2/logilab/common/clcommands.py --- logilab-common-1.8.1/logilab/common/clcommands.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/clcommands.py 2021-11-23 14:37:54.000000000 +0000 @@ -22,7 +22,6 @@ command'specific """ -from __future__ import print_function __docformat__ = "restructuredtext en" @@ -32,7 +31,7 @@ from logilab.common.configuration import Configuration from logilab.common.logging_ext import init_log, get_threshold -from logilab.common.deprecation import deprecated +from logilab.common.deprecation import callable_deprecated class BadCommandUsage(Exception): @@ -330,14 +329,14 @@ http://www.logilab.fr/ -- mailto:contact@logilab.fr""" -@deprecated("use cls.register(cli)") +@callable_deprecated("use cls.register(cli)") def register_commands(commands): """register existing commands""" for command_klass in commands: _COMMANDS.register(command_klass) -@deprecated("use args.pop(0)") +@callable_deprecated("use args.pop(0)") def main_run(args, doc=None, copyright=None, version=None): """command line tool: run command specified by argument list (without the program name). Raise SystemExit with status 0 if everything went fine. @@ -350,7 +349,7 @@ _COMMANDS.run(args) -@deprecated("use args.pop(0)") +@callable_deprecated("use args.pop(0)") def pop_arg(args_list, expected_size_after=None, msg="Missing argument"): """helper function to get and check command line arguments""" try: diff -Nru logilab-common-1.8.1/logilab/common/compat.py logilab-common-1.8.2/logilab/common/compat.py --- logilab-common-1.8.1/logilab/common/compat.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/compat.py 2021-11-23 14:37:54.000000000 +0000 @@ -68,7 +68,7 @@ reload = reload # noqa else: from io import StringIO, FileIO # noqa - from imp import reload # noqa + from importlib import reload # noqa from logilab.common.deprecation import callable_deprecated # noqa diff -Nru logilab-common-1.8.1/logilab/common/configuration.py logilab-common-1.8.2/logilab/common/configuration.py --- logilab-common-1.8.1/logilab/common/configuration.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/configuration.py 2021-11-23 14:37:54.000000000 +0000 @@ -107,7 +107,6 @@ """ -from __future__ import print_function __docformat__ = "restructuredtext en" @@ -122,6 +121,7 @@ import os import sys import re +from difflib import get_close_matches from os.path import exists, expanduser from optparse import OptionGroup from copy import copy @@ -255,7 +255,8 @@ opttype: str, optdict: Dict[str, Any], option: str, value: Union[List[str], int, str] ) -> Union[List[str], int, str]: if opttype not in VALIDATORS: - raise Exception('Unsupported type "%s"' % opttype) + all_validators = "\n - ".join(sorted(VALIDATORS.keys())) + raise Exception(f'Unsupported type "{opttype}", supported types are:\n - {all_validators}') try: return VALIDATORS[opttype](optdict, option, value) except TypeError: @@ -819,7 +820,7 @@ # help methods ############################################################ def add_help_section(self, title: str, description: str, level: int = 0) -> None: - """add a dummy option section for help purpose """ + """add a dummy option section for help purpose""" group = optik_ext.OptionGroup( self.cmdline_parser, title=title.capitalize(), description=description ) @@ -850,7 +851,7 @@ optik_ext.HelpFormatter.expand_default = self.__expand_default_backup # type: ignore def help(self, level: int = 0) -> str: - """return the usage string for available options """ + """return the usage string for available options""" # mypy: "HelpFormatter" has no attribute "output_level" # set in optik_ext self.cmdline_parser.formatter.output_level = level # type: ignore @@ -1007,7 +1008,20 @@ return option[1] # mypy: Argument 2 to "OptionError" has incompatible type "str"; expected "Option" # seems to be working? - raise OptionError("no such option %s in section %r" % (opt, self.name), opt) # type: ignore + similar_options = get_close_matches(opt, (str(x[0]) for x in self.options), n=10) + if similar_options: + raise OptionError( + "no such option %s in section %r.\n\nOptions with a similar name are:\n * %s" + % (opt, self.name, "\n * ".join(similar_options)), + opt, + ) # type: ignore + else: + raise OptionError( + "no such option %s in section %r.\n\nNo option with a similar name, " + "all available options:\n * %s" + % (opt, self.name, "\n * ".join(str(x[0]) for x in self.options)), + opt, + ) # type: ignore def all_options(self): """return an iterator on available options for this provider diff -Nru logilab-common-1.8.1/logilab/common/date.py logilab-common-1.8.2/logilab/common/date.py --- logilab-common-1.8.1/logilab/common/date.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/date.py 2021-11-23 14:37:54.000000000 +0000 @@ -16,7 +16,6 @@ # You should have received a copy of the GNU Lesser General Public License along # with logilab-common. If not, see . """Date manipulation helper functions.""" -from __future__ import division __docformat__ = "restructuredtext en" diff -Nru logilab-common-1.8.1/logilab/common/debugger.py logilab-common-1.8.2/logilab/common/debugger.py --- logilab-common-1.8.1/logilab/common/debugger.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/debugger.py 2021-11-23 14:37:54.000000000 +0000 @@ -27,7 +27,6 @@ """ -from __future__ import print_function __docformat__ = "restructuredtext en" @@ -70,9 +69,9 @@ for index, line in enumerate(output.getvalue().splitlines()): lineno = index + start_lineno if lineno == curlineno: - annotated.append("%4s\t->\t%s" % (lineno, line)) + annotated.append(f"{lineno:>4}\t->\t{line}") else: - annotated.append("%4s\t\t%s" % (lineno, line)) + annotated.append(f"{lineno:>4}\t\t{line}") return "\n".join(annotated) def colorize_source(source): @@ -119,7 +118,7 @@ # XXX try..except shouldn't be necessary # read_history_file() can accept None readline.read_history_file(self._histfile) - except IOError: + except OSError: pass def start(self): @@ -173,7 +172,7 @@ n = len(attr) for word in words: if word[:n] == attr and word != "__builtins__": - matches.append("%s.%s" % (expr, word)) + matches.append(f"{expr}.{word}") return matches def get_class_members(self, klass): @@ -196,7 +195,7 @@ print(colorize("".join(source), start_lineno, self.curframe.f_lineno)) except KeyboardInterrupt: pass - except IOError: + except OSError: Pdb.do_list(self, arg) else: Pdb.do_list(self, arg) @@ -207,7 +206,7 @@ """opens source file corresponding to the current stack level""" filename = self.curframe.f_code.co_filename lineno = self.curframe.f_lineno - cmd = "emacsclient --no-wait +%s %s" % (lineno, filename) + cmd = f"emacsclient --no-wait +{lineno} {filename}" os.system(cmd) do_o = do_open diff -Nru logilab-common-1.8.1/logilab/common/decorators.py logilab-common-1.8.2/logilab/common/decorators.py --- logilab-common-1.8.1/logilab/common/decorators.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/decorators.py 2021-11-23 14:37:54.000000000 +0000 @@ -17,7 +17,6 @@ # with logilab-common. If not, see . """ A few useful function/method decorators. """ -from __future__ import print_function __docformat__ = "restructuredtext en" diff -Nru logilab-common-1.8.1/logilab/common/fileutils.py logilab-common-1.8.2/logilab/common/fileutils.py --- logilab-common-1.8.1/logilab/common/fileutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/fileutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -24,7 +24,6 @@ :sort: path manipulation, file manipulation """ -from __future__ import print_function __docformat__ = "restructuredtext en" diff -Nru logilab-common-1.8.1/logilab/common/graph.py logilab-common-1.8.2/logilab/common/graph.py --- logilab-common-1.8.1/logilab/common/graph.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/graph.py 2021-11-23 14:37:54.000000000 +0000 @@ -152,7 +152,7 @@ ) except OSError as e: if e.errno == errno.ENOENT: - e.strerror = "File not found: {0}".format(self.renderer) + e.strerror = "File not found: {}".format(self.renderer) raise os.unlink(dot_sourcepath) return outputfile diff -Nru logilab-common-1.8.1/logilab/common/logging_ext.py logilab-common-1.8.2/logilab/common/logging_ext.py --- logilab-common-1.8.1/logilab/common/logging_ext.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/logging_ext.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # @@ -127,7 +126,7 @@ from logging.handlers import TimedRotatingFileHandler handler = TimedRotatingFileHandler(logfile, **rotation_parameters) - except IOError: + except OSError: handler = logging.StreamHandler() return handler diff -Nru logilab-common-1.8.1/logilab/common/modutils.py logilab-common-1.8.2/logilab/common/modutils.py --- logilab-common-1.8.1/logilab/common/modutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/modutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # diff -Nru logilab-common-1.8.1/logilab/common/optik_ext.py logilab-common-1.8.2/logilab/common/optik_ext.py --- logilab-common-1.8.1/logilab/common/optik_ext.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/optik_ext.py 2021-11-23 14:37:54.000000000 +0000 @@ -46,7 +46,6 @@ argument of this type will be converted to a float value in bytes according to byte units (b, kb, mb, gb, tb) """ -from __future__ import print_function __docformat__ = "restructuredtext en" diff -Nru logilab-common-1.8.1/logilab/common/optparser.py logilab-common-1.8.2/logilab/common/optparser.py --- logilab-common-1.8.1/logilab/common/optparser.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/optparser.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # @@ -29,7 +28,6 @@ With mymod.build that defines two functions run and add_options """ -from __future__ import print_function __docformat__ = "restructuredtext en" @@ -64,7 +62,7 @@ optparse.OptionParser.print_help(self) print("\ncommands:") for cmdname, (_, help) in self._commands.items(): - print("% 10s - %s" % (cmdname, help)) + print(f"{cmdname: 10} - {help}") def parse_command(self, args): if len(args) == 0: @@ -80,7 +78,7 @@ self.print_version() sys.exit(0) self.error("unknown command") - self.prog = "%s %s" % (self.prog, cmd) + self.prog = f"{self.prog} {cmd}" mod_or_f, help = self._commands[cmd] # optparse inserts self.description between usage and options help self.description = help diff -Nru logilab-common-1.8.1/logilab/common/proc.py logilab-common-1.8.2/logilab/common/proc.py --- logilab-common-1.8.1/logilab/common/proc.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/proc.py 2021-11-23 14:37:54.000000000 +0000 @@ -72,7 +72,7 @@ """return the memory usage of the process in Ko""" try: return int(self.status()[VSIZE]) - except IOError: + except OSError: return 0 def lineage_memory_usage(self): diff -Nru logilab-common-1.8.1/logilab/common/pytest.py logilab-common-1.8.2/logilab/common/pytest.py --- logilab-common-1.8.1/logilab/common/pytest.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/pytest.py 2021-11-23 14:37:54.000000000 +0000 @@ -93,7 +93,6 @@ * ``titi`` match ``rouge and not carre`` """ -from __future__ import print_function import os import re diff -Nru logilab-common-1.8.1/logilab/common/registry.py logilab-common-1.8.2/logilab/common/registry.py --- logilab-common-1.8.1/logilab/common/registry.py 2021-01-05 09:45:33.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/registry.py 2021-11-23 14:37:54.000000000 +0000 @@ -76,8 +76,6 @@ .. autoclass:: NoSelectableObject """ -from __future__ import print_function - __docformat__ = "restructuredtext en" @@ -469,7 +467,7 @@ obj = super(RegistrableInstance, cls).__new__(cls) if module is None: warn( - "instantiate {0} with " "__module__=__name__".format(cls.__name__), + "instantiate {} with " "__module__=__name__".format(cls.__name__), DeprecationWarning, ) # XXX subclass must no override __new__ @@ -1058,7 +1056,7 @@ reg.initialization_completed() def _mdate(self, filepath: str) -> Optional[int]: - """ return the modification date of a file path """ + """return the modification date of a file path""" try: return stat(filepath)[-2] except OSError: @@ -1088,7 +1086,7 @@ return False def load_file(self, filepath: str, modname: str) -> None: - """ load registrable objects (if any) from a python file """ + """load registrable objects (if any) from a python file""" if modname in self._loadedmods: return self._loadedmods[modname] = {} diff -Nru logilab-common-1.8.1/logilab/common/shellutils.py logilab-common-1.8.2/logilab/common/shellutils.py --- logilab-common-1.8.1/logilab/common/shellutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/shellutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -19,7 +19,6 @@ scripts. """ -from __future__ import print_function __docformat__ = "restructuredtext en" diff -Nru logilab-common-1.8.1/logilab/common/table.py logilab-common-1.8.2/logilab/common/table.py --- logilab-common-1.8.1/logilab/common/table.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/table.py 2021-11-23 14:37:54.000000000 +0000 @@ -17,7 +17,6 @@ # with logilab-common. If not, see . """Table management module.""" -from __future__ import print_function from types import CodeType from typing import Any, List, Optional, Tuple, Union, Dict, Iterator from _io import StringIO diff -Nru logilab-common-1.8.1/logilab/common/testlib.py logilab-common-1.8.2/logilab/common/testlib.py --- logilab-common-1.8.1/logilab/common/testlib.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/testlib.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # @@ -37,7 +36,6 @@ """ -from __future__ import print_function __docformat__ = "restructuredtext en" # modified copy of some functions from test/regrtest.py from PyXml diff -Nru logilab-common-1.8.1/logilab/common/ureports/docbook_writer.py logilab-common-1.8.2/logilab/common/ureports/docbook_writer.py --- logilab-common-1.8.1/logilab/common/ureports/docbook_writer.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/ureports/docbook_writer.py 2021-11-23 14:37:54.000000000 +0000 @@ -48,7 +48,7 @@ else: tag = "section" self.section += 1 - self.writeln(self._indent("<%s%s>" % (tag, self.handle_attrs(layout)))) + self.writeln(self._indent("<{}{}>".format(tag, self.handle_attrs(layout)))) self.format_children(layout) self.writeln(self._indent("" % tag)) self.section -= 1 @@ -62,7 +62,9 @@ def visit_table(self, layout): """display a table as html""" self.writeln( - self._indent(" %s" % (self.handle_attrs(layout), layout.title)) + self._indent( + " {}".format(self.handle_attrs(layout), layout.title) + ) ) self.writeln(self._indent(' ' % layout.cols)) for i in range(layout.cols): @@ -124,7 +126,9 @@ def visit_link(self, layout): """display links (using )""" self.write( - '%s' % (layout.url, self.handle_attrs(layout), layout.label) + '{}'.format( + layout.url, self.handle_attrs(layout), layout.label + ) ) def visit_verbatimtext(self, layout): diff -Nru logilab-common-1.8.1/logilab/common/ureports/text_writer.py logilab-common-1.8.2/logilab/common/ureports/text_writer.py --- logilab-common-1.8.1/logilab/common/ureports/text_writer.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/ureports/text_writer.py 2021-11-23 14:37:54.000000000 +0000 @@ -17,7 +17,6 @@ # along with logilab-common. If not, see . """Text formatting drivers for ureports""" -from __future__ import print_function from typing import Any, List, Tuple __docformat__ = "restructuredtext en" diff -Nru logilab-common-1.8.1/logilab/common/urllib2ext.py logilab-common-1.8.2/logilab/common/urllib2ext.py --- logilab-common-1.8.1/logilab/common/urllib2ext.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/urllib2ext.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import print_function - import logging import urllib2 diff -Nru logilab-common-1.8.1/logilab/common/vcgutils.py logilab-common-1.8.2/logilab/common/vcgutils.py --- logilab-common-1.8.1/logilab/common/vcgutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/vcgutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -201,7 +201,7 @@ def node(self, title, **args): """draw a node""" - self._stream.write('%snode: {title:"%s"' % (self._indent, title)) + self._stream.write(f'{self._indent}node: {{title:"{title}"') self._write_attributes(NODE_ATTRS, **args) self._stream.write("}\n") @@ -229,11 +229,11 @@ ) if not _type: - self._stream.write('%s%s:"%s"\n' % (self._indent, key, value)) + self._stream.write(f'{self._indent}{key}:"{value}"\n') elif _type == 1: - self._stream.write("%s%s:%s\n" % (self._indent, key, int(value))) + self._stream.write("{}{}:{}\n".format(self._indent, key, int(value))) elif value in _type: - self._stream.write("%s%s:%s\n" % (self._indent, key, value)) + self._stream.write(f"{self._indent}{key}:{value}\n") else: raise Exception( """value %s isn\'t correct for attribute %s diff -Nru logilab-common-1.8.1/logilab/common/xmlutils.py logilab-common-1.8.2/logilab/common/xmlutils.py --- logilab-common-1.8.1/logilab/common/xmlutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/logilab/common/xmlutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # diff -Nru logilab-common-1.8.1/logilab_common.egg-info/PKG-INFO logilab-common-1.8.2/logilab_common.egg-info/PKG-INFO --- logilab-common-1.8.1/logilab_common.egg-info/PKG-INFO 2021-01-05 10:43:45.000000000 +0000 +++ logilab-common-1.8.2/logilab_common.egg-info/PKG-INFO 2021-11-23 14:46:44.000000000 +0000 @@ -1,104 +1,108 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: logilab-common -Version: 1.8.1 +Version: 1.8.2 Summary: collection of low-level Python packages and modules used by Logilab projects Home-page: http://www.logilab.org/project/logilab-common Author: Logilab Author-email: contact@logilab.fr License: LGPL -Description: Logilab's common library - ======================== - - What's this ? - ------------- - - This package contains some modules used by different Logilab projects. - - It is released under the GNU Lesser General Public License. - - There is no documentation available yet but the source code should be clean and - well documented. - - Designed to ease: - - * handling command line options and configuration files - * writing interactive command line tools - * manipulation of files and character strings - * manipulation of common structures such as graph, tree, and pattern such as visitor - * generating text and HTML reports - * more... - - Documentation - ------------- - - Documentation is available at https://logilab-common.readthedocs.io/ - - Installation - ------------ - - logilab-common is available on pypi so you can install it using pip :: - - pip install logilab-common - - Or alternatively extract the tarball, jump into the created directory and run :: - - python setup.py install - - For installation options, see :: - - python setup.py install --help - - - Building the documentation - -------------------------- - - Create a virtualenv and install dependencies :: - - virtualenv venv - source venv/bin/activate - - # you need the krb5-config command to build all dependencies - # on debian you can get it using "apt-get install libkrb5-dev" - - pip install doc/requirements-doc.txt - - # install logilab-common - pip install -e . - - Then build the doc :: - - cd doc - make html - - It's now available under `doc/_build/html/` - - Code style - ---------- - - The python code is verified against *flake8* and formatted with *black*. - - * You can run `tox -e black` to check that the files are well formatted. - * You can run `tox -e black-run` to format them if needed. - * You can include the `.hgrc` to your own `.hgrc` to automatically run black - before each commit/amend. This can be done by writing `%include ../.hgrc` at - the end of your `.hgrc`. - - Comments, support, bug reports - ------------------------------ - - Project page https://www.logilab.org/project/logilab-common - - Use the cubicweb-devel at lists.cubicweb.org mailing list. - - You can subscribe to this mailing list at - https://lists.cubicweb.org/mailman/listinfo/cubicweb-devel - - Archives are available at - https://lists.cubicweb.org/pipermail/cubicweb-devel/ - Platform: UNKNOWN Classifier: Topic :: Utilities Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Requires-Python: >=3.6 +License-File: COPYING +License-File: COPYING.LESSER + +Logilab's common library +======================== + +What's this ? +------------- + +This package contains some modules used by different Logilab projects. + +It is released under the GNU Lesser General Public License. + +There is no documentation available yet but the source code should be clean and +well documented. + +Designed to ease: + +* handling command line options and configuration files +* writing interactive command line tools +* manipulation of files and character strings +* manipulation of common structures such as graph, tree, and pattern such as visitor +* generating text and HTML reports +* more... + +Documentation +------------- + +Documentation is available at https://logilab-common.readthedocs.io/ + +Installation +------------ + +logilab-common is available on pypi so you can install it using pip :: + + pip install logilab-common + +Or alternatively extract the tarball, jump into the created directory and run :: + + python setup.py install + +For installation options, see :: + + python setup.py install --help + + +Building the documentation +-------------------------- + +Create a virtualenv and install dependencies :: + + virtualenv venv + source venv/bin/activate + + # you need the krb5-config command to build all dependencies + # on debian you can get it using "apt-get install libkrb5-dev" + + pip install doc/requirements-doc.txt + + # install logilab-common + pip install -e . + +Then build the doc :: + + cd doc + make html + +It's now available under `doc/_build/html/` + +Code style +---------- + +The python code is verified against *flake8* and formatted with *black*. + +* You can run `tox -e black` to check that the files are well formatted. +* You can run `tox -e black-run` to format them if needed. +* You can include the `.hgrc` to your own `.hgrc` to automatically run black + before each commit/amend. This can be done by writing `%include ../.hgrc` at + the end of your `.hgrc`. + +Comments, support, bug reports +------------------------------ + +Project page https://www.logilab.org/project/logilab-common + +Use the cubicweb-devel at lists.cubicweb.org mailing list. + +You can subscribe to this mailing list at +https://lists.cubicweb.org/mailman/listinfo/cubicweb-devel + +Archives are available at +https://lists.cubicweb.org/pipermail/cubicweb-devel/ + + diff -Nru logilab-common-1.8.1/MANIFEST.in logilab-common-1.8.2/MANIFEST.in --- logilab-common-1.8.1/MANIFEST.in 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/MANIFEST.in 2021-11-23 14:41:24.000000000 +0000 @@ -15,6 +15,10 @@ include docs/* include __pkginfo__.py prune debian +exclude .hg-format-source prune docs/_build exclude .hgrc exclude .gitlab-ci.yml +exclude .yamllint +exclude .cube-doctor.yml +exclude CHANGELOG.md diff -Nru logilab-common-1.8.1/PKG-INFO logilab-common-1.8.2/PKG-INFO --- logilab-common-1.8.1/PKG-INFO 2021-01-05 10:43:45.000000000 +0000 +++ logilab-common-1.8.2/PKG-INFO 2021-11-23 14:46:44.000000000 +0000 @@ -1,104 +1,108 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: logilab-common -Version: 1.8.1 +Version: 1.8.2 Summary: collection of low-level Python packages and modules used by Logilab projects Home-page: http://www.logilab.org/project/logilab-common Author: Logilab Author-email: contact@logilab.fr License: LGPL -Description: Logilab's common library - ======================== - - What's this ? - ------------- - - This package contains some modules used by different Logilab projects. - - It is released under the GNU Lesser General Public License. - - There is no documentation available yet but the source code should be clean and - well documented. - - Designed to ease: - - * handling command line options and configuration files - * writing interactive command line tools - * manipulation of files and character strings - * manipulation of common structures such as graph, tree, and pattern such as visitor - * generating text and HTML reports - * more... - - Documentation - ------------- - - Documentation is available at https://logilab-common.readthedocs.io/ - - Installation - ------------ - - logilab-common is available on pypi so you can install it using pip :: - - pip install logilab-common - - Or alternatively extract the tarball, jump into the created directory and run :: - - python setup.py install - - For installation options, see :: - - python setup.py install --help - - - Building the documentation - -------------------------- - - Create a virtualenv and install dependencies :: - - virtualenv venv - source venv/bin/activate - - # you need the krb5-config command to build all dependencies - # on debian you can get it using "apt-get install libkrb5-dev" - - pip install doc/requirements-doc.txt - - # install logilab-common - pip install -e . - - Then build the doc :: - - cd doc - make html - - It's now available under `doc/_build/html/` - - Code style - ---------- - - The python code is verified against *flake8* and formatted with *black*. - - * You can run `tox -e black` to check that the files are well formatted. - * You can run `tox -e black-run` to format them if needed. - * You can include the `.hgrc` to your own `.hgrc` to automatically run black - before each commit/amend. This can be done by writing `%include ../.hgrc` at - the end of your `.hgrc`. - - Comments, support, bug reports - ------------------------------ - - Project page https://www.logilab.org/project/logilab-common - - Use the cubicweb-devel at lists.cubicweb.org mailing list. - - You can subscribe to this mailing list at - https://lists.cubicweb.org/mailman/listinfo/cubicweb-devel - - Archives are available at - https://lists.cubicweb.org/pipermail/cubicweb-devel/ - Platform: UNKNOWN Classifier: Topic :: Utilities Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Requires-Python: >=3.6 +License-File: COPYING +License-File: COPYING.LESSER + +Logilab's common library +======================== + +What's this ? +------------- + +This package contains some modules used by different Logilab projects. + +It is released under the GNU Lesser General Public License. + +There is no documentation available yet but the source code should be clean and +well documented. + +Designed to ease: + +* handling command line options and configuration files +* writing interactive command line tools +* manipulation of files and character strings +* manipulation of common structures such as graph, tree, and pattern such as visitor +* generating text and HTML reports +* more... + +Documentation +------------- + +Documentation is available at https://logilab-common.readthedocs.io/ + +Installation +------------ + +logilab-common is available on pypi so you can install it using pip :: + + pip install logilab-common + +Or alternatively extract the tarball, jump into the created directory and run :: + + python setup.py install + +For installation options, see :: + + python setup.py install --help + + +Building the documentation +-------------------------- + +Create a virtualenv and install dependencies :: + + virtualenv venv + source venv/bin/activate + + # you need the krb5-config command to build all dependencies + # on debian you can get it using "apt-get install libkrb5-dev" + + pip install doc/requirements-doc.txt + + # install logilab-common + pip install -e . + +Then build the doc :: + + cd doc + make html + +It's now available under `doc/_build/html/` + +Code style +---------- + +The python code is verified against *flake8* and formatted with *black*. + +* You can run `tox -e black` to check that the files are well formatted. +* You can run `tox -e black-run` to format them if needed. +* You can include the `.hgrc` to your own `.hgrc` to automatically run black + before each commit/amend. This can be done by writing `%include ../.hgrc` at + the end of your `.hgrc`. + +Comments, support, bug reports +------------------------------ + +Project page https://www.logilab.org/project/logilab-common + +Use the cubicweb-devel at lists.cubicweb.org mailing list. + +You can subscribe to this mailing list at +https://lists.cubicweb.org/mailman/listinfo/cubicweb-devel + +Archives are available at +https://lists.cubicweb.org/pipermail/cubicweb-devel/ + + diff -Nru logilab-common-1.8.1/__pkginfo__.py logilab-common-1.8.2/__pkginfo__.py --- logilab-common-1.8.1/__pkginfo__.py 2021-01-05 10:42:34.000000000 +0000 +++ logilab-common-1.8.2/__pkginfo__.py 2021-11-23 14:41:24.000000000 +0000 @@ -28,7 +28,7 @@ subpackage_of = "logilab" subpackage_master = True -numversion = (1, 8, 1) +numversion = (1, 8, 2) version = ".".join([str(num) for num in numversion]) license = "LGPL" # 2.1 or later diff -Nru logilab-common-1.8.1/setup.py logilab-common-1.8.2/setup.py --- logilab-common-1.8.1/setup.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/setup.py 2021-11-23 14:37:54.000000000 +0000 @@ -22,7 +22,6 @@ __docformat__ = "restructuredtext en" from setuptools import setup, find_packages -from io import open from os import path here = path.abspath(path.dirname(__file__)) diff -Nru logilab-common-1.8.1/test/data/module2.py logilab-common-1.8.2/test/data/module2.py --- logilab-common-1.8.1/test/data/module2.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/module2.py 2021-11-23 14:37:54.000000000 +0000 @@ -30,7 +30,7 @@ pass -class AbstractClass(object): +class AbstractClass: def to_override(self, whatever): raise NotImplementedError() diff -Nru logilab-common-1.8.1/test/data/module.py logilab-common-1.8.2/test/data/module.py --- logilab-common-1.8.1/test/data/module.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/module.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,7 +1,5 @@ -# -*- coding: Latin-1 -*- """test module for astng """ -from __future__ import print_function from logilab.common import modutils, Execute as spawn from logilab.common.astutils import * diff -Nru logilab-common-1.8.1/test/data/noendingnewline.py logilab-common-1.8.2/test/data/noendingnewline.py --- logilab-common-1.8.1/test/data/noendingnewline.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/noendingnewline.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import print_function - import unittest diff -Nru logilab-common-1.8.1/test/data/nonregr.py logilab-common-1.8.2/test/data/nonregr.py --- logilab-common-1.8.1/test/data/nonregr.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/nonregr.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,5 +1,3 @@ -from __future__ import print_function - try: enumerate = enumerate except NameError: diff -Nru logilab-common-1.8.1/test/data/__pkginfo__.py logilab-common-1.8.2/test/data/__pkginfo__.py --- logilab-common-1.8.1/test/data/__pkginfo__.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/__pkginfo__.py 2021-11-23 14:37:54.000000000 +0000 @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License along # with logilab-common. If not, see . """logilab.common packaging information""" +from os.path import join + __docformat__ = "restructuredtext en" import sys import os @@ -36,8 +38,6 @@ author_email = "contact@logilab.fr" -from os.path import join - scripts = [join("bin", "logilab-pytest")] include_dirs = [join("test", "data")] diff -Nru logilab-common-1.8.1/test/data/regobjects.py logilab-common-1.8.2/test/data/regobjects.py --- logilab-common-1.8.1/test/data/regobjects.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/regobjects.py 2021-11-23 14:37:54.000000000 +0000 @@ -2,7 +2,7 @@ from logilab.common.registry import yes, RegistrableObject, RegistrableInstance -class Proxy(object): +class Proxy: """annoying object should that not be registered, nor cause error""" def __getattr__(self, attr): diff -Nru logilab-common-1.8.1/test/data/sub/momo.py logilab-common-1.8.2/test/data/sub/momo.py --- logilab-common-1.8.1/test/data/sub/momo.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/data/sub/momo.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,3 +1 @@ -from __future__ import print_function - print("yo") diff -Nru logilab-common-1.8.1/test/test_decorators.py logilab-common-1.8.2/test/test_decorators.py --- logilab-common-1.8.1/test/test_decorators.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_decorators.py 2021-11-23 14:37:54.000000000 +0000 @@ -17,7 +17,6 @@ # with logilab-common. If not, see . """unit tests for the decorators module """ -import sys import types from logilab.common.testlib import TestCase, unittest_main @@ -33,18 +32,14 @@ def meth1(self): return 12 - class XXX(object): + class XXX: @monkeypatch(MyClass) def meth2(self): return 12 - if sys.version_info < (3, 0): - self.assertIsInstance(MyClass.meth1, types.MethodType) - self.assertIsInstance(MyClass.meth2, types.MethodType) - else: - # with python3, unbound method are functions - self.assertIsInstance(MyClass.meth1, types.FunctionType) - self.assertIsInstance(MyClass.meth2, types.FunctionType) + # with python3, unbound method are functions + self.assertIsInstance(MyClass.meth1, types.FunctionType) + self.assertIsInstance(MyClass.meth2, types.FunctionType) self.assertEqual(MyClass().meth1(), 12) self.assertEqual(MyClass().meth2(), 12) @@ -64,7 +59,7 @@ class MyClass: pass - class ArbitraryCallable(object): + class ArbitraryCallable: def __call__(self): return 12 @@ -112,32 +107,32 @@ self.assertRaises(AssertionError, cached, foo) def test_cached_preserves_docstrings_and_name(self): - class Foo(object): + class Foo: @cached def foo(self): - """ what's up doc ? """ + """what's up doc ?""" def bar(self, zogzog): - """ what's up doc ? """ + """what's up doc ?""" bar = cached(bar, 1) @cached def quux(self, zogzog): - """ what's up doc ? """ + """what's up doc ?""" - self.assertEqual(Foo.foo.__doc__, """ what's up doc ? """) + self.assertEqual(Foo.foo.__doc__, """what's up doc ?""") self.assertEqual(Foo.foo.__name__, "foo") - self.assertEqual(Foo.bar.__doc__, """ what's up doc ? """) + self.assertEqual(Foo.bar.__doc__, """what's up doc ?""") self.assertEqual(Foo.bar.__name__, "bar") - self.assertEqual(Foo.quux.__doc__, """ what's up doc ? """) + self.assertEqual(Foo.quux.__doc__, """what's up doc ?""") self.assertEqual(Foo.quux.__name__, "quux") def test_cached_single_cache(self): - class Foo(object): + class Foo: @cached(cacheattr="_foo") def foo(self): - """ what's up doc ? """ + """what's up doc ?""" foo = Foo() foo.foo() @@ -146,10 +141,10 @@ self.assertFalse(hasattr(foo, "_foo")) def test_cached_multi_cache(self): - class Foo(object): + class Foo: @cached(cacheattr="_foo") def foo(self, args): - """ what's up doc ? """ + """what's up doc ?""" foo = Foo() foo.foo(1) @@ -158,10 +153,10 @@ self.assertFalse(hasattr(foo, "_foo")) def test_cached_keyarg_cache(self): - class Foo(object): + class Foo: @cached(cacheattr="_foo", keyarg=1) def foo(self, other, args): - """ what's up doc ? """ + """what's up doc ?""" foo = Foo() foo.foo(2, 1) @@ -170,11 +165,11 @@ self.assertFalse(hasattr(foo, "_foo")) def test_cached_property(self): - class Foo(object): + class Foo: @property @cached(cacheattr="_foo") def foo(self): - """ what's up doc ? """ + """what's up doc ?""" foo = Foo() foo.foo @@ -183,10 +178,10 @@ self.assertFalse(hasattr(foo, "_foo")) def test_copy_cache(self): - class Foo(object): + class Foo: @cached(cacheattr="_foo") def foo(self, args): - """ what's up doc ? """ + """what's up doc ?""" foo = Foo() foo.foo(1) @@ -197,7 +192,7 @@ self.assertEqual(foo2._foo, {(1,): None}) def test_cachedproperty(self): - class Foo(object): + class Foo: x = 0 @cachedproperty @@ -207,7 +202,7 @@ @cachedproperty def quux(self): - """ some prop """ + """some prop""" return 42 foo = Foo() @@ -218,14 +213,14 @@ self.assertEqual(foo.bar, 1) self.assertEqual(foo.quux, 42) self.assertEqual(Foo.bar.__doc__, "") - self.assertEqual(Foo.quux.__doc__, "\n some prop ") + self.assertEqual(Foo.quux.__doc__, "\nsome prop") foo2 = Foo() self.assertEqual(foo2.bar, 2) # make sure foo.foo is cached self.assertEqual(foo.bar, 1) - class Kallable(object): + class Kallable: def __call__(self): return 42 diff -Nru logilab-common-1.8.1/test/test_fileutils.py logilab-common-1.8.2/test/test_fileutils.py --- logilab-common-1.8.1/test/test_fileutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_fileutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -18,7 +18,6 @@ """unit tests for logilab.common.fileutils""" import doctest -import io import sys import os import tempfile @@ -68,7 +67,7 @@ class NormReadTC(TestCase): def test_known_values_norm_read(self): - with io.open(NEWLINES_TXT) as f: + with open(NEWLINES_TXT) as f: data = f.read() self.assertEqual(data.strip(), "\n".join(["# mixed new lines", "1", "2", "3"])) diff -Nru logilab-common-1.8.1/test/test_interface.py logilab-common-1.8.2/test/test_interface.py --- logilab-common-1.8.1/test/test_interface.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_interface.py 2021-11-23 14:37:54.000000000 +0000 @@ -31,7 +31,7 @@ pass -class A(object): +class A: __implements__ = (IFace1,) @@ -51,7 +51,7 @@ __implements__ = () -class Z(object): +class Z: pass @@ -90,7 +90,7 @@ class SubIFace(IFace1): pass - class X(object): + class X: __implements__ = (SubIFace,) self.assertTrue(SubIFace.is_implemented_by(X)) diff -Nru logilab-common-1.8.1/test/test_modutils.py logilab-common-1.8.2/test/test_modutils.py --- logilab-common-1.8.1/test/test_modutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_modutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -42,7 +42,7 @@ class ModutilsTestCase(TestCase): def setUp(self): - super(ModutilsTestCase, self).setUp() + super().setUp() self.__common_in_path = common.__path__[0] in sys.path if self.__common_in_path: sys.path.remove(common.__path__[0]) @@ -50,14 +50,14 @@ def tearDown(self): if self.__common_in_path: sys.path.insert(0, common.__path__[0]) - super(ModutilsTestCase, self).tearDown() + super().tearDown() class ModuleFileTC(ModutilsTestCase): package = "mypypa" def setUp(self): - super(ModuleFileTC, self).setUp() + super().setUp() for k in list(sys.path_importer_cache.keys()): if "MyPyPa" in k: del sys.path_importer_cache[k] @@ -80,7 +80,7 @@ class load_module_from_name_tc(ModutilsTestCase): - """ load a python module from it's name """ + """load a python module from it's name""" def test_knownValues_load_module_from_name_1(self): self.assertEqual(modutils.load_module_from_name("sys"), sys) @@ -127,7 +127,7 @@ class modpath_from_file_tc(ModutilsTestCase): - """ given an absolute file path return the python module's path as a list """ + """given an absolute file path return the python module's path as a list""" def test_knownValues_modpath_from_file_1(self): with warnings.catch_warnings(record=True) as warns: @@ -220,12 +220,8 @@ """ def test_builtins(self): - if sys.version_info < (3, 0): - self.assertEqual(modutils.is_standard_module("__builtin__"), True) - self.assertEqual(modutils.is_standard_module("builtins"), False) - else: - self.assertEqual(modutils.is_standard_module("__builtin__"), False) - self.assertEqual(modutils.is_standard_module("builtins"), True) + self.assertEqual(modutils.is_standard_module("__builtin__"), False) + self.assertEqual(modutils.is_standard_module("builtins"), True) def test_builtin(self): self.assertEqual(modutils.is_standard_module("sys"), True) @@ -283,12 +279,10 @@ modules = sorted(modutils.get_modules(path.join(*mod_path), data.__path__[0])) self.assertSetEqual( set(modules), - set( - [ - ".".join(mod_path + (mod,)) - for mod in ("module", "module2", "noendingnewline", "nonregr") - ] - ), + { + ".".join(mod_path + (mod,)) + for mod in ("module", "module2", "noendingnewline", "nonregr") + }, ) diff -Nru logilab-common-1.8.1/test/test_registry.py logilab-common-1.8.2/test/test_registry.py --- logilab-common-1.8.1/test/test_registry.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_registry.py 2021-11-23 14:37:54.000000000 +0000 @@ -202,7 +202,7 @@ [str(w.message) for w in warns], ) self.assertEqual(["zereg"], list(store.keys())) - self.assertEqual(set(("appobject1", "appobject2", "appobject3")), set(store["zereg"])) + self.assertEqual({"appobject1", "appobject2", "appobject3"}, set(store["zereg"])) def test_autoload_modnames(self): store = RegistryStore() @@ -210,7 +210,7 @@ with prepended_syspath(self.datadir): store.register_modnames(["regobjects", "regobjects2"]) self.assertEqual(["zereg"], list(store.keys())) - self.assertEqual(set(("appobject1", "appobject2", "appobject3")), set(store["zereg"])) + self.assertEqual({"appobject1", "appobject2", "appobject3"}, set(store["zereg"])) class RegistrableInstanceTC(TestCase): diff -Nru logilab-common-1.8.1/test/test_shellutils.py logilab-common-1.8.2/test/test_shellutils.py --- logilab-common-1.8.1/test/test_shellutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_shellutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -34,84 +34,76 @@ files = set(find(DATA_DIR, ".py")) self.assertSetEqual( files, - set( - [ - join(DATA_DIR, f) - for f in [ - "__init__.py", - "module.py", - "module2.py", - "noendingnewline.py", - "nonregr.py", - join("sub", "momo.py"), - ] + { + join(DATA_DIR, f) + for f in [ + "__init__.py", + "module.py", + "module2.py", + "noendingnewline.py", + "nonregr.py", + join("sub", "momo.py"), ] - ), + }, ) files = set(find(DATA_DIR, (".py",), blacklist=("sub",))) self.assertSetEqual( files, - set( - [ - join(DATA_DIR, f) - for f in [ - "__init__.py", - "module.py", - "module2.py", - "noendingnewline.py", - "nonregr.py", - ] + { + join(DATA_DIR, f) + for f in [ + "__init__.py", + "module.py", + "module2.py", + "noendingnewline.py", + "nonregr.py", ] - ), + }, ) def test_exclude(self): files = set(find(DATA_DIR, (".py", ".pyc"), exclude=True)) self.assertSetEqual( files, - set( - [ - join(DATA_DIR, f) - for f in [ - "foo.txt", - "newlines.txt", - "normal_file.txt", - "test.ini", - "test1.msg", - "test2.msg", - "spam.txt", - join("sub", "doc.txt"), - "write_protected_file.txt", - ] + { + join(DATA_DIR, f) + for f in [ + "foo.txt", + "newlines.txt", + "normal_file.txt", + "test.ini", + "test1.msg", + "test2.msg", + "spam.txt", + join("sub", "doc.txt"), + "write_protected_file.txt", ] - ), + }, ) def test_globfind(self): files = set(globfind(DATA_DIR, "*.py")) self.assertSetEqual( files, - set( - [ - join(DATA_DIR, f) - for f in [ - "__init__.py", - "module.py", - "module2.py", - "noendingnewline.py", - "nonregr.py", - join("sub", "momo.py"), - ] + { + join(DATA_DIR, f) + for f in [ + "__init__.py", + "module.py", + "module2.py", + "noendingnewline.py", + "nonregr.py", + join("sub", "momo.py"), ] - ), + }, ) files = set(globfind(DATA_DIR, "mo*.py")) self.assertSetEqual( files, - set([join(DATA_DIR, f) for f in ["module.py", "module2.py", join("sub", "momo.py")]]), + {join(DATA_DIR, f) for f in ["module.py", "module2.py", join("sub", "momo.py")]}, ) files = set(globfind(DATA_DIR, "mo*.py", blacklist=("sub",))) - self.assertSetEqual(files, set([join(DATA_DIR, f) for f in ["module.py", "module2.py"]])) + self.assertSetEqual(files, {join(DATA_DIR, f) for f in ["module.py", "module2.py"]}) class ProgressBarTC(TestCase): diff -Nru logilab-common-1.8.1/test/test_testlib.py logilab-common-1.8.2/test/test_testlib.py --- logilab-common-1.8.1/test/test_testlib.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_testlib.py 2021-11-23 14:37:54.000000000 +0000 @@ -17,7 +17,6 @@ # with logilab-common. If not, see . """unittest module for logilab.comon.testlib""" -from __future__ import print_function import os import sys @@ -844,7 +843,7 @@ self.assertEqual(bob(2, 3, 7), 35) self.assertTrue(hasattr(bob, "tags")) - self.assertSetEqual(bob.tags, set(["testing", "bob"])) + self.assertSetEqual(bob.tags, {"testing", "bob"}) def test_tags_class(self): tags = self.func.tags @@ -868,7 +867,7 @@ def test_tagged_class(self): def options(tags): - class Options(object): + class Options: tags_pattern = tags return Options() diff -Nru logilab-common-1.8.1/test/test_textutils.py logilab-common-1.8.2/test/test_textutils.py --- logilab-common-1.8.1/test/test_textutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_textutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # diff -Nru logilab-common-1.8.1/test/test_tree.py logilab-common-1.8.2/test/test_tree.py --- logilab-common-1.8.1/test/test_tree.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_tree.py 2021-11-23 14:37:54.000000000 +0000 @@ -47,10 +47,10 @@ class Node_ClassTest(TestCase): - """ a basic tree node, caracterised by an id""" + """a basic tree node, caracterised by an id""" def setUp(self): - """ called before each test from this class """ + """called before each test from this class""" self.o = make_tree(tree) def test_flatten(self): @@ -195,7 +195,7 @@ """""" def setUp(self): - """ called before each test from this class """ + """called before each test from this class""" self.o = make_tree(tree) def test_known_values_post_order_list(self): @@ -235,7 +235,7 @@ """""" def setUp(self): - """ called before each test from this class """ + """called before each test from this class""" self.o = make_tree(tree) def test_known_values_next(self): @@ -253,7 +253,7 @@ """""" def setUp(self): - """ called before each test from this class """ + """called before each test from this class""" self.o = make_tree(tree) def test_known_values_pre_order_list(self): @@ -293,7 +293,7 @@ """""" def setUp(self): - """ called before each test from this class """ + """called before each test from this class""" self.o = make_tree(tree) def test_known_values_next(self): diff -Nru logilab-common-1.8.1/test/test_umessage.py logilab-common-1.8.2/test/test_umessage.py --- logilab-common-1.8.1/test/test_umessage.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_umessage.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# encoding: iso-8859-15 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # @@ -29,10 +28,10 @@ class UMessageTC(TestCase): def setUp(self): if sys.version_info >= (3, 2): - import io + pass - msg1 = email.message_from_file(io.open(join(DATA, "test1.msg"), encoding="utf8")) - msg2 = email.message_from_file(io.open(join(DATA, "test2.msg"), encoding="utf8")) + msg1 = email.message_from_file(open(join(DATA, "test1.msg"), encoding="utf8")) + msg2 = email.message_from_file(open(join(DATA, "test2.msg"), encoding="utf8")) else: msg1 = email.message_from_file(open(join(DATA, "test1.msg"))) msg2 = email.message_from_file(open(join(DATA, "test2.msg"))) @@ -42,12 +41,12 @@ def test_get_subject(self): subj = self.umessage2.get("Subject") self.assertEqual(type(subj), str) - self.assertEqual(subj, "À LA MER") + self.assertEqual(subj, "À LA MER") def test_get_all(self): to = self.umessage2.get_all("To") self.assertEqual(type(to[0]), str) - self.assertEqual(to, ["élément à accents "]) + self.assertEqual(to, ["élément à accents "]) def test_get_payload_no_multi(self): payload = self.umessage1.get_payload() @@ -68,19 +67,19 @@ dW4gcGV0aXQgY8O2dWNvdQ== """ msg = message_from_string(msg) - self.assertEqual(msg.get_payload(decode=True), "un petit cöucou") + self.assertEqual(msg.get_payload(decode=True), "un petit cöucou") def test_decode_QP(self): test_line = "=??b?UmFwaGHrbA==?= DUPONT" test = decode_QP(test_line) self.assertEqual(type(test), str) - self.assertEqual(test, "Raphaël DUPONT") + self.assertEqual(test, "Raphaël DUPONT") def test_decode_QP_utf8(self): test_line = "=?utf-8?q?o=C3=AEm?= " test = decode_QP(test_line) self.assertEqual(type(test), str) - self.assertEqual(test, "oîm ") + self.assertEqual(test, "oîm ") def test_decode_QP_ascii(self): test_line = "test " diff -Nru logilab-common-1.8.1/test/test_xmlutils.py logilab-common-1.8.2/test/test_xmlutils.py --- logilab-common-1.8.1/test/test_xmlutils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/test_xmlutils.py 2021-11-23 14:37:54.000000000 +0000 @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # diff -Nru logilab-common-1.8.1/test/utils.py logilab-common-1.8.2/test/utils.py --- logilab-common-1.8.1/test/utils.py 2021-01-05 08:17:41.000000000 +0000 +++ logilab-common-1.8.2/test/utils.py 2021-11-23 14:37:54.000000000 +0000 @@ -18,7 +18,6 @@ """unit tests utilities for ureports """ -from __future__ import print_function import sys from io import StringIO diff -Nru logilab-common-1.8.1/tox.ini logilab-common-1.8.2/tox.ini --- logilab-common-1.8.1/tox.ini 2021-01-05 09:09:57.000000000 +0000 +++ logilab-common-1.8.2/tox.ini 2021-11-23 14:37:54.000000000 +0000 @@ -1,5 +1,5 @@ [tox] -envlist=py3,check-manifest,mypy,flake8,black,black-run +envlist=py3,check-manifest,mypy,flake8,black,black-run,yamllint [testenv] deps = @@ -94,3 +94,9 @@ dpkg-buildpackage -us -uc --no-check-builddeps --build=source " sh -c "cd dist && dcmd zip latest.zip *.changes" http -f POST https://{env:JENKINS_USER}:{env:JENKINS_TOKEN}@jenkins.intra.logilab.fr/job/pkg-from-dsc/buildWithParameters DIST=buster source.zip@dist/latest.zip REPO=buster PUBLISH=true + +[testenv:yamllint] +skip_install = true +deps = yamllint +commands = + yamllint .