Hello community, here is the log from the commit of package python-rebulk for openSUSE:Factory checked in at 2018-09-04 22:56:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rebulk (Old) and /work/SRC/openSUSE:Factory/.python-rebulk.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rebulk" Tue Sep 4 22:56:14 2018 rev:2 rq:632806 version:0.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-rebulk/python-rebulk.changes 2017-04-29 10:52:27.261296943 +0200 +++ /work/SRC/openSUSE:Factory/.python-rebulk.new/python-rebulk.changes 2018-09-04 22:56:15.993020676 +0200 @@ -1,0 +2,14 @@ +Mon Sep 3 08:57:02 UTC 2018 - Tomáš Chvátal <[email protected]> + +- Write up the tests syntax to match up rest python packages + +------------------------------------------------------------------- +Sat Sep 1 11:11:27 UTC 2018 - [email protected] + +- Update to version 0.9.0 + * Fix pylint issues + * Refactor Matches to_dict() method for better API + +- Enabled tests + +------------------------------------------------------------------- Old: ---- rebulk-0.8.2.tar.gz New: ---- rebulk-0.9.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rebulk.spec ++++++ --- /var/tmp/diff_new_pack.1wqe01/_old 2018-09-04 22:56:16.597022739 +0200 +++ /var/tmp/diff_new_pack.1wqe01/_new 2018-09-04 22:56:16.601022753 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-rebulk # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,23 +15,22 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rebulk -Version: 0.8.2 +Version: 0.9.0 Release: 0 Summary: Rebulk - Define bulk search patterns to perform advanced string matching License: MIT Group: Development/Languages/Python Url: https://github.com/Toilal/rebulk Source0: https://pypi.io/packages/source/r/rebulk/rebulk-%{version}.tar.gz -BuildRequires: fdupes BuildRequires: %{python_module devel} -BuildRequires: %{python_module docutils} -BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest-runner} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: python-rpm-macros -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch %python_subpackages @@ -54,6 +53,8 @@ for i in {'default_rules_module','__init__','rebulk_rules_module','rules_module','test_chain','test_debug','test_introspector','test_loose','test_match','test_pattern','test_processors','test_rebulk','test_rules','test_toposort','test_validators'}; do sed -i -e "1d" "rebulk/test/$i.py" done +# remove debug test that will always fail in OBS +rm rebulk/test/test_debug.py %build %python_build @@ -62,15 +63,15 @@ %python_install %python_expand %fdupes -s %{buildroot}%{$python_sitelib} -# unable to fix this -#%%check -#pushd build -#%%python_exec %%{_bindir}/py.test -#popd +%check +export PYTHONDONTWRITEBYTECODE=1 +%{python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} +py.test-%{$python_version} rebulk/test/ +} %files %{python_files} -%defattr(-,root,root,-) -%doc LICENSE README.rst +%doc README.rst +%license LICENSE %{python_sitelib}/rebulk %{python_sitelib}/rebulk-%{version}-py%{python_version}.egg-info ++++++ rebulk-0.8.2.tar.gz -> rebulk-0.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/PKG-INFO new/rebulk-0.9.0/PKG-INFO --- old/rebulk-0.8.2/PKG-INFO 2016-11-27 15:43:34.000000000 +0100 +++ new/rebulk-0.9.0/PKG-INFO 2017-05-31 15:41:53.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.1 Name: rebulk -Version: 0.8.2 +Version: 0.9.0 Summary: Rebulk - Define simple search patterns in bulk to perform advanced matching on any string. Home-page: https://github.com/Toilal/rebulk/ Author: Rémi Alvergnat Author-email: [email protected] License: MIT -Download-URL: https://pypi.python.org/packages/source/r/rebulk/rebulk-0.8.2.tar.gz +Download-URL: https://pypi.python.org/packages/source/r/rebulk/rebulk-0.9.0.tar.gz Description: ReBulk ======= @@ -183,7 +183,7 @@ ... .regex(r'v(?P<version>\d+)').repeater('?')\ ... .regex(r'[ex-](?P<episode>\d{1,4})').repeater('*')\ ... .close() # .repeater(1) could be omitted as it's the default behavior - >>> r.matches("This is E14v2-15-16-17").to_dict(implicit=True) # converts matches to dict and keep multiple values + >>> r.matches("This is E14v2-15-16-17").to_dict() # converts matches to dict MatchesDict([('episode', [14, 15, 16, 17]), ('version', 2)]) Patterns parameters @@ -433,17 +433,19 @@ Retrieves a sequence of all ``Match.tags`` properties. - - ``to_dict(details=False, implicit=False)`` + - ``to_dict(details=False, first_value=False, enforce_list=False)`` Convert to an ordered dict, with ``Match.name`` as key and ``Match.value`` as value. It's a subclass of `OrderedDict`_, that contains a ``matches`` property which is a dict with ``Match.name`` as key and list of ``Match`` objects as value. - If ``implicit`` is ``True`` and distinct values are found for the same name, value will be converted as list. + If ``first_value`` is ``True`` and distinct values are found for the same name, value will be wrapped to a list. If ``False``, first value only will be kept and values lists can be retrieved with ``values_list`` which is a dict with ``Match.name`` as key and list of ``Match.value`` as value. + if ``enforce_list`` is ``True``, all values will be wrapped to a list, even if a single value is found. + If ``details`` is True, ``Match.value`` objects are replaced with complete ``Match`` object. - ``markers`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/README.rst new/rebulk-0.9.0/README.rst --- old/rebulk-0.8.2/README.rst 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/README.rst 2017-05-31 15:41:51.000000000 +0200 @@ -174,7 +174,7 @@ ... .regex(r'v(?P<version>\d+)').repeater('?')\ ... .regex(r'[ex-](?P<episode>\d{1,4})').repeater('*')\ ... .close() # .repeater(1) could be omitted as it's the default behavior - >>> r.matches("This is E14v2-15-16-17").to_dict(implicit=True) # converts matches to dict and keep multiple values + >>> r.matches("This is E14v2-15-16-17").to_dict() # converts matches to dict MatchesDict([('episode', [14, 15, 16, 17]), ('version', 2)]) Patterns parameters @@ -424,17 +424,19 @@ Retrieves a sequence of all ``Match.tags`` properties. -- ``to_dict(details=False, implicit=False)`` +- ``to_dict(details=False, first_value=False, enforce_list=False)`` Convert to an ordered dict, with ``Match.name`` as key and ``Match.value`` as value. It's a subclass of `OrderedDict`_, that contains a ``matches`` property which is a dict with ``Match.name`` as key and list of ``Match`` objects as value. - If ``implicit`` is ``True`` and distinct values are found for the same name, value will be converted as list. + If ``first_value`` is ``True`` and distinct values are found for the same name, value will be wrapped to a list. If ``False``, first value only will be kept and values lists can be retrieved with ``values_list`` which is a dict with ``Match.name`` as key and list of ``Match.value`` as value. + if ``enforce_list`` is ``True``, all values will be wrapped to a list, even if a single value is found. + If ``details`` is True, ``Match.value`` objects are replaced with complete ``Match`` object. - ``markers`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/__version__.py new/rebulk-0.9.0/rebulk/__version__.py --- old/rebulk-0.8.2/rebulk/__version__.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/__version__.py 2017-05-31 15:41:51.000000000 +0200 @@ -4,4 +4,4 @@ Version module """ # pragma: no cover -__version__ = '0.8.2' +__version__ = '0.9.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/chain.py new/rebulk-0.9.0/rebulk/chain.py --- old/rebulk-0.8.2/rebulk/chain.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/chain.py 2017-05-31 15:41:51.000000000 +0200 @@ -300,14 +300,14 @@ if not is_chain_start: separator = chain_input_string[0:chain_part_matches[0].initiator.raw_start] - if len(separator) > 0: + if separator: return [] j = 1 for i in range(0, len(chain_part_matches) - 1): separator = chain_input_string[chain_part_matches[i].initiator.raw_end: chain_part_matches[i + 1].initiator.raw_start] - if len(separator) > 0: + if separator: break j += 1 truncated = chain_part_matches[:j] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/match.py new/rebulk-0.9.0/rebulk/match.py --- old/rebulk-0.8.2/rebulk/match.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/match.py 2017-05-31 15:41:51.000000000 +0200 @@ -38,7 +38,7 @@ _base_remove = _base.remove _base_extend = _base.extend - def __init__(self, matches=None, input_string=None): + def __init__(self, matches=None, input_string=None): # pylint: disable=super-init-not-called self.input_string = input_string self._max_end = 0 self._delegate = [] @@ -493,14 +493,17 @@ """ return self._tag_dict.keys() - def to_dict(self, details=False, implicit=False): + def to_dict(self, details=False, first_value=False, enforce_list=False): """ Converts matches to a dict object. :param details if True, values will be complete Match object, else it will be only string Match.value property :type details: bool - :param implicit if True, multiple values will be set as a list in the dict. Else, only the first value - will be kept. - :type implicit: bool + :param first_value if True, only the first value will be kept. Else, multiple values will be set as a list in + the dict. + :type first_value: bool + :param enforce_list: if True, value is wrapped in a list even when a single value is found. Else, list values + are available under `values_list` property of the returned dict object. + :type enforce_list: bool :return: :rtype: dict """ @@ -508,10 +511,10 @@ for match in sorted(self): value = match if details else match.value ret.matches[match.name].append(match) - if value not in ret.values_list[match.name]: + if not enforce_list and value not in ret.values_list[match.name]: ret.values_list[match.name].append(value) if match.name in ret.keys(): - if implicit: + if not first_value: if not isinstance(ret[match.name], list): if ret[match.name] == value: continue @@ -521,7 +524,10 @@ continue ret[match.name].append(value) else: - ret[match.name] = value + if enforce_list and not isinstance(value, list): + ret[match.name] = [value] + else: + ret[match.name] = value return ret if six.PY2: # pragma: no cover @@ -561,9 +567,9 @@ def __repr__(self): return self._delegate.__repr__() - def insert(self, index, match): - self._delegate.insert(index, match) - self._add_match(match) + def insert(self, index, value): + self._delegate.insert(index, value) + self._add_match(value) class Matches(_BaseMatches): @@ -671,12 +677,11 @@ """ if not self.children: return set([self.name]) - else: - ret = set() - for child in self.children: - for name in child.names: - ret.add(name) - return ret + ret = set() + for child in self.children: + for name in child.names: + ret.add(name) + return ret @property def raw_start(self): @@ -768,10 +773,10 @@ # crop is included in self, split current ... right = copy.deepcopy(current) current.end = start - if len(current) <= 0: + if not current: ret.remove(current) right.start = end - if len(right) > 0: + if right: ret.append(right) elif end <= current.end and end > current.start: current.start = end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/pattern.py new/rebulk-0.9.0/rebulk/pattern.py --- old/rebulk-0.8.2/rebulk/pattern.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/pattern.py 2017-05-31 15:41:51.000000000 +0200 @@ -136,7 +136,7 @@ :return: :rtype: """ - if len(match) == 0 or match.value == "": + if not match or match.value == "": return False pattern_value = get_first_defined(self.values, [match.name, '__parent__', None], @@ -164,7 +164,7 @@ :return: :rtype: """ - if len(child) == 0 or child.value == "": + if not child or child.value == "": return False pattern_value = get_first_defined(self.values, [child.name, '__children__', None], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/processors.py new/rebulk-0.9.0/rebulk/processors.py --- old/rebulk-0.8.2/rebulk/processors.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/processors.py 2017-05-31 15:41:51.000000000 +0200 @@ -51,6 +51,7 @@ return _default_conflict_solver def when(self, matches, context): + # pylint:disable=too-many-nested-blocks to_remove_matches = IdentitySet() public_matches = [match for match in matches if not match.private] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/default_rules_module.py new/rebulk-0.9.0/rebulk/test/default_rules_module.py --- old/rebulk-0.8.2/rebulk/test/default_rules_module.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/default_rules_module.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, len-as-condition from ..match import Match from ..rules import Rule, RemoveMatch, AppendMatch, RenameMatch, AppendTags, RemoveTags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/rebulk_rules_module.py new/rebulk-0.9.0/rebulk/test/rebulk_rules_module.py --- old/rebulk-0.8.2/rebulk/test/rebulk_rules_module.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/rebulk_rules_module.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, len-as-condition from rebulk.rules import Rule, RemoveMatch, CustomRule diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/rules_module.py new/rebulk-0.9.0/rebulk/test/rules_module.py --- old/rebulk-0.8.2/rebulk/test/rules_module.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/rules_module.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, len-as-condition from ..match import Match from ..rules import Rule diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_chain.py new/rebulk-0.9.0/rebulk/test/test_chain.py --- old/rebulk-0.8.2/rebulk/test/test_chain.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_chain.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, no-member +# pylint: disable=no-self-use, pointless-statement, missing-docstring, no-member, len-as-condition import re from functools import partial diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_debug.py new/rebulk-0.9.0/rebulk/test/test_debug.py --- old/rebulk-0.8.2/rebulk/test/test_debug.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_debug.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, protected-access, invalid-name +# pylint: disable=no-self-use, pointless-statement, missing-docstring, protected-access, invalid-name, len-as-condition from ..pattern import StringPattern from ..rebulk import Rebulk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_introspector.py new/rebulk-0.9.0/rebulk/test/test_introspector.py --- old/rebulk-0.8.2/rebulk/test/test_introspector.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_introspector.py 2017-05-31 15:41:51.000000000 +0200 @@ -3,7 +3,7 @@ """ Introspector tests """ -# pylint: disable=no-self-use,pointless-statement,missing-docstring,protected-access,invalid-name +# pylint: disable=no-self-use,pointless-statement,missing-docstring,protected-access,invalid-name,len-as-condition from ..rebulk import Rebulk from .. import introspector from .default_rules_module import RuleAppend2, RuleAppend3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_loose.py new/rebulk-0.9.0/rebulk/test/test_loose.py --- old/rebulk-0.8.2/rebulk/test/test_loose.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_loose.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, len-as-condition from ..loose import call diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_match.py new/rebulk-0.9.0/rebulk/test/test_match.py --- old/rebulk-0.8.2/rebulk/test/test_match.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_match.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, unneeded-not +# pylint: disable=no-self-use, pointless-statement, missing-docstring, unneeded-not, len-as-condition import pytest import six @@ -419,7 +419,7 @@ matches.extend(RePattern("Three", name="3bis", tags=["Three", "re"]).matches(input_string)) matches.extend(RePattern(r"(\w+)", name="words").matches(input_string)) - kvalues = matches.to_dict() + kvalues = matches.to_dict(first_value=True) assert kvalues == {"1": "One", "2": "Two", "3": "Three", @@ -427,7 +427,10 @@ "words": "One"} assert kvalues.values_list["words"] == ["One", "Two", "Three"] - kvalues = matches.to_dict(details=True, implicit=True) + kvalues = matches.to_dict(enforce_list=True) + assert kvalues["words"] == ["One", "Two", "Three"] + + kvalues = matches.to_dict(details=True) assert kvalues["1"].value == "One" assert len(kvalues["2"]) == 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_pattern.py new/rebulk-0.9.0/rebulk/test/test_pattern.py --- old/rebulk-0.8.2/rebulk/test/test_pattern.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_pattern.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, unbalanced-tuple-unpacking +# pylint: disable=no-self-use, pointless-statement, missing-docstring, unbalanced-tuple-unpacking, len-as-condition import re import pytest @@ -396,10 +396,10 @@ children = matches[0].children assert len(children) == 2 - assert children[0].name is "test" + assert children[0].name == "test" assert children[0].value == "HE" - assert children[1].name is "test" + assert children[1].name == "test" assert children[1].value == "HE" pattern = RePattern("H(?P<first>e.)(?P<second>rew)", name="test", value="HE") @@ -807,8 +807,7 @@ def invalid_func(match): if match.name == 'intParam': return True - else: - return match.value.startswith('abc') + return match.value.startswith('abc') pattern = RePattern(r"contains (?P<intParam>\d+)", formatter=int, validator=invalid_func, validate_all=True, children=True) @@ -819,8 +818,7 @@ def func(match): if match.name == 'intParam': return True - else: - return match.value.startswith('contains') + return match.value.startswith('contains') pattern = RePattern(r"contains (?P<intParam>\d+)", formatter=int, validator=func, validate_all=True, children=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_processors.py new/rebulk-0.9.0/rebulk/test/test_processors.py --- old/rebulk-0.8.2/rebulk/test/test_processors.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_processors.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, no-member +# pylint: disable=no-self-use, pointless-statement, missing-docstring, no-member, len-as-condition from ..pattern import StringPattern, RePattern from ..processors import ConflictSolver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_rebulk.py new/rebulk-0.9.0/rebulk/test/test_rebulk.py --- old/rebulk-0.8.2/rebulk/test/test_rebulk.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_rebulk.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, no-member +# pylint: disable=no-self-use, pointless-statement, missing-docstring, no-member, len-as-condition from ..rebulk import Rebulk from ..rules import Rule diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_rules.py new/rebulk-0.9.0/rebulk/test/test_rules.py --- old/rebulk-0.8.2/rebulk/test/test_rules.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_rules.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, no-member +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, no-member, len-as-condition import pytest from rebulk.test.default_rules_module import RuleRemove0, RuleAppend0, RuleRename0, RuleAppend1, RuleRemove1, \ RuleRename1, RuleAppend2, RuleRename2, RuleAppend3, RuleRename3, RuleAppendTags0, RuleRemoveTags0, \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/test/test_validators.py new/rebulk-0.9.0/rebulk/test/test_validators.py --- old/rebulk-0.8.2/rebulk/test/test_validators.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/test/test_validators.py 2017-05-31 15:41:51.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name +# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name,len-as-condition from functools import partial diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk/utils.py new/rebulk-0.9.0/rebulk/utils.py --- old/rebulk-0.8.2/rebulk/utils.py 2016-11-27 15:43:31.000000000 +0100 +++ new/rebulk-0.9.0/rebulk/utils.py 2017-05-31 15:41:51.000000000 +0200 @@ -83,6 +83,7 @@ We don't need to check for the Python 2 `unicode` type, because it doesn't have an `__iter__` attribute anyway. """ + # pylint: disable=consider-using-ternary return hasattr(obj, '__iter__') and not isinstance(obj, str) or isinstance(obj, GeneratorType) @@ -117,7 +118,7 @@ """ Set based on identity """ - def __init__(self, items=None): + def __init__(self, items=None): # pylint: disable=super-init-not-called if items is None: items = [] self.refs = set(map(_Ref, items)) @@ -131,11 +132,11 @@ def __len__(self): return len(self.refs) - def add(self, elem): - self.refs.add(_Ref(elem)) + def add(self, value): + self.refs.add(_Ref(value)) - def discard(self, elem): - self.refs.discard(_Ref(elem)) + def discard(self, value): + self.refs.discard(_Ref(value)) def update(self, iterable): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rebulk-0.8.2/rebulk.egg-info/PKG-INFO new/rebulk-0.9.0/rebulk.egg-info/PKG-INFO --- old/rebulk-0.8.2/rebulk.egg-info/PKG-INFO 2016-11-27 15:43:34.000000000 +0100 +++ new/rebulk-0.9.0/rebulk.egg-info/PKG-INFO 2017-05-31 15:41:53.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.1 Name: rebulk -Version: 0.8.2 +Version: 0.9.0 Summary: Rebulk - Define simple search patterns in bulk to perform advanced matching on any string. Home-page: https://github.com/Toilal/rebulk/ Author: Rémi Alvergnat Author-email: [email protected] License: MIT -Download-URL: https://pypi.python.org/packages/source/r/rebulk/rebulk-0.8.2.tar.gz +Download-URL: https://pypi.python.org/packages/source/r/rebulk/rebulk-0.9.0.tar.gz Description: ReBulk ======= @@ -183,7 +183,7 @@ ... .regex(r'v(?P<version>\d+)').repeater('?')\ ... .regex(r'[ex-](?P<episode>\d{1,4})').repeater('*')\ ... .close() # .repeater(1) could be omitted as it's the default behavior - >>> r.matches("This is E14v2-15-16-17").to_dict(implicit=True) # converts matches to dict and keep multiple values + >>> r.matches("This is E14v2-15-16-17").to_dict() # converts matches to dict MatchesDict([('episode', [14, 15, 16, 17]), ('version', 2)]) Patterns parameters @@ -433,17 +433,19 @@ Retrieves a sequence of all ``Match.tags`` properties. - - ``to_dict(details=False, implicit=False)`` + - ``to_dict(details=False, first_value=False, enforce_list=False)`` Convert to an ordered dict, with ``Match.name`` as key and ``Match.value`` as value. It's a subclass of `OrderedDict`_, that contains a ``matches`` property which is a dict with ``Match.name`` as key and list of ``Match`` objects as value. - If ``implicit`` is ``True`` and distinct values are found for the same name, value will be converted as list. + If ``first_value`` is ``True`` and distinct values are found for the same name, value will be wrapped to a list. If ``False``, first value only will be kept and values lists can be retrieved with ``values_list`` which is a dict with ``Match.name`` as key and list of ``Match.value`` as value. + if ``enforce_list`` is ``True``, all values will be wrapped to a list, even if a single value is found. + If ``details`` is True, ``Match.value`` objects are replaced with complete ``Match`` object. - ``markers``
