Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-ConfigArgParse for 
openSUSE:Factory checked in at 2022-03-10 22:45:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ConfigArgParse (Old)
 and      /work/SRC/openSUSE:Factory/.python-ConfigArgParse.new.2349 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ConfigArgParse"

Thu Mar 10 22:45:22 2022 rev:2 rq:960710 version:1.5.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-ConfigArgParse/python-ConfigArgParse.changes  
    2021-07-21 19:07:35.451417737 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-ConfigArgParse.new.2349/python-ConfigArgParse.changes
    2022-03-11 11:51:39.679006639 +0100
@@ -1,0 +2,7 @@
+Wed Mar  9 09:34:57 UTC 2022 - [email protected]
+
+- version update to 1.5.3
+  * no upstream changelog found
+- python-mock actually not required for build
+
+-------------------------------------------------------------------

Old:
----
  ConfigArgParse-1.5.1.tar.gz

New:
----
  ConfigArgParse-1.5.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-ConfigArgParse.spec ++++++
--- /var/tmp/diff_new_pack.63K2OT/_old  2022-03-11 11:51:40.127007166 +0100
+++ /var/tmp/diff_new_pack.63K2OT/_new  2022-03-11 11:51:40.131007171 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-ConfigArgParse
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,9 +17,9 @@
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%bcond_without python2
+%define skip_python2 1
 Name:           python-ConfigArgParse
-Version:        1.5.1
+Version:        1.5.3
 Release:        0
 Summary:        A drop-in replacement for argparse
 License:        MIT
@@ -27,7 +27,6 @@
 URL:            https://github.com/bw2/ConfigArgParse
 Source:         
https://files.pythonhosted.org/packages/source/C/ConfigArgParse/ConfigArgParse-%{version}.tar.gz
 BuildRequires:  %{python_module PyYAML}
-BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
@@ -38,9 +37,6 @@
 Provides:       python-configargparse = %{version}-%{release}
 Obsoletes:      python-configargparse < %{version}-%{release}
 BuildArch:      noarch
-%if %{with python2}
-BuildRequires:  python2-devel
-%endif
 %python_subpackages
 
 %description

++++++ ConfigArgParse-1.5.1.tar.gz -> ConfigArgParse-1.5.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ConfigArgParse-1.5.1/ConfigArgParse.egg-info/PKG-INFO 
new/ConfigArgParse-1.5.3/ConfigArgParse.egg-info/PKG-INFO
--- old/ConfigArgParse-1.5.1/ConfigArgParse.egg-info/PKG-INFO   2021-07-01 
15:11:14.000000000 +0200
+++ new/ConfigArgParse-1.5.3/ConfigArgParse.egg-info/PKG-INFO   2021-10-03 
02:17:14.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ConfigArgParse
-Version: 1.5.1
+Version: 1.5.3
 Summary: A drop-in replacement for argparse that allows options to also be set 
via config files and/or environment variables.
 Home-page: https://github.com/bw2/ConfigArgParse
 License: MIT
@@ -19,6 +19,10 @@
             :alt: Travis CI build
             :target: https://travis-ci.org/bw2/ConfigArgParse
         
+        .. image:: https://img.shields.io/badge/-API_Documentation-blue
+            :alt: API Documentation
+            :target: https://bw2.github.io/ConfigArgParse/
+        
         Overview
         ~~~~~~~~
         
@@ -327,6 +331,10 @@
         - DefaultsFormatter = ArgumentDefaultsHelpFormatter
         - DefaultsRawFormatter = ArgumentDefaultsRawHelpFormatter
         
+        API Documentation
+        ~~~~~~~~~~~~~~~~~
+        
+        You can review the generated API Documentation for the 
``configargparse`` module: `HERE <https://bw2.github.io/ConfigArgParse/>`_
         
         Design Notes
         ~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.5.1/PKG-INFO 
new/ConfigArgParse-1.5.3/PKG-INFO
--- old/ConfigArgParse-1.5.1/PKG-INFO   2021-07-01 15:11:14.000000000 +0200
+++ new/ConfigArgParse-1.5.3/PKG-INFO   2021-10-03 02:17:14.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ConfigArgParse
-Version: 1.5.1
+Version: 1.5.3
 Summary: A drop-in replacement for argparse that allows options to also be set 
via config files and/or environment variables.
 Home-page: https://github.com/bw2/ConfigArgParse
 License: MIT
@@ -19,6 +19,10 @@
             :alt: Travis CI build
             :target: https://travis-ci.org/bw2/ConfigArgParse
         
+        .. image:: https://img.shields.io/badge/-API_Documentation-blue
+            :alt: API Documentation
+            :target: https://bw2.github.io/ConfigArgParse/
+        
         Overview
         ~~~~~~~~
         
@@ -327,6 +331,10 @@
         - DefaultsFormatter = ArgumentDefaultsHelpFormatter
         - DefaultsRawFormatter = ArgumentDefaultsRawHelpFormatter
         
+        API Documentation
+        ~~~~~~~~~~~~~~~~~
+        
+        You can review the generated API Documentation for the 
``configargparse`` module: `HERE <https://bw2.github.io/ConfigArgParse/>`_
         
         Design Notes
         ~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.5.1/README.rst 
new/ConfigArgParse-1.5.3/README.rst
--- old/ConfigArgParse-1.5.1/README.rst 2021-05-10 21:38:05.000000000 +0200
+++ new/ConfigArgParse-1.5.3/README.rst 2021-08-06 01:14:22.000000000 +0200
@@ -13,6 +13,10 @@
     :alt: Travis CI build
     :target: https://travis-ci.org/bw2/ConfigArgParse
 
+.. image:: https://img.shields.io/badge/-API_Documentation-blue
+    :alt: API Documentation
+    :target: https://bw2.github.io/ConfigArgParse/
+
 Overview
 ~~~~~~~~
 
@@ -321,6 +325,10 @@
 - DefaultsFormatter = ArgumentDefaultsHelpFormatter
 - DefaultsRawFormatter = ArgumentDefaultsRawHelpFormatter
 
+API Documentation
+~~~~~~~~~~~~~~~~~
+
+You can review the generated API Documentation for the ``configargparse`` 
module: `HERE <https://bw2.github.io/ConfigArgParse/>`_
 
 Design Notes
 ~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.5.1/configargparse.py 
new/ConfigArgParse-1.5.3/configargparse.py
--- old/ConfigArgParse-1.5.1/configargparse.py  2021-07-01 15:10:04.000000000 
+0200
+++ new/ConfigArgParse-1.5.3/configargparse.py  2021-10-03 02:15:57.000000000 
+0200
@@ -1,3 +1,8 @@
+"""
+A drop-in replacement for `argparse` that allows options to also be set via 
config files and/or environment variables.
+
+:see: `configargparse.ArgumentParser`, `configargparse.add_argument`
+"""
 import argparse
 import json
 import glob
@@ -14,9 +19,17 @@
     from StringIO import StringIO
 
 
-ACTION_TYPES_THAT_DONT_NEED_A_VALUE = (argparse._StoreTrueAction,
+ACTION_TYPES_THAT_DONT_NEED_A_VALUE = [argparse._StoreTrueAction,
     argparse._StoreFalseAction, argparse._CountAction,
-    argparse._StoreConstAction, argparse._AppendConstAction)
+    argparse._StoreConstAction, argparse._AppendConstAction]
+
+if sys.version_info >= (3, 9):
+    ACTION_TYPES_THAT_DONT_NEED_A_VALUE.append(argparse.BooleanOptionalAction)
+    is_boolean_optional_action = lambda action: isinstance(action, 
argparse.BooleanOptionalAction)
+else:
+    is_boolean_optional_action = lambda action: False
+
+ACTION_TYPES_THAT_DONT_NEED_A_VALUE = 
tuple(ACTION_TYPES_THAT_DONT_NEED_A_VALUE)
 
 
 # global ArgumentParser instances
@@ -80,7 +93,7 @@
         one of: "yes", "no", "true", "false". Otherwise an error will be 
raised.
 
         Args:
-            stream: A config file input stream (such as an open file object).
+            stream (IO): A config file input stream (such as an open file 
object).
 
         Returns:
             OrderedDict: Items where the keys are strings and the
@@ -109,9 +122,11 @@
 
 
 class DefaultConfigFileParser(ConfigFileParser):
-    """Based on a simplified subset of INI and YAML formats. Here is the
-    supported syntax::
+    """
+    Based on a simplified subset of INI and YAML formats. Here is the
+    supported syntax
 
+    .. code::
 
         # this is a comment
         ; this is also a comment (.ini style)
@@ -142,7 +157,7 @@
         return msg
 
     def parse(self, stream):
-        """Parses the keys + values from a config file."""
+       # see ConfigFileParser.parse docstring
 
         items = OrderedDict()
         for i, line in enumerate(stream):
@@ -178,9 +193,7 @@
         return items
 
     def serialize(self, items):
-        """Does the inverse of config parsing by taking parsed values and
-        converting them back to a string representing config file contents.
-        """
+        # see ConfigFileParser.serialize docstring
         r = StringIO()
         for key, value in items.items():
             if isinstance(value, list):
@@ -211,7 +224,7 @@
         return msg
 
     def parse(self, stream):
-        """Parses the keys and values from an INI config file."""
+        # see ConfigFileParser.parse docstring
         import configparser
         from ast import literal_eval
         # parse with configparser to allow multi-line values
@@ -246,9 +259,7 @@
         return result
 
     def serialize(self, items):
-        """Does the inverse of config parsing by taking parsed values and
-        converting them back to a string representing config file contents.
-        """
+        # see ConfigFileParser.serialize docstring
         import configparser
         import io
         config = configparser.ConfigParser(
@@ -287,7 +298,7 @@
         return yaml
 
     def parse(self, stream):
-        """Parses the keys and values from a config file."""
+        # see ConfigFileParser.parse docstring
         yaml = self._load_yaml()
 
         try:
@@ -313,12 +324,7 @@
         return result
 
     def serialize(self, items, default_flow_style=False):
-        """Does the inverse of config parsing by taking parsed values and
-        converting them back to a string representing config file contents.
-
-        Args:
-            default_flow_style: defines serialization format (see PyYAML docs)
-        """
+        # see ConfigFileParser.serialize docstring
 
         # lazy-import so there's no dependency on yaml unless this class is 
used
         yaml = self._load_yaml()
@@ -336,13 +342,13 @@
 
 
 class ArgumentParser(argparse.ArgumentParser):
-    """Drop-in replacement for argparse.ArgumentParser that adds support for
-    environment variables and .ini or .yaml-style config files.
+    """Drop-in replacement for `argparse.ArgumentParser` that adds support for
+    environment variables and ``.ini`` or ``.yaml-style`` config files.
     """
 
     def __init__(self, *args, **kwargs):
 
-        r"""Supports args of the argparse.ArgumentParser constructor
+        r"""Supports args of the `argparse.ArgumentParser` constructor
         as \*\*kwargs, as well as the following additional args.
 
         Arguments:
@@ -353,8 +359,8 @@
             auto_env_var_prefix: If set to a string instead of None, all 
config-
                 file-settable options will become also settable via environment
                 variables whose names are this prefix followed by the config
-                file key, all in upper case. (eg. setting this to "foo_" will
-                allow an arg like "--my-arg" to also be set via the FOO_MY_ARG
+                file key, all in upper case. (eg. setting this to ``foo_`` will
+                allow an arg like ``--my-arg`` to also be set via the 
FOO_MY_ARG
                 environment variable)
             default_config_files: When specified, this list of config files 
will
                 be parsed in order, with the values from each config file
@@ -448,13 +454,16 @@
 
     def parse_args(self, args = None, namespace = None,
                    config_file_contents = None, env_vars = os.environ):
-        """Supports all the same args as the ArgumentParser.parse_args(..),
+        """Supports all the same args as the 
`argparse.ArgumentParser.parse_args()`,
         as well as the following additional args.
 
         Arguments:
             args: a list of args as in argparse, or a string (eg. "-x -y bla")
             config_file_contents: String. Used for testing.
             env_vars: Dictionary. Used for testing.
+
+        Returns:
+            argparse.Namespace: namespace
         """
         args, argv = self.parse_known_args(
             args=args,
@@ -475,15 +484,18 @@
             env_vars=os.environ,
             ignore_help_args=False,
     ):
-        """Supports all the same args as the ArgumentParser.parse_args(..),
+        """Supports all the same args as the 
`argparse.ArgumentParser.parse_args()`,
         as well as the following additional args.
 
         Arguments:
             args: a list of args as in argparse, or a string (eg. "-x -y bla")
             config_file_contents (str). Used for testing.
             env_vars (dict). Used for testing.
-            ignore_help_args (bool): This flag determines behavior when user 
specifies --help or -h. If False,
+            ignore_help_args (bool): This flag determines behavior when user 
specifies ``--help`` or ``-h``. If False,
                 it will have the default behavior - printing help and exiting. 
If True, it won't do either.
+
+        Returns:
+            tuple[argparse.Namespace, list[str]]: tuple namescpace, 
unknown_args
         """
         if args is None:
             args = sys.argv[1:]
@@ -532,9 +544,13 @@
             # Make list-string into list.
             if action.nargs or isinstance(action, argparse._AppendAction):
                 nargs = True
-                element_capture = re.match(r'\[(.*)\]', value)
-                if element_capture:
-                    value = [val.strip() for val in 
element_capture.group(1).split(',') if val.strip()]
+                if value.startswith("[") and value.endswith("]"):
+                    # handle special case of k=[1,2,3] or other json-like 
syntax
+                    try:
+                        value = json.loads(value)
+                    except Exception:
+                        # for backward compatibility with legacy format (eg. 
where config value is [a, b, c] instead of proper json ["a", "b", "c"]
+                        value = [elem.strip() for elem in 
value[1:-1].split(",")]
             env_var_args += self.convert_item_to_command_line_arg(
                 action, key, value)
 
@@ -642,14 +658,18 @@
         return namespace, unknown_args
 
     def get_source_to_settings_dict(self):
-        """If called after parse_args() or parse_known_args(), this dict. will 
contain up to 4 keys corresponding
+        """
+        If called after `parse_args()` or `parse_known_args()`, returns a dict 
that contains up to 4 keys corresponding
         to where a given option's value is coming from:
-            "command_line"
-            "environment_variables"
-            "config_file"
-            "defaults"
+        - "command_line"
+        - "environment_variables"
+        - "config_file"
+        - "defaults"
         Each such key, will be mapped to another dictionary containing the 
options set via that method. Here the key
-        will be the option name, and the value will be a 2-tuple of the form 
(argparse Action obj, string value).
+        will be the option name, and the value will be a 2-tuple of the form 
(`argparse.Action` obj, `str` value).
+
+        Returns:
+            dict[str, dict[str, tuple[argparse.Action, str]]]: source to 
settings dict
         """
 
         return self._source_to_settings
@@ -691,6 +711,9 @@
 
         Args:
             key: The config file key that was being set.
+
+        Returns:
+            str: command line key
         """
         key_without_prefix_chars = key.strip(self.prefix_chars)
         command_line_key = self.prefix_chars[0]*2 + key_without_prefix_chars
@@ -754,6 +777,9 @@
                 configargparse arg.
             key: string (config file key or env var name)
             value: parsed value of type string or list
+
+        Returns:
+            list[str]: args
         """
         args = []
 
@@ -761,15 +787,24 @@
             command_line_key = \
                 self.get_command_line_key_for_unknown_config_file_setting(key)
         else:
-            command_line_key = action.option_strings[-1]
+            if not is_boolean_optional_action(action):
+                command_line_key = action.option_strings[-1]
 
         # handle boolean value
         if action is not None and isinstance(action, 
ACTION_TYPES_THAT_DONT_NEED_A_VALUE):
             if value.lower() in ("true", "yes", "1"):
-                args.append( command_line_key )
+                if not is_boolean_optional_action(action):
+                    args.append( command_line_key )
+                else:
+                    # --foo
+                    args.append(action.option_strings[0])
             elif value.lower() in ("false", "no", "0"):
                 # don't append when set to "false" / "no"
-                pass
+                if not is_boolean_optional_action(action):
+                    pass
+                else:
+                    # --no-foo
+                    args.append(action.option_strings[1])
             elif isinstance(action, argparse._CountAction):
                 for arg in args:
                     if any([arg.startswith(s) for s in action.option_strings]):
@@ -812,6 +847,9 @@
         """This method decides which actions can be set in a config file and
         what their keys will be. It returns a list of 0 or more config keys 
that
         can be used to set the given action's value in a config file.
+
+        Returns:
+            list[str]: keys
         """
         keys = []
 
@@ -833,6 +871,9 @@
 
         Args:
             command_line_args: List of all args
+        
+        Returns:
+            list[IO]: open config files
         """
         # open any default config files
         config_files = []
@@ -900,6 +941,9 @@
     def format_values(self):
         """Returns a string with all args and settings and where they came from
         (eg. commandline, config file, environment variable or default)
+
+        Returns:
+            str: source to settings string
         """
         source_key_to_display_value_map = {
             _COMMAND_LINE_SOURCE_KEY: "Command Line Args: ",
@@ -1009,6 +1053,9 @@
             configargparse to write all current commandline args to this file
             as config options and then exit.
             Default: False
+    
+    Returns:
+        argparse.Action: the new argparse action
     """
 
     env_var = kwargs.pop("env_var", None)
@@ -1046,6 +1093,9 @@
 def already_on_command_line(existing_args_list, potential_command_line_args, 
prefix_chars):
     """Utility method for checking if any of the potential_command_line_args is
     already present in existing_args.
+
+    Returns:
+        bool: already on command line?
     """
     arg_names = []
     for arg_string in existing_args_list:
@@ -1055,16 +1105,11 @@
         else:
             arg_names.append(arg_string)
 
-    """
-    return any(
-        arg_name.startswith(potential_arg) for potential_arg in 
potential_command_line_args for arg_name in arg_names
-    )
-    # TODO: need to support allow_abbrev, exit_on.. new args etc.
-    """
     return any(
         potential_arg in arg_names for potential_arg in 
potential_command_line_args
     )
-
+#TODO: Update to latest version of pydoctor when 
https://github.com/twisted/pydoctor/pull/414 has been merged 
+# such that the alises can be documented automatically.
 
 # wrap ArgumentParser's add_argument(..) method with the one above
 argparse._ActionsContainer.original_add_argument_method = 
argparse._ActionsContainer.add_argument
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.5.1/setup.py 
new/ConfigArgParse-1.5.3/setup.py
--- old/ConfigArgParse-1.5.1/setup.py   2021-07-01 14:41:49.000000000 +0200
+++ new/ConfigArgParse-1.5.3/setup.py   2021-10-03 02:16:57.000000000 +0200
@@ -81,7 +81,7 @@
 
 setup(
     name='ConfigArgParse',
-    version="1.5.1",
+    version="1.5.3",
     description='A drop-in replacement for argparse that allows options to '
                 'also be set via config files and/or environment variables.',
     long_description=long_description,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.5.1/tests/test_configargparse.py 
new/ConfigArgParse-1.5.3/tests/test_configargparse.py
--- old/ConfigArgParse-1.5.1/tests/test_configargparse.py       2021-07-01 
15:04:28.000000000 +0200
+++ new/ConfigArgParse-1.5.3/tests/test_configargparse.py       2021-10-03 
02:15:57.000000000 +0200
@@ -97,6 +97,10 @@
         self.add_arg("-x", "--arg-x", action="store_true")
         self.add_arg("-y", "--arg-y", dest="y1", type=int, required=True)
         self.add_arg("--arg-z", action="append", type=float, required=True)
+        if sys.version_info >= (3, 9):
+            self.add_arg('--foo', action=argparse.BooleanOptionalAction, 
default=False)
+        else:
+            self.add_arg('--foo', action="store_true", default=False)
 
         # make sure required args are enforced
         self.assertParseArgsRaises("too few arg"
@@ -112,12 +116,13 @@
             args="file1.txt file2.txt file3.txt -x -y 1")
 
         # check values after setting args on command line
-        ns = self.parse(args="file1.txt --arg-x -y 3 --arg-z 10",
+        ns = self.parse(args="file1.txt --arg-x -y 3 --arg-z 10 --foo",
                         config_file_contents="")
         self.assertListEqual(ns.filenames, ["file1.txt"])
         self.assertEqual(ns.arg_x, True)
         self.assertEqual(ns.y1, 3)
         self.assertEqual(ns.arg_z, [10])
+        self.assertEqual(ns.foo, True)
 
         self.assertRegex(self.format_values(),
             'Command Line Args:   file1.txt --arg-x -y 3 --arg-z 10')
@@ -129,23 +134,27 @@
             arg-y = 10
             arg-z = 30
             arg-z = 40
+            foo = True
             """)
         self.assertListEqual(ns.filenames, ["file1.txt", "file2.txt"])
         self.assertEqual(ns.arg_x, True)
         self.assertEqual(ns.y1, 10)
         self.assertEqual(ns.arg_z, [40])
+        self.assertEqual(ns.foo, True)
 
         self.assertRegex(self.format_values(),
             'Command Line Args: \\s+ file1.txt file2.txt\n'
             'Config File \\(method arg\\):\n'
             '  arg-x: \\s+ True\n'
             '  arg-y: \\s+ 10\n'
-            '  arg-z: \\s+ 40\n')
+            '  arg-z: \\s+ 40\n'
+            '  foo: \\s+ True\n')
 
         # check values after setting args in both command line and config file
         ns = self.parse(args="file1.txt file2.txt --arg-x -y 3 --arg-z 100 ",
             config_file_contents="""arg-y = 31.5
                                     arg-z = 30
+                                    foo = True
                                  """)
         self.format_help()
         self.format_values()
@@ -153,6 +162,7 @@
         self.assertEqual(ns.arg_x, True)
         self.assertEqual(ns.y1, 3)
         self.assertEqual(ns.arg_z, [100])
+        self.assertEqual(ns.foo, True)
 
         self.assertRegex(self.format_values(),
             "Command Line Args:   file1.txt file2.txt --arg-x -y 3 --arg-z 
100")

Reply via email to