Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-yq for openSUSE:Factory 
checked in at 2022-07-26 19:45:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-yq (Old)
 and      /work/SRC/openSUSE:Factory/.python-yq.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-yq"

Tue Jul 26 19:45:35 2022 rev:10 rq:991280 version:3.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-yq/python-yq.changes      2022-02-26 
17:02:43.107541959 +0100
+++ /work/SRC/openSUSE:Factory/.python-yq.new.1533/python-yq.changes    
2022-07-26 19:45:45.607420997 +0200
@@ -1,0 +2,17 @@
+Tue Jul 26 15:58:36 UTC 2022 - Matej Cepl <mc...@suse.com>
+
+- Update to 3.1.0:
+    Use configurable output grammar, compatible with YAML 1.1
+- Update to 3.0.2:
+  - Expand merge keys (https://yaml.org/type/merge.html). This is
+    a YAML 1.1 specific behavior, but will be accommodated in yq
+    due to its widespread use and low likelihood of accidental
+    invocation.
+- Update to 3.0.1:
+  - yq now uses the YAML 1.2 grammar when parsing and rendering
+    YAML documents. This means bare literals like ???on???, ???no???,
+    and ???12:34:56??? are interpreted as strings. (Fix interrupted
+    release)
+- Removed upstreamed e37a7981b505aa0fd60d062ca81fd7b23715233e.patch
+
+-------------------------------------------------------------------

Old:
----
  e37a7981b505aa0fd60d062ca81fd7b23715233e.patch
  yq-2.14.0.tar.gz

New:
----
  yq-3.1.0.tar.gz

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

Other differences:
------------------
++++++ python-yq.spec ++++++
--- /var/tmp/diff_new_pack.uyLGWb/_old  2022-07-26 19:45:46.111343128 +0200
+++ /var/tmp/diff_new_pack.uyLGWb/_new  2022-07-26 19:45:46.119341892 +0200
@@ -19,14 +19,12 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-yq
-Version:        2.14.0
+Version:        3.1.0
 Release:        0
 Summary:        Command-line YAML processor - jq wrapper for YAML documents
 License:        Apache-2.0
 URL:            https://github.com/kislyuk/yq
 Source:         
https://files.pythonhosted.org/packages/source/y/yq/yq-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM
-Patch0:         
https://github.com/kislyuk/yq/commit/e37a7981b505aa0fd60d062ca81fd7b23715233e.patch
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros

++++++ yq-2.14.0.tar.gz -> yq-3.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/.github/workflows/pythonpackage.yml 
new/yq-3.1.0/.github/workflows/pythonpackage.yml
--- old/yq-2.14.0/.github/workflows/pythonpackage.yml   2021-11-29 
17:38:20.000000000 +0100
+++ new/yq-3.1.0/.github/workflows/pythonpackage.yml    2022-07-05 
20:34:10.000000000 +0200
@@ -9,7 +9,7 @@
       max-parallel: 8
       matrix:
         os: [ubuntu-18.04, ubuntu-20.04, macos-10.15]
-        python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
+        python-version: ["3.7", "3.8", "3.9", "3.10"]
 
     steps:
     - uses: actions/checkout@v2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/Changes.rst new/yq-3.1.0/Changes.rst
--- old/yq-2.14.0/Changes.rst   2022-02-21 04:14:13.000000000 +0100
+++ new/yq-3.1.0/Changes.rst    2022-07-24 19:50:54.000000000 +0200
@@ -1,3 +1,29 @@
+Changes for v3.1.0 (2022-07-24)
+===============================
+
+-  Use configurable output grammar, compatible with YAML 1.1
+
+Changes for v3.0.2 (2022-07-05)
+===============================
+
+-  Expand merge keys (https://yaml.org/type/merge.html). This is a YAML
+   1.1 specific behavior, but will be accommodated in yq due to its
+   widespread use and low likelihood of accidental invocation.
+
+Changes for v3.0.1 (2022-07-04)
+===============================
+
+-  yq now uses the YAML 1.2 grammar when parsing and rendering YAML
+   documents. This means bare literals like ???on???, ???no???, and 
???12:34:56???
+   are interpreted as strings. (Fix interrupted release)
+
+Changes for v3.0.0 (2022-07-04)
+===============================
+
+-  yq now uses the YAML 1.2 grammar when parsing and rendering YAML
+   documents. This means bare literals like ???on???, ???no???, and 
???12:34:56???
+   are interpreted as strings.
+
 Changes for v2.14.0 (2022-02-20)
 ================================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/PKG-INFO new/yq-3.1.0/PKG-INFO
--- old/yq-2.14.0/PKG-INFO      2022-02-21 04:14:48.907249500 +0100
+++ new/yq-3.1.0/PKG-INFO       2022-07-24 19:51:29.951044300 +0200
@@ -1,12 +1,11 @@
 Metadata-Version: 2.1
 Name: yq
-Version: 2.14.0
+Version: 3.1.0
 Summary: Command-line YAML/XML processor - jq wrapper for YAML/XML documents
 Home-page: https://github.com/kislyuk/yq
 Author: Andrey Kislyuk
 Author-email: kisl...@gmail.com
 License: Apache Software License
-Platform: UNKNOWN
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Operating System :: MacOS :: MacOS X
@@ -172,5 +171,3 @@
         :target: https://pypi.python.org/pypi/yq
 .. image:: https://img.shields.io/pypi/l/yq.svg
         :target: https://pypi.python.org/pypi/yq
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/docs/cli-doc.txt 
new/yq-3.1.0/docs/cli-doc.txt
--- old/yq-2.14.0/docs/cli-doc.txt      2022-02-21 04:14:13.000000000 +0100
+++ new/yq-3.1.0/docs/cli-doc.txt       2022-07-24 19:50:54.000000000 +0200
@@ -1,5 +1,6 @@
 usage: yq [options] <jq filter> [input file...]
-          [jq_filter] [files ...]
+          [--indentless-lists] [--in-place] [--version]
+          [jq_filter] [files [files ...]]
 
 yq: Command-line YAML processor - jq wrapper for YAML documents
 
@@ -16,6 +17,8 @@
                         Transcode jq JSON output back into YAML and emit it
   --yaml-roundtrip, --yml-roundtrip, -Y
                         Transcode jq JSON output back into YAML and emit it. 
Preserve YAML tags and styles by representing them as extra items in their 
enclosing mappings and sequences while in JSON. This option is incompatible 
with jq filters that do not expect these extra items.
+  --yaml-output-grammar-version {1.1,1.2}, --yml-out-ver {1.1,1.2}
+                        When using --yaml-output, specify output grammar (the 
default is 1.1 and will be changed to 1.2 in a future version). Setting this to 
1.2 will cause strings like 'on' and 'no' to be emitted unquoted.
   --width WIDTH, -w WIDTH
                         When using --yaml-output, specify string wrap width
   --indentless-lists, --indentless
@@ -25,9 +28,9 @@
 
 jq - commandline JSON processor [version 1.6]
 
-Usage: jq [options] <jq filter> [file...]
-       jq [options] --args <jq filter> [strings...]
-       jq [options] --jsonargs <jq filter> [JSON_TEXTS...]
+Usage: /Users/andrey.kislyuk/.asdf/installs/jq/1.6/bin/jq [options] <jq 
filter> [file...]
+       /Users/andrey.kislyuk/.asdf/installs/jq/1.6/bin/jq [options] --args <jq 
filter> [strings...]
+       /Users/andrey.kislyuk/.asdf/installs/jq/1.6/bin/jq [options] --jsonargs 
<jq filter> [JSON_TEXTS...]
 
 jq is a tool for processing JSON inputs, applying the given filter to
 its JSON text inputs and producing the filter's results as JSON on
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/setup.py new/yq-3.1.0/setup.py
--- old/yq-2.14.0/setup.py      2022-02-21 04:14:03.000000000 +0100
+++ new/yq-3.1.0/setup.py       2022-07-24 19:50:48.000000000 +0200
@@ -4,7 +4,7 @@
 
 setup(
     name="yq",
-    version="2.14.0",
+    version="3.1.0",
     url="https://github.com/kislyuk/yq";,
     license="Apache Software License",
     author="Andrey Kislyuk",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/test/test.py new/yq-3.1.0/test/test.py
--- old/yq-2.14.0/test/test.py  2022-02-21 04:10:36.000000000 +0100
+++ new/yq-3.1.0/test/test.py   2022-07-24 19:40:08.000000000 +0200
@@ -75,9 +75,11 @@
         self.assertEqual(self.run_yq("- ??????????????????????\n- 
??????????????\n", ["-y", "."]), "- ??????????????????????\n- ??????????????\n")
 
     def test_yq_err(self):
-        err = ('yq: Error running jq: ScannerError: while scanning for the 
next token\nfound character that '
+        err = ('yq: Error running jq: ScannerError: while scanning for the 
next token\nfound character \'%\' that '
                'cannot start any token\n  in "<file>", line 1, column 3.')
-        self.run_yq("- %", ["."], expect_exit_codes={err, 2})
+        err2 = ('yq: Error running jq: ScannerError: while scanning for the 
next token\nfound character that '
+                'cannot start any token\n  in "<file>", line 1, column 3.')
+        self.run_yq("- %", ["."], expect_exit_codes={err, err2, 2})
 
     def test_yq_arg_handling(self):
         from unittest import mock
@@ -147,13 +149,12 @@
 
     def test_datetimes(self):
         self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["."]), "")
-        if yaml.__version__ < '5.3':
-            self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", 
"."]), "- '2016-12-20T22:07:36'\n")
-        else:
-            self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", 
"."]), "- '2016-12-20T22:07:36+00:00'\n")
-
+        self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", "."]), 
"- '2016-12-20T22:07:36Z'\n")
+        self.assertEqual(self.run_yq("- 2016-12-20T22:07:36Z\n", ["-y", 
"--yml-out-ver=1.2", "."]),
+                         "- 2016-12-20T22:07:36Z\n")
         self.assertEqual(self.run_yq("2016-12-20", ["."]), "")
         self.assertEqual(self.run_yq("2016-12-20", ["-y", "."]), 
"'2016-12-20'\n")
+        self.assertEqual(self.run_yq("2016-12-20", ["-y", "--yml-out-ver=1.2", 
"."]), "2016-12-20\n...\n")
 
     def test_unrecognized_tags(self):
         self.assertEqual(self.run_yq("!!foo bar\n", ["."]), "")
@@ -193,14 +194,6 @@
         self.assertTrue(self.run_yq("", ["-y", "--explicit-start", ".", 
test_doc]).startswith("---"))
         self.assertTrue(self.run_yq("", ["-y", "--explicit-end", ".", 
test_doc]).endswith("...\n"))
 
-    @unittest.expectedFailure
-    def test_times(self):
-        """
-        Timestamps are parsed as sexagesimals in YAML 1.1 but not 1.2. No 
PyYAML support for YAML 1.2 yet. See issue 10
-        """
-        self.assertEqual(self.run_yq("11:12:13", ["."]), "")
-        self.assertEqual(self.run_yq("11:12:13", ["-y", "."]), "'11:12:13'\n")
-
     def test_xq(self):
         self.assertEqual(self.run_yq("<foo/>", ["."], input_format="xml"), "")
         self.assertEqual(self.run_yq("<foo/>", ["-x", ".foo.x=1"], 
input_format="xml"),
@@ -262,5 +255,38 @@
             "example:\n  Boston Red Sox: null\n  Detroit Tigers: null\n  New 
York Yankees: null\n"
         )
 
+    def test_yaml_merge(self):
+        self.assertEqual(self.run_yq("a: &b\n  c: d\ne:\n  <<: *b\n  g: h", 
["-y", "."]),
+                         "a:\n  c: d\ne:\n  c: d\n  g: h\n")
+
+    def test_yaml_1_2(self):
+        self.assertEqual(self.run_yq("11:12:13", ["."]), "")
+        self.assertEqual(self.run_yq("11:12:13", ["-y", "."]), "'11:12:13'\n")
+
+        self.assertEqual(self.run_yq("on: 12:34:56", ["-y", "."]), "'on': 
'12:34:56'\n")
+        self.assertEqual(self.run_yq("on: 12:34:56", ["-y", 
"--yml-out-ver=1.2", "."]), "on: 12:34:56\n")
+
+        self.assertEqual(self.run_yq("2022-02-22", ["-y", "."]), 
"'2022-02-22'\n")
+        self.assertEqual(self.run_yq("2022-02-22", ["-y", "--yml-out-ver=1.2", 
"."]), "2022-02-22\n...\n")
+
+        self.assertEqual(self.run_yq("0b1010_0111", ["-y", "."]), 
"'0b1010_0111'\n")
+        self.assertEqual(self.run_yq("0b1010_0111", ["-y", 
"--yml-out-ver=1.2", "."]), "0b1010_0111\n...\n")
+
+        self.assertEqual(self.run_yq("0x_0A_74_AE", ["-y", "."]), 
"'0x_0A_74_AE'\n")
+        self.assertEqual(self.run_yq("0x_0A_74_AE", ["-y", 
"--yml-out-ver=1.2", "."]), "0x_0A_74_AE\n...\n")
+
+        self.assertEqual(self.run_yq("+685_230", ["-y", "."]), "'+685_230'\n")
+        self.assertEqual(self.run_yq("+685_230", ["-y", "--yml-out-ver=1.2", 
"."]), "+685_230\n...\n")
+
+        self.assertEqual(self.run_yq("+12345", ["-y", "."]), "12345\n...\n")
+
+    def test_yaml_1_1_octals(self):
+        self.assertEqual(self.run_yq("on: -012345", ["-y", "."]), "'on': 
-5349\n")
+
+    @unittest.expectedFailure
+    def test_yaml_1_2_octals(self):
+        """YAML 1.2 octals not yet implemented"""
+        self.assertEqual(self.run_yq("on: -012345", ["-y", 
"--yml-out-ver=1.2", "."]), "on: -12345\n")
+
 if __name__ == '__main__':
     unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/yq/__init__.py new/yq-3.1.0/yq/__init__.py
--- old/yq-2.14.0/yq/__init__.py        2022-01-17 01:20:19.000000000 +0100
+++ new/yq-3.1.0/yq/__init__.py 2022-07-23 01:39:38.000000000 +0200
@@ -137,6 +137,7 @@
 
 def load_yaml_docs(in_stream, out_stream, jq, loader_class, 
max_expansion_factor, exit_func, prog):
     loader = loader_class(in_stream)
+
     last_loader_pos = 0
     try:
         while loader.check_node():
@@ -159,8 +160,8 @@
 
 def yq(input_streams=None, output_stream=None, input_format="yaml", 
output_format="json",
        program_name="yq", width=None, indentless_lists=False, xml_root=None, 
xml_dtd=False, xml_force_list=frozenset(),
-       explicit_start=False, explicit_end=False, expand_aliases=True, 
max_expansion_factor=1024, jq_args=frozenset(),
-       exit_func=None):
+       explicit_start=False, explicit_end=False, expand_merge_keys=True, 
expand_aliases=True,
+       max_expansion_factor=1024, yaml_output_grammar_version="1.1", 
jq_args=frozenset(), exit_func=None):
     if not input_streams:
         input_streams = [sys.stdin]
     if not output_stream:
@@ -190,7 +191,8 @@
             json_buffer = io.StringIO()
             for input_stream in input_streams:
                 if input_format == "yaml":
-                    loader_class = get_loader(use_annotations=use_annotations, 
expand_aliases=expand_aliases)
+                    loader_class = get_loader(use_annotations=use_annotations, 
expand_aliases=expand_aliases,
+                                              
expand_merge_keys=expand_merge_keys)
                     load_yaml_docs(in_stream=input_stream, 
out_stream=json_buffer, jq=None, loader_class=loader_class,
                                    max_expansion_factor=max_expansion_factor, 
exit_func=exit_func, prog=program_name)
                 elif input_format == "xml":
@@ -208,7 +210,8 @@
             jq_out, jq_err = jq.communicate(json_buffer.getvalue())
             json_decoder = json.JSONDecoder()
             if output_format == "yaml" or output_format == "annotated_yaml":
-                dumper_class = get_dumper(use_annotations=use_annotations, 
indentless=indentless_lists)
+                dumper_class = get_dumper(use_annotations=use_annotations, 
indentless=indentless_lists,
+                                          
grammar_version=yaml_output_grammar_version)
                 yaml.dump_all(decode_docs(jq_out, json_decoder), 
stream=output_stream, Dumper=dumper_class,
                               width=width, allow_unicode=True, 
default_flow_style=False,
                               explicit_start=explicit_start, 
explicit_end=explicit_end)
@@ -240,7 +243,8 @@
                     toml.dump(doc, output_stream)
         else:
             if input_format == "yaml":
-                loader_class = get_loader(use_annotations=False, 
expand_aliases=expand_aliases)
+                loader_class = get_loader(use_annotations=False, 
expand_aliases=expand_aliases,
+                                          expand_merge_keys=expand_merge_keys)
                 for input_stream in input_streams:
                     load_yaml_docs(in_stream=input_stream, 
out_stream=jq.stdin, jq=jq, loader_class=loader_class,
                                    max_expansion_factor=max_expansion_factor, 
exit_func=exit_func, prog=program_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/yq/dumper.py new/yq-3.1.0/yq/dumper.py
--- old/yq-2.14.0/yq/dumper.py  2021-12-03 01:38:58.000000000 +0100
+++ new/yq-3.1.0/yq/dumper.py   2022-07-23 01:39:22.000000000 +0200
@@ -6,7 +6,7 @@
 # except ImportError:
 #     from yaml import SafeDumper as default_dumper
 
-from .loader import hash_key
+from .loader import hash_key, set_yaml_grammar
 
 class OrderedIndentlessDumper(yaml.SafeDumper):
     pass
@@ -21,7 +21,7 @@
 yaml_value_annotation_re = 
re.compile(r"^__yq_(?P<type>tag|style)_(?P<key>.+)__$")
 yaml_item_annotation_re = 
re.compile(r"^__yq_(?P<type>tag|style)_(?P<key>\d+)_(?P<value>.+)__$")
 
-def get_dumper(use_annotations=False, indentless=False):
+def get_dumper(use_annotations=False, indentless=False, grammar_version="1.1"):
     # if not (use_annotations or indentless):
     #     return default_dumper
 
@@ -79,4 +79,5 @@
     dumper = OrderedIndentlessDumper if indentless else OrderedDumper
     dumper.add_representer(dict, represent_dict)
     dumper.add_representer(list, represent_list)
+    set_yaml_grammar(dumper, grammar_version=grammar_version)
     return dumper
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/yq/loader.py new/yq-3.1.0/yq/loader.py
--- old/yq-2.14.0/yq/loader.py  2022-02-21 04:11:03.000000000 +0100
+++ new/yq-3.1.0/yq/loader.py   2022-07-24 18:06:03.000000000 +0200
@@ -1,3 +1,4 @@
+import re
 from base64 import b64encode
 from hashlib import sha224
 
@@ -9,6 +10,93 @@
 except ImportError:
     from yaml import SafeLoader as default_loader
 
+
+core_resolvers = {
+    "1.1": [
+        {
+            "tag": "tag:yaml.org,2002:bool",
+            "regexp": re.compile(r'''^(?:yes|Yes|YES|no|No|NO
+            |true|True|TRUE|false|False|FALSE
+            |on|On|ON|off|Off|OFF)$''', re.X),
+            "start_chars": list('yYnNtTfFoO')
+        }, {
+            "tag": "tag:yaml.org,2002:float",
+            "regexp": 
re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)?
+            |\.[0-9_]+(?:[eE][-+][0-9]+)?
+            |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*
+            |[-+]?\.(?:inf|Inf|INF)
+            |\.(?:nan|NaN|NAN))$''', re.X),
+            "start_chars": list('-+0123456789.')
+        }, {
+            "tag": "tag:yaml.org,2002:int",
+            "regexp": re.compile(r'''^(?:[-+]?0b[0-1_]+
+            |[-+]?0[0-7_]+
+            |[-+]?(?:0|[1-9][0-9_]*)
+            |[-+]?0x[0-9a-fA-F_]+
+            |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X),
+            "start_chars": list('-+0123456789')
+        }, {
+            "tag": "tag:yaml.org,2002:null",
+            "regexp": re.compile(r'''^(?: ~
+            |null|Null|NULL
+            | )$''', re.X),
+            "start_chars": ['~', 'n', 'N', '']
+        }, {
+            "tag": "tag:yaml.org,2002:timestamp",
+            "regexp": 
re.compile(r'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
+            |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?
+            (?:[Tt]|[ \t]+)[0-9][0-9]?
+            :[0-9][0-9] :[0-9][0-9] (?:\.[0-9]*)?
+            (?:[ \t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X),
+            "start_chars": list('0123456789')
+        }, {
+            "tag": "tag:yaml.org,2002:value",
+            "regexp": re.compile(r'^(?:=)$'),
+            "start_chars": ['=']
+        }
+    ],
+    "1.2": [
+        {
+            "tag": "tag:yaml.org,2002:bool",
+            "regexp": re.compile(r'^(?:|true|True|TRUE|false|False|FALSE)$', 
re.X),
+            "start_chars": list('tTfF')
+        }, {
+            "tag": "tag:yaml.org,2002:int",
+            "regexp": 
re.compile(r'^(?:|0o[0-7]+|[-+]?(?:[0-9]+)|0x[0-9a-fA-F]+)$', re.X),
+            "start_chars": list('-+0123456789')
+        }, {
+            "tag": "tag:yaml.org,2002:float",
+            "regexp": re.compile(
+                
r'^(?:[-+]?(?:\.[0-9]+|[0-9]+(\.[0-9]*)?)(?:[eE][-+]?[0-9]+)?|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$',
  # noqa
+                re.X
+            ),
+            "start_chars": list('-+0123456789.')
+        }, {
+            "tag": "tag:yaml.org,2002:null",
+            "regexp": re.compile(r'^(?:~||null|Null|NULL)$', re.X),
+            "start_chars": ['~', 'n', 'N', '']
+        }
+    ]
+}
+
+merge_resolver = {
+    "tag": "tag:yaml.org,2002:merge",
+    "regexp": re.compile(r'^(?:<<)$'),
+    "start_chars": ['<']
+}
+
+def set_yaml_grammar(resolver, grammar_version="1.2", expand_merge_keys=True):
+    if grammar_version not in core_resolvers:
+        raise Exception(f"Unknown grammar version {grammar_version}")
+    resolvers = list(core_resolvers[grammar_version])
+    if expand_merge_keys:
+        resolvers.append(merge_resolver)
+    resolver.yaml_implicit_resolvers = {}
+    for r in resolvers:
+        for start_char in r["start_chars"]:
+            resolver.yaml_implicit_resolvers.setdefault(start_char, [])
+            resolver.yaml_implicit_resolvers[start_char].append((r["tag"], 
r["regexp"]))
+
 def hash_key(key):
     return b64encode(sha224(key.encode() if isinstance(key, str) else 
key).digest()).decode()
 
@@ -41,7 +129,7 @@
         anchor_token = self.scan_anchor(AnchorToken)  # noqa: F841
         # self.emit_yq_kv("__yq_anchor__", anchor_token.value, 
original_token=anchor_token)
 
-def get_loader(use_annotations=False, expand_aliases=True):
+def get_loader(use_annotations=False, expand_aliases=True, 
expand_merge_keys=True):
     def construct_sequence(loader, node):
         annotations = []
         for i, v_node in enumerate(node.value):
@@ -86,4 +174,5 @@
     loader_class.add_multi_constructor('', parse_unknown_tags)
     loader_class.yaml_constructors.pop("tag:yaml.org,2002:binary", None)
     loader_class.yaml_constructors.pop("tag:yaml.org,2002:set", None)
+    set_yaml_grammar(loader_class, expand_merge_keys=expand_merge_keys)
     return loader_class
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/yq/parser.py new/yq-3.1.0/yq/parser.py
--- old/yq-2.14.0/yq/parser.py  2022-01-17 01:20:22.000000000 +0100
+++ new/yq-3.1.0/yq/parser.py   2022-07-23 01:40:02.000000000 +0200
@@ -23,10 +23,8 @@
 
 def get_parser(program_name, description):
     # By default suppress these help strings and only enable them in the 
specific programs.
-    yaml_output_help, yaml_roundtrip_help, width_help, indentless_help = 
(argparse.SUPPRESS, argparse.SUPPRESS,
-                                                                          
argparse.SUPPRESS, argparse.SUPPRESS)
-    xml_output_help, xml_dtd_help, xml_root_help, xml_force_list_help = 
(argparse.SUPPRESS, argparse.SUPPRESS,
-                                                                         
argparse.SUPPRESS, argparse.SUPPRESS)
+    yaml_output_help, yaml_roundtrip_help, width_help, indentless_help, 
grammar_help = [argparse.SUPPRESS] * 5
+    xml_output_help, xml_dtd_help, xml_root_help, xml_force_list_help = 
[argparse.SUPPRESS] * 4
     toml_output_help = argparse.SUPPRESS
 
     if program_name == "yq":
@@ -39,6 +37,9 @@
         width_help = "When using --yaml-output, specify string wrap width"
         indentless_help = ("When using --yaml-output, indent block style lists 
(sequences) "
                            "with 0 spaces instead of 2")
+        grammar_help = ("When using --yaml-output, specify output grammar (the 
default is 1.1 and will be changed "
+                        "to 1.2 in a future version). Setting this to 1.2 will 
cause strings like 'on' and 'no' to be "
+                        "emitted unquoted.")
     elif program_name == "xq":
         current_language = "XML"
         xml_output_help = "Transcode jq JSON output back into XML and emit it"
@@ -62,6 +63,8 @@
                         help=yaml_output_help)
     parser.add_argument("--yaml-roundtrip", "--yml-roundtrip", "-Y", 
dest="output_format", action="store_const",
                         const="annotated_yaml", help=yaml_roundtrip_help)
+    parser.add_argument("--yaml-output-grammar-version", "--yml-out-ver", 
choices=["1.1", "1.2"], default="1.1",
+                        help=grammar_help)
     parser.add_argument("--width", "-w", type=int, help=width_help)
     parser.add_argument("--indentless-lists", "--indentless", 
action="store_true", help=indentless_help)
     parser.add_argument("--explicit-start", action="store_true", 
help=argparse.SUPPRESS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/yq/version.py new/yq-3.1.0/yq/version.py
--- old/yq-2.14.0/yq/version.py 2022-02-21 04:14:48.000000000 +0100
+++ new/yq-3.1.0/yq/version.py  2022-07-24 19:51:29.000000000 +0200
@@ -1,5 +1,5 @@
 # coding: utf-8
 # file generated by setuptools_scm
 # don't change, don't track in version control
-version = '2.14.0'
-version_tuple = (2, 14, 0)
+__version__ = version = '3.1.0'
+__version_tuple__ = version_tuple = (3, 1, 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yq-2.14.0/yq.egg-info/PKG-INFO 
new/yq-3.1.0/yq.egg-info/PKG-INFO
--- old/yq-2.14.0/yq.egg-info/PKG-INFO  2022-02-21 04:14:48.000000000 +0100
+++ new/yq-3.1.0/yq.egg-info/PKG-INFO   2022-07-24 19:51:29.000000000 +0200
@@ -1,12 +1,11 @@
 Metadata-Version: 2.1
 Name: yq
-Version: 2.14.0
+Version: 3.1.0
 Summary: Command-line YAML/XML processor - jq wrapper for YAML/XML documents
 Home-page: https://github.com/kislyuk/yq
 Author: Andrey Kislyuk
 Author-email: kisl...@gmail.com
 License: Apache Software License
-Platform: UNKNOWN
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Operating System :: MacOS :: MacOS X
@@ -172,5 +171,3 @@
         :target: https://pypi.python.org/pypi/yq
 .. image:: https://img.shields.io/pypi/l/yq.svg
         :target: https://pypi.python.org/pypi/yq
-
-

Reply via email to