{"id":334083,"date":"2022-06-06T09:00:23","date_gmt":"2022-06-06T09:00:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334083"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334083","title":{"rendered":"<span>\u0421\u043e\u0432\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043f\u0430\u0441\u0442\u0438 \u0412\u0430\u0441 \u043e\u0442 \u0443\u0436\u0430\u0441\u043e\u0432 PyYAML<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p>\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c \u0441 PyYAML \u043f\u0440\u043e\u0449\u0435.<\/p>\n<\/blockquote>\n<p>YAML &#8212; \u044d\u0442\u043e \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u044f\u0437\u044b\u043a \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c YAML \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 YAML, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c PyYAML \u0432 Python, \u043c\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u0438 \u043f\u043e\u043b\u043d\u0430 \u043b\u043e\u0432\u0443\u0448\u0435\u043a. \u0417\u0434\u0435\u0441\u044c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0412\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c \u0441 PyYAML.<\/p>\n<blockquote>\n<p>\u041a\u043e\u0434 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Python 3<\/p>\n<\/blockquote>\n<h3>\u0412\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 safe_load\/safe_dump<\/h3>\n<p>\u0421\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c YAML \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Python \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u043b\u0435\u043f\u0443\u044e. \u0414\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>yaml.load<\/code> \u0438\u0437 \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434.<\/p>\n<p>\u0421\u043c. <a href=\"https:\/\/pyyaml.org\/wiki\/PyYAMLDocumentation#loading-yaml\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e PyYAML<\/a>:<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435<\/strong>: \u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>yaml.load<\/code> \u0441 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e! <code>yaml.load<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043a\u0430\u043a <code>pickle.load<\/code>, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e Python.<\/p>\n<\/blockquote>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0412\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>yaml.safe_load<\/code> \u0438 <code>yaml.safe_dump<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f YAML.<\/p>\n<h3>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0439\u0442\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 (\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430\/\u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430)<\/h3>\n<p>\u0412 Python 3.7+ \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0442 <code>yaml.safe_load<\/code>, \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439, \u0447\u0442\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">>>> import yaml >>> text = \"\"\"--- ... c: 1 ... b: 1 ... d: 1 ... a: 1 ... \"\"\" >>> d = yaml.safe_load(text) >>> d {'c': 1, 'b': 1, 'd': 1, 'a': 1} >>> list(d) ['c', 'b', 'd', 'a'] <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0434\u0430\u043c\u043f\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 YAML, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>sort_keys=False<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<pre><code class=\"python\">>>> print(yaml.safe_dump(d)) a: 1 b: 1 c: 1 d: 1 >>> d['e'] = 1 >>> print(yaml.safe_dump(d, sort_keys=False)) c: 1 b: 1 d: 1 a: 1 e: 1 <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0412\u0430\u0448\u0430 \u0432\u0435\u0440\u0441\u0438\u044f Python \u043d\u0438\u0436\u0435 3.7, \u0438\u043b\u0438 \u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/wimglenn\/oyaml\" rel=\"noopener noreferrer nofollow\">oyaml<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b <code>PyYAML<\/code>.<\/p>\n<pre><code class=\"python\">>>> import oyaml as yaml >>> d = yaml.safe_load(text) >>> d OrderedDict([('c', 1), ('b', 1), ('d', 1), ('a', 1)]) >>> d['e'] = 1 >>> print(yaml.safe_dump(d, sort_keys=False)) c: 1 b: 1 d: 1 a: 1 e: 1 <\/code><\/pre>\n<h3>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 (dump)<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 PyYAML \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0442\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0443\u0440\u043e\u0432\u043d\u0435, \u0447\u0442\u043e \u0438 \u0438\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c.<\/p>\n<pre><code class=\"python\">>>> d = {'a': [1, 2, 3]} >>> print(yaml.safe_dump(d)) a: - 1 - 2 - 3 <\/code><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043f\u043e \u0441\u0442\u0438\u043b\u044e, \u043a\u0430\u043a <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/reference_appendices\/YAMLSyntax.html\" rel=\"noopener noreferrer nofollow\">Ansible<\/a> \u0438 <a href=\"https:\/\/developers.home-assistant.io\/docs\/documenting\/yaml-style-guide\/#block-style-sequences\" rel=\"noopener noreferrer nofollow\">HomeAssistant<\/a>. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a VSCode, \u0434\u0435\u043b\u0430\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0435\u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <code>IndentDumper<\/code>:<\/p>\n<pre><code class=\"python\">class IndentDumper(yaml.Dumper):     def increase_indent(self, flow=False, indentless=False):         return super(IndentDumper, self).increase_indent(flow, False) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>Dumper<\/code> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>yaml.dump<\/code>.<\/p>\n<pre><code class=\"python\">>>> print(yaml.dump(d, Dumper=IndentDumper)) a:   - 1   - 2   - 3 <\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <code>Dumper<\/code> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 <code>yaml.safe_dump<\/code>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 dumper-\u043a\u043b\u0430\u0441\u0441.<\/p>\n<\/blockquote>\n<h3>\u0412\u044b\u0432\u043e\u0434 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0433\u043e UTF-8 (dump)<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e PyYAML \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e ASCII \u043a\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u044b UTF-8 \u0432 \u042e\u043d\u0438\u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Python.<\/p>\n<pre><code class=\"python\">>>> d = {'a': '\u4f60\u597d'} >>> print(yaml.safe_dump(d)) a: \"\\u4F60\\u597D\" <\/code><\/pre>\n<p>\u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0442\u0440\u0443\u0434\u043d\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.<\/p>\n<p>\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f UTF-8, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c UTF-8 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435. \u041f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 <code>allow_unicode=True<\/code> \u0432 <code>yaml.safe_dump<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"python\">>>> print(yaml.safe_dump(d, allow_unicode=True)) a: \u4f60\u597d <\/code><\/pre>\n<h3>\u041d\u0435 \u043d\u0443\u0436\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 default_flow_style (dump)<\/h3>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b <a href=\"https:\/\/yaml.org\/spec\/1.2.2\/#chapter-7-flow-style-productions\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0438\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430<\/a> (\u0442.\u0435. \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e JSON \u0432 YAML). \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/pyyaml.org\/wiki\/PyYAMLDocumentation#dictionaries-without-nested-collections-are-not-dumped-correctly\" rel=\"noopener noreferrer nofollow\">PyYAML<\/a>, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0432 <code>yaml.safe_dump<\/code> \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c <code>default_flow_style=False<\/code>.<\/p>\n<p>\u041f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 PyYaml (6.0), \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u044b\u043c \u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u043c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/940\/326\/dd2\/940326dd24a37bc0aea686f5db5a6afb.png\" width=\"637\" height=\"218\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/326\/dd2\/940326dd24a37bc0aea686f5db5a6afb.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h3>\n<h4>oyaml<\/h4>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430: <a href=\"https:\/\/github.com\/wimglenn\/oyaml\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/wimglenn\/oyaml<\/a><\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, oyaml &#8212; \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0430 PyYAML, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 oyaml, \u0435\u0441\u043b\u0438 \u0412\u044b \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 PyYAML \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u0434\u0435.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e oyaml &#8212; \u044d\u0442\u043e \u043e\u0434\u043d\u043e\u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0432\u0441\u0435\u0433\u043e <a href=\"https:\/\/github.com\/wimglenn\/oyaml\/blob\/d0195070d26bd982f1e4e604bded5510dd035cd7\/oyaml.py)\" rel=\"noopener noreferrer nofollow\">53 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430<\/a>. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0435 \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u043e\u0439 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0412\u0430\u0448\u0438\u043c\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<h4>strictyaml<\/h4>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430: <a href=\"https:\/\/github.com\/crdoconnor\/strictyaml\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/crdoconnor\/strictyaml<\/a><\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u044e\u0434\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e YAML \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u0435\u043d \u0438 \u0433\u0438\u0431\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 YAML, \u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c. \u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u043d\u0430\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c.<\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f StrictYAML. \u042d\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 YAML, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 <a href=\"https:\/\/hitchdev.com\/strictyaml\/features-removed\" rel=\"noopener noreferrer nofollow\">\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e<\/a> \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 YAML.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 StrictYAML, \u0435\u0441\u043b\u0438 \u0412\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u0435\u0441\u044c \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0412\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 <a href=\"https:\/\/hitchdev.com\/strictyaml\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043f\u043e strictyaml \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0435\u0441\u043b\u0438 \u0412\u044b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043e YAML \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>ruamel.yaml<\/h4>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430: <a href=\"https:\/\/yaml.readthedocs.io\/en\/latest\/overview.html\" rel=\"noopener noreferrer nofollow\">https:\/\/yaml.readthedocs.io\/en\/latest\/overview.html<\/a><\/p>\n<p>ruamel.yaml &#8212; \u044d\u0442\u043e \u0444\u043e\u0440\u043a PyYAML, \u043e\u043d \u0431\u044b\u043b \u0432\u044b\u043f\u0443\u0449\u0435\u043d \u0432 2009 \u0433\u043e\u0434\u0443 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f.<\/p>\n<p>\u0420\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0441 PyYAML \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b <a href=\"https:\/\/yaml.readthedocs.io\/en\/latest\/pyyaml.html#yaml-1-2-support\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0412 \u0446\u0435\u043b\u043e\u043c, ruamel.yaml \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/yaml.org\/spec\/1.2.2\/\" rel=\"noopener noreferrer nofollow\">YAML 1.2<\/a> \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>\u0421\u0430\u043c\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0432 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f round-trip \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\/\u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0447\u0435\u0440\u043d\u0430\u044f \u043c\u0430\u0433\u0438\u044f. \u0412\u043e\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 ruamel.yaml:<\/p>\n<blockquote>\n<p>Round-trip &#8212; \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c YAML \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430-\u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f-\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435, \u0438 ruamel.yaml \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0441\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e:<\/p>\n<p>&#8212; \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438<br \/>&#8212; \u0441\u0442\u0438\u043b\u044c \u0431\u043b\u043e\u043a\u043e\u0432 \u0438 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c diff \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 round-trip<br \/>&#8212; \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u0442\u0438\u043b\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 (&#8216;a: b, c, d&#8217;)<br \/>&#8212; \u0438\u043c\u0435\u043d\u0430 \u044f\u043a\u043e\u0440\u0435\u0439, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e (\u0442.\u0435. \u043d\u0435 \u0432 \u0444\u043e\u0440\u043c\u0435 <code>idNNN<\/code>)<br \/>&#8212; \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f  <\/p>\n<\/blockquote>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ruamel.yaml, \u0435\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 &#8212; \u043c\u0435\u0442\u043e\u0434 <code>safe_load<\/code> \u0432 ruamel.yaml (<code>YAML(typ='safe').load<\/code>) \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0432 \u0441\u0442\u0438\u043b\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 (<code>a: {\"foo\": \"bar\"}<\/code>), \u044d\u0442\u043e \u043d\u0435\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0441 PyYAML.<\/p>\n<\/blockquote>\n<h3>\u0420\u0435\u0437\u044e\u043c\u0435<\/h3>\n<p>\u0423 YAML \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u0415\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0442\u044c, \u043a\u0440\u0438\u0432\u0430\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043b\u0435\u0433\u043a\u0430\u044f, \u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u0430, \u0447\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0445\u0430\u043e\u0441 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043d\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u0438 \u043f\u0440\u0438\u0447\u0443\u0434\u044b, YAML \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0438 \u043f\u043e\u043a\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c  \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0430 \u043e\u043f\u044b\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/669684\/\"> https:\/\/habr.com\/ru\/post\/669684\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p>\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c \u0441 PyYAML \u043f\u0440\u043e\u0449\u0435.<\/p>\n<\/blockquote>\n<p>YAML &#8212; \u044d\u0442\u043e \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u044f\u0437\u044b\u043a \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c YAML \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 YAML, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c PyYAML \u0432 Python, \u043c\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u0438 \u043f\u043e\u043b\u043d\u0430 \u043b\u043e\u0432\u0443\u0448\u0435\u043a. \u0417\u0434\u0435\u0441\u044c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0412\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c \u0441 PyYAML.<\/p>\n<blockquote>\n<p>\u041a\u043e\u0434 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 Python 3<\/p>\n<\/blockquote>\n<h3>\u0412\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 safe_load\/safe_dump<\/h3>\n<p>\u0421\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c YAML \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Python \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u043b\u0435\u043f\u0443\u044e. \u0414\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>yaml.load<\/code> \u0438\u0437 \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434.<\/p>\n<p>\u0421\u043c. <a href=\"https:\/\/pyyaml.org\/wiki\/PyYAMLDocumentation#loading-yaml\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e PyYAML<\/a>:<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435<\/strong>: \u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>yaml.load<\/code> \u0441 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e! <code>yaml.load<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043a\u0430\u043a <code>pickle.load<\/code>, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e Python.<\/p>\n<\/blockquote>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0412\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>yaml.safe_load<\/code> \u0438 <code>yaml.safe_dump<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f YAML.<\/p>\n<h3>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0439\u0442\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 (\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430\/\u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430)<\/h3>\n<p>\u0412 Python 3.7+ \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0442 <code>yaml.safe_load<\/code>, \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439, \u0447\u0442\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">>>> import yaml >>> text = \"\"\"--- ... c: 1 ... b: 1 ... d: 1 ... a: 1 ... \"\"\" >>> d = yaml.safe_load(text) >>> d {'c': 1, 'b': 1, 'd': 1, 'a': 1} >>> list(d) ['c', 'b', 'd', 'a'] <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0434\u0430\u043c\u043f\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 YAML, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>sort_keys=False<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<pre><code class=\"python\">>>> print(yaml.safe_dump(d)) a: 1 b: 1 c: 1 d: 1 >>> d['e'] = 1 >>> print(yaml.safe_dump(d, sort_keys=False)) c: 1 b: 1 d: 1 a: 1 e: 1 <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0412\u0430\u0448\u0430 \u0432\u0435\u0440\u0441\u0438\u044f Python \u043d\u0438\u0436\u0435 3.7, \u0438\u043b\u0438 \u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043b\u044e\u0447\u0435\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/wimglenn\/oyaml\" rel=\"noopener noreferrer nofollow\">oyaml<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043c\u0435\u043d\u044b <code>PyYAML<\/code>.<\/p>\n<pre><code class=\"python\">>>> import oyaml as yaml >>> d = yaml.safe_load(text) >>> d OrderedDict([('c', 1), ('b', 1), ('d', 1), ('a', 1)]) >>> d['e'] = 1 >>> print(yaml.safe_dump(d, sort_keys=False)) c: 1 b: 1 d: 1 a: 1 e: 1 <\/code><\/pre>\n<h3>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 (dump)<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 PyYAML \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0442\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0443\u0440\u043e\u0432\u043d\u0435, \u0447\u0442\u043e \u0438 \u0438\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c.<\/p>\n<pre><code class=\"python\">>>> d = {'a': [1, 2, 3]} >>> print(yaml.safe_dump(d)) a: - 1 - 2 - 3 <\/code><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043f\u043e \u0441\u0442\u0438\u043b\u044e, \u043a\u0430\u043a <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/reference_appendices\/YAMLSyntax.html\" rel=\"noopener noreferrer nofollow\">Ansible<\/a> \u0438 <a href=\"https:\/\/developers.home-assistant.io\/docs\/documenting\/yaml-style-guide\/#block-style-sequences\" rel=\"noopener noreferrer nofollow\">HomeAssistant<\/a>. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a VSCode, \u0434\u0435\u043b\u0430\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0435\u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <code>IndentDumper<\/code>:<\/p>\n<pre><code class=\"python\">class IndentDumper(yaml.Dumper):     def increase_indent(self, flow=False, indentless=False):         return super(IndentDumper, self).increase_indent(flow, False) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>Dumper<\/code> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>yaml.dump<\/code>.<\/p>\n<pre><code class=\"python\">>>> print(yaml.dump(d, Dumper=IndentDumper)) a:   - 1   - 2   - 3 <\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <code>Dumper<\/code> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 <code>yaml.safe_dump<\/code>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 dumper-\u043a\u043b\u0430\u0441\u0441.<\/p>\n<\/blockquote>\n<h3>\u0412\u044b\u0432\u043e\u0434 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0433\u043e UTF-8 (dump)<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e PyYAML \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e ASCII \u043a\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u044b UTF-8 \u0432 \u042e\u043d\u0438\u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Python.<\/p>\n<pre><code class=\"python\">>>> d = {'a': '\u4f60\u597d'} >>> print(yaml.safe_dump(d)) a: \"\\u4F60\\u597D\" <\/code><\/pre>\n<p>\u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0442\u0440\u0443\u0434\u043d\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.<\/p>\n<p>\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f UTF-8, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c UTF-8 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435. \u041f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 <code>allow_unicode=True<\/code> \u0432 <code>yaml.safe_dump<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"python\">>>> print(yaml.safe_dump(d, allow_unicode=True)) a: \u4f60\u597d <\/code><\/pre>\n<h3>\u041d\u0435 \u043d\u0443\u0436\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 default_flow_style (dump)<\/h3>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b <a href=\"https:\/\/yaml.org\/spec\/1.2.2\/#chapter-7-flow-style-productions\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0438\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430<\/a> (\u0442.\u0435. \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e JSON \u0432 YAML). \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/pyyaml.org\/wiki\/PyYAMLDocumentation#dictionaries-without-nested-collections-are-not-dumped-correctly\" rel=\"noopener noreferrer nofollow\">PyYAML<\/a>, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0432 <code>yaml.safe_dump<\/code> \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c <code>default_flow_style=False<\/code>.<\/p>\n<p>\u041f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 PyYaml (6.0), \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u044b\u043c \u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u043c.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h3>\n<h4>oyaml<\/h4>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430: <a href=\"https:\/\/github.com\/wimglenn\/oyaml\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/wimglenn\/oyaml<\/a><\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, oyaml &#8212; \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0430 PyYAML, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 oyaml, \u0435\u0441\u043b\u0438 \u0412\u044b \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 PyYAML \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u0434\u0435.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e oyaml &#8212; \u044d\u0442\u043e \u043e\u0434\u043d\u043e\u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0432\u0441\u0435\u0433\u043e <a href=\"https:\/\/github.com\/wimglenn\/oyaml\/blob\/d0195070d26bd982f1e4e604bded5510dd035cd7\/oyaml.py)\" rel=\"noopener noreferrer nofollow\">53 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430<\/a>. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0435 \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u043e\u0439 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0412\u0430\u0448\u0438\u043c\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<h4>strictyaml<\/h4>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430: <a href=\"https:\/\/github.com\/crdoconnor\/strictyaml\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/crdoconnor\/strictyaml<\/a><\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u044e\u0434\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e YAML \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u0435\u043d \u0438 \u0433\u0438\u0431\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 YAML, \u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c. \u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u043d\u0430\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c.<\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f StrictYAML. \u042d\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 YAML, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 <a href=\"https:\/\/hitchdev.com\/strictyaml\/features-removed\" rel=\"noopener noreferrer nofollow\">\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e<\/a> \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 YAML.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 StrictYAML, \u0435\u0441\u043b\u0438 \u0412\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u0435\u0441\u044c \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0412\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 <a href=\"https:\/\/hitchdev.com\/strictyaml\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043f\u043e strictyaml \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0435\u0441\u043b\u0438 \u0412\u044b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043e YAML \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>ruamel.yaml<\/h4>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430: <a href=\"https:\/\/yaml.readthedocs.io\/en\/latest\/overview.html\" rel=\"noopener noreferrer nofollow\">https:\/\/yaml.readthedocs.io\/en\/latest\/overview.html<\/a><\/p>\n<p>ruamel.yaml &#8212; \u044d\u0442\u043e \u0444\u043e\u0440\u043a PyYAML, \u043e\u043d \u0431\u044b\u043b \u0432\u044b\u043f\u0443\u0449\u0435\u043d \u0432 2009 \u0433\u043e\u0434\u0443 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f.<\/p>\n<p>\u0420\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0441 PyYAML \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b <a href=\"https:\/\/yaml.readthedocs.io\/en\/latest\/pyyaml.html#yaml-1-2-support\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0412 \u0446\u0435\u043b\u043e\u043c, ruamel.yaml \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/yaml.org\/spec\/1.2.2\/\" rel=\"noopener noreferrer nofollow\">YAML 1.2<\/a> \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>\u0421\u0430\u043c\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0432 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f round-trip \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\/\u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0447\u0435\u0440\u043d\u0430\u044f \u043c\u0430\u0433\u0438\u044f. \u0412\u043e\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 ruamel.yaml:<\/p>\n<blockquote>\n<p>Round-trip &#8212; \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c YAML \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430-\u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f-\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435, \u0438 ruamel.yaml \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0441\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e:<\/p>\n<p>&#8212; \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438<br \/>&#8212; \u0441\u0442\u0438\u043b\u044c \u0431\u043b\u043e\u043a\u043e\u0432 \u0438 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c diff \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 round-trip<br \/>&#8212; \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u0442\u0438\u043b\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 (&#8216;a: b, c, d&#8217;)<br \/>&#8212; \u0438\u043c\u0435\u043d\u0430 \u044f\u043a\u043e\u0440\u0435\u0439, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e (\u0442.\u0435. \u043d\u0435 \u0432 \u0444\u043e\u0440\u043c\u0435 <code>idNNN<\/code>)<br \/>&#8212; \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f  <\/p>\n<\/blockquote>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ruamel.yaml, \u0435\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 &#8212; \u043c\u0435\u0442\u043e\u0434 <code>safe_load<\/code> \u0432 ruamel.yaml (<code>YAML(typ='safe').load<\/code>) \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0432 \u0441\u0442\u0438\u043b\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 (<code>a: {\"foo\": \"bar\"}<\/code>), \u044d\u0442\u043e \u043d\u0435\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0441 PyYAML.<\/p>\n<\/blockquote>\n<h3>\u0420\u0435\u0437\u044e\u043c\u0435<\/h3>\n<p>\u0423 YAML \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u0415\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0442\u044c, \u043a\u0440\u0438\u0432\u0430\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043b\u0435\u0433\u043a\u0430\u044f, \u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u0430, \u0447\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0445\u0430\u043e\u0441 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043d\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u0438 \u043f\u0440\u0438\u0447\u0443\u0434\u044b, YAML \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0438 \u043f\u043e\u043a\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c  \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0430 \u043e\u043f\u044b\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/669684\/\"> https:\/\/habr.com\/ru\/post\/669684\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-334083","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334083"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334083\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}