diff --git a/.travis.yml b/.travis.yml index 9d65d52..bca7359 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: python python: - '2.7' + - '3.2' - '3.3' - '3.4' - - '3.5' install: - pip install coveralls flake8 nose>=1.3.0 - python setup.py install diff --git a/docs/release_notes.rst b/docs/release_notes.rst index d45e4e9..1d9050d 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -1,10 +1,6 @@ Release Notes ============= -v0.1.5 ------- -* Added a method to get a set of all field keys used in a kmatch pattern - v0.1.3 ------ * Added KmatchTestMixin for tests diff --git a/kmatch/kmatch.py b/kmatch/kmatch.py index f6f223d..1223dd8 100644 --- a/kmatch/kmatch.py +++ b/kmatch/kmatch.py @@ -152,30 +152,3 @@ def match(self, value): suppress_key_errors class variable is False """ return self._match(self._compiled_pattern, value) - - def get_field_keys(self, pattern=None): - """ - Builds a set of all field keys used in the pattern including nested fields. - - :param pattern: The kmatch pattern to get field keys from or None to use self.pattern - :type pattern: list or None - :returns: A set object of all field keys used in the pattern - :rtype: set - """ - # Use own pattern or passed in argument for recursion - pattern = pattern or self.pattern - keys = set() - - # Valid pattern length can only be 2 or 3 - if len(pattern) == 2: - if pattern[0] in ('&', '|', '^'): - # Pass each nested pattern to get_field_keys - for filter_item in pattern[1]: - keys = keys.union(self.get_field_keys(filter_item)) - else: - # pattern[0] == '!' - keys = keys.union(self.get_field_keys(pattern[1])) - else: - # Pattern length is 3 - keys.add(pattern[1]) - return keys diff --git a/kmatch/tests/kmatch_tests.py b/kmatch/tests/kmatch_tests.py index e0d8741..a0eb163 100644 --- a/kmatch/tests/kmatch_tests.py +++ b/kmatch/tests/kmatch_tests.py @@ -225,27 +225,6 @@ def test_xor_false(self): ]).match({'email': 'opensource@ambition.com', 'e-mail': 'opensource@ambition.com'})) - def test_get_field_keys(self): - """ - Verifies that all field keys are returned - """ - pattern = ['&', [ - ['=~', 'one', 'one value'], - ['=~', 'two', 'two value'], - ['|', [ - ['=~', 'three', 'three value'], - ['!', ['=~', 'one', 'other one value']], - ['^', [ - ['==', 'five', 'five value'], - ['==', 'five', 'five value'] - ]], - ['&', [ - ['=~', 'four', 'four value'], - ]] - ]], - ]] - self.assertEqual(K(pattern).get_field_keys(), set(['one', 'two', 'three', 'four', 'five'])) - class KInitTest(TestCase): """ diff --git a/kmatch/version.py b/kmatch/version.py index 66a87bb..7525d19 100644 --- a/kmatch/version.py +++ b/kmatch/version.py @@ -1 +1 @@ -__version__ = '0.1.5' +__version__ = '0.1.4' diff --git a/setup.py b/setup.py index b3178ff..90498a2 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,9 @@ def get_version(): packages=find_packages(), classifiers=[ 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent',