commit 9bc1fa1a8147322468eaa657b2fa9517d1c9670a78bcbcf60a05cbe418802f85 Author: Markéta Machová Date: Thu Aug 29 12:40:25 2024 +0000 - version update to 0.6.3 * Copy structured test suite to "tests/parse_tests/" * Copy structured test suite to "tests/parse_tests_with_parse_type" * REMOVE: tests/test_parse.py * README: Fix compact display of BADGES (was using multi-line) * CI: Add support for Python 3.12 - added patches fix https://github.com/jenisys/parse_type/pull/24 + python-parse_type-remove-python2.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-parse_type?expand=0&rev=16 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-parse_type-remove-python2.patch b/python-parse_type-remove-python2.patch new file mode 100644 index 0000000..5dfa6cb --- /dev/null +++ b/python-parse_type-remove-python2.patch @@ -0,0 +1,656 @@ +From b0d9934405de8da0640ca7f6f1b9bd7e73ae390d Mon Sep 17 00:00:00 2001 +From: Alexandre Detiste +Date: Wed, 28 Aug 2024 13:41:35 +0200 +Subject: [PATCH] remove Python 2 support + +--- + bin/make_localpi.py | 3 +-- + bin/toxcmd.py | 3 +-- + parse_type/__init__.py | 1 - + parse_type/builder.py | 1 - + parse_type/cardinality.py | 4 +--- + parse_type/cardinality_field.py | 8 +++----- + parse_type/cfparse.py | 1 - + parse_type/parse.py | 9 ++++----- + parse_type/parse_util.py | 8 +++----- + py.requirements/basic.txt | 5 +---- + pyproject.toml | 8 ++------ + setup.py | 10 +++------- + tasks/__init__.py | 2 -- + tasks/__main__.py | 2 -- + tasks/docs.py | 1 - + tasks/invoke_dry_run.py | 3 +-- + tasks/py.requirements.txt | 1 - + tasks/release.py | 1 - + tasks/test.py | 1 - + tests/parse_tests_with_parse_type/test_bugs.py | 1 - + tests/parse_tests_with_parse_type/test_findall.py | 1 - + tests/parse_tests_with_parse_type/test_parse.py | 1 - + tests/parse_tests_with_parse_type/test_parsetype.py | 1 - + tests/parse_tests_with_parse_type/test_pattern.py | 1 - + tests/parse_tests_with_parse_type/test_result.py | 1 - + tests/parse_tests_with_parse_type/test_search.py | 1 - + tests/parse_type_test.py | 6 +----- + tests/test_builder.py | 1 - + tests/test_cardinality.py | 1 - + tests/test_cardinality_field.py | 1 - + tests/test_cardinality_field0.py | 1 - + tests/test_cfparse.py | 1 - + tests/test_parse_decorator.py | 7 +++---- + tests/test_parse_number.py | 1 - + tests/test_parse_util.py | 1 - + 35 files changed, 24 insertions(+), 75 deletions(-) + +diff --git a/bin/make_localpi.py b/bin/make_localpi.py +index 7661bb6..d093e3d 100755 +--- a/bin/make_localpi.py ++++ b/bin/make_localpi.py +@@ -38,7 +38,6 @@ + pip install --find-links=/tmp/downloads --no-index argparse Jinja2 + """ + +-from __future__ import with_statement, print_function + from fnmatch import fnmatch + import os.path + import shutil +@@ -51,7 +50,7 @@ + __copyright__ = "(c) 2013 by Jens Engel" + + +-class Package(object): ++class Package: + """ + Package entity that keeps track of: + * one or more versions of this package +diff --git a/bin/toxcmd.py b/bin/toxcmd.py +index 38bb6d5..c73261f 100755 +--- a/bin/toxcmd.py ++++ b/bin/toxcmd.py +@@ -7,7 +7,6 @@ + + * copytree + * copy +- * py2to3 + + REQUIRES: + * argparse +@@ -181,7 +180,7 @@ def discover_commands(): + return commands + + +-class Command(object): ++class Command: + def __init__(self, name, func): + assert isinstance(name, basestring) + assert callable(func) +diff --git a/parse_type/__init__.py b/parse_type/__init__.py +index 8147313..551cbd0 100644 +--- a/parse_type/__init__.py ++++ b/parse_type/__init__.py +@@ -6,7 +6,6 @@ + parse-types from other, existing types. + """ + +-from __future__ import absolute_import + from parse_type.cardinality import Cardinality + from parse_type.builder import TypeBuilder, build_type_dict + +diff --git a/parse_type/builder.py b/parse_type/builder.py +index ed5cda1..5843e94 100644 +--- a/parse_type/builder.py ++++ b/parse_type/builder.py +@@ -61,7 +61,6 @@ + + """ + +-from __future__ import absolute_import + import inspect + import re + import enum +diff --git a/parse_type/cardinality.py b/parse_type/cardinality.py +index 6857767..1f3e0b0 100644 +--- a/parse_type/cardinality.py ++++ b/parse_type/cardinality.py +@@ -4,8 +4,6 @@ + for a data type with the specified cardinality. + """ + +-# -- USE: enum34 +-from __future__ import absolute_import + from enum import Enum + + +@@ -84,7 +82,7 @@ def compute_group_count(self, pattern): + # ----------------------------------------------------------------------------- + # CLASS: TypeBuilder + # ----------------------------------------------------------------------------- +-class TypeBuilder(object): ++class TypeBuilder: + """Provides a utility class to build type-converters (parse_types) for parse. + It supports to build new type-converters for different cardinality + based on the type-converter for cardinality one. +diff --git a/parse_type/cardinality_field.py b/parse_type/cardinality_field.py +index 4e892ed..25c2215 100644 +--- a/parse_type/cardinality_field.py ++++ b/parse_type/cardinality_field.py +@@ -8,8 +8,6 @@ + "{persons:Person+}" #< Cardinality: 1..* = one or more = many + """ + +-from __future__ import absolute_import +-import six + from parse_type.cardinality import Cardinality, TypeBuilder + + +@@ -19,7 +17,7 @@ class MissingTypeError(KeyError): # pylint: disable=missing-docstring + # ----------------------------------------------------------------------------- + # CLASS: Cardinality (Field Part) + # ----------------------------------------------------------------------------- +-class CardinalityField(object): ++class CardinalityField: + """Cardinality field for parse format expression, ala: + + "{person:Person?}" #< Cardinality: 0..1 = zero or one = optional +@@ -81,7 +79,7 @@ def make_type(cls, basename, cardinality): + # ----------------------------------------------------------------------------- + # CLASS: CardinalityFieldTypeBuilder + # ----------------------------------------------------------------------------- +-class CardinalityFieldTypeBuilder(object): ++class CardinalityFieldTypeBuilder: + """Utility class to create type converters based on: + + * the CardinalityField naming scheme and +@@ -115,7 +113,7 @@ def parse_number(text): + :raises: ValueError, if type_name does not end with CardinalityField + :raises: MissingTypeError, if type_converter is missing in type_dict + """ +- assert isinstance(type_name, six.string_types) ++ assert isinstance(type_name, str) + if not CardinalityField.matches_type(type_name): + message = "type_name='%s' has no CardinalityField" % type_name + raise ValueError(message) +diff --git a/parse_type/cfparse.py b/parse_type/cfparse.py +index 1032a87..29a8baf 100644 +--- a/parse_type/cfparse.py ++++ b/parse_type/cfparse.py +@@ -4,7 +4,6 @@ + cardinality fields in (user-defined) types. + """ + +-from __future__ import absolute_import + import logging + import parse + from .cardinality_field import CardinalityField, CardinalityFieldTypeBuilder +diff --git a/parse_type/parse.py b/parse_type/parse.py +index fd1a01d..fcb274a 100644 +--- a/parse_type/parse.py ++++ b/parse_type/parse.py +@@ -11,7 +11,6 @@ + # pylint: disable=all + # + # -- ORIGINAL-CODE STARTS-HERE ------------------------------------------------ +-from __future__ import absolute_import + + import logging + import re +@@ -414,7 +413,7 @@ def extract_format(format, extra_types): + PARSE_RE = re.compile(r"({{|}}|{[\w-]*(?:\.[\w-]+|\[[^]]+])*(?::[^}]+)?})") + + +-class Parser(object): ++class Parser: + """Encapsulate a format string that may be used to parse other strings.""" + + def __init__(self, format, extra_types=None, case_sensitive=False): +@@ -868,7 +867,7 @@ def _handle_field(self, field): + return s + + +-class Result(object): ++class Result: + """The result of a parse() or search(). + + Fixed results may be looked up using `result[index]`. +@@ -896,7 +895,7 @@ def __contains__(self, name): + return name in self.named + + +-class Match(object): ++class Match: + """The result of a parse() or search() if no results are generated. + + This class is only used to expose internal used regex match objects +@@ -912,7 +911,7 @@ def evaluate_result(self): + return self.parser.evaluate_result(self.match) + + +-class ResultIterator(object): ++class ResultIterator: + """The result of a findall() operation. + + Each element is a Result instance. +diff --git a/parse_type/parse_util.py b/parse_type/parse_util.py +index 0e5ee73..64c1441 100644 +--- a/parse_type/parse_util.py ++++ b/parse_type/parse_util.py +@@ -4,10 +4,8 @@ + Provides generic utility classes for the :class:`parse.Parser` class. + """ + +-from __future__ import absolute_import + from collections import namedtuple + import parse +-import six + + + # -- HELPER-CLASS: For format part in a Field. +@@ -21,7 +19,7 @@ def make_format_spec(type=None, width="", zero=False, align=None, fill=None, + return FormatSpec(type, width, zero, align, fill, precision) + # pylint: enable=redefined-builtin + +-class Field(object): ++class Field: + """ + Provides a ValueObject for a Field in a parse expression. + +@@ -66,7 +64,7 @@ def __eq__(self, other): + format1 = self.format or "" + format2 = other.format or "" + return (self.name == other.name) and (format1 == format2) +- elif isinstance(other, six.string_types): ++ elif isinstance(other, str): + return str(self) == other + else: + raise ValueError(other) +@@ -150,7 +148,7 @@ def extract_format_spec(cls, format): + return FormatSpec(type, width, zero, align, fill, precision) + + +-class FieldParser(object): ++class FieldParser: + """ + Utility class that parses/extracts fields in parse expressions. + """ +diff --git a/py.requirements/basic.txt b/py.requirements/basic.txt +index b9735ab..0d72a6a 100644 +--- a/py.requirements/basic.txt ++++ b/py.requirements/basic.txt +@@ -8,7 +8,4 @@ + # * http://www.pip-installer.org/ + # ============================================================================ + +-parse >= 1.18.0; python_version >= '3.0' +-parse >= 1.13.1; python_version <= '2.7' +-enum34; python_version < '3.4' +-six >= 1.15 ++parse >= 1.18.0 +diff --git a/pyproject.toml b/pyproject.toml +index ba02098..1211515 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -16,7 +16,7 @@ authors = [ + ] + description = "Simplifies to build parse types based on the parse module" + readme = "README.rst" +-requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" ++requires-python = ">=3.2" + keywords = ["parse", "parsing"] + license = {text = "MIT"} + classifiers = [ +@@ -26,7 +26,6 @@ classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +- "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", +@@ -43,10 +42,7 @@ classifiers = [ + "Topic :: Software Development :: Libraries :: Python Modules", + ] + dependencies = [ +- "parse >= 1.18.0; python_version >= '3.0'", +- "parse >= 1.13.1; python_version <= '2.7'", +- "enum34; python_version < '3.4'", +- "six >= 1.15", ++ "parse >= 1.18.0", + ] + # PREPARED: + dynamic = ["version"] +diff --git a/setup.py b/setup.py +index e44d7ee..650431a 100644 +--- a/setup.py ++++ b/setup.py +@@ -66,12 +66,9 @@ def find_packages_by_root_package(where): + include_package_data = True, + + # -- REQUIREMENTS: +- python_requires=">=2.7, !=3.0.*, !=3.1.*", ++ python_requires=">=3.2", + install_requires=[ +- "parse >= 1.18.0; python_version >= '3.0'", +- "parse >= 1.13.1; python_version <= '2.7'", +- "enum34; python_version < '3.4'", +- "six >= 1.15", ++ "parse >= 1.18.0", + ], + tests_require=[ + "pytest < 5.0; python_version < '3.0'", # >= 4.2 +@@ -88,8 +85,7 @@ def find_packages_by_root_package(where): + "build >= 0.5.1", + "twine >= 1.13.0", + "coverage >= 4.4", +- "pytest < 5.0; python_version < '3.0'", # >= 4.2 +- "pytest >= 5.0; python_version >= '3.0'", ++ "pytest >= 5.0", + "pytest-html >= 1.19.0", + "pytest-cov", + "tox >=2.8,<4.0", +diff --git a/tasks/__init__.py b/tasks/__init__.py +index c96729c..b51ae64 100644 +--- a/tasks/__init__.py ++++ b/tasks/__init__.py +@@ -12,8 +12,6 @@ + * https://github.com/pyinvoke/invoke + """ + +-from __future__ import absolute_import, print_function +- + # ----------------------------------------------------------------------------- + # IMPORTS: + # ----------------------------------------------------------------------------- +diff --git a/tasks/__main__.py b/tasks/__main__.py +index d8d9174..110ac5b 100644 +--- a/tasks/__main__.py ++++ b/tasks/__main__.py +@@ -18,8 +18,6 @@ + * https://github.com/pyinvoke/invoke + """ + +-from __future__ import absolute_import, print_function +- + # ----------------------------------------------------------------------------- + # AUTO-MAIN: + # ----------------------------------------------------------------------------- +diff --git a/tasks/docs.py b/tasks/docs.py +index 3360279..e1bdd00 100644 +--- a/tasks/docs.py ++++ b/tasks/docs.py +@@ -3,7 +3,6 @@ + Provides tasks to build documentation with sphinx, etc. + """ + +-from __future__ import absolute_import, print_function + import os + import sys + from invoke import task, Collection +diff --git a/tasks/invoke_dry_run.py b/tasks/invoke_dry_run.py +index 308d5fe..256a193 100644 +--- a/tasks/invoke_dry_run.py ++++ b/tasks/invoke_dry_run.py +@@ -15,7 +15,6 @@ def destroy_something(ctx, path, dry_run=False): + ctx.run("rm -rf {}".format(path)) + """ + +-from __future__ import print_function + from contextlib import contextmanager + + @contextmanager +@@ -36,7 +35,7 @@ def dry_run_mode(ctx): + ctx.config.run.dry = initial_dry_run + + +-class DryRunContext(object): ++class DryRunContext: + PREFIX = "DRY-RUN: " + SCHEMA = "{prefix}{command}" + SCHEMA_WITH_KWARGS = "{prefix}{command} (with kwargs={kwargs})" +diff --git a/tasks/py.requirements.txt b/tasks/py.requirements.txt +index 99a369f..3a30f7d 100644 +--- a/tasks/py.requirements.txt ++++ b/tasks/py.requirements.txt +@@ -11,7 +11,6 @@ + invoke >=1.7.0,<2.0; python_version < '3.6' + invoke >=1.7.0; python_version >= '3.6' + pycmd +-six >= 1.15.0 + + # -- HINT, was RENAMED: path.py => path (for python3) + path >= 13.1.0; python_version >= '3.5' +diff --git a/tasks/release.py b/tasks/release.py +index 6a2594c..620d94f 100644 +--- a/tasks/release.py ++++ b/tasks/release.py +@@ -49,7 +49,6 @@ + * https://packaging.python.org/tutorials/distributing-packages/ + """ + +-from __future__ import absolute_import, print_function + from invoke import Collection, task + from invoke_cleanup import path_glob + from .invoke_dry_run import DryRunContext +diff --git a/tasks/test.py b/tasks/test.py +index 6fe045c..f3104eb 100644 +--- a/tasks/test.py ++++ b/tasks/test.py +@@ -3,7 +3,6 @@ + Invoke test tasks. + """ + +-from __future__ import print_function + import os.path + import sys + from invoke import task, Collection +diff --git a/tests/parse_tests_with_parse_type/test_bugs.py b/tests/parse_tests_with_parse_type/test_bugs.py +index 05284db..da4d053 100644 +--- a/tests/parse_tests_with_parse_type/test_bugs.py ++++ b/tests/parse_tests_with_parse_type/test_bugs.py +@@ -1,5 +1,4 @@ + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + +diff --git a/tests/parse_tests_with_parse_type/test_findall.py b/tests/parse_tests_with_parse_type/test_findall.py +index c49bdc0..000cce6 100644 +--- a/tests/parse_tests_with_parse_type/test_findall.py ++++ b/tests/parse_tests_with_parse_type/test_findall.py +@@ -1,5 +1,4 @@ + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + # -- ORIGINAL_SOURCE_STARTS_HERE: +diff --git a/tests/parse_tests_with_parse_type/test_parse.py b/tests/parse_tests_with_parse_type/test_parse.py +index 5f23642..751a681 100644 +--- a/tests/parse_tests_with_parse_type/test_parse.py ++++ b/tests/parse_tests_with_parse_type/test_parse.py +@@ -1,6 +1,5 @@ + # coding: utf-8 + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + # -- ORIGINAL_SOURCE_STARTS_HERE: +diff --git a/tests/parse_tests_with_parse_type/test_parsetype.py b/tests/parse_tests_with_parse_type/test_parsetype.py +index f791bd5..dddcfb5 100644 +--- a/tests/parse_tests_with_parse_type/test_parsetype.py ++++ b/tests/parse_tests_with_parse_type/test_parsetype.py +@@ -1,5 +1,4 @@ + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + # -- ORIGINAL_SOURCE_STARTS_HERE: +diff --git a/tests/parse_tests_with_parse_type/test_pattern.py b/tests/parse_tests_with_parse_type/test_pattern.py +index b02a877..e144b48 100644 +--- a/tests/parse_tests_with_parse_type/test_pattern.py ++++ b/tests/parse_tests_with_parse_type/test_pattern.py +@@ -1,5 +1,4 @@ + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + # -- ORIGINAL_SOURCE_STARTS_HERE: +diff --git a/tests/parse_tests_with_parse_type/test_result.py b/tests/parse_tests_with_parse_type/test_result.py +index 2ff4c68..15849cb 100644 +--- a/tests/parse_tests_with_parse_type/test_result.py ++++ b/tests/parse_tests_with_parse_type/test_result.py +@@ -1,5 +1,4 @@ + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + # -- ORIGINAL_SOURCE_STARTS_HERE: +diff --git a/tests/parse_tests_with_parse_type/test_search.py b/tests/parse_tests_with_parse_type/test_search.py +index 5a4a9c4..d6108aa 100644 +--- a/tests/parse_tests_with_parse_type/test_search.py ++++ b/tests/parse_tests_with_parse_type/test_search.py +@@ -1,5 +1,4 @@ + # -- REPLACE: parse with parse_type.parse +-from __future__ import absolute_import, print_function + from parse_type import parse + + # -- ORIGINAL_SOURCE_STARTS_HERE: +diff --git a/tests/parse_type_test.py b/tests/parse_type_test.py +index e254279..f768ce8 100755 +--- a/tests/parse_type_test.py ++++ b/tests/parse_type_test.py +@@ -1,12 +1,8 @@ + # -*- coding: utf-8 -*- + +-from __future__ import absolute_import + from parse_type import TypeBuilder + from enum import Enum +-try: +- import unittest2 as unittest +-except ImportError: +- import unittest ++import unittest + + + # ----------------------------------------------------------------------------- +diff --git a/tests/test_builder.py b/tests/test_builder.py +index bf6582a..26f3ee9 100755 +--- a/tests/test_builder.py ++++ b/tests/test_builder.py +@@ -6,7 +6,6 @@ + REQUIRES: parse >= 1.8.4 ('pattern' attribute support) + """ + +-from __future__ import absolute_import + import re + import unittest + import parse +diff --git a/tests/test_cardinality.py b/tests/test_cardinality.py +index 621e2e6..4b971c4 100755 +--- a/tests/test_cardinality.py ++++ b/tests/test_cardinality.py +@@ -4,7 +4,6 @@ + Test suite to test the :mod:`parse_type.cardinality` module. + """ + +-from __future__ import absolute_import + from .parse_type_test import ParseTypeTestCase, parse_number + from parse_type import Cardinality, TypeBuilder, build_type_dict + from parse import Parser +diff --git a/tests/test_cardinality_field.py b/tests/test_cardinality_field.py +index 3c59cb0..f939f30 100755 +--- a/tests/test_cardinality_field.py ++++ b/tests/test_cardinality_field.py +@@ -16,7 +16,6 @@ + IDEA, working prototype with patched parse module, but not accepted. + """ + +-from __future__ import absolute_import + from .parse_type_test \ + import TestCase, parse_number, unittest + from .test_cardinality import CardinalityTypeBuilderTest +diff --git a/tests/test_cardinality_field0.py b/tests/test_cardinality_field0.py +index 663a30a..aff4d66 100755 +--- a/tests/test_cardinality_field0.py ++++ b/tests/test_cardinality_field0.py +@@ -16,7 +16,6 @@ + IDEA, working prototype with patched parse module, but not accepted. + """ + +-from __future__ import absolute_import + from .parse_type_test import ParseTypeTestCase + from parse_type import TypeBuilder, build_type_dict + import parse +diff --git a/tests/test_cfparse.py b/tests/test_cfparse.py +index 732234e..d269cca 100644 +--- a/tests/test_cfparse.py ++++ b/tests/test_cfparse.py +@@ -5,7 +5,6 @@ + Test suite to test the :mod:`parse_type.cfparse` module. + """ + +-from __future__ import absolute_import + from .parse_type_test import ParseTypeTestCase, parse_number, unittest + from parse_type.cfparse import Parser + from parse_type.cardinality_field \ +diff --git a/tests/test_parse_decorator.py b/tests/test_parse_decorator.py +index bb1972a..a302d89 100755 +--- a/tests/test_parse_decorator.py ++++ b/tests/test_parse_decorator.py +@@ -5,7 +5,6 @@ + Integrated into :mod:`parse` module. + """ + +-from __future__ import absolute_import + import unittest + import parse + from parse_type import build_type_dict +@@ -54,7 +53,7 @@ def parse_number(text): + + def test_classmethod_with_pattern_decorator(self): + choice_pattern = r"Alice|Bob|Charly" +- class C(object): ++ class C: + @classmethod + @parse.with_pattern(choice_pattern) + def parse_choice(cls, text): +@@ -65,7 +64,7 @@ def parse_choice(cls, text): + + def test_staticmethod_with_pattern_decorator(self): + choice_pattern = r"Alice|Bob|Charly" +- class S(object): ++ class S: + @staticmethod + @parse.with_pattern(choice_pattern) + def parse_choice(text): +@@ -98,7 +97,7 @@ def parse_number(text): + + def test_decorated_classmethod_with_parser(self): + # -- SETUP: +- class C(object): ++ class C: + @classmethod + @parse.with_pattern(r"Alice|Bob|Charly") + def parse_person(cls, text): +diff --git a/tests/test_parse_number.py b/tests/test_parse_number.py +index 9a94df9..eb12656 100644 +--- a/tests/test_parse_number.py ++++ b/tests/test_parse_number.py +@@ -4,7 +4,6 @@ + Related to auto-detection of number base (base=10, 2, 8, 16). + """ + +-from __future__ import absolute_import, print_function + import pytest + import parse + +diff --git a/tests/test_parse_util.py b/tests/test_parse_util.py +index 5642277..f7dfbc6 100644 +--- a/tests/test_parse_util.py ++++ b/tests/test_parse_util.py +@@ -4,7 +4,6 @@ + Test suite to test the :mod:`parse_type.parse_util` module. + """ + +-from __future__ import absolute_import, print_function + from .parse_type_test import TestCase, unittest + from parse_type.parse_util \ + import Field, FieldParser, FormatSpec, make_format_spec + diff --git a/python-parse_type.changes b/python-parse_type.changes new file mode 100644 index 0000000..1c0eff1 --- /dev/null +++ b/python-parse_type.changes @@ -0,0 +1,83 @@ +------------------------------------------------------------------- +Thu Aug 29 10:20:41 UTC 2024 - pgajdos@suse.com + +- version update to 0.6.3 + * Copy structured test suite to "tests/parse_tests/" + * Copy structured test suite to "tests/parse_tests_with_parse_type" + * REMOVE: tests/test_parse.py + * README: Fix compact display of BADGES (was using multi-line) + * CI: Add support for Python 3.12 +- added patches + fix https://github.com/jenisys/parse_type/pull/24 + + python-parse_type-remove-python2.patch + +------------------------------------------------------------------- +Sun Dec 10 21:39:08 UTC 2023 - Dirk Müller + +- update to 0.6.2: + * #21: tests/test_parse.py tests ``parse_type.parse`` (per + default). + * REASON: Using for older installed ``parse`` module may + cause weird problems. + * RELATED TO: ``parse v1.19.1`` (behavior changed compared to + ``v1.19.0``) + +------------------------------------------------------------------- +Sun Jul 2 15:18:54 UTC 2023 - Matej Cepl + +- Update to 0.6.1: + - Switch to MIT license (same as: parse module) + - Use SPDX-License-Identifier in source code (to simplify + understanding) + - UPDATE/SYNC to parse v1.19.1 + - ADDED: pyproject.toml to support newer pip versions + - REASON: setup.py becomes DEPRECATED in 2023-09 for newer pip + versions. + - Issue #19: 0.6.0: pytest is failing in two units (caused by: + parse v1.19.1) + - Issue #1: Licensing confusion + +------------------------------------------------------------------- +Mon Feb 28 10:33:12 UTC 2022 - pgajdos@suse.com + +- version update to 0.6.0 + + issue #17: setup.py: Remove use of "use_2to3" + + parse issue #119 (same as: #121): int_convert memory effect with number-base discovery + + UPDATE to parse v1.18.0 (needed by: parse issue #119) + + parse PR #122: Fixes issue #121 in parse: int_convert memory effect. + + parse v1.17.0 + +------------------------------------------------------------------- +Wed Sep 23 09:50:41 UTC 2020 - Ondřej Súkup + +- python-enum34 is mandatory with pyhon2 + +------------------------------------------------------------------- +Sun Mar 15 09:32:31 UTC 2020 - Tomáš Chvátal + +- Update to 0.5.3: + * no changelog +- Remove not needed testsuite-fix.patch + +------------------------------------------------------------------- +Tue Aug 27 13:57:32 UTC 2019 - Marketa Calabkova + +- update to version 0.5.2 + * requires parse >= 1.12.0 + * test fixes +- shortened patch testsuite-fix.patch + +------------------------------------------------------------------- +Thu Feb 14 00:56:44 UTC 2019 - Jan Engelhardt + +- Use noun phrase in summary. + +------------------------------------------------------------------- +Wed Feb 13 14:55:24 UTC 2019 - Matěj Cepl + +- Add python3-fixes.patch to make tests pass. + +------------------------------------------------------------------- +Wed Nov 28 20:49:13 UTC 2018 - Mathias Homann + +- initial package using py2pack and version 0.4.2 diff --git a/python-parse_type.spec b/python-parse_type.spec new file mode 100644 index 0000000..053efd7 --- /dev/null +++ b/python-parse_type.spec @@ -0,0 +1,88 @@ +# +# spec file for package python-parse_type +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%bcond_without python2 +Name: python-parse_type +Version: 0.6.3 +Release: 0 +Summary: Extension to the parse module +License: MIT +Group: Development/Languages/Python +URL: https://github.com/jenisys/parse_type +Source: https://github.com/jenisys/parse_type/archive/v%{version}.tar.gz +# to remove python 2 is the goal of 0.7.0 +# https://github.com/jenisys/parse_type/blob/main/CHANGES.txt +# https://github.com/jenisys/parse_type/pull/24 +Patch0: python-parse_type-remove-python2.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-parse >= 1.12.0 +BuildArch: noarch +%if %{with python2} +BuildRequires: python-enum34 +%endif +%ifpython2 +Requires: python-enum34 +%endif +# SECTION test requirements +BuildRequires: %{python_module parse >= 1.12.0} +BuildRequires: %{python_module pytest >= 3.0} +# /SECTION +%python_subpackages + +%description +parse_type extends the parse module (opposite of string.format()) with +the following features: + + * build type converters for common use cases (enum/mapping, choice) + * build a type converter with a cardinality constraint (0..1, 0..*, 1..*) + from the type converter with cardinality=1. + * compose a type converter from other type converters + * an extended parser that supports the CardinalityField naming schema + and creates missing type variants (0..1, 0..*, 1..*) from the + primary type converter + +%prep +%autosetup -p1 -n parse_type-%{version} + +# no extra pytest options are needed +rm pytest.ini +# Remove bundled parse.py +rm parse_type/parse.py +sed -i 's:from parse_type import parse:import parse:' \ + tests/*.py tests/parse_tests_with_parse_type/*.py + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%license LICENSE +%doc README.rst +%{python_sitelib}/parse_type +%{python_sitelib}/parse_type-%{version}*-info + +%changelog diff --git a/v0.6.2.tar.gz b/v0.6.2.tar.gz new file mode 100644 index 0000000..905bc82 --- /dev/null +++ b/v0.6.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e839d5b4e588f92f4986948e101ac62cdc9d3a476bfc96f711dfaf85dc722a4 +size 66346 diff --git a/v0.6.3.tar.gz b/v0.6.3.tar.gz new file mode 100644 index 0000000..013e731 --- /dev/null +++ b/v0.6.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95c0c2adb34a692a92c8726e612b9b8f2f70fd857064be988937dab7f82c7001 +size 75579