From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WM/sJ+ui22DIrwAAgWs5BA (envelope-from ) for ; Wed, 30 Jun 2021 00:47:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gMy3I+ui22BwdQAAbx9fmQ (envelope-from ) for ; Tue, 29 Jun 2021 22:47:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ECCE335C00 for ; Wed, 30 Jun 2021 00:47:04 +0200 (CEST) Received: from localhost ([::1]:44500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyMVT-0005P5-MV for larch@yhetil.org; Tue, 29 Jun 2021 18:47:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyMSb-0003pu-74 for guix-patches@gnu.org; Tue, 29 Jun 2021 18:44:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyMSa-0003f9-U0 for guix-patches@gnu.org; Tue, 29 Jun 2021 18:44:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyMSa-0004ex-RL for guix-patches@gnu.org; Tue, 29 Jun 2021 18:44:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49281] [PATCH 7/7] gnu: Add dynaconf. Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Jun 2021 22:44:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49281 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 49281@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 49281-submit@debbugs.gnu.org id=B49281.162500661117814 (code B ref 49281); Tue, 29 Jun 2021 22:44:04 +0000 Received: (at 49281) by debbugs.gnu.org; 29 Jun 2021 22:43:31 +0000 Received: from localhost ([127.0.0.1]:55903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyMS3-0004dA-6W for submit@debbugs.gnu.org; Tue, 29 Jun 2021 18:43:31 -0400 Received: from latitanza.investici.org ([82.94.249.234]:57921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyMRl-0004cG-SD for 49281@debbugs.gnu.org; Tue, 29 Jun 2021 18:43:14 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4GDzyn2bWczGp5C; Tue, 29 Jun 2021 22:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1625006593; bh=eSwygc9H2pgq+7KW3XQ7IhRTyXwB32LH8shdLljhnpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUgnLS3I8k+kIP0Eszl/q4YtvCsGgt32NbzGEtIvYHAhZjBDUpvR+lJbiSkJknLqL vPoMrt3JLur10RxdNg7dlYu5+wXLBxwInOTY51zaqZgohhZQLcrB8WjxhZdAhYHtl5 Cp56hDw1gCMnkoMlZ/GLL+T5QrreSDmnakm5H00o= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4GDzyl6RCmzGp58; Tue, 29 Jun 2021 22:43:11 +0000 (UTC) From: Giacomo Leidi Date: Wed, 30 Jun 2021 00:42:45 +0200 Message-Id: <20210629224245.29530-7-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210629224245.29530-1-goodoldpaul@autistici.org> References: <20210629224245.29530-1-goodoldpaul@autistici.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625006826; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=eSwygc9H2pgq+7KW3XQ7IhRTyXwB32LH8shdLljhnpw=; b=RuYP/FCaXWg29IjZ4doxcgUC91ZU+0v3Ab6HMcBnaBGyn4XKrsEkoVPiUPejhKSSpY9Gwm HVH2pWux+BtwJSx7nwSvRDCJ8Oteb6MuNKYAMux9YqveNn7Ffn7GTcK/FOE9IQ89/q3Vvp nI40v1FIOL6zGRgHmwTr87FLZvv2XLaeR6WCFfMucX7jN9sqA6EVCNzrZWdOdzHR/4Px8f 0PgNxeGGQGYOeGvQkIyj32ZmyfHz0p4B6tEoc71qgT2/C0rOGUzxQIkN8eQ2MdK/n40tAo C9DRog7vmdIVxEsMTbtzbNM3g47lSPw5LSSb+U8thltLlRDej7BwgRvxFZdsRw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625006826; a=rsa-sha256; cv=none; b=uMGGiD05C1SIaFlcgQSr6sdBDLBGVMwxzoD3+c0+bssv3OZjj2D943oyTzXXQAdvac6eqW pThHUG8GXtbWem5qLgLagHY8fa4Ialqr5vrxDEG1jyUJUoHMQe1DCXZugB1XTjevsbtBZ4 snUTzlhTNp80bsiAFzICumNrN/fyvYOCK17zQqiHm+oWKgxbKaHZRHKS728ZqBKKp6Clzi 3+cP5xvVp3DtiLgMkoPin3pfuKB7eM+vhbeEi0Qy2bocnUUFOKF4LwaJh4fQUOfCpY27RB W9hJxmhCIAcgNGlM6BrXtynD/krLLxwhHbayhn+r/d+Tvg7y6Whh+2a5yFKtlQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=lUgnLS3I; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=lUgnLS3I; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: ECCE335C00 X-Spam-Score: -0.42 X-Migadu-Scanner: scn1.migadu.com X-TUID: J7bcYvvD+Bz8 * gnu/packages/python-xyz.scm (python-colorama-0.4.1): New variable, (python-dotenv-0.13.0): New variable, (dynaconf): New variable. * gnu/packages/patches/dynaconf-Unvendor-dependencies.patch: New file. * local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + .../dynaconf-Unvendor-dependencies.patch | 40096 ++++++++++++++++ gnu/packages/python-xyz.scm | 87 + 3 files changed, 40184 insertions(+) create mode 100644 gnu/packages/patches/dynaconf-Unvendor-dependencies.pat= ch diff --git a/gnu/local.mk b/gnu/local.mk index 6b9202cba1..a296d24fe4 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -967,6 +967,7 @@ dist_patch_DATA =3D \ %D%/packages/patches/dstat-skip-devices-without-io.patch \ %D%/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch \ %D%/packages/patches/dvd+rw-tools-add-include.patch \ + %D%/packages/patches/dynaconf-Unvendor-dependencies.patch \ %D%/packages/patches/ecl-16-format-directive-limit.patch \ %D%/packages/patches/ecl-16-ignore-stderr-write-error.patch \ %D%/packages/patches/ecl-16-libffi.patch \ diff --git a/gnu/packages/patches/dynaconf-Unvendor-dependencies.patch b/gn= u/packages/patches/dynaconf-Unvendor-dependencies.patch new file mode 100644 index 0000000000..a7d184e662 --- /dev/null +++ b/gnu/packages/patches/dynaconf-Unvendor-dependencies.patch @@ -0,0 +1,40096 @@ +From 73a56e307650000b576fe28ab2afe824a186d1da Mon Sep 17 00:00:00 2001 +From: Giacomo Leidi +Date: Sat, 24 Apr 2021 22:59:37 +0200 +Subject: [PATCH] Unbundle some dependencies. + +Box was not unvendored because it appears to be heavily patched. +--- + dynaconf/cli.py | 4 +- + dynaconf/default_settings.py | 2 +- + dynaconf/loaders/env_loader.py | 2 +- + dynaconf/loaders/toml_loader.py | 2 +- + dynaconf/loaders/yaml_loader.py | 2 +- + dynaconf/utils/parse_conf.py | 2 +- + dynaconf/vendor/box/converters.py | 6 +- + dynaconf/vendor/box/from_file.py | 6 +- + dynaconf/vendor/click/README.md | 5 - + dynaconf/vendor/click/__init__.py | 60 - + dynaconf/vendor/click/_bashcomplete.py | 114 - + dynaconf/vendor/click/_compat.py | 240 -- + dynaconf/vendor/click/_termui_impl.py | 262 --- + dynaconf/vendor/click/_textwrap.py | 19 - + dynaconf/vendor/click/_unicodefun.py | 28 - + dynaconf/vendor/click/_winconsole.py | 108 - + dynaconf/vendor/click/core.py | 620 ----- + dynaconf/vendor/click/decorators.py | 115 - + dynaconf/vendor/click/exceptions.py | 76 - + dynaconf/vendor/click/formatting.py | 90 - + dynaconf/vendor/click/globals.py | 14 - + dynaconf/vendor/click/parser.py | 157 -- + dynaconf/vendor/click/termui.py | 135 -- + dynaconf/vendor/click/testing.py | 108 - + dynaconf/vendor/click/types.py | 227 -- + dynaconf/vendor/click/utils.py | 119 - + dynaconf/vendor/dotenv/README.md | 6 - + dynaconf/vendor/dotenv/__init__.py | 18 - + dynaconf/vendor/dotenv/cli.py | 56 - + dynaconf/vendor/dotenv/compat.py | 18 - + dynaconf/vendor/dotenv/ipython.py | 18 - + dynaconf/vendor/dotenv/main.py | 114 - + dynaconf/vendor/dotenv/parser.py | 85 - + dynaconf/vendor/dotenv/py.typed | 1 - + dynaconf/vendor/dotenv/version.py | 1 - + dynaconf/vendor/ruamel/__init__.py | 0 + dynaconf/vendor/ruamel/yaml/CHANGES | 957 -------- + dynaconf/vendor/ruamel/yaml/LICENSE | 21 - + dynaconf/vendor/ruamel/yaml/MANIFEST.in | 3 - + dynaconf/vendor/ruamel/yaml/PKG-INFO | 782 ------- + dynaconf/vendor/ruamel/yaml/README.rst | 752 ------ + dynaconf/vendor/ruamel/yaml/__init__.py | 10 - + dynaconf/vendor/ruamel/yaml/anchor.py | 7 - + dynaconf/vendor/ruamel/yaml/comments.py | 485 ---- + dynaconf/vendor/ruamel/yaml/compat.py | 120 - + dynaconf/vendor/ruamel/yaml/composer.py | 82 - + .../vendor/ruamel/yaml/configobjwalker.py | 4 - + dynaconf/vendor/ruamel/yaml/constructor.py | 728 ------ + dynaconf/vendor/ruamel/yaml/cyaml.py | 20 - + dynaconf/vendor/ruamel/yaml/dumper.py | 16 - + dynaconf/vendor/ruamel/yaml/emitter.py | 678 ------ + dynaconf/vendor/ruamel/yaml/error.py | 90 - + dynaconf/vendor/ruamel/yaml/events.py | 45 - + dynaconf/vendor/ruamel/yaml/loader.py | 18 - + dynaconf/vendor/ruamel/yaml/main.py | 462 ---- + dynaconf/vendor/ruamel/yaml/nodes.py | 32 - + dynaconf/vendor/ruamel/yaml/parser.py | 216 -- + dynaconf/vendor/ruamel/yaml/py.typed | 0 + dynaconf/vendor/ruamel/yaml/reader.py | 117 - + dynaconf/vendor/ruamel/yaml/representer.py | 578 ----- + dynaconf/vendor/ruamel/yaml/resolver.py | 160 -- + dynaconf/vendor/ruamel/yaml/scalarbool.py | 21 - + dynaconf/vendor/ruamel/yaml/scalarfloat.py | 33 - + dynaconf/vendor/ruamel/yaml/scalarint.py | 37 - + dynaconf/vendor/ruamel/yaml/scalarstring.py | 59 - + dynaconf/vendor/ruamel/yaml/scanner.py | 602 ----- + dynaconf/vendor/ruamel/yaml/serializer.py | 91 - + dynaconf/vendor/ruamel/yaml/setup.cfg | 4 - + dynaconf/vendor/ruamel/yaml/setup.py | 402 ---- + dynaconf/vendor/ruamel/yaml/timestamp.py | 8 - + dynaconf/vendor/ruamel/yaml/tokens.py | 97 - + dynaconf/vendor/ruamel/yaml/util.py | 69 - + dynaconf/vendor/toml/README.md | 5 - + dynaconf/vendor/toml/__init__.py | 16 - + dynaconf/vendor/toml/decoder.py | 515 ---- + dynaconf/vendor/toml/encoder.py | 134 -- + dynaconf/vendor/toml/ordered.py | 7 - + dynaconf/vendor/toml/tz.py | 10 - + dynaconf/vendor/vendor.txt | 4 - + dynaconf/vendor_src/box/converters.py | 4 +- + dynaconf/vendor_src/box/from_file.py | 4 +- + dynaconf/vendor_src/click/README.md | 5 - + dynaconf/vendor_src/click/__init__.py | 75 - + dynaconf/vendor_src/click/_bashcomplete.py | 371 --- + dynaconf/vendor_src/click/_compat.py | 611 ----- + dynaconf/vendor_src/click/_termui_impl.py | 667 ------ + dynaconf/vendor_src/click/_textwrap.py | 37 - + dynaconf/vendor_src/click/_unicodefun.py | 82 - + dynaconf/vendor_src/click/_winconsole.py | 308 --- + dynaconf/vendor_src/click/core.py | 2070 ----------------- + dynaconf/vendor_src/click/decorators.py | 331 --- + dynaconf/vendor_src/click/exceptions.py | 233 -- + dynaconf/vendor_src/click/formatting.py | 279 --- + dynaconf/vendor_src/click/globals.py | 47 - + dynaconf/vendor_src/click/parser.py | 431 ---- + dynaconf/vendor_src/click/termui.py | 688 ------ + dynaconf/vendor_src/click/testing.py | 362 --- + dynaconf/vendor_src/click/types.py | 726 ------ + dynaconf/vendor_src/click/utils.py | 440 ---- + dynaconf/vendor_src/dotenv/README.md | 6 - + dynaconf/vendor_src/dotenv/__init__.py | 46 - + dynaconf/vendor_src/dotenv/cli.py | 145 -- + dynaconf/vendor_src/dotenv/compat.py | 49 - + dynaconf/vendor_src/dotenv/ipython.py | 41 - + dynaconf/vendor_src/dotenv/main.py | 323 --- + dynaconf/vendor_src/dotenv/parser.py | 237 -- + dynaconf/vendor_src/dotenv/py.typed | 1 - + dynaconf/vendor_src/dotenv/version.py | 1 - + dynaconf/vendor_src/ruamel/__init__.py | 0 + dynaconf/vendor_src/ruamel/yaml/CHANGES | 957 -------- + dynaconf/vendor_src/ruamel/yaml/LICENSE | 21 - + dynaconf/vendor_src/ruamel/yaml/MANIFEST.in | 3 - + dynaconf/vendor_src/ruamel/yaml/PKG-INFO | 782 ------- + dynaconf/vendor_src/ruamel/yaml/README.rst | 752 ------ + dynaconf/vendor_src/ruamel/yaml/__init__.py | 60 - + dynaconf/vendor_src/ruamel/yaml/anchor.py | 20 - + dynaconf/vendor_src/ruamel/yaml/comments.py | 1149 --------- + dynaconf/vendor_src/ruamel/yaml/compat.py | 324 --- + dynaconf/vendor_src/ruamel/yaml/composer.py | 238 -- + .../vendor_src/ruamel/yaml/configobjwalker.py | 14 - + .../vendor_src/ruamel/yaml/constructor.py | 1805 -------------- + dynaconf/vendor_src/ruamel/yaml/cyaml.py | 185 -- + dynaconf/vendor_src/ruamel/yaml/dumper.py | 221 -- + dynaconf/vendor_src/ruamel/yaml/emitter.py | 1688 -------------- + dynaconf/vendor_src/ruamel/yaml/error.py | 311 --- + dynaconf/vendor_src/ruamel/yaml/events.py | 157 -- + dynaconf/vendor_src/ruamel/yaml/loader.py | 74 - + dynaconf/vendor_src/ruamel/yaml/main.py | 1534 ------------ + dynaconf/vendor_src/ruamel/yaml/nodes.py | 131 -- + dynaconf/vendor_src/ruamel/yaml/parser.py | 802 ------- + dynaconf/vendor_src/ruamel/yaml/py.typed | 0 + dynaconf/vendor_src/ruamel/yaml/reader.py | 311 --- + .../vendor_src/ruamel/yaml/representer.py | 1283 ---------- + dynaconf/vendor_src/ruamel/yaml/resolver.py | 399 ---- + dynaconf/vendor_src/ruamel/yaml/scalarbool.py | 51 - + .../vendor_src/ruamel/yaml/scalarfloat.py | 127 - + dynaconf/vendor_src/ruamel/yaml/scalarint.py | 130 -- + .../vendor_src/ruamel/yaml/scalarstring.py | 156 -- + dynaconf/vendor_src/ruamel/yaml/scanner.py | 1980 ---------------- + dynaconf/vendor_src/ruamel/yaml/serializer.py | 240 -- + dynaconf/vendor_src/ruamel/yaml/setup.cfg | 4 - + dynaconf/vendor_src/ruamel/yaml/setup.py | 962 -------- + dynaconf/vendor_src/ruamel/yaml/timestamp.py | 28 - + dynaconf/vendor_src/ruamel/yaml/tokens.py | 286 --- + dynaconf/vendor_src/ruamel/yaml/util.py | 190 -- + dynaconf/vendor_src/toml/README.md | 5 - + dynaconf/vendor_src/toml/__init__.py | 25 - + dynaconf/vendor_src/toml/decoder.py | 1052 --------- + dynaconf/vendor_src/toml/encoder.py | 304 --- + dynaconf/vendor_src/toml/ordered.py | 15 - + dynaconf/vendor_src/toml/tz.py | 21 - + dynaconf/vendor_src/vendor.txt | 4 - + tests/test_cli.py | 2 +- + 153 files changed, 18 insertions(+), 38742 deletions(-) + delete mode 100644 dynaconf/vendor/click/README.md + delete mode 100644 dynaconf/vendor/click/__init__.py + delete mode 100644 dynaconf/vendor/click/_bashcomplete.py + delete mode 100644 dynaconf/vendor/click/_compat.py + delete mode 100644 dynaconf/vendor/click/_termui_impl.py + delete mode 100644 dynaconf/vendor/click/_textwrap.py + delete mode 100644 dynaconf/vendor/click/_unicodefun.py + delete mode 100644 dynaconf/vendor/click/_winconsole.py + delete mode 100644 dynaconf/vendor/click/core.py + delete mode 100644 dynaconf/vendor/click/decorators.py + delete mode 100644 dynaconf/vendor/click/exceptions.py + delete mode 100644 dynaconf/vendor/click/formatting.py + delete mode 100644 dynaconf/vendor/click/globals.py + delete mode 100644 dynaconf/vendor/click/parser.py + delete mode 100644 dynaconf/vendor/click/termui.py + delete mode 100644 dynaconf/vendor/click/testing.py + delete mode 100644 dynaconf/vendor/click/types.py + delete mode 100644 dynaconf/vendor/click/utils.py + delete mode 100644 dynaconf/vendor/dotenv/README.md + delete mode 100644 dynaconf/vendor/dotenv/__init__.py + delete mode 100644 dynaconf/vendor/dotenv/cli.py + delete mode 100644 dynaconf/vendor/dotenv/compat.py + delete mode 100644 dynaconf/vendor/dotenv/ipython.py + delete mode 100644 dynaconf/vendor/dotenv/main.py + delete mode 100644 dynaconf/vendor/dotenv/parser.py + delete mode 100644 dynaconf/vendor/dotenv/py.typed + delete mode 100644 dynaconf/vendor/dotenv/version.py + delete mode 100644 dynaconf/vendor/ruamel/__init__.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/CHANGES + delete mode 100644 dynaconf/vendor/ruamel/yaml/LICENSE + delete mode 100644 dynaconf/vendor/ruamel/yaml/MANIFEST.in + delete mode 100644 dynaconf/vendor/ruamel/yaml/PKG-INFO + delete mode 100644 dynaconf/vendor/ruamel/yaml/README.rst + delete mode 100644 dynaconf/vendor/ruamel/yaml/__init__.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/anchor.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/comments.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/compat.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/composer.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/configobjwalker.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/constructor.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/cyaml.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/dumper.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/emitter.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/error.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/events.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/loader.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/main.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/nodes.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/parser.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/py.typed + delete mode 100644 dynaconf/vendor/ruamel/yaml/reader.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/representer.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/resolver.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/scalarbool.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/scalarfloat.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/scalarint.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/scalarstring.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/scanner.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/serializer.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/setup.cfg + delete mode 100644 dynaconf/vendor/ruamel/yaml/setup.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/timestamp.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/tokens.py + delete mode 100644 dynaconf/vendor/ruamel/yaml/util.py + delete mode 100644 dynaconf/vendor/toml/README.md + delete mode 100644 dynaconf/vendor/toml/__init__.py + delete mode 100644 dynaconf/vendor/toml/decoder.py + delete mode 100644 dynaconf/vendor/toml/encoder.py + delete mode 100644 dynaconf/vendor/toml/ordered.py + delete mode 100644 dynaconf/vendor/toml/tz.py + delete mode 100644 dynaconf/vendor_src/click/README.md + delete mode 100644 dynaconf/vendor_src/click/__init__.py + delete mode 100644 dynaconf/vendor_src/click/_bashcomplete.py + delete mode 100644 dynaconf/vendor_src/click/_compat.py + delete mode 100644 dynaconf/vendor_src/click/_termui_impl.py + delete mode 100644 dynaconf/vendor_src/click/_textwrap.py + delete mode 100644 dynaconf/vendor_src/click/_unicodefun.py + delete mode 100644 dynaconf/vendor_src/click/_winconsole.py + delete mode 100644 dynaconf/vendor_src/click/core.py + delete mode 100644 dynaconf/vendor_src/click/decorators.py + delete mode 100644 dynaconf/vendor_src/click/exceptions.py + delete mode 100644 dynaconf/vendor_src/click/formatting.py + delete mode 100644 dynaconf/vendor_src/click/globals.py + delete mode 100644 dynaconf/vendor_src/click/parser.py + delete mode 100644 dynaconf/vendor_src/click/termui.py + delete mode 100644 dynaconf/vendor_src/click/testing.py + delete mode 100644 dynaconf/vendor_src/click/types.py + delete mode 100644 dynaconf/vendor_src/click/utils.py + delete mode 100644 dynaconf/vendor_src/dotenv/README.md + delete mode 100644 dynaconf/vendor_src/dotenv/__init__.py + delete mode 100644 dynaconf/vendor_src/dotenv/cli.py + delete mode 100644 dynaconf/vendor_src/dotenv/compat.py + delete mode 100644 dynaconf/vendor_src/dotenv/ipython.py + delete mode 100644 dynaconf/vendor_src/dotenv/main.py + delete mode 100644 dynaconf/vendor_src/dotenv/parser.py + delete mode 100644 dynaconf/vendor_src/dotenv/py.typed + delete mode 100644 dynaconf/vendor_src/dotenv/version.py + delete mode 100644 dynaconf/vendor_src/ruamel/__init__.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/CHANGES + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/LICENSE + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/MANIFEST.in + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/PKG-INFO + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/README.rst + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/__init__.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/anchor.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/comments.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/compat.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/composer.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/configobjwalker.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/constructor.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/cyaml.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/dumper.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/emitter.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/error.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/events.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/loader.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/main.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/nodes.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/parser.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/py.typed + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/reader.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/representer.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/resolver.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/scalarbool.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/scalarfloat.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/scalarint.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/scalarstring.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/scanner.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/serializer.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/setup.cfg + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/setup.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/timestamp.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/tokens.py + delete mode 100644 dynaconf/vendor_src/ruamel/yaml/util.py + delete mode 100644 dynaconf/vendor_src/toml/README.md + delete mode 100644 dynaconf/vendor_src/toml/__init__.py + delete mode 100644 dynaconf/vendor_src/toml/decoder.py + delete mode 100644 dynaconf/vendor_src/toml/encoder.py + delete mode 100644 dynaconf/vendor_src/toml/ordered.py + delete mode 100644 dynaconf/vendor_src/toml/tz.py + +diff --git a/dynaconf/cli.py b/dynaconf/cli.py +index 2d45e52..7df767a 100644 +--- a/dynaconf/cli.py ++++ b/dynaconf/cli.py +@@ -20,8 +20,8 @@ from dynaconf.utils.functional import empty + from dynaconf.utils.parse_conf import parse_conf_data + from dynaconf.validator import ValidationError + from dynaconf.validator import Validator +-from dynaconf.vendor import click +-from dynaconf.vendor import toml ++import click ++import toml +=20 +=20 + CWD =3D Path.cwd() +diff --git a/dynaconf/default_settings.py b/dynaconf/default_settings.py +index 66601b0..9605fc5 100644 +--- a/dynaconf/default_settings.py ++++ b/dynaconf/default_settings.py +@@ -8,7 +8,7 @@ from dynaconf.utils import upperfy + from dynaconf.utils import warn_deprecations + from dynaconf.utils.files import find_file + from dynaconf.utils.parse_conf import parse_conf_data +-from dynaconf.vendor.dotenv import load_dotenv ++from dotenv import load_dotenv +=20 +=20 + def try_renamed(key, value, older_key, current_key): +diff --git a/dynaconf/loaders/env_loader.py b/dynaconf/loaders/env_loader.= py +index e7b13bd..b034c8a 100644 +--- a/dynaconf/loaders/env_loader.py ++++ b/dynaconf/loaders/env_loader.py +@@ -2,7 +2,7 @@ from os import environ +=20 + from dynaconf.utils import upperfy + from dynaconf.utils.parse_conf import parse_conf_data +-from dynaconf.vendor.dotenv import cli as dotenv_cli ++from dotenv import cli as dotenv_cli +=20 +=20 + IDENTIFIER =3D "env" +diff --git a/dynaconf/loaders/toml_loader.py b/dynaconf/loaders/toml_loade= r.py +index 07b973f..d81d675 100644 +--- a/dynaconf/loaders/toml_loader.py ++++ b/dynaconf/loaders/toml_loader.py +@@ -5,7 +5,7 @@ from dynaconf import default_settings + from dynaconf.constants import TOML_EXTENSIONS + from dynaconf.loaders.base import BaseLoader + from dynaconf.utils import object_merge +-from dynaconf.vendor import toml ++import toml +=20 +=20 + def load(obj, env=3DNone, silent=3DTrue, key=3DNone, filename=3DNone): +diff --git a/dynaconf/loaders/yaml_loader.py b/dynaconf/loaders/yaml_loade= r.py +index 33c6532..3ef419a 100644 +--- a/dynaconf/loaders/yaml_loader.py ++++ b/dynaconf/loaders/yaml_loader.py +@@ -7,7 +7,7 @@ from dynaconf.constants import YAML_EXTENSIONS + from dynaconf.loaders.base import BaseLoader + from dynaconf.utils import object_merge + from dynaconf.utils.parse_conf import try_to_encode +-from dynaconf.vendor.ruamel import yaml ++from ruamel import yaml +=20 + # Add support for Dynaconf Lazy values to YAML dumper + yaml.SafeDumper.yaml_representers[ +diff --git a/dynaconf/utils/parse_conf.py b/dynaconf/utils/parse_conf.py +index 5fc8234..6509c35 100644 +--- a/dynaconf/utils/parse_conf.py ++++ b/dynaconf/utils/parse_conf.py +@@ -8,7 +8,7 @@ from dynaconf.utils import extract_json_objects + from dynaconf.utils import multi_replace + from dynaconf.utils import recursively_evaluate_lazy_format + from dynaconf.utils.boxing import DynaBox +-from dynaconf.vendor import toml ++import toml +=20 + try: + from jinja2 import Environment +diff --git a/dynaconf/vendor/box/converters.py b/dynaconf/vendor/box/conve= rters.py +index 93cdcfb..c81877a 100644 +--- a/dynaconf/vendor/box/converters.py ++++ b/dynaconf/vendor/box/converters.py +@@ -7,9 +7,9 @@ _B=3D'utf-8' + _A=3DNone + import csv,json,sys,warnings + from pathlib import Path +-import dynaconf.vendor.ruamel.yaml as yaml ++import ruamel.yaml as yaml + from dynaconf.vendor.box.exceptions import BoxError,BoxWarning +-from dynaconf.vendor import toml ++import toml + BOX_PARAMETERS=3D'default_box','default_box_attr','conversion_box','froze= n_box','camel_killer_box','box_safe_prefix','box_duplicates','ordered_box',= 'default_box_none_transform','box_dots','modify_tuples_box','box_intact_typ= es','box_recast' + def _exists(filename,create=3D_E): + A=3Dfilename;B=3DPath(A) +@@ -75,4 +75,4 @@ def _to_csv(box_list,filename,encoding=3D_B,errors=3D_C): + for G in A:D.writerow(G) + def _from_csv(filename,encoding=3D_B,errors=3D_C): + A=3Dfilename;_exists(A) +- with open(A,_G,encoding=3Dencoding,errors=3Derrors,newline=3D'')as B:C= =3Dcsv.DictReader(B);return[A for A in C] +\ No newline at end of file ++ with open(A,_G,encoding=3Dencoding,errors=3Derrors,newline=3D'')as B:C= =3Dcsv.DictReader(B);return[A for A in C] +diff --git a/dynaconf/vendor/box/from_file.py b/dynaconf/vendor/box/from_f= ile.py +index daa1137..4a2739d 100644 +--- a/dynaconf/vendor/box/from_file.py ++++ b/dynaconf/vendor/box/from_file.py +@@ -1,8 +1,8 @@ + from json import JSONDecodeError + from pathlib import Path + from typing import Union +-from dynaconf.vendor.toml import TomlDecodeError +-from dynaconf.vendor.ruamel.yaml import YAMLError ++from toml import TomlDecodeError ++from ruamel.yaml import YAMLError + from .exceptions import BoxError + from .box import Box + from .box_list import BoxList +@@ -31,4 +31,4 @@ def box_from_file(file,file_type=3DNone,encoding=3D'utf-= 8',errors=3D'strict'): + if A.suffix in('.json','.jsn'):return _to_json(B) + if A.suffix in('.yaml','.yml'):return _to_yaml(B) + if A.suffix in('.tml','.toml'):return _to_toml(B) +- raise BoxError(f"Could not determine file type based off extension, plea= se provide file_type") +\ No newline at end of file ++ raise BoxError(f"Could not determine file type based off extension, plea= se provide file_type") +diff --git a/dynaconf/vendor/click/README.md b/dynaconf/vendor/click/READM= E.md +deleted file mode 100644 +index 0f7bac3..0000000 +--- a/dynaconf/vendor/click/README.md ++++ /dev/null +@@ -1,5 +0,0 @@ +-## python-click +- +-Vendored dep taken from: https://github.com/pallets/click +-Licensed under MIT: https://github.com/pallets/clickl/blob/master/LICENSE +-Current version: 7.1.x +diff --git a/dynaconf/vendor/click/__init__.py b/dynaconf/vendor/click/__i= nit__.py +deleted file mode 100644 +index fc6520a..0000000 +--- a/dynaconf/vendor/click/__init__.py ++++ /dev/null +@@ -1,60 +0,0 @@ +-from .core import Argument,BaseCommand,Command,CommandCollection,Context,= Group,MultiCommand,Option,Parameter +-from .decorators import argument +-from .decorators import command +-from .decorators import confirmation_option +-from .decorators import group +-from .decorators import help_option +-from .decorators import make_pass_decorator +-from .decorators import option +-from .decorators import pass_context +-from .decorators import pass_obj +-from .decorators import password_option +-from .decorators import version_option +-from .exceptions import Abort +-from .exceptions import BadArgumentUsage +-from .exceptions import BadOptionUsage +-from .exceptions import BadParameter +-from .exceptions import ClickException +-from .exceptions import FileError +-from .exceptions import MissingParameter +-from .exceptions import NoSuchOption +-from .exceptions import UsageError +-from .formatting import HelpFormatter +-from .formatting import wrap_text +-from .globals import get_current_context +-from .parser import OptionParser +-from .termui import clear +-from .termui import confirm +-from .termui import echo_via_pager +-from .termui import edit +-from .termui import get_terminal_size +-from .termui import getchar +-from .termui import launch +-from .termui import pause +-from .termui import progressbar +-from .termui import prompt +-from .termui import secho +-from .termui import style +-from .termui import unstyle +-from .types import BOOL +-from .types import Choice +-from .types import DateTime +-from .types import File +-from .types import FLOAT +-from .types import FloatRange +-from .types import INT +-from .types import IntRange +-from .types import ParamType +-from .types import Path +-from .types import STRING +-from .types import Tuple +-from .types import UNPROCESSED +-from .types import UUID +-from .utils import echo +-from .utils import format_filename +-from .utils import get_app_dir +-from .utils import get_binary_stream +-from .utils import get_os_args +-from .utils import get_text_stream +-from .utils import open_file +-__version__=3D'8.0.0.dev' +\ No newline at end of file +diff --git a/dynaconf/vendor/click/_bashcomplete.py b/dynaconf/vendor/clic= k/_bashcomplete.py +deleted file mode 100644 +index e27049d..0000000 +--- a/dynaconf/vendor/click/_bashcomplete.py ++++ /dev/null +@@ -1,114 +0,0 @@ +-_I=3D'COMP_CWORD' +-_H=3D'COMP_WORDS' +-_G=3D'fish' +-_F=3D'zsh' +-_E=3D'bash' +-_D=3D'_' +-_C=3DFalse +-_B=3DNone +-_A=3DTrue +-import copy,os,re +-from collections import abc +-from .core import Argument +-from .core import MultiCommand +-from .core import Option +-from .parser import split_arg_string +-from .types import Choice +-from .utils import echo +-WORDBREAK=3D'=3D' +-COMPLETION_SCRIPT_BASH=3D'\n%(complete_func)s() {\n local IFS=3D$\'\n\= '\n COMPREPLY=3D( $( env COMP_WORDS=3D"${COMP_WORDS[*]}" \\\n = COMP_CWORD=3D$COMP_CWORD \\\n %(autocomplete_var)= s=3Dcomplete $1 ) )\n return 0\n}\n\n%(complete_func)setup() {\n loca= l COMPLETION_OPTIONS=3D""\n local BASH_VERSION_ARR=3D(${BASH_VERSION//./= })\n # Only BASH version 4.4 and later have the nosort option.\n if = [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq 4 ] && [ = ${BASH_VERSION_ARR[1]} -ge 4 ]); then\n COMPLETION_OPTIONS=3D"-o nos= ort"\n fi\n\n complete $COMPLETION_OPTIONS -F %(complete_func)s %(scr= ipt_names)s\n}\n\n%(complete_func)setup\n' +-COMPLETION_SCRIPT_ZSH=3D'\n#compdef %(script_names)s\n\n%(complete_func)s= () {\n local -a completions\n local -a completions_with_descriptions\= n local -a response\n (( ! $+commands[%(script_names)s] )) && return = 1\n\n response=3D("${(@f)$( env COMP_WORDS=3D"${words[*]}" \\\n = COMP_CWORD=3D$((CURRENT-1)) \\\n %(au= tocomplete_var)s=3D"complete_zsh" \\\n %(script_name= s)s )}")\n\n for key descr in ${(kv)response}; do\n if [[ "$descr" = =3D=3D "_" ]]; then\n completions+=3D("$key")\n else\n = completions_with_descriptions+=3D("$key":"$descr")\n fi\n done\n= \n if [ -n "$completions_with_descriptions" ]; then\n _describe -= V unsorted completions_with_descriptions -U\n fi\n\n if [ -n "$comple= tions" ]; then\n compadd -U -V unsorted -a completions\n fi\n = compstate[insert]=3D"automenu"\n}\n\ncompdef %(complete_func)s %(script_nam= es)s\n' +-COMPLETION_SCRIPT_FISH=3D'complete --no-files --command %(script_names)s = --arguments "(env %(autocomplete_var)s=3Dcomplete_fish COMP_WORDS=3D(comman= dline -cp) COMP_CWORD=3D(commandline -t) %(script_names)s)"' +-_completion_scripts=3D{_E:COMPLETION_SCRIPT_BASH,_F:COMPLETION_SCRIPT_ZSH= ,_G:COMPLETION_SCRIPT_FISH} +-_invalid_ident_char_re=3Dre.compile('[^a-zA-Z0-9_]') +-def get_completion_script(prog_name,complete_var,shell):A=3Dprog_name;B= =3D_invalid_ident_char_re.sub('',A.replace('-',_D));C=3D_completion_scripts= .get(shell,COMPLETION_SCRIPT_BASH);return (C%{'complete_func':f"_{B}_comple= tion",'script_names':A,'autocomplete_var':complete_var}).strip()+';' +-def resolve_ctx(cli,prog_name,args): +- B=3Dargs;A=3Dcli.make_context(prog_name,B,resilient_parsing=3D_A);B=3DA.= protected_args+A.args +- while B: +- if isinstance(A.command,MultiCommand): +- if not A.command.chain: +- E,C,B=3DA.command.resolve_command(A,B) +- if C is _B:return A +- A=3DC.make_context(E,B,parent=3DA,resilient_parsing=3D_A);B=3DA.prote= cted_args+A.args +- else: +- while B: +- E,C,B=3DA.command.resolve_command(A,B) +- if C is _B:return A +- D=3DC.make_context(E,B,parent=3DA,allow_extra_args=3D_A,allow_inters= persed_args=3D_C,resilient_parsing=3D_A);B=3DD.args +- A=3DD;B=3DD.protected_args+D.args +- else:break +- return A +-def start_of_option(param_str):A=3Dparam_str;return A and A[:1]=3D=3D'-' +-def is_incomplete_option(all_args,cmd_param): +- A=3Dcmd_param +- if not isinstance(A,Option):return _C +- if A.is_flag:return _C +- B=3D_B +- for (D,C) in enumerate(reversed([A for A in all_args if A!=3DWORDBREAK])= ): +- if D+1>A.nargs:break +- if start_of_option(C):B=3DC +- return _A if B and B in A.opts else _C +-def is_incomplete_argument(current_params,cmd_param): +- A=3Dcmd_param +- if not isinstance(A,Argument):return _C +- B=3Dcurrent_params[A.name] +- if B is _B:return _A +- if A.nargs=3D=3D-1:return _A +- if isinstance(B,abc.Iterable)and A.nargs>1 and len(B)0:return f"{A}d {E:02}:{D:02}:{C:02}" +- else:return f"{E:02}:{D:02}:{C:02}" +- return'' +- def format_pos(A): +- B=3Dstr(A.pos) +- if A.length_known:B+=3Df"/{A.length}" +- return B +- def format_pct(A):return f"{int(A.pct*100): 4}%"[1:] +- def format_bar(A): +- if A.length_known:C=3Dint(A.pct*A.width);B=3DA.fill_char*C;B+=3DA.empty= _char*(A.width-C) +- elif A.finished:B=3DA.fill_char*A.width +- else: +- B=3Dlist(A.empty_char*(A.width or 1)) +- if A.time_per_iteration!=3D0:B[int((math.cos(A.pos*A.time_per_iteratio= n)/2.0+0.5)*A.width)]=3DA.fill_char +- B=3D''.join(B) +- return B +- def format_progress_line(A): +- C=3DA.show_percent;B=3D[] +- if A.length_known and C is _A:C=3Dnot A.show_pos +- if A.show_pos:B.append(A.format_pos()) +- if C:B.append(A.format_pct()) +- if A.show_eta and A.eta_known and not A.finished:B.append(A.format_eta(= )) +- if A.item_show_func is not _A: +- D=3DA.item_show_func(A.current_item) +- if D is not _A:B.append(D) +- return (A.bar_template%{'label':A.label,'bar':A.format_bar(),'info':A.i= nfo_sep.join(B)}).rstrip() +- def render_progress(A): +- from .termui import get_terminal_size as G +- if A.is_hidden:return +- B=3D[] +- if A.autowidth: +- H=3DA.width;A.width=3D0;I=3Dterm_len(A.format_progress_line());D=3Dmax= (0,G()[0]-I) +- if D=3DA.length:A.finished=3D_B +- if time.time()-A.last_eta<1.0:return +- A.last_eta=3Dtime.time() +- if A.pos:B=3D(time.time()-A.start)/A.pos +- else:B=3Dtime.time()-A.start +- A.avg=3DA.avg[-6:]+[B];A.eta_known=3DA.length_known +- def update(A,n_steps,current_item=3D_A): +- B=3Dcurrent_item;A.make_step(n_steps) +- if B is not _A:A.current_item=3DB +- A.render_progress() +- def finish(A):A.eta_known=3D0;A.current_item=3D_A;A.finished=3D_B +- def generator(A): +- if not A.entered:raise RuntimeError(_F) +- if A.is_hidden:yield from A.iter +- else: +- for B in A.iter:A.current_item=3DB;yield B;A.update(1) +- A.finish();A.render_progress() +-def pager(generator,color=3D_A): +- H=3D'system';B=3Dcolor;A=3Dgenerator;C=3D_default_text_stdout() +- if not isatty(sys.stdin)or not isatty(C):return _nullpager(C,A,B) +- D=3D(os.environ.get('PAGER',_A)or'').strip() +- if D: +- if WIN:return _tempfilepager(A,D,B) +- return _pipepager(A,D,B) +- if os.environ.get('TERM')in('dumb','emacs'):return _nullpager(C,A,B) +- if WIN or sys.platform.startswith('os2'):return _tempfilepager(A,'more <= ',B) +- if hasattr(os,H)and os.system('(less) 2>/dev/null')=3D=3D0:return _pipep= ager(A,_G,B) +- import tempfile as F;G,E=3DF.mkstemp();os.close(G) +- try: +- if hasattr(os,H)and os.system(f'more "{E}"')=3D=3D0:return _pipepager(A= ,'more',B) +- return _nullpager(C,A,B) +- finally:os.unlink(E) +-def _pipepager(generator,cmd,color): +- I=3D'LESS';A=3Dcolor;import subprocess as E;F=3Ddict(os.environ);G=3Dcmd= .rsplit('/',1)[-1].split() +- if A is _A and G[0]=3D=3D_G: +- C=3Df"{os.environ.get(I,'')}{_E.join(G[1:])}" +- if not C:F[I]=3D'-R';A=3D_B +- elif'r'in C or'R'in C:A=3D_B +- B=3DE.Popen(cmd,shell=3D_B,stdin=3DE.PIPE,env=3DF);H=3Dget_best_encoding= (B.stdin) +- try: +- for D in generator: +- if not A:D=3Dstrip_ansi(D) +- B.stdin.write(D.encode(H,_H)) +- except (OSError,KeyboardInterrupt):pass +- else:B.stdin.close() +- while _B: +- try:B.wait() +- except KeyboardInterrupt:pass +- else:break +-def _tempfilepager(generator,cmd,color): +- import tempfile as C;A=3DC.mktemp();B=3D''.join(generator) +- if not color:B=3Dstrip_ansi(B) +- D=3Dget_best_encoding(sys.stdout) +- with open_stream(A,'wb')[0]as E:E.write(B.encode(D)) +- try:os.system(f'{cmd} "{A}"') +- finally:os.unlink(A) +-def _nullpager(stream,generator,color): +- for A in generator: +- if not color:A=3Dstrip_ansi(A) +- stream.write(A) +-class Editor: +- def __init__(A,editor=3D_A,env=3D_A,require_save=3D_B,extension=3D'.txt'= ):A.editor=3Deditor;A.env=3Denv;A.require_save=3Drequire_save;A.extension= =3Dextension +- def get_editor(A): +- if A.editor is not _A:return A.editor +- for D in ('VISUAL','EDITOR'): +- B=3Dos.environ.get(D) +- if B:return B +- if WIN:return'notepad' +- for C in ('sensible-editor','vim','nano'): +- if os.system(f"which {C} >/dev/null 2>&1")=3D=3D0:return C +- return'vi' +- def edit_file(A,filename): +- import subprocess as D;B=3DA.get_editor() +- if A.env:C=3Dos.environ.copy();C.update(A.env) +- else:C=3D_A +- try: +- E=3DD.Popen(f'{B} "{filename}"',env=3DC,shell=3D_B);F=3DE.wait() +- if F!=3D0:raise ClickException(f"{B}: Editing failed!") +- except OSError as G:raise ClickException(f"{B}: Editing failed: {G}") +- def edit(D,text): +- L=3D'\r\n';K=3D'utf-8-sig';A=3Dtext;import tempfile as H;A=3DA or'';E= =3Dtype(A)in[bytes,bytearray] +- if not E and A and not A.endswith(_D):A+=3D_D +- I,B=3DH.mkstemp(prefix=3D'editor-',suffix=3DD.extension) +- try: +- if not E: +- if WIN:F=3DK;A=3DA.replace(_D,L) +- else:F=3D'utf-8' +- A=3DA.encode(F) +- C=3Dos.fdopen(I,'wb');C.write(A);C.close();J=3Dos.path.getmtime(B);D.e= dit_file(B) +- if D.require_save and os.path.getmtime(B)=3D=3DJ:return _A +- C=3Dopen(B,'rb') +- try:G=3DC.read() +- finally:C.close() +- if E:return G +- else:return G.decode(K).replace(L,_D) +- finally:os.unlink(B) +-def open_url(url,wait=3D_C,locate=3D_C): +- F=3D'"';D=3Dlocate;C=3Dwait;A=3Durl;import subprocess as G +- def E(url): +- A=3Durl;import urllib as B +- if A.startswith('file://'):A=3DB.unquote(A[7:]) +- return A +- if sys.platform=3D=3D'darwin': +- B=3D['open'] +- if C:B.append('-W') +- if D:B.append('-R') +- B.append(E(A));H=3Dopen('/dev/null','w') +- try:return G.Popen(B,stderr=3DH).wait() +- finally:H.close() +- elif WIN: +- if D:A=3DE(A.replace(F,''));B=3Df'explorer /select,"{A}"' +- else:A=3DA.replace(F,'');C=3D'/WAIT'if C else'';B=3Df'start {C} "" "{A}= "' +- return os.system(B) +- elif CYGWIN: +- if D:A=3Dos.path.dirname(E(A).replace(F,''));B=3Df'cygstart "{A}"' +- else:A=3DA.replace(F,'');C=3D'-w'if C else'';B=3Df'cygstart {C} "{A}"' +- return os.system(B) +- try: +- if D:A=3Dos.path.dirname(E(A))or'.' +- else:A=3DE(A) +- I=3DG.Popen(['xdg-open',A]) +- if C:return I.wait() +- return 0 +- except OSError: +- if A.startswith(('http://','https://'))and not D and not C:import webbr= owser as J;J.open(A);return 0 +- return 1 +-def _translate_ch_to_exc(ch): +- if ch=3D=3D'\x03':raise KeyboardInterrupt() +- if ch=3D=3D'\x04'and not WIN:raise EOFError() +- if ch=3D=3D'\x1a'and WIN:raise EOFError() +-if WIN: +- import msvcrt +- @contextlib.contextmanager +- def raw_terminal():yield +- def getchar(echo): +- if echo:B=3Dmsvcrt.getwche +- else:B=3Dmsvcrt.getwch +- A=3DB() +- if A in('\x00','=C3=A0'):A+=3DB() +- _translate_ch_to_exc(A);return A +-else: +- import tty,termios +- @contextlib.contextmanager +- def raw_terminal(): +- if not isatty(sys.stdin):B=3Dopen('/dev/tty');A=3DB.fileno() +- else:A=3Dsys.stdin.fileno();B=3D_A +- try: +- C=3Dtermios.tcgetattr(A) +- try:tty.setraw(A);yield A +- finally: +- termios.tcsetattr(A,termios.TCSADRAIN,C);sys.stdout.flush() +- if B is not _A:B.close() +- except termios.error:pass +- def getchar(echo): +- with raw_terminal()as B: +- A=3Dos.read(B,32);A=3DA.decode(get_best_encoding(sys.stdin),_H) +- if echo and isatty(sys.stdout):sys.stdout.write(A) +- _translate_ch_to_exc(A);return A +\ No newline at end of file +diff --git a/dynaconf/vendor/click/_textwrap.py b/dynaconf/vendor/click/_t= extwrap.py +deleted file mode 100644 +index b02fced..0000000 +--- a/dynaconf/vendor/click/_textwrap.py ++++ /dev/null +@@ -1,19 +0,0 @@ +-import textwrap +-from contextlib import contextmanager +-class TextWrapper(textwrap.TextWrapper): +- def _handle_long_word(E,reversed_chunks,cur_line,cur_len,width): +- B=3Dcur_line;A=3Dreversed_chunks;C=3Dmax(width-cur_len,1) +- if E.break_long_words:D=3DA[-1];F=3DD[:C];G=3DD[C:];B.append(F);A[-1]= =3DG +- elif not B:B.append(A.pop()) +- @contextmanager +- def extra_indent(self,indent): +- B=3Dindent;A=3Dself;C=3DA.initial_indent;D=3DA.subsequent_indent;A.init= ial_indent+=3DB;A.subsequent_indent+=3DB +- try:yield +- finally:A.initial_indent=3DC;A.subsequent_indent=3DD +- def indent_only(A,text): +- B=3D[] +- for (D,E) in enumerate(text.splitlines()): +- C=3DA.initial_indent +- if D>0:C=3DA.subsequent_indent +- B.append(f"{C}{E}") +- return '\n'.join(B) +\ No newline at end of file +diff --git a/dynaconf/vendor/click/_unicodefun.py b/dynaconf/vendor/click/= _unicodefun.py +deleted file mode 100644 +index 792053f..0000000 +--- a/dynaconf/vendor/click/_unicodefun.py ++++ /dev/null +@@ -1,28 +0,0 @@ +-import codecs,os +-def _verify_python_env(): +- M=3D'.utf8';L=3D'.utf-8';J=3DNone;I=3D'ascii' +- try:import locale as A;G=3Dcodecs.lookup(A.getpreferredencoding()).name +- except Exception:G=3DI +- if G!=3DI:return +- B=3D'' +- if os.name=3D=3D'posix': +- import subprocess as D +- try:C=3DD.Popen(['locale','-a'],stdout=3DD.PIPE,stderr=3DD.PIPE).commun= icate()[0] +- except OSError:C=3Db'' +- E=3Dset();H=3DFalse +- if isinstance(C,bytes):C=3DC.decode(I,'replace') +- for K in C.splitlines(): +- A=3DK.strip() +- if A.lower().endswith((L,M)): +- E.add(A) +- if A.lower()in('c.utf8','c.utf-8'):H=3DTrue +- B+=3D'\n\n' +- if not E:B+=3D'Additional information: on this system no suitable UTF-8= locales were discovered. This most likely requires resolving by reconfigur= ing the locale system.' +- elif H:B+=3D'This system supports the C.UTF-8 locale which is recommend= ed. You might be able to resolve your issue by exporting the following envi= ronment variables:\n\n export LC_ALL=3DC.UTF-8\n export LANG=3DC.UTF-= 8' +- else:B+=3Df"This system lists some UTF-8 supporting locales that you ca= n pick from. The following suitable locales were discovered: {', '.join(sor= ted(E))}" +- F=3DJ +- for A in (os.environ.get('LC_ALL'),os.environ.get('LANG')): +- if A and A.lower().endswith((L,M)):F=3DA +- if A is not J:break +- if F is not J:B+=3Df"\n\nClick discovered that you exported a UTF-8 loc= ale but the locale system could not pick up from it because it does not exi= st. The exported locale is {F!r} but it is not supported" +- raise RuntimeError(f"Click will abort further execution because Python w= as configured to use ASCII as encoding for the environment. Consult https:/= /click.palletsprojects.com/unicode-support/ for mitigation steps.{B}") +\ No newline at end of file +diff --git a/dynaconf/vendor/click/_winconsole.py b/dynaconf/vendor/click/= _winconsole.py +deleted file mode 100644 +index 316b252..0000000 +--- a/dynaconf/vendor/click/_winconsole.py ++++ /dev/null +@@ -1,108 +0,0 @@ +-_E=3DFalse +-_D=3D'strict' +-_C=3D'utf-16-le' +-_B=3DTrue +-_A=3DNone +-import ctypes,io,time +-from ctypes import byref,c_char,c_char_p,c_int,c_ssize_t,c_ulong,c_void_p= ,POINTER,py_object,windll,WINFUNCTYPE +-from ctypes.wintypes import DWORD +-from ctypes.wintypes import HANDLE +-from ctypes.wintypes import LPCWSTR +-from ctypes.wintypes import LPWSTR +-import msvcrt +-from ._compat import _NonClosingTextIOWrapper +-try:from ctypes import pythonapi +-except ImportError:pythonapi=3D_A +-else:PyObject_GetBuffer=3Dpythonapi.PyObject_GetBuffer;PyBuffer_Release= =3Dpythonapi.PyBuffer_Release +-c_ssize_p=3DPOINTER(c_ssize_t) +-kernel32=3Dwindll.kernel32 +-GetStdHandle=3Dkernel32.GetStdHandle +-ReadConsoleW=3Dkernel32.ReadConsoleW +-WriteConsoleW=3Dkernel32.WriteConsoleW +-GetConsoleMode=3Dkernel32.GetConsoleMode +-GetLastError=3Dkernel32.GetLastError +-GetCommandLineW=3DWINFUNCTYPE(LPWSTR)(('GetCommandLineW',windll.kernel32)) +-CommandLineToArgvW=3DWINFUNCTYPE(POINTER(LPWSTR),LPCWSTR,POINTER(c_int))(= ('CommandLineToArgvW',windll.shell32)) +-LocalFree=3DWINFUNCTYPE(ctypes.c_void_p,ctypes.c_void_p)(('LocalFree',win= dll.kernel32)) +-STDIN_HANDLE=3DGetStdHandle(-10) +-STDOUT_HANDLE=3DGetStdHandle(-11) +-STDERR_HANDLE=3DGetStdHandle(-12) +-PyBUF_SIMPLE=3D0 +-PyBUF_WRITABLE=3D1 +-ERROR_SUCCESS=3D0 +-ERROR_NOT_ENOUGH_MEMORY=3D8 +-ERROR_OPERATION_ABORTED=3D995 +-STDIN_FILENO=3D0 +-STDOUT_FILENO=3D1 +-STDERR_FILENO=3D2 +-EOF=3Db'\x1a' +-MAX_BYTES_WRITTEN=3D32767 +-class Py_buffer(ctypes.Structure):_fields_=3D[('buf',c_void_p),('obj',py_= object),('len',c_ssize_t),('itemsize',c_ssize_t),('readonly',c_int),('ndim'= ,c_int),('format',c_char_p),('shape',c_ssize_p),('strides',c_ssize_p),('sub= offsets',c_ssize_p),('internal',c_void_p)] +-if pythonapi is _A:get_buffer=3D_A +-else: +- def get_buffer(obj,writable=3D_E): +- A=3DPy_buffer();B=3DPyBUF_WRITABLE if writable else PyBUF_SIMPLE;PyObje= ct_GetBuffer(py_object(obj),byref(A),B) +- try:C=3Dc_char*A.len;return C.from_address(A.buf) +- finally:PyBuffer_Release(byref(A)) +-class _WindowsConsoleRawIOBase(io.RawIOBase): +- def __init__(A,handle):A.handle=3Dhandle +- def isatty(A):io.RawIOBase.isatty(A);return _B +-class _WindowsConsoleReader(_WindowsConsoleRawIOBase): +- def readable(A):return _B +- def readinto(D,b): +- A=3Dlen(b) +- if not A:return 0 +- elif A%2:raise ValueError('cannot read odd number of bytes from UTF-16-= LE encoded console') +- B=3Dget_buffer(b,writable=3D_B);E=3DA//2;C=3Dc_ulong();F=3DReadConsoleW= (HANDLE(D.handle),B,E,byref(C),_A) +- if GetLastError()=3D=3DERROR_OPERATION_ABORTED:time.sleep(0.1) +- if not F:raise OSError(f"Windows error: {GetLastError()}") +- if B[0]=3D=3DEOF:return 0 +- return 2*C.value +-class _WindowsConsoleWriter(_WindowsConsoleRawIOBase): +- def writable(A):return _B +- @staticmethod +- def _get_error_message(errno): +- A=3Derrno +- if A=3D=3DERROR_SUCCESS:return'ERROR_SUCCESS' +- elif A=3D=3DERROR_NOT_ENOUGH_MEMORY:return'ERROR_NOT_ENOUGH_MEMORY' +- return f"Windows error {A}" +- def write(A,b): +- B=3Dlen(b);E=3Dget_buffer(b);F=3Dmin(B,MAX_BYTES_WRITTEN)//2;C=3Dc_ulon= g();WriteConsoleW(HANDLE(A.handle),E,F,byref(C),_A);D=3D2*C.value +- if D=3D=3D0 and B>0:raise OSError(A._get_error_message(GetLastError())) +- return D +-class ConsoleStream: +- def __init__(A,text_stream,byte_stream):A._text_stream=3Dtext_stream;A.b= uffer=3Dbyte_stream +- @property +- def name(self):return self.buffer.name +- def write(A,x): +- if isinstance(x,str):return A._text_stream.write(x) +- try:A.flush() +- except Exception:pass +- return A.buffer.write(x) +- def writelines(A,lines): +- for B in lines:A.write(B) +- def __getattr__(A,name):return getattr(A._text_stream,name) +- def isatty(A):return A.buffer.isatty() +- def __repr__(A):return f"" +-class WindowsChunkedWriter: +- def __init__(A,wrapped):A.__wrapped=3Dwrapped +- def __getattr__(A,name):return getattr(A.__wrapped,name) +- def write(D,text): +- B=3Dlen(text);A=3D0 +- while A" +- def get_usage(A,ctx):raise NotImplementedError('Base commands cannot get= usage') +- def get_help(A,ctx):raise NotImplementedError('Base commands cannot get = help') +- def make_context(A,info_name,args,parent=3D_A,**B): +- for (D,E) in A.context_settings.items(): +- if D not in B:B[D]=3DE +- C=3DContext(A,info_name=3Dinfo_name,parent=3Dparent,**B) +- with C.scope(cleanup=3D_B):A.parse_args(C,args) +- return C +- def parse_args(A,ctx,args):raise NotImplementedError('Base commands do n= ot know how to parse arguments.') +- def invoke(A,ctx):raise NotImplementedError('Base commands are not invok= able by default') +- def main(E,args=3D_A,prog_name=3D_A,complete_var=3D_A,standalone_mode=3D= _C,**G): +- D=3Dstandalone_mode;C=3Dprog_name;B=3Dargs;_verify_python_env() +- if B is _A:B=3Dsys.argv[1:] +- else:B=3Dlist(B) +- if C is _A:C=3Dmake_str(os.path.basename(sys.argv[0]if sys.argv else __= file__)) +- _bashcomplete(E,C,complete_var) +- try: +- try: +- with E.make_context(C,B,**G)as F: +- H=3DE.invoke(F) +- if not D:return H +- F.exit() +- except (EOFError,KeyboardInterrupt):echo(file=3Dsys.stderr);raise Abor= t() +- except ClickException as A: +- if not D:raise +- A.show();sys.exit(A.exit_code) +- except OSError as A: +- if A.errno=3D=3Derrno.EPIPE:sys.stdout=3DPacifyFlushWrapper(sys.stdou= t);sys.stderr=3DPacifyFlushWrapper(sys.stderr);sys.exit(1) +- else:raise +- except Exit as A: +- if D:sys.exit(A.exit_code) +- else:return A.exit_code +- except Abort: +- if not D:raise +- echo('Aborted!',file=3Dsys.stderr);sys.exit(1) +- def __call__(A,*B,**C):return A.main(*B,**C) +-class Command(BaseCommand): +- def __init__(A,name,context_settings=3D_A,callback=3D_A,params=3D_A,help= =3D_A,epilog=3D_A,short_help=3D_A,options_metavar=3D'[OPTIONS]',add_help_op= tion=3D_C,no_args_is_help=3D_B,hidden=3D_B,deprecated=3D_B): +- B=3D'\x0c';BaseCommand.__init__(A,name,context_settings);A.callback=3Dc= allback;A.params=3Dparams or[] +- if help and B in help:help=3Dhelp.split(B,1)[0] +- A.help=3Dhelp;A.epilog=3Depilog;A.options_metavar=3Doptions_metavar;A.s= hort_help=3Dshort_help;A.add_help_option=3Dadd_help_option;A.no_args_is_hel= p=3Dno_args_is_help;A.hidden=3Dhidden;A.deprecated=3Ddeprecated +- def __repr__(A):return f"<{A.__class__.__name__} {A.name}>" +- def get_usage(B,ctx):A=3Dctx.make_formatter();B.format_usage(ctx,A);retu= rn A.getvalue().rstrip('\n') +- def get_params(B,ctx): +- A=3DB.params;C=3DB.get_help_option(ctx) +- if C is not _A:A=3DA+[C] +- return A +- def format_usage(A,ctx,formatter):B=3DA.collect_usage_pieces(ctx);format= ter.write_usage(ctx.command_path,' '.join(B)) +- def collect_usage_pieces(A,ctx): +- B=3D[A.options_metavar] +- for C in A.get_params(ctx):B.extend(C.get_usage_pieces(ctx)) +- return B +- def get_help_option_names(C,ctx): +- A=3Dset(ctx.help_option_names) +- for B in C.params:A.difference_update(B.opts);A.difference_update(B.sec= ondary_opts) +- return A +- def get_help_option(A,ctx): +- B=3DA.get_help_option_names(ctx) +- if not B or not A.add_help_option:return +- def C(ctx,param,value): +- A=3Dctx +- if value and not A.resilient_parsing:echo(A.get_help(),color=3DA.color= );A.exit() +- return Option(B,is_flag=3D_C,is_eager=3D_C,expose_value=3D_B,callback= =3DC,help=3D'Show this message and exit.') +- def make_parser(C,ctx): +- A=3Dctx;B=3DOptionParser(A) +- for D in C.get_params(A):D.add_to_parser(B,A) +- return B +- def get_help(B,ctx):A=3Dctx.make_formatter();B.format_help(ctx,A);return= A.getvalue().rstrip('\n') +- def get_short_help_str(A,limit=3D45):return A.short_help or A.help and m= ake_default_short_help(A.help,limit)or'' +- def format_help(A,ctx,formatter):C=3Dformatter;B=3Dctx;A.format_usage(B,= C);A.format_help_text(B,C);A.format_options(B,C);A.format_epilog(B,C) +- def format_help_text(B,ctx,formatter): +- A=3Dformatter +- if B.help: +- A.write_paragraph() +- with A.indentation(): +- C=3DB.help +- if B.deprecated:C+=3DDEPRECATED_HELP_NOTICE +- A.write_text(C) +- elif B.deprecated: +- A.write_paragraph() +- with A.indentation():A.write_text(DEPRECATED_HELP_NOTICE) +- def format_options(D,ctx,formatter): +- B=3Dformatter;A=3D[] +- for E in D.get_params(ctx): +- C=3DE.get_help_record(ctx) +- if C is not _A:A.append(C) +- if A: +- with B.section('Options'):B.write_dl(A) +- def format_epilog(B,ctx,formatter): +- A=3Dformatter +- if B.epilog: +- A.write_paragraph() +- with A.indentation():A.write_text(B.epilog) +- def parse_args(C,ctx,args): +- B=3Dargs;A=3Dctx +- if not B and C.no_args_is_help and not A.resilient_parsing:echo(A.get_h= elp(),color=3DA.color);A.exit() +- D=3DC.make_parser(A);E,B,F=3DD.parse_args(args=3DB) +- for G in iter_params_for_processing(F,C.get_params(A)):H,B=3DG.handle_p= arse_result(A,E,B) +- if B and not A.allow_extra_args and not A.resilient_parsing:A.fail(f"Go= t unexpected extra argument{'s'if len(B)!=3D1 else''} ({' '.join(map(make_s= tr,B))})") +- A.args=3DB;return B +- def invoke(A,ctx): +- _maybe_show_deprecated_notice(A) +- if A.callback is not _A:return ctx.invoke(A.callback,**ctx.params) +-class MultiCommand(Command): +- allow_extra_args=3D_C;allow_interspersed_args=3D_B +- def __init__(A,name=3D_A,invoke_without_command=3D_B,no_args_is_help=3D_= A,subcommand_metavar=3D_A,chain=3D_B,result_callback=3D_A,**G): +- E=3Dchain;D=3Dinvoke_without_command;C=3Dno_args_is_help;B=3Dsubcommand= _metavar;Command.__init__(A,name,**G) +- if C is _A:C=3Dnot D +- A.no_args_is_help=3DC;A.invoke_without_command=3DD +- if B is _A: +- if E:B=3DSUBCOMMANDS_METAVAR +- else:B=3DSUBCOMMAND_METAVAR +- A.subcommand_metavar=3DB;A.chain=3DE;A.result_callback=3Dresult_callback +- if A.chain: +- for F in A.params: +- if isinstance(F,Argument)and not F.required:raise RuntimeError('Multi= commands in chain mode cannot have optional arguments.') +- def collect_usage_pieces(A,ctx):B=3DCommand.collect_usage_pieces(A,ctx);= B.append(A.subcommand_metavar);return B +- def format_options(A,ctx,formatter):B=3Dformatter;Command.format_options= (A,ctx,B);A.format_commands(ctx,B) +- def resultcallback(A,replace=3D_B): +- def B(f): +- B=3DA.result_callback +- if B is _A or replace:A.result_callback=3Df;return f +- def C(__value,*A,**C):return f(B(__value,*A,**C),*A,**C) +- A.result_callback=3DD=3Dupdate_wrapper(C,f);return D +- return B +- def format_commands(F,ctx,formatter): +- D=3Dformatter;B=3D[] +- for C in F.list_commands(ctx): +- A=3DF.get_command(ctx,C) +- if A is _A:continue +- if A.hidden:continue +- B.append((C,A)) +- if len(B): +- G=3DD.width-6-max((len(A[0])for A in B));E=3D[] +- for (C,A) in B:help=3DA.get_short_help_str(G);E.append((C,help)) +- if E: +- with D.section('Commands'):D.write_dl(E) +- def parse_args(C,ctx,args): +- A=3Dctx +- if not args and C.no_args_is_help and not A.resilient_parsing:echo(A.ge= t_help(),color=3DA.color);A.exit() +- B=3DCommand.parse_args(C,A,args) +- if C.chain:A.protected_args=3DB;A.args=3D[] +- elif B:A.protected_args,A.args=3DB[:1],B[1:] +- return A.args +- def invoke(B,ctx): +- A=3Dctx +- def F(value): +- C=3Dvalue +- if B.result_callback is not _A:C=3DA.invoke(B.result_callback,C,**A.pa= rams) +- return C +- if not A.protected_args: +- if B.invoke_without_command: +- if not B.chain:return Command.invoke(B,A) +- with A:Command.invoke(B,A);return F([]) +- A.fail('Missing command.') +- D=3DA.protected_args+A.args;A.args=3D[];A.protected_args=3D[] +- if not B.chain: +- with A: +- E,G,D=3DB.resolve_command(A,D);A.invoked_subcommand=3DE;Command.invok= e(B,A);C=3DG.make_context(E,D,parent=3DA) +- with C:return F(C.command.invoke(C)) +- with A: +- A.invoked_subcommand=3D'*'if D else _A;Command.invoke(B,A);H=3D[] +- while D:E,G,D=3DB.resolve_command(A,D);C=3DG.make_context(E,D,parent= =3DA,allow_extra_args=3D_C,allow_interspersed_args=3D_B);H.append(C);D,C.ar= gs=3DC.args,[] +- I=3D[] +- for C in H: +- with C:I.append(C.command.invoke(C)) +- return F(I) +- def resolve_command(D,ctx,args): +- A=3Dctx;B=3Dmake_str(args[0]);E=3DB;C=3DD.get_command(A,B) +- if C is _A and A.token_normalize_func is not _A:B=3DA.token_normalize_f= unc(B);C=3DD.get_command(A,B) +- if C is _A and not A.resilient_parsing: +- if split_opt(B)[0]:D.parse_args(A,A.args) +- A.fail(f"No such command '{E}'.") +- return B,C,args[1:] +- def get_command(A,ctx,cmd_name):raise NotImplementedError() +- def list_commands(A,ctx):return[] +-class Group(MultiCommand): +- def __init__(A,name=3D_A,commands=3D_A,**B):MultiCommand.__init__(A,name= ,**B);A.commands=3Dcommands or{} +- def add_command(C,cmd,name=3D_A): +- B=3Dcmd;A=3Dname;A=3DA or B.name +- if A is _A:raise TypeError('Command has no name.') +- _check_multicommand(C,A,B,register=3D_C);C.commands[A]=3DB +- def command(B,*C,**D): +- from .decorators import command as E +- def A(f):A=3DE(*C,**D)(f);B.add_command(A);return A +- return A +- def group(B,*C,**D): +- from .decorators import group +- def A(f):A=3Dgroup(*C,**D)(f);B.add_command(A);return A +- return A +- def get_command(A,ctx,cmd_name):return A.commands.get(cmd_name) +- def list_commands(A,ctx):return sorted(A.commands) +-class CommandCollection(MultiCommand): +- def __init__(A,name=3D_A,sources=3D_A,**B):MultiCommand.__init__(A,name,= **B);A.sources=3Dsources or[] +- def add_source(A,multi_cmd):A.sources.append(multi_cmd) +- def get_command(A,ctx,cmd_name): +- C=3Dcmd_name +- for D in A.sources: +- B=3DD.get_command(ctx,C) +- if B is not _A: +- if A.chain:_check_multicommand(A,C,B) +- return B +- def list_commands(B,ctx): +- A=3Dset() +- for C in B.sources:A.update(C.list_commands(ctx)) +- return sorted(A) +-class Parameter: +- param_type_name=3D'parameter' +- def __init__(A,param_decls=3D_A,type=3D_A,required=3D_B,default=3D_A,cal= lback=3D_A,nargs=3D_A,metavar=3D_A,expose_value=3D_C,is_eager=3D_B,envvar= =3D_A,autocompletion=3D_A): +- D=3Dexpose_value;C=3Ddefault;B=3Dnargs;A.name,A.opts,A.secondary_opts= =3DA._parse_decls(param_decls or(),D);A.type=3Dconvert_type(type,C) +- if B is _A: +- if A.type.is_composite:B=3DA.type.arity +- else:B=3D1 +- A.required=3Drequired;A.callback=3Dcallback;A.nargs=3DB;A.multiple=3D_B= ;A.expose_value=3DD;A.default=3DC;A.is_eager=3Dis_eager;A.metavar=3Dmetavar= ;A.envvar=3Denvvar;A.autocompletion=3Dautocompletion +- def __repr__(A):return f"<{A.__class__.__name__} {A.name}>" +- @property +- def human_readable_name(self):return self.name +- def make_metavar(A): +- if A.metavar is not _A:return A.metavar +- B=3DA.type.get_metavar(A) +- if B is _A:B=3DA.type.name.upper() +- if A.nargs!=3D1:B+=3D_G +- return B +- def get_default(A,ctx): +- if callable(A.default):B=3DA.default() +- else:B=3DA.default +- return A.type_cast_value(ctx,B) +- def add_to_parser(A,parser,ctx):0 +- def consume_value(B,ctx,opts): +- C=3Dctx;A=3Dopts.get(B.name);D=3DParameterSource.COMMANDLINE +- if A is _A:A=3DB.value_from_envvar(C);D=3DParameterSource.ENVIRONMENT +- if A is _A:A=3DC.lookup_default(B.name);D=3DParameterSource.DEFAULT_MAP +- if A is not _A:C.set_parameter_source(B.name,D) +- return A +- def type_cast_value(A,ctx,value): +- C=3Dvalue;B=3Dctx +- if A.type.is_composite: +- if A.nargs<=3D1:raise TypeError(f"Attempted to invoke composite type b= ut nargs has been set to {A.nargs}. This is not supported; nargs needs to b= e set to a fixed value > 1.") +- if A.multiple:return tuple((A.type(D or(),A,B)for D in C or())) +- return A.type(C or(),A,B) +- def D(value,level): +- E=3Dlevel;C=3Dvalue +- if E=3D=3D0:return A.type(C,A,B) +- return tuple((D(A,E-1)for A in C or())) +- return D(C,(A.nargs!=3D1)+bool(A.multiple)) +- def process_value(B,ctx,value): +- A=3Dvalue +- if A is not _A:return B.type_cast_value(ctx,A) +- def value_is_missing(A,value): +- B=3Dvalue +- if B is _A:return _C +- if(A.nargs!=3D1 or A.multiple)and B=3D=3D():return _C +- return _B +- def full_process_value(B,ctx,value): +- C=3Dctx;A=3Dvalue;A=3DB.process_value(C,A) +- if A is _A and not C.resilient_parsing: +- A=3DB.get_default(C) +- if A is not _A:C.set_parameter_source(B.name,ParameterSource.DEFAULT) +- if B.required and B.value_is_missing(A):raise MissingParameter(ctx=3DC,= param=3DB) +- return A +- def resolve_envvar_value(B,ctx): +- if B.envvar is _A:return +- if isinstance(B.envvar,(tuple,list)): +- for C in B.envvar: +- A=3Dos.environ.get(C) +- if A is not _A:return A +- else: +- A=3Dos.environ.get(B.envvar) +- if A!=3D'':return A +- def value_from_envvar(B,ctx): +- A=3DB.resolve_envvar_value(ctx) +- if A is not _A and B.nargs!=3D1:A=3DB.type.split_envvar_value(A) +- return A +- def handle_parse_result(A,ctx,opts,args): +- B=3Dctx +- with augment_usage_errors(B,param=3DA): +- C=3DA.consume_value(B,opts) +- try:C=3DA.full_process_value(B,C) +- except Exception: +- if not B.resilient_parsing:raise +- C=3D_A +- if A.callback is not _A: +- try:C=3DA.callback(B,A,C) +- except Exception: +- if not B.resilient_parsing:raise +- if A.expose_value:B.params[A.name]=3DC +- return C,args +- def get_help_record(A,ctx):0 +- def get_usage_pieces(A,ctx):return[] +- def get_error_hint(A,ctx):B=3DA.opts or[A.human_readable_name];return _H= .join((repr(A)for A in B)) +-class Option(Parameter): +- param_type_name=3D'option' +- def __init__(A,param_decls=3D_A,show_default=3D_B,prompt=3D_B,confirmati= on_prompt=3D_B,hide_input=3D_B,is_flag=3D_A,flag_value=3D_A,multiple=3D_B,c= ount=3D_B,allow_from_autoenv=3D_C,type=3D_A,help=3D_A,hidden=3D_B,show_choi= ces=3D_C,show_envvar=3D_B,**G): +- F=3Dcount;D=3Dprompt;C=3Dflag_value;B=3Dis_flag;H=3DG.get(_I,_missing)i= s _missing;Parameter.__init__(A,param_decls,type=3Dtype,**G) +- if D is _C:E=3DA.name.replace(_D,' ').capitalize() +- elif D is _B:E=3D_A +- else:E=3DD +- A.prompt=3DE;A.confirmation_prompt=3Dconfirmation_prompt;A.hide_input= =3Dhide_input;A.hidden=3Dhidden +- if B is _A: +- if C is not _A:B=3D_C +- else:B=3Dbool(A.secondary_opts) +- if B and H:A.default=3D_B +- if C is _A:C=3Dnot A.default +- A.is_flag=3DB;A.flag_value=3DC +- if A.is_flag and isinstance(A.flag_value,bool)and type in[_A,bool]:A.ty= pe=3DBOOL;A.is_bool_flag=3D_C +- else:A.is_bool_flag=3D_B +- A.count=3DF +- if F: +- if type is _A:A.type=3DIntRange(min=3D0) +- if H:A.default=3D0 +- A.multiple=3Dmultiple;A.allow_from_autoenv=3Dallow_from_autoenv;A.help= =3Dhelp;A.show_default=3Dshow_default;A.show_choices=3Dshow_choices;A.show_= envvar=3Dshow_envvar +- if __debug__: +- if A.nargs<0:raise TypeError('Options cannot have nargs < 0') +- if A.prompt and A.is_flag and not A.is_bool_flag:raise TypeError('Cann= ot prompt for flags that are not bools.') +- if not A.is_bool_flag and A.secondary_opts:raise TypeError('Got second= ary option for non boolean flag.') +- if A.is_bool_flag and A.hide_input and A.prompt is not _A:raise TypeEr= ror('Hidden input does not work with boolean flag prompts.') +- if A.count: +- if A.multiple:raise TypeError('Options cannot be multiple and count a= t the same time.') +- elif A.is_flag:raise TypeError('Options cannot be count and flags at = the same time.') +- def _parse_decls(J,decls,expose_value): +- I=3D'/';C=3D[];F=3D[];A=3D_A;D=3D[] +- for B in decls: +- if B.isidentifier(): +- if A is not _A:raise TypeError('Name defined twice') +- A=3DB +- else: +- H=3D';'if B[:1]=3D=3DI else I +- if H in B: +- E,G=3DB.split(H,1);E=3DE.rstrip() +- if E:D.append(split_opt(E));C.append(E) +- G=3DG.lstrip() +- if G:F.append(G.lstrip()) +- else:D.append(split_opt(B));C.append(B) +- if A is _A and D: +- D.sort(key=3Dlambda x:-len(x[0]));A=3DD[0][1].replace(_E,_D).lower() +- if not A.isidentifier():A=3D_A +- if A is _A: +- if not expose_value:return _A,C,F +- raise TypeError('Could not determine name for option') +- if not C and not F:raise TypeError(f"No options defined but a name was = passed ({A}). Did you mean to declare an argument instead of an option?") +- return A,C,F +- def add_to_parser(A,parser,ctx): +- C=3Dparser;B=3D{'dest':A.name,_F:A.nargs,'obj':A} +- if A.multiple:D=3D'append' +- elif A.count:D=3D'count' +- else:D=3D'store' +- if A.is_flag: +- B.pop(_F,_A);E=3Df"{D}_const" +- if A.is_bool_flag and A.secondary_opts:C.add_option(A.opts,action=3DE,= const=3D_C,**B);C.add_option(A.secondary_opts,action=3DE,const=3D_B,**B) +- else:C.add_option(A.opts,action=3DE,const=3DA.flag_value,**B) +- else:B['action']=3DD;C.add_option(A.opts,**B) +- def get_help_record(A,ctx): +- K=3D', ';E=3Dctx +- if A.hidden:return +- F=3D[] +- def G(opts): +- B,C=3Djoin_options(opts) +- if C:F[:]=3D[_C] +- if not A.is_flag and not A.count:B+=3Df" {A.make_metavar()}" +- return B +- H=3D[G(A.opts)] +- if A.secondary_opts:H.append(G(A.secondary_opts)) +- help=3DA.help or'';C=3D[] +- if A.show_envvar: +- B=3DA.envvar +- if B is _A: +- if A.allow_from_autoenv and E.auto_envvar_prefix is not _A:B=3Df"{E.a= uto_envvar_prefix}_{A.name.upper()}" +- if B is not _A:J=3DK.join((str(A)for A in B))if isinstance(B,(list,tup= le))else B;C.append(f"env var: {J}") +- if A.default is not _A and(A.show_default or E.show_default): +- if isinstance(A.show_default,str):D=3Df"({A.show_default})" +- elif isinstance(A.default,(list,tuple)):D=3DK.join((str(B)for B in A.d= efault)) +- elif inspect.isfunction(A.default):D=3D'(dynamic)' +- else:D=3DA.default +- C.append(f"default: {D}") +- if A.required:C.append('required') +- if C:I=3D';'.join(C);help=3Df"{help} [{I}]"if help else f"[{I}]" +- return ('; 'if F else _H).join(H),help +- def get_default(A,ctx): +- if A.is_flag and not A.is_bool_flag: +- for B in ctx.command.params: +- if B.name=3D=3DA.name and B.default:return B.flag_value +- return _A +- return Parameter.get_default(A,ctx) +- def prompt_for_value(A,ctx): +- B=3DA.get_default(ctx) +- if A.is_bool_flag:return confirm(A.prompt,B) +- return prompt(A.prompt,default=3DB,type=3DA.type,hide_input=3DA.hide_in= put,show_choices=3DA.show_choices,confirmation_prompt=3DA.confirmation_prom= pt,value_proc=3Dlambda x:A.process_value(ctx,x)) +- def resolve_envvar_value(A,ctx): +- B=3Dctx;C=3DParameter.resolve_envvar_value(A,B) +- if C is not _A:return C +- if A.allow_from_autoenv and B.auto_envvar_prefix is not _A:D=3Df"{B.aut= o_envvar_prefix}_{A.name.upper()}";return os.environ.get(D) +- def value_from_envvar(A,ctx): +- B=3DA.resolve_envvar_value(ctx) +- if B is _A:return _A +- C=3D(A.nargs!=3D1)+bool(A.multiple) +- if C>0 and B is not _A: +- B=3DA.type.split_envvar_value(B) +- if A.multiple and A.nargs!=3D1:B=3Dbatch(B,A.nargs) +- return B +- def full_process_value(A,ctx,value): +- C=3Dvalue;B=3Dctx +- if C is _A and A.prompt is not _A and not B.resilient_parsing:return A.= prompt_for_value(B) +- return Parameter.full_process_value(A,B,C) +-class Argument(Parameter): +- param_type_name=3D'argument' +- def __init__(B,param_decls,required=3D_A,**C): +- A=3Drequired +- if A is _A: +- if C.get(_I)is not _A:A=3D_B +- else:A=3DC.get(_F,1)>0 +- Parameter.__init__(B,param_decls,required=3DA,**C) +- if B.default is not _A and B.nargs<0:raise TypeError('nargs=3D-1 in com= bination with a default value is not supported.') +- @property +- def human_readable_name(self): +- A=3Dself +- if A.metavar is not _A:return A.metavar +- return A.name.upper() +- def make_metavar(A): +- if A.metavar is not _A:return A.metavar +- B=3DA.type.get_metavar(A) +- if not B:B=3DA.name.upper() +- if not A.required:B=3Df"[{B}]" +- if A.nargs!=3D1:B+=3D_G +- return B +- def _parse_decls(D,decls,expose_value): +- A=3Ddecls +- if not A: +- if not expose_value:return _A,[],[] +- raise TypeError('Could not determine name for argument') +- if len(A)=3D=3D1:B=3DC=3DA[0];B=3DB.replace(_E,_D).lower() +- else:raise TypeError(f"Arguments take exactly one parameter declaration= , got {len(A)}.") +- return B,[C],[] +- def get_usage_pieces(A,ctx):return[A.make_metavar()] +- def get_error_hint(A,ctx):return repr(A.make_metavar()) +- def add_to_parser(A,parser,ctx):parser.add_argument(dest=3DA.name,nargs= =3DA.nargs,obj=3DA) +\ No newline at end of file +diff --git a/dynaconf/vendor/click/decorators.py b/dynaconf/vendor/click/d= ecorators.py +deleted file mode 100644 +index 888b3e0..0000000 +--- a/dynaconf/vendor/click/decorators.py ++++ /dev/null +@@ -1,115 +0,0 @@ +-_J=3D'is_eager' +-_I=3D'prompt' +-_H=3D'expose_value' +-_G=3D'callback' +-_F=3D'is_flag' +-_E=3D'cls' +-_D=3DFalse +-_C=3DTrue +-_B=3D'help' +-_A=3DNone +-import inspect,sys +-from functools import update_wrapper +-from .core import Argument +-from .core import Command +-from .core import Group +-from .core import Option +-from .globals import get_current_context +-from .utils import echo +-def pass_context(f): +- 'Marks a callback as wanting to receive the current context\n object = as first argument.\n ' +- def A(*A,**B):return f(get_current_context(),*A,**B) +- return update_wrapper(A,f) +-def pass_obj(f): +- 'Similar to :func:`pass_context`, but only pass the object on the\n c= ontext onwards (:attr:`Context.obj`). This is useful if that object\n r= epresents the state of a nested system.\n ' +- def A(*A,**B):return f(get_current_context().obj,*A,**B) +- return update_wrapper(A,f) +-def make_pass_decorator(object_type,ensure=3D_D): +- "Given an object type this creates a decorator that will work\n simil= ar to :func:`pass_obj` but instead of passing the object of the\n curren= t context, it will find the innermost context of type\n :func:`object_ty= pe`.\n\n This generates a decorator that works roughly like this::\n\n = from functools import update_wrapper\n\n def decorator(f):\n = @pass_context\n def new_func(ctx, *args, **kwargs):\n = obj =3D ctx.find_object(object_type)\n return= ctx.invoke(f, obj, *args, **kwargs)\n return update_wrapper(new= _func, f)\n return decorator\n\n :param object_type: the type of = the object to pass.\n :param ensure: if set to `True`, a new object will= be created and\n remembered on the context if it's not t= here yet.\n ";A=3Dobject_type +- def B(f): +- def B(*D,**E): +- B=3Dget_current_context() +- if ensure:C=3DB.ensure_object(A) +- else:C=3DB.find_object(A) +- if C is _A:raise RuntimeError(f"Managed to invoke callback without a c= ontext object of type {A.__name__!r} existing.") +- return B.invoke(f,C,*D,**E) +- return update_wrapper(B,f) +- return B +-def _make_command(f,name,attrs,cls): +- A=3Dattrs +- if isinstance(f,Command):raise TypeError('Attempted to convert a callbac= k into a command twice.') +- try:B=3Df.__click_params__;B.reverse();del f.__click_params__ +- except AttributeError:B=3D[] +- help=3DA.get(_B) +- if help is _A: +- help=3Dinspect.getdoc(f) +- if isinstance(help,bytes):help=3Dhelp.decode('utf-8') +- else:help=3Dinspect.cleandoc(help) +- A[_B]=3Dhelp;return cls(name=3Dname or f.__name__.lower().replace('_','-= '),callback=3Df,params=3DB,**A) +-def command(name=3D_A,cls=3D_A,**C): +- 'Creates a new :class:`Command` and uses the decorated function as\n = callback. This will also automatically attach all decorated\n :func:`op= tion`\\s and :func:`argument`\\s as parameters to the command.\n\n The n= ame of the command defaults to the name of the function with\n underscor= es replaced by dashes. If you want to change that, you can\n pass the i= ntended name as the first argument.\n\n All keyword arguments are forwar= ded to the underlying command class.\n\n Once decorated the function tur= ns into a :class:`Command` instance\n that can be invoked as a command l= ine utility or be attached to a\n command :class:`Group`.\n\n :param = name: the name of the command. This defaults to the function\n = name with underscores replaced by dashes.\n :param cls: the command= class to instantiate. This defaults to\n :class:`Command`.= \n ';A=3Dcls +- if A is _A:A=3DCommand +- def B(f):B=3D_make_command(f,name,C,A);B.__doc__=3Df.__doc__;return B +- return B +-def group(name=3D_A,**A):'Creates a new :class:`Group` with a function as= callback. This\n works otherwise the same as :func:`command` just that= the `cls`\n parameter is set to :class:`Group`.\n ';A.setdefault(_E,= Group);return command(name,**A) +-def _param_memo(f,param): +- A=3Dparam +- if isinstance(f,Command):f.params.append(A) +- else: +- if not hasattr(f,'__click_params__'):f.__click_params__=3D[] +- f.__click_params__.append(A) +-def argument(*B,**A): +- 'Attaches an argument to the command. All positional arguments are\n = passed as parameter declarations to :class:`Argument`; all keyword\n ar= guments are forwarded unchanged (except ``cls``).\n This is equivalent t= o creating an :class:`Argument` instance manually\n and attaching it to = the :attr:`Command.params` list.\n\n :param cls: the argument class to i= nstantiate. This defaults to\n :class:`Argument`.\n ' +- def C(f):C=3DA.pop(_E,Argument);_param_memo(f,C(B,**A));return f +- return C +-def option(*B,**C): +- 'Attaches an option to the command. All positional arguments are\n p= assed as parameter declarations to :class:`Option`; all keyword\n argume= nts are forwarded unchanged (except ``cls``).\n This is equivalent to cr= eating an :class:`Option` instance manually\n and attaching it to the :a= ttr:`Command.params` list.\n\n :param cls: the option class to instantia= te. This defaults to\n :class:`Option`.\n ' +- def A(f): +- A=3DC.copy() +- if _B in A:A[_B]=3Dinspect.cleandoc(A[_B]) +- D=3DA.pop(_E,Option);_param_memo(f,D(B,**A));return f +- return A +-def confirmation_option(*B,**A): +- "Shortcut for confirmation prompts that can be ignored by passing\n `= `--yes`` as parameter.\n\n This is equivalent to decorating a function w= ith :func:`option` with\n the following parameters::\n\n def call= back(ctx, param, value):\n if not value:\n ctx.ab= ort()\n\n @click.command()\n @click.option('--yes', is_flag= =3DTrue, callback=3Dcallback,\n expose_value=3DFalse, = prompt=3D'Do you want to continue?')\n def dropdb():\n pa= ss\n " +- def C(f): +- def C(ctx,param,value): +- if not value:ctx.abort() +- A.setdefault(_F,_C);A.setdefault(_G,C);A.setdefault(_H,_D);A.setdefault= (_I,'Do you want to continue?');A.setdefault(_B,'Confirm the action without= prompting.');return option(*B or('--yes',),**A)(f) +- return C +-def password_option(*B,**A): +- "Shortcut for password prompts.\n\n This is equivalent to decorating = a function with :func:`option` with\n the following parameters::\n\n = @click.command()\n @click.option('--password', prompt=3DTrue, co= nfirmation_prompt=3DTrue,\n hide_input=3DTrue)\n = def changeadmin(password):\n pass\n " +- def C(f):A.setdefault(_I,_C);A.setdefault('confirmation_prompt',_C);A.se= tdefault('hide_input',_C);return option(*B or('--password',),**A)(f) +- return C +-def version_option(version=3D_A,*B,**A): +- "Adds a ``--version`` option which immediately ends the program\n pri= nting out the version number. This is implemented as an eager\n option = that prints the version and exits the program in the callback.\n\n :para= m version: the version number to show. If not provided Click\n = attempts an auto discovery via setuptools.\n :param prog_name: t= he name of the program (defaults to autodetection)\n :param message: cus= tom message to show instead of the default\n (``'%(prog)= s, version %(version)s'``)\n :param others: everything else is forwarded= to :func:`option`.\n ";D=3Dversion +- if D is _A: +- if hasattr(sys,'_getframe'):E=3Dsys._getframe(1).f_globals.get('__name_= _') +- else:E=3D'' +- def C(f): +- G=3DA.pop('prog_name',_A);H=3DA.pop('message','%(prog)s, version %(vers= ion)s') +- def C(ctx,param,value): +- A=3Dctx +- if not value or A.resilient_parsing:return +- C=3DG +- if C is _A:C=3DA.find_root().info_name +- B=3DD +- if B is _A: +- try:import pkg_resources as I +- except ImportError:pass +- else: +- for F in I.working_set: +- J=3DF.get_entry_map().get('console_scripts')or{} +- for K in J.values(): +- if K.module_name=3D=3DE:B=3DF.version;break +- if B is _A:raise RuntimeError('Could not determine version') +- echo(H%{'prog':C,'version':B},color=3DA.color);A.exit() +- A.setdefault(_F,_C);A.setdefault(_H,_D);A.setdefault(_J,_C);A.setdefaul= t(_B,'Show the version and exit.');A[_G]=3DC;return option(*B or('--version= ',),**A)(f) +- return C +-def help_option(*B,**A): +- 'Adds a ``--help`` option which immediately ends the program\n printi= ng out the help page. This is usually unnecessary to add as\n this is a= dded by default to all commands unless suppressed.\n\n Like :func:`versi= on_option`, this is implemented as eager option that\n prints in the cal= lback and exits.\n\n All arguments are forwarded to :func:`option`.\n = ' +- def C(f): +- def C(ctx,param,value): +- A=3Dctx +- if value and not A.resilient_parsing:echo(A.get_help(),color=3DA.color= );A.exit() +- A.setdefault(_F,_C);A.setdefault(_H,_D);A.setdefault(_B,'Show this mess= age and exit.');A.setdefault(_J,_C);A[_G]=3DC;return option(*B or('--help',= ),**A)(f) +- return C +\ No newline at end of file +diff --git a/dynaconf/vendor/click/exceptions.py b/dynaconf/vendor/click/e= xceptions.py +deleted file mode 100644 +index 6cc0189..0000000 +--- a/dynaconf/vendor/click/exceptions.py ++++ /dev/null +@@ -1,76 +0,0 @@ +-_A=3DNone +-from ._compat import filename_to_ui,get_text_stderr +-from .utils import echo +-def _join_param_hints(param_hint): +- A=3Dparam_hint +- if isinstance(A,(tuple,list)):return ' / '.join((repr(B)for B in A)) +- return A +-class ClickException(Exception): +- exit_code=3D1 +- def __init__(B,message):A=3Dmessage;super().__init__(A);B.message=3DA +- def format_message(A):return A.message +- def __str__(A):return A.message +- def show(B,file=3D_A): +- A=3Dfile +- if A is _A:A=3Dget_text_stderr() +- echo(f"Error: {B.format_message()}",file=3DA) +-class UsageError(ClickException): +- exit_code=3D2 +- def __init__(A,message,ctx=3D_A):ClickException.__init__(A,message);A.ct= x=3Dctx;A.cmd=3DA.ctx.command if A.ctx else _A +- def show(A,file=3D_A): +- B=3Dfile +- if B is _A:B=3Dget_text_stderr() +- C=3D_A;D=3D'' +- if A.cmd is not _A and A.cmd.get_help_option(A.ctx)is not _A:D=3Df"Try = '{A.ctx.command_path} {A.ctx.help_option_names[0]}' for help.\n" +- if A.ctx is not _A:C=3DA.ctx.color;echo(f"{A.ctx.get_usage()}\n{D}",fil= e=3DB,color=3DC) +- echo(f"Error: {A.format_message()}",file=3DB,color=3DC) +-class BadParameter(UsageError): +- def __init__(A,message,ctx=3D_A,param=3D_A,param_hint=3D_A):UsageError._= _init__(A,message,ctx);A.param=3Dparam;A.param_hint=3Dparam_hint +- def format_message(A): +- if A.param_hint is not _A:B=3DA.param_hint +- elif A.param is not _A:B=3DA.param.get_error_hint(A.ctx) +- else:return f"Invalid value: {A.message}" +- B=3D_join_param_hints(B);return f"Invalid value for {B}: {A.message}" +-class MissingParameter(BadParameter): +- def __init__(A,message=3D_A,ctx=3D_A,param=3D_A,param_hint=3D_A,param_ty= pe=3D_A):BadParameter.__init__(A,message,ctx,param,param_hint);A.param_type= =3Dparam_type +- def format_message(A): +- if A.param_hint is not _A:B=3DA.param_hint +- elif A.param is not _A:B=3DA.param.get_error_hint(A.ctx) +- else:B=3D_A +- B=3D_join_param_hints(B);D=3DA.param_type +- if D is _A and A.param is not _A:D=3DA.param.param_type_name +- C=3DA.message +- if A.param is not _A: +- E=3DA.param.type.get_missing_message(A.param) +- if E: +- if C:C+=3Df". {E}" +- else:C=3DE +- F=3Df" {B}"if B else'';return f"Missing {D}{F}.{' 'if C else''}{C or''}" +- def __str__(A): +- if A.message is _A:B=3DA.param.name if A.param else _A;return f"missing= parameter: {B}" +- else:return A.message +-class NoSuchOption(UsageError): +- def __init__(A,option_name,message=3D_A,possibilities=3D_A,ctx=3D_A): +- C=3Doption_name;B=3Dmessage +- if B is _A:B=3Df"no such option: {C}" +- UsageError.__init__(A,B,ctx);A.option_name=3DC;A.possibilities=3Dpossib= ilities +- def format_message(A): +- B=3D[A.message] +- if A.possibilities: +- if len(A.possibilities)=3D=3D1:B.append(f"Did you mean {A.possibilitie= s[0]}?") +- else:C=3Dsorted(A.possibilities);B.append(f"(Possible options: {', '.j= oin(C)})") +- return ' '.join(B) +-class BadOptionUsage(UsageError): +- def __init__(A,option_name,message,ctx=3D_A):UsageError.__init__(A,messa= ge,ctx);A.option_name=3Doption_name +-class BadArgumentUsage(UsageError): +- def __init__(A,message,ctx=3D_A):UsageError.__init__(A,message,ctx) +-class FileError(ClickException): +- def __init__(A,filename,hint=3D_A): +- C=3Dfilename;B=3Dhint;D=3Dfilename_to_ui(C) +- if B is _A:B=3D'unknown error' +- ClickException.__init__(A,B);A.ui_filename=3DD;A.filename=3DC +- def format_message(A):return f"Could not open file {A.ui_filename}: {A.m= essage}" +-class Abort(RuntimeError):0 +-class Exit(RuntimeError): +- __slots__=3D'exit_code', +- def __init__(A,code=3D0):A.exit_code=3Dcode +\ No newline at end of file +diff --git a/dynaconf/vendor/click/formatting.py b/dynaconf/vendor/click/f= ormatting.py +deleted file mode 100644 +index df18661..0000000 +--- a/dynaconf/vendor/click/formatting.py ++++ /dev/null +@@ -1,90 +0,0 @@ +-_E=3DTrue +-_D=3DFalse +-_C=3D' ' +-_B=3D'\n' +-_A=3DNone +-from contextlib import contextmanager +-from ._compat import term_len +-from .parser import split_opt +-from .termui import get_terminal_size +-FORCED_WIDTH=3D_A +-def measure_table(rows): +- A=3D{} +- for C in rows: +- for (B,D) in enumerate(C):A[B]=3Dmax(A.get(B,0),term_len(D)) +- return tuple((B for(C,B)in sorted(A.items()))) +-def iter_rows(rows,col_count): +- for A in rows:A=3Dtuple(A);yield A+('',)*(col_count-len(A)) +-def wrap_text(text,width=3D78,initial_indent=3D'',subsequent_indent=3D'',= preserve_paragraphs=3D_D): +- A=3Dtext;from ._textwrap import TextWrapper as I;A=3DA.expandtabs();E=3D= I(width,initial_indent=3Dinitial_indent,subsequent_indent=3Dsubsequent_inde= nt,replace_whitespace=3D_D) +- if not preserve_paragraphs:return E.fill(A) +- F=3D[];C=3D[];B=3D_A +- def H(): +- if not C:return +- if C[0].strip()=3D=3D'\x08':F.append((B or 0,_E,_B.join(C[1:]))) +- else:F.append((B or 0,_D,_C.join(C))) +- del C[:] +- for D in A.splitlines(): +- if not D:H();B=3D_A +- else: +- if B is _A:J=3Dterm_len(D);D=3DD.lstrip();B=3DJ-term_len(D) +- C.append(D) +- H();G=3D[] +- for (B,K,A) in F: +- with E.extra_indent(_C*B): +- if K:G.append(E.indent_only(A)) +- else:G.append(E.fill(A)) +- return '\n\n'.join(G) +-class HelpFormatter: +- def __init__(B,indent_increment=3D2,width=3D_A,max_width=3D_A): +- C=3Dmax_width;A=3Dwidth;B.indent_increment=3Dindent_increment +- if C is _A:C=3D80 +- if A is _A: +- A=3DFORCED_WIDTH +- if A is _A:A=3Dmax(min(get_terminal_size()[0],C)-2,50) +- B.width=3DA;B.current_indent=3D0;B.buffer=3D[] +- def write(A,string):A.buffer.append(string) +- def indent(A):A.current_indent+=3DA.indent_increment +- def dedent(A):A.current_indent-=3DA.indent_increment +- def write_usage(A,prog,args=3D'',prefix=3D'Usage: '): +- E=3Dprefix;B=3Df"{E:>{A.current_indent}}{prog} ";D=3DA.width-A.current_= indent +- if D>=3Dterm_len(B)+20:C=3D_C*term_len(B);A.write(wrap_text(args,D,init= ial_indent=3DB,subsequent_indent=3DC)) +- else:A.write(B);A.write(_B);C=3D_C*(max(A.current_indent,term_len(E))+4= );A.write(wrap_text(args,D,initial_indent=3DC,subsequent_indent=3DC)) +- A.write(_B) +- def write_heading(A,heading):A.write(f"{'':>{A.current_indent}}{heading}= :\n") +- def write_paragraph(A): +- if A.buffer:A.write(_B) +- def write_text(A,text):C=3Dmax(A.width-A.current_indent,11);B=3D_C*A.cur= rent_indent;A.write(wrap_text(text,C,initial_indent=3DB,subsequent_indent= =3DB,preserve_paragraphs=3D_E));A.write(_B) +- def write_dl(A,rows,col_max=3D30,col_spacing=3D2): +- G=3Dcol_spacing;C=3Drows;C=3Dlist(C);E=3Dmeasure_table(C) +- if len(E)!=3D2:raise TypeError('Expected two columns for definition lis= t') +- B=3Dmin(E[0],col_max)+G +- for (F,H) in iter_rows(C,len(E)): +- A.write(f"{'':>{A.current_indent}}{F}") +- if not H:A.write(_B);continue +- if term_len(F)<=3DB-G:A.write(_C*(B-term_len(F))) +- else:A.write(_B);A.write(_C*(B+A.current_indent)) +- I=3Dmax(A.width-B-2,10);J=3Dwrap_text(H,I,preserve_paragraphs=3D_E);D= =3DJ.splitlines() +- if D: +- A.write(f"{D[0]}\n") +- for K in D[1:]:A.write(f"{'':>{B+A.current_indent}}{K}\n") +- if len(D)>1:A.write(_B) +- else:A.write(_B) +- @contextmanager +- def section(self,name): +- A=3Dself;A.write_paragraph();A.write_heading(name);A.indent() +- try:yield +- finally:A.dedent() +- @contextmanager +- def indentation(self): +- self.indent() +- try:yield +- finally:self.dedent() +- def getvalue(A):return ''.join(A.buffer) +-def join_options(options): +- A=3D[];B=3D_D +- for C in options: +- D=3Dsplit_opt(C)[0] +- if D=3D=3D'/':B=3D_E +- A.append((len(D),C)) +- A.sort(key=3Dlambda x:x[0]);A=3D', '.join((B[1]for B in A));return A,B +\ No newline at end of file +diff --git a/dynaconf/vendor/click/globals.py b/dynaconf/vendor/click/glob= als.py +deleted file mode 100644 +index e0b71c5..0000000 +--- a/dynaconf/vendor/click/globals.py ++++ /dev/null +@@ -1,14 +0,0 @@ +-_A=3DNone +-from threading import local +-_local=3Dlocal() +-def get_current_context(silent=3DFalse): +- try:return _local.stack[-1] +- except (AttributeError,IndexError): +- if not silent:raise RuntimeError('There is no active click context.') +-def push_context(ctx):_local.__dict__.setdefault('stack',[]).append(ctx) +-def pop_context():_local.stack.pop() +-def resolve_color_default(color=3D_A): +- A=3Dcolor +- if A is not _A:return A +- B=3Dget_current_context(silent=3DTrue) +- if B is not _A:return B.color +\ No newline at end of file +diff --git a/dynaconf/vendor/click/parser.py b/dynaconf/vendor/click/parse= r.py +deleted file mode 100644 +index 769c403..0000000 +--- a/dynaconf/vendor/click/parser.py ++++ /dev/null +@@ -1,157 +0,0 @@ +-_D=3DFalse +-_C=3D'append' +-_B=3D'store' +-_A=3DNone +-import re +-from collections import deque +-from .exceptions import BadArgumentUsage +-from .exceptions import BadOptionUsage +-from .exceptions import NoSuchOption +-from .exceptions import UsageError +-def _unpack_args(args,nargs_spec): +- D=3Dnargs_spec;C=3Dargs;C=3Ddeque(C);D=3Ddeque(D);A=3D[];B=3D_A +- def F(c): +- try: +- if B is _A:return c.popleft() +- else:return c.pop() +- except IndexError:return _A +- while D: +- E=3DF(D) +- if E=3D=3D1:A.append(F(C)) +- elif E>1: +- G=3D[F(C)for A in range(E)] +- if B is not _A:G.reverse() +- A.append(tuple(G)) +- elif E<0: +- if B is not _A:raise TypeError('Cannot have two nargs < 0') +- B=3Dlen(A);A.append(_A) +- if B is not _A:A[B]=3Dtuple(C);C=3D[];A[B+1:]=3Dreversed(A[B+1:]) +- return tuple(A),list(C) +-def _error_opt_args(nargs,opt): +- B=3Dnargs;A=3Dopt +- if B=3D=3D1:raise BadOptionUsage(A,f"{A} option requires an argument") +- raise BadOptionUsage(A,f"{A} option requires {B} arguments") +-def split_opt(opt): +- A=3Dopt;B=3DA[:1] +- if B.isalnum():return'',A +- if A[1:2]=3D=3DB:return A[:2],A[2:] +- return B,A[1:] +-def normalize_opt(opt,ctx): +- B=3Dctx;A=3Dopt +- if B is _A or B.token_normalize_func is _A:return A +- C,A=3Dsplit_opt(A);return f"{C}{B.token_normalize_func(A)}" +-def split_arg_string(string): +- B=3Dstring;C=3D[] +- for D in re.finditer('(\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|\\"([^\\"\\\= \]*(?:\\\\.[^\\"\\\\]*)*)\\"|\\S+)\\s*',B,re.S): +- A=3DD.group().strip() +- if A[:1]=3D=3DA[-1:]and A[:1]in'"\'':A=3DA[1:-1].encode('ascii','backsl= ashreplace').decode('unicode-escape') +- try:A=3Dtype(B)(A) +- except UnicodeError:pass +- C.append(A) +- return C +-class Option: +- def __init__(A,opts,dest,action=3D_A,nargs=3D1,const=3D_A,obj=3D_A): +- D=3Daction;A._short_opts=3D[];A._long_opts=3D[];A.prefixes=3Dset() +- for B in opts: +- C,E=3Dsplit_opt(B) +- if not C:raise ValueError(f"Invalid start character for option ({B})") +- A.prefixes.add(C[0]) +- if len(C)=3D=3D1 and len(E)=3D=3D1:A._short_opts.append(B) +- else:A._long_opts.append(B);A.prefixes.add(C) +- if D is _A:D=3D_B +- A.dest=3Ddest;A.action=3DD;A.nargs=3Dnargs;A.const=3Dconst;A.obj=3Dobj +- @property +- def takes_value(self):return self.action in(_B,_C) +- def process(A,value,state): +- C=3Dvalue;B=3Dstate +- if A.action=3D=3D_B:B.opts[A.dest]=3DC +- elif A.action=3D=3D'store_const':B.opts[A.dest]=3DA.const +- elif A.action=3D=3D_C:B.opts.setdefault(A.dest,[]).append(C) +- elif A.action=3D=3D'append_const':B.opts.setdefault(A.dest,[]).append(A= .const) +- elif A.action=3D=3D'count':B.opts[A.dest]=3DB.opts.get(A.dest,0)+1 +- else:raise ValueError(f"unknown action '{A.action}'") +- B.order.append(A.obj) +-class Argument: +- def __init__(A,dest,nargs=3D1,obj=3D_A):A.dest=3Ddest;A.nargs=3Dnargs;A.= obj=3Dobj +- def process(A,value,state): +- C=3Dstate;B=3Dvalue +- if A.nargs>1: +- D=3Dsum((1 for A in B if A is _A)) +- if D=3D=3Dlen(B):B=3D_A +- elif D!=3D0:raise BadArgumentUsage(f"argument {A.dest} takes {A.nargs}= values") +- C.opts[A.dest]=3DB;C.order.append(A.obj) +-class ParsingState: +- def __init__(A,rargs):A.opts=3D{};A.largs=3D[];A.rargs=3Drargs;A.order= =3D[] +-class OptionParser: +- def __init__(A,ctx=3D_A): +- B=3Dctx;A.ctx=3DB;A.allow_interspersed_args=3DTrue;A.ignore_unknown_opt= ions=3D_D +- if B is not _A:A.allow_interspersed_args=3DB.allow_interspersed_args;A.= ignore_unknown_options=3DB.ignore_unknown_options +- A._short_opt=3D{};A._long_opt=3D{};A._opt_prefixes=3D{'-','--'};A._args= =3D[] +- def add_option(B,opts,dest,action=3D_A,nargs=3D1,const=3D_A,obj=3D_A): +- D=3Dobj;C=3Dopts +- if D is _A:D=3Ddest +- C=3D[normalize_opt(A,B.ctx)for A in C];A=3DOption(C,dest,action=3Dactio= n,nargs=3Dnargs,const=3Dconst,obj=3DD);B._opt_prefixes.update(A.prefixes) +- for E in A._short_opts:B._short_opt[E]=3DA +- for E in A._long_opts:B._long_opt[E]=3DA +- def add_argument(B,dest,nargs=3D1,obj=3D_A): +- A=3Dobj +- if A is _A:A=3Ddest +- B._args.append(Argument(dest=3Ddest,nargs=3Dnargs,obj=3DA)) +- def parse_args(B,args): +- A=3DParsingState(args) +- try:B._process_args_for_options(A);B._process_args_for_args(A) +- except UsageError: +- if B.ctx is _A or not B.ctx.resilient_parsing:raise +- return A.opts,A.largs,A.order +- def _process_args_for_args(B,state): +- A=3Dstate;C,D=3D_unpack_args(A.largs+A.rargs,[A.nargs for A in B._args]) +- for (E,F) in enumerate(B._args):F.process(C[E],A) +- A.largs=3DD;A.rargs=3D[] +- def _process_args_for_options(C,state): +- B=3Dstate +- while B.rargs: +- A=3DB.rargs.pop(0);D=3Dlen(A) +- if A=3D=3D'--':return +- elif A[:1]in C._opt_prefixes and D>1:C._process_opts(A,B) +- elif C.allow_interspersed_args:B.largs.append(A) +- else:B.rargs.insert(0,A);return +- def _match_long_opt(D,opt,explicit_value,state): +- E=3Dexplicit_value;B=3Dstate;A=3Dopt +- if A not in D._long_opt:H=3D[B for B in D._long_opt if B.startswith(A)]= ;raise NoSuchOption(A,possibilities=3DH,ctx=3DD.ctx) +- F=3DD._long_opt[A] +- if F.takes_value: +- if E is not _A:B.rargs.insert(0,E) +- C=3DF.nargs +- if len(B.rargs)" +-class CliRunner: +- def __init__(A,charset=3D'utf-8',env=3D_A,echo_stdin=3D_D,mix_stderr=3DT= rue):A.charset=3Dcharset;A.env=3Denv or{};A.echo_stdin=3Decho_stdin;A.mix_s= tderr=3Dmix_stderr +- def get_default_prog_name(A,cli):return cli.name or'root' +- def make_env(C,overrides=3D_A): +- A=3Doverrides;B=3Ddict(C.env) +- if A:B.update(A) +- return B +- @contextlib.contextmanager +- def isolation(self,input=3D_A,env=3D_A,color=3D_D): +- D=3Denv;A=3Dself;input=3Dmake_input_stream(input,A.charset);H=3Dsys.std= in;I=3Dsys.stdout;J=3Dsys.stderr;K=3Dformatting.FORCED_WIDTH;formatting.FOR= CED_WIDTH=3D80;D=3DA.make_env(D);E=3Dio.BytesIO() +- if A.echo_stdin:input=3DEchoingStdin(input,E) +- input=3Dio.TextIOWrapper(input,encoding=3DA.charset);sys.stdout=3Dio.Te= xtIOWrapper(E,encoding=3DA.charset) +- if not A.mix_stderr:F=3Dio.BytesIO();sys.stderr=3Dio.TextIOWrapper(F,en= coding=3DA.charset) +- if A.mix_stderr:sys.stderr=3Dsys.stdout +- sys.stdin=3Dinput +- def L(prompt=3D_A):sys.stdout.write(prompt or'');A=3Dinput.readline().r= strip(_B);sys.stdout.write(f"{A}\n");sys.stdout.flush();return A +- def M(prompt=3D_A):sys.stdout.write(f"{prompt or''}\n");sys.stdout.flus= h();return input.readline().rstrip(_B) +- def N(echo): +- A=3Dsys.stdin.read(1) +- if echo:sys.stdout.write(A);sys.stdout.flush() +- return A +- O=3Dcolor +- def P(stream=3D_A,color=3D_A): +- A=3Dcolor +- if A is _A:return not O +- return not A +- Q=3Dtermui.visible_prompt_func;R=3Dtermui.hidden_prompt_func;S=3Dtermui= ._getchar;T=3Dutils.should_strip_ansi;termui.visible_prompt_func=3DL;termui= .hidden_prompt_func=3DM;termui._getchar=3DN;utils.should_strip_ansi=3DP;G= =3D{} +- try: +- for (B,C) in D.items(): +- G[B]=3Dos.environ.get(B) +- if C is _A: +- try:del os.environ[B] +- except Exception:pass +- else:os.environ[B]=3DC +- yield(E,not A.mix_stderr and F) +- finally: +- for (B,C) in G.items(): +- if C is _A: +- try:del os.environ[B] +- except Exception:pass +- else:os.environ[B]=3DC +- sys.stdout=3DI;sys.stderr=3DJ;sys.stdin=3DH;termui.visible_prompt_func= =3DQ;termui.hidden_prompt_func=3DR;termui._getchar=3DS;utils.should_strip_a= nsi=3DT;formatting.FORCED_WIDTH=3DK +- def invoke(B,cli,args=3D_A,input=3D_A,env=3D_A,catch_exceptions=3DTrue,c= olor=3D_D,**G): +- C=3Dargs;E=3D_A +- with B.isolation(input=3Dinput,env=3Denv,color=3Dcolor)as H: +- F=3D_A;A=3D0 +- if isinstance(C,str):C=3Dshlex.split(C) +- try:I=3DG.pop('prog_name') +- except KeyError:I=3DB.get_default_prog_name(cli) +- try:cli.main(args=3DC or(),prog_name=3DI,**G) +- except SystemExit as D: +- E=3Dsys.exc_info();A=3DD.code +- if A is _A:A=3D0 +- if A!=3D0:F=3DD +- if not isinstance(A,int):sys.stdout.write(str(A));sys.stdout.write(_C= );A=3D1 +- except Exception as D: +- if not catch_exceptions:raise +- F=3DD;A=3D1;E=3Dsys.exc_info() +- finally: +- sys.stdout.flush();K=3DH[0].getvalue() +- if B.mix_stderr:J=3D_A +- else:J=3DH[1].getvalue() +- return Result(runner=3DB,stdout_bytes=3DK,stderr_bytes=3DJ,exit_code=3D= A,exception=3DF,exc_info=3DE) +- @contextlib.contextmanager +- def isolated_filesystem(self): +- B=3Dos.getcwd();A=3Dtempfile.mkdtemp();os.chdir(A) +- try:yield A +- finally: +- os.chdir(B) +- try:shutil.rmtree(A) +- except OSError:pass +\ No newline at end of file +diff --git a/dynaconf/vendor/click/types.py b/dynaconf/vendor/click/types.= py +deleted file mode 100644 +index 30ee5fa..0000000 +--- a/dynaconf/vendor/click/types.py ++++ /dev/null +@@ -1,227 +0,0 @@ +-_F=3D'text' +-_E=3D'replace' +-_D=3D'utf-8' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import os,stat +-from datetime import datetime +-from ._compat import _get_argv_encoding +-from ._compat import filename_to_ui +-from ._compat import get_filesystem_encoding +-from ._compat import get_strerror +-from ._compat import open_stream +-from .exceptions import BadParameter +-from .utils import LazyFile +-from .utils import safecall +-class ParamType: +- is_composite=3D_B;name=3D_A;envvar_list_splitter=3D_A +- def __call__(B,value,param=3D_A,ctx=3D_A): +- A=3Dvalue +- if A is not _A:return B.convert(A,param,ctx) +- def get_metavar(A,param):0 +- def get_missing_message(A,param):0 +- def convert(A,value,param,ctx):return value +- def split_envvar_value(A,rv):return (rv or'').split(A.envvar_list_splitt= er) +- def fail(A,message,param=3D_A,ctx=3D_A):raise BadParameter(message,ctx= =3Dctx,param=3Dparam) +-class CompositeParamType(ParamType): +- is_composite=3D_C +- @property +- def arity(self):raise NotImplementedError() +-class FuncParamType(ParamType): +- def __init__(A,func):A.name=3Dfunc.__name__;A.func=3Dfunc +- def convert(B,value,param,ctx): +- A=3Dvalue +- try:return B.func(A) +- except ValueError: +- try:A=3Dstr(A) +- except UnicodeError:A=3DA.decode(_D,_E) +- B.fail(A,param,ctx) +-class UnprocessedParamType(ParamType): +- name=3D_F +- def convert(A,value,param,ctx):return value +- def __repr__(A):return'UNPROCESSED' +-class StringParamType(ParamType): +- name=3D_F +- def convert(D,value,param,ctx): +- A=3Dvalue +- if isinstance(A,bytes): +- B=3D_get_argv_encoding() +- try:A=3DA.decode(B) +- except UnicodeError: +- C=3Dget_filesystem_encoding() +- if C!=3DB: +- try:A=3DA.decode(C) +- except UnicodeError:A=3DA.decode(_D,_E) +- else:A=3DA.decode(_D,_E) +- return A +- return A +- def __repr__(A):return'STRING' +-class Choice(ParamType): +- name=3D'choice' +- def __init__(A,choices,case_sensitive=3D_C):A.choices=3Dchoices;A.case_s= ensitive=3Dcase_sensitive +- def get_metavar(A,param):return f"[{'|'.join(A.choices)}]" +- def get_missing_message(A,param):B=3D',\n\t'.join(A.choices);return f"Ch= oose from:\n\t{B}" +- def convert(D,value,param,ctx): +- E=3Dvalue;B=3Dctx;C=3DE;A=3D{A:A for A in D.choices} +- if B is not _A and B.token_normalize_func is not _A:C=3DB.token_normali= ze_func(E);A=3D{B.token_normalize_func(C):D for(C,D)in A.items()} +- if not D.case_sensitive:C=3DC.casefold();A=3D{B.casefold():C for(B,C)in= A.items()} +- if C in A:return A[C] +- D.fail(f"invalid choice: {E}. (choose from {', '.join(D.choices)})",par= am,B) +- def __repr__(A):return f"Choice({list(A.choices)})" +-class DateTime(ParamType): +- name=3D'datetime' +- def __init__(A,formats=3D_A):A.formats=3Dformats or['%Y-%m-%d','%Y-%m-%d= T%H:%M:%S','%Y-%m-%d %H:%M:%S'] +- def get_metavar(A,param):return f"[{'|'.join(A.formats)}]" +- def _try_to_convert_date(A,value,format): +- try:return datetime.strptime(value,format) +- except ValueError:return _A +- def convert(A,value,param,ctx): +- B=3Dvalue +- for format in A.formats: +- C=3DA._try_to_convert_date(B,format) +- if C:return C +- A.fail(f"invalid datetime format: {B}. (choose from {', '.join(A.format= s)})") +- def __repr__(A):return'DateTime' +-class IntParamType(ParamType): +- name=3D'integer' +- def convert(B,value,param,ctx): +- A=3Dvalue +- try:return int(A) +- except ValueError:B.fail(f"{A} is not a valid integer",param,ctx) +- def __repr__(A):return'INT' +-class IntRange(IntParamType): +- name=3D'integer range' +- def __init__(A,min=3D_A,max=3D_A,clamp=3D_B):A.min=3Dmin;A.max=3Dmax;A.c= lamp=3Dclamp +- def convert(A,value,param,ctx): +- D=3Dctx;C=3Dparam;B=3DIntParamType.convert(A,value,C,D) +- if A.clamp: +- if A.min is not _A and BA.max:return A.max +- if A.min is not _A and BA.max: +- if A.min is _A:A.fail(f"{B} is bigger than the maximum valid value {A.= max}.",C,D) +- elif A.max is _A:A.fail(f"{B} is smaller than the minimum valid value = {A.min}.",C,D) +- else:A.fail(f"{B} is not in the valid range of {A.min} to {A.max}.",C,= D) +- return B +- def __repr__(A):return f"IntRange({A.min}, {A.max})" +-class FloatParamType(ParamType): +- name=3D'float' +- def convert(B,value,param,ctx): +- A=3Dvalue +- try:return float(A) +- except ValueError:B.fail(f"{A} is not a valid floating point value",par= am,ctx) +- def __repr__(A):return'FLOAT' +-class FloatRange(FloatParamType): +- name=3D'float range' +- def __init__(A,min=3D_A,max=3D_A,clamp=3D_B):A.min=3Dmin;A.max=3Dmax;A.c= lamp=3Dclamp +- def convert(A,value,param,ctx): +- D=3Dctx;C=3Dparam;B=3DFloatParamType.convert(A,value,C,D) +- if A.clamp: +- if A.min is not _A and BA.max:return A.max +- if A.min is not _A and BA.max: +- if A.min is _A:A.fail(f"{B} is bigger than the maximum valid value {A.= max}.",C,D) +- elif A.max is _A:A.fail(f"{B} is smaller than the minimum valid value = {A.min}.",C,D) +- else:A.fail(f"{B} is not in the valid range of {A.min} to {A.max}.",C,= D) +- return B +- def __repr__(A):return f"FloatRange({A.min}, {A.max})" +-class BoolParamType(ParamType): +- name=3D'boolean' +- def convert(B,value,param,ctx): +- A=3Dvalue +- if isinstance(A,bool):return bool(A) +- A=3DA.lower() +- if A in('true','t','1','yes','y'):return _C +- elif A in('false','f','0','no','n'):return _B +- B.fail(f"{A} is not a valid boolean",param,ctx) +- def __repr__(A):return'BOOL' +-class UUIDParameterType(ParamType): +- name=3D'uuid' +- def convert(B,value,param,ctx): +- A=3Dvalue;import uuid +- try:return uuid.UUID(A) +- except ValueError:B.fail(f"{A} is not a valid UUID value",param,ctx) +- def __repr__(A):return'UUID' +-class File(ParamType): +- name=3D'filename';envvar_list_splitter=3Dos.path.pathsep +- def __init__(A,mode=3D'r',encoding=3D_A,errors=3D'strict',lazy=3D_A,atom= ic=3D_B):A.mode=3Dmode;A.encoding=3Dencoding;A.errors=3Derrors;A.lazy=3Dlaz= y;A.atomic=3Datomic +- def resolve_lazy_flag(A,value): +- if A.lazy is not _A:return A.lazy +- if value=3D=3D'-':return _B +- elif'w'in A.mode:return _C +- return _B +- def convert(A,value,param,ctx): +- C=3Dctx;B=3Dvalue +- try: +- if hasattr(B,'read')or hasattr(B,'write'):return B +- E=3DA.resolve_lazy_flag(B) +- if E: +- D=3DLazyFile(B,A.mode,A.encoding,A.errors,atomic=3DA.atomic) +- if C is not _A:C.call_on_close(D.close_intelligently) +- return D +- D,F=3Dopen_stream(B,A.mode,A.encoding,A.errors,atomic=3DA.atomic) +- if C is not _A: +- if F:C.call_on_close(safecall(D.close)) +- else:C.call_on_close(safecall(D.flush)) +- return D +- except OSError as G:A.fail(f"Could not open file: {filename_to_ui(B)}: = {get_strerror(G)}",param,C) +-class Path(ParamType): +- envvar_list_splitter=3Dos.path.pathsep +- def __init__(A,exists=3D_B,file_okay=3D_C,dir_okay=3D_C,writable=3D_B,re= adable=3D_C,resolve_path=3D_B,allow_dash=3D_B,path_type=3D_A): +- A.exists=3Dexists;A.file_okay=3Dfile_okay;A.dir_okay=3Ddir_okay;A.writa= ble=3Dwritable;A.readable=3Dreadable;A.resolve_path=3Dresolve_path;A.allow_= dash=3Dallow_dash;A.type=3Dpath_type +- if A.file_okay and not A.dir_okay:A.name=3D'file';A.path_type=3D'File' +- elif A.dir_okay and not A.file_okay:A.name=3D'directory';A.path_type=3D= 'Directory' +- else:A.name=3D'path';A.path_type=3D'Path' +- def coerce_path_result(B,rv): +- A=3Drv +- if B.type is not _A and not isinstance(A,B.type): +- if B.type is str:A=3DA.decode(get_filesystem_encoding()) +- else:A=3DA.encode(get_filesystem_encoding()) +- return A +- def convert(A,value,param,ctx): +- E=3Dctx;D=3Dparam;B=3Dvalue;C=3DB;G=3DA.file_okay and A.allow_dash and = C in(b'-','-') +- if not G: +- if A.resolve_path:C=3Dos.path.realpath(C) +- try:F=3Dos.stat(C) +- except OSError: +- if not A.exists:return A.coerce_path_result(C) +- A.fail(f"{A.path_type} {filename_to_ui(B)!r} does not exist.",D,E) +- if not A.file_okay and stat.S_ISREG(F.st_mode):A.fail(f"{A.path_type} = {filename_to_ui(B)!r} is a file.",D,E) +- if not A.dir_okay and stat.S_ISDIR(F.st_mode):A.fail(f"{A.path_type} {= filename_to_ui(B)!r} is a directory.",D,E) +- if A.writable and not os.access(B,os.W_OK):A.fail(f"{A.path_type} {fil= ename_to_ui(B)!r} is not writable.",D,E) +- if A.readable and not os.access(B,os.R_OK):A.fail(f"{A.path_type} {fil= ename_to_ui(B)!r} is not readable.",D,E) +- return A.coerce_path_result(C) +-class Tuple(CompositeParamType): +- def __init__(A,types):A.types=3D[convert_type(A)for A in types] +- @property +- def name(self):return f"<{' '.join((A.name for A in self.types))}>" +- @property +- def arity(self):return len(self.types) +- def convert(A,value,param,ctx): +- B=3Dvalue +- if len(B)!=3Dlen(A.types):raise TypeError('It would appear that nargs i= s set to conflict with the composite type arity.') +- return tuple((C(D,param,ctx)for(C,D)in zip(A.types,B))) +-def convert_type(ty,default=3D_A): +- B=3Ddefault;A=3Dty;C=3D_B +- if A is _A and B is not _A: +- if isinstance(B,tuple):A=3Dtuple(map(type,B)) +- else:A=3Dtype(B) +- C=3D_C +- if isinstance(A,tuple):return Tuple(A) +- if isinstance(A,ParamType):return A +- if A is str or A is _A:return STRING +- if A is int:return INT +- if A is bool and not C:return BOOL +- if A is float:return FLOAT +- if C:return STRING +- if __debug__: +- try: +- if issubclass(A,ParamType):raise AssertionError(f"Attempted to use an = uninstantiated parameter type ({A}).") +- except TypeError:pass +- return FuncParamType(A) +-UNPROCESSED=3DUnprocessedParamType() +-STRING=3DStringParamType() +-INT=3DIntParamType() +-FLOAT=3DFloatParamType() +-BOOL=3DBoolParamType() +-UUID=3DUUIDParameterType() +\ No newline at end of file +diff --git a/dynaconf/vendor/click/utils.py b/dynaconf/vendor/click/utils.= py +deleted file mode 100644 +index e0cf442..0000000 +--- a/dynaconf/vendor/click/utils.py ++++ /dev/null +@@ -1,119 +0,0 @@ +-_D=3D'strict' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import os,sys +-from ._compat import _default_text_stderr,_default_text_stdout,_find_bina= ry_writer,auto_wrap_for_ansi,binary_streams,filename_to_ui,get_filesystem_e= ncoding,get_strerror,is_bytes,open_stream,should_strip_ansi,strip_ansi,text= _streams,WIN +-from .globals import resolve_color_default +-echo_native_types=3Dstr,bytes,bytearray +-def _posixify(name):return '-'.join(name.split()).lower() +-def safecall(func): +- def A(*A,**B): +- try:return func(*A,**B) +- except Exception:pass +- return A +-def make_str(value): +- A=3Dvalue +- if isinstance(A,bytes): +- try:return A.decode(get_filesystem_encoding()) +- except UnicodeError:return A.decode('utf-8','replace') +- return str(A) +-def make_default_short_help(help,max_length=3D45): +- F=3Dhelp.split();D=3D0;A=3D[];C=3D_B +- for B in F: +- if B[-1:]=3D=3D'.':C=3D_C +- E=3D1+len(B)if A else len(B) +- if D+E>max_length:A.append('...');C=3D_C +- else: +- if A:A.append(' ') +- A.append(B) +- if C:break +- D+=3DE +- return ''.join(A) +-class LazyFile: +- def __init__(A,filename,mode=3D'r',encoding=3D_A,errors=3D_D,atomic=3D_B= ): +- E=3Derrors;D=3Dencoding;C=3Dmode;B=3Dfilename;A.name=3DB;A.mode=3DC;A.e= ncoding=3DD;A.errors=3DE;A.atomic=3Datomic +- if B=3D=3D'-':A._f,A.should_close=3Dopen_stream(B,C,D,E) +- else: +- if'r'in C:open(B,C).close() +- A._f=3D_A;A.should_close=3D_C +- def __getattr__(A,name):return getattr(A.open(),name) +- def __repr__(A): +- if A._f is not _A:return repr(A._f) +- return f"" +- def open(A): +- if A._f is not _A:return A._f +- try:B,A.should_close=3Dopen_stream(A.name,A.mode,A.encoding,A.errors,at= omic=3DA.atomic) +- except OSError as C:from .exceptions import FileError as D;raise D(A.na= me,hint=3Dget_strerror(C)) +- A._f=3DB;return B +- def close(A): +- if A._f is not _A:A._f.close() +- def close_intelligently(A): +- if A.should_close:A.close() +- def __enter__(A):return A +- def __exit__(A,exc_type,exc_value,tb):A.close_intelligently() +- def __iter__(A):A.open();return iter(A._f) +-class KeepOpenFile: +- def __init__(A,file):A._file=3Dfile +- def __getattr__(A,name):return getattr(A._file,name) +- def __enter__(A):return A +- def __exit__(A,exc_type,exc_value,tb):0 +- def __repr__(A):return repr(A._file) +- def __iter__(A):return iter(A._file) +-def echo(message=3D_A,file=3D_A,nl=3D_C,err=3D_B,color=3D_A): +- C=3Dcolor;B=3Dfile;A=3Dmessage +- if B is _A: +- if err:B=3D_default_text_stderr() +- else:B=3D_default_text_stdout() +- if A is not _A and not isinstance(A,echo_native_types):A=3Dstr(A) +- if nl: +- A=3DA or'' +- if isinstance(A,str):A+=3D'\n' +- else:A+=3Db'\n' +- if A and is_bytes(A): +- D=3D_find_binary_writer(B) +- if D is not _A:B.flush();D.write(A);D.flush();return +- if A and not is_bytes(A): +- C=3Dresolve_color_default(C) +- if should_strip_ansi(B,C):A=3Dstrip_ansi(A) +- elif WIN: +- if auto_wrap_for_ansi is not _A:B=3Dauto_wrap_for_ansi(B) +- elif not C:A=3Dstrip_ansi(A) +- if A:B.write(A) +- B.flush() +-def get_binary_stream(name): +- A=3Dbinary_streams.get(name) +- if A is _A:raise TypeError(f"Unknown standard stream '{name}'") +- return A() +-def get_text_stream(name,encoding=3D_A,errors=3D_D): +- A=3Dtext_streams.get(name) +- if A is _A:raise TypeError(f"Unknown standard stream '{name}'") +- return A(encoding,errors) +-def open_file(filename,mode=3D'r',encoding=3D_A,errors=3D_D,lazy=3D_B,ato= mic=3D_B): +- E=3Datomic;D=3Derrors;C=3Dencoding;B=3Dfilename +- if lazy:return LazyFile(B,mode,C,D,atomic=3DE) +- A,F=3Dopen_stream(B,mode,C,D,atomic=3DE) +- if not F:A=3DKeepOpenFile(A) +- return A +-def get_os_args():import warnings as A;A.warn("'get_os_args' is deprecate= d and will be removed in 8.1. Access 'sys.argv[1:]' directly instead.",Depr= ecationWarning,stacklevel=3D2);return sys.argv[1:] +-def format_filename(filename,shorten=3D_B): +- A=3Dfilename +- if shorten:A=3Dos.path.basename(A) +- return filename_to_ui(A) +-def get_app_dir(app_name,roaming=3D_C,force_posix=3D_B): +- A=3Dapp_name +- if WIN: +- C=3D'APPDATA'if roaming else'LOCALAPPDATA';B=3Dos.environ.get(C) +- if B is _A:B=3Dos.path.expanduser('~') +- return os.path.join(B,A) +- if force_posix:return os.path.join(os.path.expanduser(f"~/.{_posixify(A)= }")) +- if sys.platform=3D=3D'darwin':return os.path.join(os.path.expanduser('~/= Library/Application Support'),A) +- return os.path.join(os.environ.get('XDG_CONFIG_HOME',os.path.expanduser(= '~/.config')),_posixify(A)) +-class PacifyFlushWrapper: +- def __init__(A,wrapped):A.wrapped=3Dwrapped +- def flush(A): +- try:A.wrapped.flush() +- except OSError as B: +- import errno +- if B.errno!=3Derrno.EPIPE:raise +- def __getattr__(A,attr):return getattr(A.wrapped,attr) +\ No newline at end of file +diff --git a/dynaconf/vendor/dotenv/README.md b/dynaconf/vendor/dotenv/REA= DME.md +deleted file mode 100644 +index 94a816f..0000000 +--- a/dynaconf/vendor/dotenv/README.md ++++ /dev/null +@@ -1,6 +0,0 @@ +-## python-bodotenv +- +-Vendored dep taken from: https://github.com/theskumar/python-dotenv +-Licensed under BSD: https://github.com/theskumar/python-dotenv/blob/maste= r/LICENSE +- +-Current version: 0.13.0 +diff --git a/dynaconf/vendor/dotenv/__init__.py b/dynaconf/vendor/dotenv/_= _init__.py +deleted file mode 100644 +index 25aa760..0000000 +--- a/dynaconf/vendor/dotenv/__init__.py ++++ /dev/null +@@ -1,18 +0,0 @@ +-_A=3DNone +-from .compat import IS_TYPE_CHECKING +-from .main import load_dotenv,get_key,set_key,unset_key,find_dotenv,doten= v_values +-if IS_TYPE_CHECKING:from typing import Any,Optional +-def load_ipython_extension(ipython):from .ipython import load_ipython_ext= ension as A;A(ipython) +-def get_cli_string(path=3D_A,action=3D_A,key=3D_A,value=3D_A,quote=3D_A): +- E=3D' ';D=3Dquote;C=3Daction;B=3Dvalue;A=3D['dotenv'] +- if D:A.append('-q %s'%D) +- if path:A.append('-f %s'%path) +- if C: +- A.append(C) +- if key: +- A.append(key) +- if B: +- if E in B:A.append('"%s"'%B) +- else:A.append(B) +- return E.join(A).strip() +-__all__=3D['get_cli_string','load_dotenv','dotenv_values','get_key','set_= key','unset_key','find_dotenv','load_ipython_extension'] +\ No newline at end of file +diff --git a/dynaconf/vendor/dotenv/cli.py b/dynaconf/vendor/dotenv/cli.py +deleted file mode 100644 +index 8599595..0000000 +--- a/dynaconf/vendor/dotenv/cli.py ++++ /dev/null +@@ -1,56 +0,0 @@ +-_F=3D'always' +-_E=3D'key' +-_D=3D'%s=3D%s' +-_C=3D'QUOTE' +-_B=3D'FILE' +-_A=3DTrue +-import os,sys +-from subprocess import Popen +-try:from dynaconf.vendor import click +-except ImportError:sys.stderr.write('It seems python-dotenv is not instal= led with cli option. \nRun pip install "python-dotenv[cli]" to fix this.');= sys.exit(1) +-from .compat import IS_TYPE_CHECKING,to_env +-from .main import dotenv_values,get_key,set_key,unset_key +-from .version import __version__ +-if IS_TYPE_CHECKING:from typing import Any,List,Dict +-@click.group() +-@click.option('-f','--file',default=3Dos.path.join(os.getcwd(),'.env'),ty= pe=3Dclick.Path(exists=3D_A),help=3D'Location of the .env file, defaults to= .env file in current working directory.') +-@click.option('-q','--quote',default=3D_F,type=3Dclick.Choice([_F,'never'= ,'auto']),help=3D'Whether to quote or not the variable values. Default mode= is always. This does not affect parsing.') +-@click.version_option(version=3D__version__) +-@click.pass_context +-def cli(ctx,file,quote):A=3Dctx;A.obj=3D{};A.obj[_B]=3Dfile;A.obj[_C]=3Dq= uote +-@cli.command() +-@click.pass_context +-def list(ctx): +- A=3Dctx.obj[_B];B=3Ddotenv_values(A) +- for (C,D) in B.items():click.echo(_D%(C,D)) +-@cli.command() +-@click.pass_context +-@click.argument(_E,required=3D_A) +-@click.argument('value',required=3D_A) +-def set(ctx,key,value): +- B=3Dvalue;A=3Dkey;C=3Dctx.obj[_B];D=3Dctx.obj[_C];E,A,B=3Dset_key(C,A,B,= D) +- if E:click.echo(_D%(A,B)) +- else:exit(1) +-@cli.command() +-@click.pass_context +-@click.argument(_E,required=3D_A) +-def get(ctx,key): +- B=3Dctx.obj[_B];A=3Dget_key(B,key) +- if A:click.echo(_D%(key,A)) +- else:exit(1) +-@cli.command() +-@click.pass_context +-@click.argument(_E,required=3D_A) +-def unset(ctx,key): +- A=3Dkey;B=3Dctx.obj[_B];C=3Dctx.obj[_C];D,A=3Dunset_key(B,A,C) +- if D:click.echo('Successfully removed %s'%A) +- else:exit(1) +-@cli.command(context_settings=3D{'ignore_unknown_options':_A}) +-@click.pass_context +-@click.argument('commandline',nargs=3D-1,type=3Dclick.UNPROCESSED) +-def run(ctx,commandline): +- A=3Dcommandline;B=3Dctx.obj[_B];C=3D{to_env(C):to_env(A)for(C,A)in doten= v_values(B).items()if A is not None} +- if not A:click.echo('No command given.');exit(1) +- D=3Drun_command(A,C);exit(D) +-def run_command(command,env):A=3Dos.environ.copy();A.update(env);B=3DPope= n(command,universal_newlines=3D_A,bufsize=3D0,shell=3DFalse,env=3DA);C,C=3D= B.communicate();return B.returncode +-if __name__=3D=3D'__main__':cli() +\ No newline at end of file +diff --git a/dynaconf/vendor/dotenv/compat.py b/dynaconf/vendor/dotenv/com= pat.py +deleted file mode 100644 +index 09aad2f..0000000 +--- a/dynaconf/vendor/dotenv/compat.py ++++ /dev/null +@@ -1,18 +0,0 @@ +-_A=3D'utf-8' +-import sys +-PY2=3Dsys.version_info[0]=3D=3D2 +-if PY2:from StringIO import StringIO +-else:from io import StringIO +-def is_type_checking(): +- try:from typing import TYPE_CHECKING as A +- except ImportError:return False +- return A +-IS_TYPE_CHECKING=3Dis_type_checking() +-if IS_TYPE_CHECKING:from typing import Text +-def to_env(text): +- if PY2:return text.encode(sys.getfilesystemencoding()or _A) +- else:return text +-def to_text(string): +- A=3Dstring +- if PY2:return A.decode(_A) +- else:return A +\ No newline at end of file +diff --git a/dynaconf/vendor/dotenv/ipython.py b/dynaconf/vendor/dotenv/ip= ython.py +deleted file mode 100644 +index 47b92bc..0000000 +--- a/dynaconf/vendor/dotenv/ipython.py ++++ /dev/null +@@ -1,18 +0,0 @@ +-from __future__ import print_function +-_A=3D'store_true' +-from IPython.core.magic import Magics,line_magic,magics_class +-from IPython.core.magic_arguments import argument,magic_arguments,parse_a= rgstring +-from .main import find_dotenv,load_dotenv +-@magics_class +-class IPythonDotEnv(Magics): +- @magic_arguments() +- @argument('-o','--override',action=3D_A,help=3D'Indicate to override exi= sting variables') +- @argument('-v','--verbose',action=3D_A,help=3D'Indicate function calls t= o be verbose') +- @argument('dotenv_path',nargs=3D'?',type=3Dstr,default=3D'.env',help=3D'= Search in increasingly higher folders for the `dotenv_path`') +- @line_magic +- def dotenv(self,line): +- C=3DTrue;A=3Dparse_argstring(self.dotenv,line);B=3DA.dotenv_path +- try:B=3Dfind_dotenv(B,C,C) +- except IOError:print('cannot find .env file');return +- load_dotenv(B,verbose=3DA.verbose,override=3DA.override) +-def load_ipython_extension(ipython):ipython.register_magics(IPythonDotEnv) +\ No newline at end of file +diff --git a/dynaconf/vendor/dotenv/main.py b/dynaconf/vendor/dotenv/main.= py +deleted file mode 100644 +index 343e298..0000000 +--- a/dynaconf/vendor/dotenv/main.py ++++ /dev/null +@@ -1,114 +0,0 @@ +-from __future__ import absolute_import,print_function,unicode_literals +-_E=3D'.env' +-_D=3D'always' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import io,logging,os,re,shutil,sys,tempfile +-from collections import OrderedDict +-from contextlib import contextmanager +-from .compat import IS_TYPE_CHECKING,PY2,StringIO,to_env +-from .parser import Binding,parse_stream +-logger=3Dlogging.getLogger(__name__) +-if IS_TYPE_CHECKING: +- from typing import Dict,Iterator,Match,Optional,Pattern,Union,Text,IO,Tu= ple +- if sys.version_info>=3D(3,6):_PathLike=3Dos.PathLike +- else:_PathLike=3DText +- if sys.version_info>=3D(3,0):_StringIO=3DStringIO +- else:_StringIO=3DStringIO[Text] +-__posix_variable=3Dre.compile('\n \\$\\{\n (?P[^\\}:]*)\n= (?::-\n (?P[^\\}]*)\n )?\n \\}\n '= ,re.VERBOSE) +-def with_warn_for_invalid_lines(mappings): +- for A in mappings: +- if A.error:logger.warning('Python-dotenv could not parse statement star= ting at line %s',A.original.line) +- yield A +-class DotEnv: +- def __init__(A,dotenv_path,verbose=3D_B,encoding=3D_A,interpolate=3D_C):= A.dotenv_path=3Ddotenv_path;A._dict=3D_A;A.verbose=3Dverbose;A.encoding=3De= ncoding;A.interpolate=3Dinterpolate +- @contextmanager +- def _get_stream(self): +- A=3Dself +- if isinstance(A.dotenv_path,StringIO):yield A.dotenv_path +- elif os.path.isfile(A.dotenv_path): +- with io.open(A.dotenv_path,encoding=3DA.encoding)as B:yield B +- else: +- if A.verbose:logger.info('Python-dotenv could not find configuration f= ile %s.',A.dotenv_path or _E) +- yield StringIO('') +- def dict(A): +- if A._dict:return A._dict +- B=3DOrderedDict(A.parse());A._dict=3Dresolve_nested_variables(B)if A.in= terpolate else B;return A._dict +- def parse(B): +- with B._get_stream()as C: +- for A in with_warn_for_invalid_lines(parse_stream(C)): +- if A.key is not _A:yield(A.key,A.value) +- def set_as_environment_variables(C,override=3D_B): +- for (A,B) in C.dict().items(): +- if A in os.environ and not override:continue +- if B is not _A:os.environ[to_env(A)]=3Dto_env(B) +- return _C +- def get(A,key): +- B=3Dkey;C=3DA.dict() +- if B in C:return C[B] +- if A.verbose:logger.warning('Key %s not found in %s.',B,A.dotenv_path) +- return _A +-def get_key(dotenv_path,key_to_get):return DotEnv(dotenv_path,verbose=3D_= C).get(key_to_get) +-@contextmanager +-def rewrite(path): +- try: +- with tempfile.NamedTemporaryFile(mode=3D'w+',delete=3D_B)as A: +- with io.open(path)as B:yield(B,A) +- except BaseException: +- if os.path.isfile(A.name):os.unlink(A.name) +- raise +- else:shutil.move(A.name,path) +-def set_key(dotenv_path,key_to_set,value_to_set,quote_mode=3D_D): +- K=3D'"';E=3Dquote_mode;C=3Ddotenv_path;B=3Dkey_to_set;A=3Dvalue_to_set;A= =3DA.strip("'").strip(K) +- if not os.path.exists(C):logger.warning("Can't write to %s - it doesn't = exist.",C);return _A,B,A +- if' 'in A:E=3D_D +- if E=3D=3D_D:F=3D'"{}"'.format(A.replace(K,'\\"')) +- else:F=3DA +- G=3D'{}=3D{}\n'.format(B,F) +- with rewrite(C)as(J,D): +- H=3D_B +- for I in with_warn_for_invalid_lines(parse_stream(J)): +- if I.key=3D=3DB:D.write(G);H=3D_C +- else:D.write(I.original.string) +- if not H:D.write(G) +- return _C,B,A +-def unset_key(dotenv_path,key_to_unset,quote_mode=3D_D): +- B=3Ddotenv_path;A=3Dkey_to_unset +- if not os.path.exists(B):logger.warning("Can't delete from %s - it doesn= 't exist.",B);return _A,A +- C=3D_B +- with rewrite(B)as(E,F): +- for D in with_warn_for_invalid_lines(parse_stream(E)): +- if D.key=3D=3DA:C=3D_C +- else:F.write(D.original.string) +- if not C:logger.warning("Key %s not removed from %s - key doesn't exist.= ",A,B);return _A,A +- return C,A +-def resolve_nested_variables(values): +- def C(name,default):A=3Ddefault;A=3DA if A is not _A else'';C=3Dos.geten= v(name,B.get(name,A));return C +- def D(match):A=3Dmatch.groupdict();return C(name=3DA['name'],default=3DA= ['default']) +- B=3D{} +- for (E,A) in values.items():B[E]=3D__posix_variable.sub(D,A)if A is not = _A else _A +- return B +-def _walk_to_root(path): +- A=3Dpath +- if not os.path.exists(A):raise IOError('Starting path not found') +- if os.path.isfile(A):A=3Dos.path.dirname(A) +- C=3D_A;B=3Dos.path.abspath(A) +- while C!=3DB:yield B;D=3Dos.path.abspath(os.path.join(B,os.path.pardir))= ;C,B=3DB,D +-def find_dotenv(filename=3D_E,raise_error_if_not_found=3D_B,usecwd=3D_B): +- H=3D'.py' +- def E():B=3D'__file__';A=3D__import__('__main__',_A,_A,fromlist=3D[B]);r= eturn not hasattr(A,B) +- if usecwd or E()or getattr(sys,'frozen',_B):B=3Dos.getcwd() +- else: +- A=3Dsys._getframe() +- if PY2 and not __file__.endswith(H):C=3D__file__.rsplit('.',1)[0]+H +- else:C=3D__file__ +- while A.f_code.co_filename=3D=3DC:assert A.f_back is not _A;A=3DA.f_back +- F=3DA.f_code.co_filename;B=3Dos.path.dirname(os.path.abspath(F)) +- for G in _walk_to_root(B): +- D=3Dos.path.join(G,filename) +- if os.path.isfile(D):return D +- if raise_error_if_not_found:raise IOError('File not found') +- return'' +-def load_dotenv(dotenv_path=3D_A,stream=3D_A,verbose=3D_B,override=3D_B,i= nterpolate=3D_C,**A):B=3Ddotenv_path or stream or find_dotenv();return DotE= nv(B,verbose=3Dverbose,interpolate=3Dinterpolate,**A).set_as_environment_va= riables(override=3Doverride) +-def dotenv_values(dotenv_path=3D_A,stream=3D_A,verbose=3D_B,interpolate= =3D_C,**A):B=3Ddotenv_path or stream or find_dotenv();return DotEnv(B,verbo= se=3Dverbose,interpolate=3Dinterpolate,**A).dict() +\ No newline at end of file +diff --git a/dynaconf/vendor/dotenv/parser.py b/dynaconf/vendor/dotenv/par= ser.py +deleted file mode 100644 +index 65f4f31..0000000 +--- a/dynaconf/vendor/dotenv/parser.py ++++ /dev/null +@@ -1,85 +0,0 @@ +-_I=3D'error' +-_H=3D'original' +-_G=3D'value' +-_F=3D'key' +-_E=3D'Binding' +-_D=3D'line' +-_C=3D'string' +-_B=3D'Original' +-_A=3DNone +-import codecs,re +-from .compat import IS_TYPE_CHECKING,to_text +-if IS_TYPE_CHECKING:from typing import IO,Iterator,Match,NamedTuple,Optio= nal,Pattern,Sequence,Text,Tuple +-def make_regex(string,extra_flags=3D0):return re.compile(to_text(string),= re.UNICODE|extra_flags) +-_newline=3Dmake_regex('(\\r\\n|\\n|\\r)') +-_multiline_whitespace=3Dmake_regex('\\s*',extra_flags=3Dre.MULTILINE) +-_whitespace=3Dmake_regex('[^\\S\\r\\n]*') +-_export=3Dmake_regex('(?:export[^\\S\\r\\n]+)?') +-_single_quoted_key=3Dmake_regex("'([^']+)'") +-_unquoted_key=3Dmake_regex('([^=3D\\#\\s]+)') +-_equal_sign=3Dmake_regex('(=3D[^\\S\\r\\n]*)') +-_single_quoted_value=3Dmake_regex("'((?:\\\\'|[^'])*)'") +-_double_quoted_value=3Dmake_regex('"((?:\\\\"|[^"])*)"') +-_unquoted_value_part=3Dmake_regex('([^ \\r\\n]*)') +-_comment=3Dmake_regex('(?:[^\\S\\r\\n]*#[^\\r\\n]*)?') +-_end_of_line=3Dmake_regex('[^\\S\\r\\n]*(?:\\r\\n|\\n|\\r|$)') +-_rest_of_line=3Dmake_regex('[^\\r\\n]*(?:\\r|\\n|\\r\\n)?') +-_double_quote_escapes=3Dmake_regex('\\\\[\\\\\'\\"abfnrtv]') +-_single_quote_escapes=3Dmake_regex("\\\\[\\\\']") +-try:import typing;Original=3Dtyping.NamedTuple(_B,[(_C,typing.Text),(_D,i= nt)]);Binding=3Dtyping.NamedTuple(_E,[(_F,typing.Optional[typing.Text]),(_G= ,typing.Optional[typing.Text]),(_H,Original),(_I,bool)]) +-except ImportError:from collections import namedtuple;Original=3Dnamedtup= le(_B,[_C,_D]);Binding=3Dnamedtuple(_E,[_F,_G,_H,_I]) +-class Position: +- def __init__(A,chars,line):A.chars=3Dchars;A.line=3Dline +- @classmethod +- def start(A):return A(chars=3D0,line=3D1) +- def set(A,other):B=3Dother;A.chars=3DB.chars;A.line=3DB.line +- def advance(A,string):B=3Dstring;A.chars+=3Dlen(B);A.line+=3Dlen(re.find= all(_newline,B)) +-class Error(Exception):0 +-class Reader: +- def __init__(A,stream):A.string=3Dstream.read();A.position=3DPosition.st= art();A.mark=3DPosition.start() +- def has_next(A):return A.position.chars`__) +- +-[0, 16, 6]: 2020-01-20 +- - fix empty string mapping key roundtripping with preservation of quote= s as `? ''` +- (reported via email by Tomer Aharoni). +- - fix incorrect state setting in class constructor (reported by `Dougla= s Raillard +- `_= _) +- - adjust deprecation warning test for Hashable, as that no longer warns= (reported +- by `Jason Montleon `__) +- +-[0, 16, 5]: 2019-08-18 +- - allow for ``YAML(typ=3D['unsafe', 'pytypes'])`` +- +-[0, 16, 4]: 2019-08-16 +- - fix output of TAG directives with # (reported by `Thomas Smith +- `_= _) +- +- +-[0, 16, 3]: 2019-08-15 +- - move setting of version based on YAML directive to scanner, allowing = to +- check for file version during TAG directive scanning +- +-[0, 16, 2]: 2019-08-15 +- - preserve YAML and TAG directives on roundtrip, correctly output # +- in URL for YAML 1.2 (both reported by `Thomas Smith +- `_= _) +- +-[0, 16, 1]: 2019-08-08 +- - Force the use of new version of ruamel.yaml.clib (reported by `Alex J= oz +- `_= _) +- - Allow '#' in tag URI as these are allowed in YAML 1.2 (reported by +- `Thomas Smith +- `_= _) +- +-[0, 16, 0]: 2019-07-25 +- - split of C source that generates .so file to ruamel.yaml.clib +- - duplicate keys are now an error when working with the old API as well +- +-[0, 15, 100]: 2019-07-17 +- - fixing issue with dumping deep-copied data from commented YAML, by +- providing both the memo parameter to __deepcopy__, and by allowing +- startmarks to be compared on their content (reported by `Theofilos +- Petsios +- `_= _) +- +-[0, 15, 99]: 2019-07-12 +- - add `py.typed` to distribution, based on a PR submitted by +- `Michael Crusoe +- `__ +- - merge PR 40 (also by Michael Crusoe) to more accurately specify +- repository in the README (also reported in a misunderstood issue +- some time ago) +- +-[0, 15, 98]: 2019-07-09 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.12, needed +- for Python 3.8.0b2 (reported by `John Vandenberg +- `_= _) +- +-[0, 15, 97]: 2019-06-06 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.10, needed for +- Python 3.8.0b1 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.9, needed for +- Python 3.8.0a4 (reported by `Anthony Sottile +- `_= _) +- +-[0, 15, 96]: 2019-05-16 +- - fix failure to indent comments on round-trip anchored block style +- scalars in block sequence (reported by `William Kimball +- `_= _) +- +-[0, 15, 95]: 2019-05-16 +- - fix failure to round-trip anchored scalars in block sequence +- (reported by `William Kimball +- `_= _) +- - wheel files for Python 3.4 no longer provided (`Python 3.4 EOL 2019-0= 3-18 +- `__) +- +-[0, 15, 94]: 2019-04-23 +- - fix missing line-break after end-of-file comments not ending in +- line-break (reported by `Philip Thompson +- `_= _) +- +-[0, 15, 93]: 2019-04-21 +- - fix failure to parse empty implicit flow mapping key +- - in YAML 1.1 plains scalars `y`, 'n', `Y`, and 'N' are now +- correctly recognised as booleans and such strings dumped quoted +- (reported by `Marcel Bollmann +- `_= _) +- +-[0, 15, 92]: 2019-04-16 +- - fix failure to parse empty implicit block mapping key (reported by=20 +- `Nolan W `__) +- +-[0, 15, 91]: 2019-04-05 +- - allowing duplicate keys would not work for merge keys (reported by ma= macdon on +- `StackOverflow `__=20 +- +-[0, 15, 90]: 2019-04-04 +- - fix issue with updating `CommentedMap` from list of tuples (reported = by=20 +- `Peter Henry `__) +- +-[0, 15, 89]: 2019-02-27 +- - fix for items with flow-mapping in block sequence output on single li= ne +- (reported by `Zahari Dim `__) +- - fix for safe dumping erroring in creation of representereror when dum= ping namedtuple +- (reported and solution by `Jaakko Kantoj=C3=A4rvi `__) +- +-[0, 15, 88]: 2019-02-12 +- - fix inclusing of python code from the subpackage data (containing ext= ra tests, +- reported by `Florian Apolloner `__) +- +-[0, 15, 87]: 2019-01-22 +- - fix problem with empty lists and the code to reinsert merge keys (rep= orted via email=20 +- by Zaloo) +- +-[0, 15, 86]: 2019-01-16 +- - reinsert merge key in its old position (reported by grumbler on +- `__) +- - fix for issue with non-ASCII anchor names (reported and fix +- provided by Dandaleon Flux via email) +- - fix for issue when parsing flow mapping value starting with colon (in= pure Python only) +- (reported by `FichteFoll `__) +- +-[0, 15, 85]: 2019-01-08 +- - the types used by `SafeConstructor` for mappings and sequences can +- now by set by assigning to `XXXConstructor.yaml_base_dict_type` +- (and `..._list_type`), preventing the need to copy two methods +- with 50+ lines that had `var =3D {}` hardcoded. (Implemented to +- help solve an feature request by `Anthony Sottile +- `__ in an easier way) +- +-[0, 15, 84]: 2019-01-07 +- - fix for `CommentedMap.copy()` not returning `CommentedMap`, let alone= copying comments etc. +- (reported by `Anthony Sottile `__) +- +-[0, 15, 83]: 2019-01-02 +- - fix for bug in roundtripping aliases used as key (reported via email = by Zaloo) +- +-[0, 15, 82]: 2018-12-28 +- - anchors and aliases on scalar int, float, string and bool are now pre= served. Anchors +- do not need a referring alias for these (reported by=20 +- `Alex Harvey `__) +- - anchors no longer lost on tagged objects when roundtripping (reported= by `Zaloo=20 +- `__) +- +-[0, 15, 81]: 2018-12-06 +- - fix issue saving methods of metaclass derived classes (reported and fi= x provided +- by `Douglas Raillard `__) +- +-[0, 15, 80]: 2018-11-26 +- - fix issue emitting BEL character when round-tripping invalid folded in= put +- (reported by Isaac on `StackOverflow `__) +-=20=20=20=20 +-[0, 15, 79]: 2018-11-21 +- - fix issue with anchors nested deeper than alias (reported by gaFF on +- `StackOverflow `__) +- +-[0, 15, 78]: 2018-11-15 +- - fix setup issue for 3.8 (reported by `Sidney Kuyateh=20 +- `__) +- +-[0, 15, 77]: 2018-11-09 +- - setting `yaml.sort_base_mapping_type_on_output =3D False`, will preve= nt +- explicit sorting by keys in the base representer of mappings. Roundtr= ip +- already did not do this. Usage only makes real sense for Python 3.6+ +- (feature request by `Sebastian Gerber `__). +- - implement Python version check in YAML metadata in ``_test/test_z_dat= a.py`` +- +-[0, 15, 76]: 2018-11-01 +- - fix issue with empty mapping and sequence loaded as flow-style +- (mapping reported by `Min RK `__, seque= nce +- by `Maged Ahmed `__) +- +-[0, 15, 75]: 2018-10-27 +- - fix issue with single '?' scalar (reported by `Terrance=20 +- `__) +- - fix issue with duplicate merge keys (prompted by `answering=20 +- `__ a=20 +- `StackOverflow question `__ +- by `math `__) +- +-[0, 15, 74]: 2018-10-17 +- - fix dropping of comment on rt before sequence item that is sequence i= tem +- (reported by `Thorsten Kampe `_= _) +- +-[0, 15, 73]: 2018-10-16 +- - fix irregular output on pre-comment in sequence within sequence (repo= rted +- by `Thorsten Kampe `__) +- - allow non-compact (i.e. next line) dumping sequence/mapping within se= quence. +- +-[0, 15, 72]: 2018-10-06 +- - fix regression on explicit 1.1 loading with the C based scanner/parser +- (reported by `Tomas Vavra `__) +- +-[0, 15, 71]: 2018-09-26 +- - fix regression where handcrafted CommentedMaps could not be initiated= (reported by=20 +- `Dan Helfman `__) +- - fix regression with non-root literal scalars that needed indent indic= ator +- (reported by `Clark Breyman `__) +- - tag:yaml.org,2002:python/object/apply now also uses __qualname__ on P= Y3 +- (reported by `Douglas RAILLARD `__) +- +-[0, 15, 70]: 2018-09-21 +- - reverted CommentedMap and CommentedSeq to subclass ordereddict resp. = list, +- reimplemented merge maps so that both ``dict(**commented_map_instance= )`` and JSON +- dumping works. This also allows checking with ``isinstance()`` on ``d= ict`` resp. ``list``. +- (Proposed by `Stuart Berg `__, wi= th feedback +- from `blhsing `__ on +- `StackOverflow `__) +- +-[0, 15, 69]: 2018-09-20 +- - fix issue with dump_all gobbling end-of-document comments on parsing +- (reported by `Pierre B. `__) +- +-[0, 15, 68]: 2018-09-20 +- - fix issue with parsabel, but incorrect output with nested flow-style = sequences +- (reported by `Dougal Seeley `__) +- - fix issue with loading Python objects that have __setstate__ and recu= rsion in parameters +- (reported by `Douglas RAILLARD `__) +- +-[0, 15, 67]: 2018-09-19 +- - fix issue with extra space inserted with non-root literal strings=20 +- (Issue reported and PR with fix provided by=20 +- `Naomi Seyfer `__.) +- +-[0, 15, 66]: 2018-09-07 +- - fix issue with fold indicating characters inserted in safe_load-ed fo= lded strings +- (reported by `Maximilian Hils `__). +- +-[0, 15, 65]: 2018-09-07 +- - fix issue #232 revert to throw ParserError for unexcpected ``]`` +- and ``}`` instead of IndexError. (Issue reported and PR with fix +- provided by `Naomi Seyfer `__.) +- - added ``key`` and ``reverse`` parameter (suggested by Jannik Klemm vi= a email) +- - indent root level literal scalars that have directive or document end= markers +- at the beginning of a line +- +-[0, 15, 64]: 2018-08-30 +- - support round-trip of tagged sequences: ``!Arg [a, {b: 1}]`` +- - single entry mappings in flow sequences now written by default withou= t quotes +- set ``yaml.brace_single_entry_mapping_in_flow_sequence=3DTrue`` to fo= rce +- getting ``[a, {b: 1}, {c: {d: 2}}]`` instead of the default ``[a, b: = 1, c: {d: 2}]`` +- - fix issue when roundtripping floats starting with a dot such as ``.5`` +- (reported by `Harrison Gregg `_= _) +- +-[0, 15, 63]: 2018-08-29 +- - small fix only necessary for Windows users that don't use wheels. +- +-[0, 15, 62]: 2018-08-29 +- - C based reader/scanner & emitter now allow setting of 1.2 as YAML ver= sion. +- ** The loading/dumping is still YAML 1.1 code**, so use the common su= bset of +- YAML 1.2 and 1.1 (reported by `Ge Yang `__) +- +-[0, 15, 61]: 2018-08-23 +- - support for round-tripping folded style scalars (initially requested= =20 +- by `Johnathan Viduchinsky `__) +- - update of C code +- - speed up of scanning (~30% depending on the input) +- +-[0, 15, 60]: 2018-08-18 +- - cleanup for mypy=20 +- - spurious print in library (reported by=20 +- `Lele Gaifax `__), now automatically che= cked=20 +- +-[0, 15, 59]: 2018-08-17 +- - issue with C based loader and leading zeros (reported by=20 +- `Tom Hamilton Stubber `__) +- +-[0, 15, 58]: 2018-08-17 +- - simple mappings can now be used as keys when round-tripping:: +- +- {a: 1, b: 2}: hello world +-=20=20=20=20=20=20 +- although using the obvious operations (del, popitem) on the key will +- fail, you can mutilate it by going through its attributes. If you loa= d the +- above YAML in `d`, then changing the value is cumbersome: +- +- d =3D {CommentedKeyMap([('a', 1), ('b', 2)]): "goodbye"} +- +- and changing the key even more so: +- +- d[CommentedKeyMap([('b', 1), ('a', 2)])] =3D d.pop( +- CommentedKeyMap([('a', 1), ('b', 2)])) +- +- (you can use a `dict` instead of a list of tuples (or ordereddict), b= ut that might result +- in a different order, of the keys of the key, in the output) +- - check integers to dump with 1.2 patterns instead of 1.1 (reported by= =20 +- `Lele Gaifax `__) +-=20=20 +- +-[0, 15, 57]: 2018-08-15 +- - Fix that CommentedSeq could no longer be used in adding or do a copy +- (reported by `Christopher Wright `__) +- +-[0, 15, 56]: 2018-08-15 +- - fix issue with ``python -O`` optimizing away code (reported, and deta= iled cause +- pinpointed, by `Alex Gr=C3=B6nholm = `__ +- +-[0, 15, 55]: 2018-08-14 +- +- - unmade ``CommentedSeq`` a subclass of ``list``. It is now +- indirectly a subclass of the standard +- ``collections.abc.MutableSequence`` (without .abc if you are +- still on Python2.7). If you do ``isinstance(yaml.load('[1, 2]'), +- list)``) anywhere in your code replace ``list`` with +- ``MutableSequence``. Directly, ``CommentedSeq`` is a subclass of +- the abstract baseclass ``ruamel.yaml.compat.MutableScliceableSequence= ``, +- with the result that *(extended) slicing is supported on=20 +- ``CommentedSeq``*. +- (reported by `Stuart Berg `__) +- - duplicate keys (or their values) with non-ascii now correctly +- report in Python2, instead of raising a Unicode error. +- (Reported by `Jonathan Pyle `__) +- +-[0, 15, 54]: 2018-08-13 +- +- - fix issue where a comment could pop-up twice in the output (reported = by=20 +- `Mike Kazantsev `__ and by=20 +- `Nate Peterson `__) +- - fix issue where JSON object (mapping) without spaces was not parsed +- properly (reported by `Marc Schmidt `__) +- - fix issue where comments after empty flow-style mappings were not emi= tted +- (reported by `Qinfench Chen `__) +- +-[0, 15, 53]: 2018-08-12 +- - fix issue with flow style mapping with comments gobbled newline (repo= rted +- by `Christopher Lambert `__) +- - fix issue where single '+' under YAML 1.2 was interpreted as +- integer, erroring out (reported by `Jethro Yu +- `__) +- +-[0, 15, 52]: 2018-08-09 +- - added `.copy()` mapping representation for round-tripping +- (``CommentedMap``) to fix incomplete copies of merged mappings +- (reported by `Will Richards +- `__)=20 +- - Also unmade that class a subclass of ordereddict to solve incorrect b= ehaviour +- for ``{**merged-mapping}`` and ``dict(**merged-mapping)`` (reported by +- `Filip Matzner `__) +- +-[0, 15, 51]: 2018-08-08 +- - Fix method name dumps (were not dotted) and loads (reported by `Dougl= as Raillard=20 +- `__) +- - Fix spurious trailing white-space caused when the comment start +- column was no longer reached and there was no actual EOL comment +- (e.g. following empty line) and doing substitutions, or when +- quotes around scalars got dropped. (reported by `Thomas Guillet +- `__) +- +-[0, 15, 50]: 2018-08-05 +- - Allow ``YAML()`` as a context manager for output, thereby making it m= uch easier +- to generate multi-documents in a stream.=20 +- - Fix issue with incorrect type information for `load()` and `dump()` (= reported=20 +- by `Jimbo Jim `__) +- +-[0, 15, 49]: 2018-08-05 +- - fix preservation of leading newlines in root level literal style scal= ar, +- and preserve comment after literal style indicator (``| # some comme= nt``) +- Both needed for round-tripping multi-doc streams in=20 +- `ryd `__. +- +-[0, 15, 48]: 2018-08-03 +- - housekeeping: ``oitnb`` for formatting, mypy 0.620 upgrade and confor= mity +- +-[0, 15, 47]: 2018-07-31 +- - fix broken 3.6 manylinux1 (result of an unclean ``build`` (reported b= y=20 +- `Roman Sichnyi `__) +- +- +-[0, 15, 46]: 2018-07-29 +- - fixed DeprecationWarning for importing from ``collections`` on 3.7 +- (issue 210, reported by `Reinoud Elhorst +- `__). It was `difficult to find +- why tox/pytest did not report +- `__ and as time +- consuming to actually `fix +- `__ the tests. +- +-[0, 15, 45]: 2018-07-26 +- - After adding failing test for ``YAML.load_all(Path())``, remove StopI= teration=20 +- (PR provided by `Zachary Buhman `__, +- also reported by `Steven Hiscocks = `__. +- +-[0, 15, 44]: 2018-07-14 +- - Correct loading plain scalars consisting of numerals only and +- starting with `0`, when not explicitly specifying YAML version +- 1.1. This also fixes the issue about dumping string `'019'` as +- plain scalars as reported by `Min RK +- `__, that prompted this chance. +- +-[0, 15, 43]: 2018-07-12 +- - merge PR33: Python2.7 on Windows is narrow, but has no +- ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by +- `Marcel Bargull `__) +- - ``register_class()`` now returns class (proposed by +- `Mike Nerone `__} +- +-[0, 15, 42]: 2018-07-01 +- - fix regression showing only on narrow Python 2.7 (py27mu) builds +- (with help from +- `Marcel Bargull `__ and +- `Colm O'Connor <>`__). +- - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as +- 3.4/3.5/3.6/3.7/pypy +- +-[0, 15, 41]: 2018-06-27 +- - add detection of C-compile failure (investigation prompted by=20 +- `StackOverlow `__ by=20 +- `Emmanuel Blot `__), +- which was removed while no longer dependent on ``libyaml``, C-extensi= ons +- compilation still needs a compiler though. +- +-[0, 15, 40]: 2018-06-18 +- - added links to landing places as suggested in issue 190 by +- `KostisA `__ +- - fixes issue #201: decoding unicode escaped tags on Python2, reported +- by `Dan Abolafia `__ +- +-[0, 15, 39]: 2018-06-16 +- - merge PR27 improving package startup time (and loading when regexp no= t=20 +- actually used), provided by=20 +- `Marcel Bargull `__ +- +-[0, 15, 38]: 2018-06-13 +- - fix for losing precision when roundtripping floats by +- `Rolf Wojtech `__ +- - fix for hardcoded dir separator not working for Windows by +- `Nuno Andr=C3=A9 `__ +- - typo fix by `Andrey Somov `__ +- +-[0, 15, 37]: 2018-03-21 +- - again trying to create installable files for 187 +- +-[0, 15, 36]: 2018-02-07 +- - fix issue 187, incompatibility of C extension with 3.7 (reported by +- Daniel Blanchard) +- +-[0, 15, 35]: 2017-12-03 +- - allow ``None`` as stream when specifying ``transform`` parameters to +- ``YAML.dump()``. +- This is useful if the transforming function doesn't return a meaningf= ul value +- (inspired by `StackOverflow `__ by +- `rsaw `__). +- +-[0, 15, 34]: 2017-09-17 +- - fix for issue 157: CDumper not dumping floats (reported by Jan Smitka) +- +-[0, 15, 33]: 2017-08-31 +- - support for "undefined" round-tripping tagged scalar objects (in addi= tion to +- tagged mapping object). Inspired by a use case presented by Matthew P= atton +- on `StackOverflow `__. +- - fix issue 148: replace cryptic error message when using !!timestamp w= ith an +- incorrectly formatted or non- scalar. Reported by FichteFoll. +- +-[0, 15, 32]: 2017-08-21 +- - allow setting ``yaml.default_flow_style =3D None`` (default: ``False`= `) for +- for ``typ=3D'rt'``. +- - fix for issue 149: multiplications on ``ScalarFloat`` now return ``fl= oat`` +- +-[0, 15, 31]: 2017-08-15 +- - fix Comment dumping +- +-[0, 15, 30]: 2017-08-14 +- - fix for issue with "compact JSON" not parsing: ``{"in":{},"out":{}}`` +- (reported on `StackOverflow `_ by +- `mjalkio `_ +- +-[0, 15, 29]: 2017-08-14 +- - fix issue #51: different indents for mappings and sequences (reported= by=20 +- Alex Harvey) +- - fix for flow sequence/mapping as element/value of block sequence with= =20 +- sequence-indent minus dash-offset not equal two. +- +-[0, 15, 28]: 2017-08-13 +- - fix issue #61: merge of merge cannot be __repr__-ed (reported by Tal = Liron) +- +-[0, 15, 27]: 2017-08-13 +- - fix issue 62, YAML 1.2 allows ``?`` and ``:`` in plain scalars if non= -ambigious +- (reported by nowox) +- - fix lists within lists which would make comments disappear +- +-[0, 15, 26]: 2017-08-10 +- - fix for disappearing comment after empty flow sequence (reported by +- oit-tzhimmash) +- +-[0, 15, 25]: 2017-08-09 +- - fix for problem with dumping (unloaded) floats (reported by eyenseo) +- +-[0, 15, 24]: 2017-08-09 +- - added ScalarFloat which supports roundtripping of 23.1, 23.100, +- 42.00E+56, 0.0, -0.0 etc. while keeping the format. Underscores in ma= ntissas +- are not preserved/supported (yet, is anybody using that?). +- - (finally) fixed longstanding issue 23 (reported by `Antony Sottile +- `_), now handling comment between bl= ock +- mapping key and value correctly +- - warn on YAML 1.1 float input that is incorrect (triggered by invalid = YAML +- provided by Cecil Curry) +- - allow setting of boolean representation (`false`, `true`) by using: +- ``yaml.boolean_representation =3D [u'False', u'True']`` +- +-[0, 15, 23]: 2017-08-01 +- - fix for round_tripping integers on 2.7.X > sys.maxint (reported by cc= atterina) +- +-[0, 15, 22]: 2017-07-28 +- - fix for round_tripping singe excl. mark tags doubling (reported and f= ix by Jan Brezina) +- +-[0, 15, 21]: 2017-07-25 +- - fix for writing unicode in new API, https://stackoverflow.com/a/45281= 922/1307905 +- +-[0, 15, 20]: 2017-07-23 +- - wheels for windows including C extensions +- +-[0, 15, 19]: 2017-07-13 +- - added object constructor for rt, decorator ``yaml_object`` to replace= YAMLObject. +- - fix for problem using load_all with Path() instance +- - fix for load_all in combination with zero indent block style literal +- (``pure=3DTrue`` only!) +- +-[0, 15, 18]: 2017-07-04 +- - missing ``pure`` attribute on ``YAML`` useful for implementing `!incl= ude` tag +- constructor for `including YAML files in a YAML file +- `_ +- - some documentation improvements +- - trigger of doc build on new revision +- +-[0, 15, 17]: 2017-07-03 +- - support for Unicode supplementary Plane **output** with allow_unicode +- (input was already supported, triggered by +- `this `_ Stack Overflow= Q&A) +- +-[0, 15, 16]: 2017-07-01 +- - minor typing issues (reported and fix provided by +- `Manvendra Singh `_) +- - small doc improvements +- +-[0, 15, 15]: 2017-06-27 +- - fix for issue 135, typ=3D'safe' not dumping in Python 2.7 +- (reported by Andrzej Ostrowski `_) +- +-[0, 15, 14]: 2017-06-25 +- - setup.py: change ModuleNotFoundError to ImportError (reported and fix= by Asley Drake) +- +-[0, 15, 13]: 2017-06-24 +- - suppress duplicate key warning on mappings with merge keys (reported = by +- Cameron Sweeney) +- +-[0, 15, 12]: 2017-06-24 +- - remove fatal dependency of setup.py on wheel package (reported by +- Cameron Sweeney) +- +-[0, 15, 11]: 2017-06-24 +- - fix for issue 130, regression in nested merge keys (reported by +- `David Fee `_) +- +-[0, 15, 10]: 2017-06-23 +- - top level PreservedScalarString not indented if not explicitly asked = to +- - remove Makefile (not very useful anyway) +- - some mypy additions +- +-[0, 15, 9]: 2017-06-16 +- - fix for issue 127: tagged scalars were always quoted and seperated +- by a newline when in a block sequence (reported and largely fixed by +- `Tommy Wang `_) +- +-[0, 15, 8]: 2017-06-15 +- - allow plug-in install via ``install ruamel.yaml[jinja2]`` +- +-[0, 15, 7]: 2017-06-14 +- - add plug-in mechanism for load/dump pre resp. post-processing +- +-[0, 15, 6]: 2017-06-10 +- - a set() with duplicate elements now throws error in rt loading +- - support for toplevel column zero literal/folded scalar in explicit do= cuments +- +-[0, 15, 5]: 2017-06-08 +- - repeat `load()` on a single `YAML()` instance would fail. +- +-(0, 15, 4) 2017-06-08: | +- - `transform` parameter on dump that expects a function taking a +- string and returning a string. This allows transformation of the outp= ut +- before it is written to stream. +- - some updates to the docs +- +-(0, 15, 3) 2017-06-07: +- - No longer try to compile C extensions on Windows. Compilation can be = forced by setting +- the environment variable `RUAMEL_FORCE_EXT_BUILD` to some value +- before starting the `pip install`. +- +-(0, 15, 2) 2017-06-07: +- - update to conform to mypy 0.511:mypy --strict +- +-(0, 15, 1) 2017-06-07: +- - Any `duplicate keys `_ +- in mappings generate an error (in the old API this change generates a= warning until 0.16) +- - dependecy on ruamel.ordereddict for 2.7 now via extras_require +- +-(0, 15, 0) 2017-06-04: +- - it is now allowed to pass in a ``pathlib.Path`` as "stream" parameter= to all +- load/dump functions +- - passing in a non-supported object (e.g. a string) as "stream" will re= sult in a +- much more meaningful YAMLStreamError. +- - assigning a normal string value to an existing CommentedMap key or Co= mmentedSeq +- element will result in a value cast to the previous value's type if p= ossible. +- +-(0, 14, 12) 2017-05-14: +- - fix for issue 119, deepcopy not returning subclasses (reported and PR= by +- Constantine Evans ) +- +-(0, 14, 11) 2017-05-01: +- - fix for issue 103 allowing implicit documents after document end mark= er line (``...``) +- in YAML 1.2 +- +-(0, 14, 10) 2017-04-26: +- - fix problem with emitting using cyaml +- +-(0, 14, 9) 2017-04-22: +- - remove dependency on ``typing`` while still supporting ``mypy`` +- (http://stackoverflow.com/a/43516781/1307905) +- - fix unclarity in doc that stated 2.6 is supported (reported by feetdu= st) +- +-(0, 14, 8) 2017-04-19: +- - fix Text not available on 3.5.0 and 3.5.1, now proactively setting ve= rsion guards +- on all files (reported by `Jo=C3=A3o Paulo Magalh=C3=A3es `_) +- +-(0, 14, 7) 2017-04-18: +- - round trip of integers (decimal, octal, hex, binary) now preserve +- leading zero(s) padding and underscores. Underscores are presumed +- to be at regular distances (i.e. ``0o12_345_67`` dumps back as +- ``0o1_23_45_67`` as the space from the last digit to the +- underscore before that is the determining factor). +- +-(0, 14, 6) 2017-04-14: +- - binary, octal and hex integers are now preserved by default. This +- was a known deficiency. Working on this was prompted by the issue rep= ort (112) +- from devnoname120, as well as the additional experience with `.replac= e()` +- on `scalarstring` classes. +- - fix issues 114 cannot install on Buildozer (reported by mixmastamyk). +- Setting env. var ``RUAMEL_NO_PIP_INSTALL_CHECK`` will suppress ``pip`= `-check. +- +-(0, 14, 5) 2017-04-04: +- - fix issue 109 None not dumping correctly at top level (reported by An= drea Censi) +- - fix issue 110 .replace on Preserved/DoubleQuoted/SingleQuoted ScalarS= tring +- would give back "normal" string (reported by sandres23) +- +-(0, 14, 4) 2017-03-31: +- - fix readme +- +-(0, 14, 3) 2017-03-31: +- - fix for 0o52 not being a string in YAML 1.1 (reported on +- `StackOverflow Q&A 43138503>`_ by +- `Frank D `_ +- +-(0, 14, 2) 2017-03-23: +- - fix for old default pip on Ubuntu 14.04 (reported by S=C3=A9bastien M= accagnoni-Munch) +- +-(0.14.1) 2017-03-22: +- - fix Text not available on 3.5.0 and 3.5.1 (reported by Charles Boucha= rd-L=C3=A9gar=C3=A9) +- +-(0.14.0) 2017-03-21: +- - updates for mypy --strict +- - preparation for moving away from inheritance in Loader and Dumper, ca= lls from e.g. +- the Representer to the Serializer.serialize() are now done via the at= tribute +- .serializer.serialize(). Usage of .serialize() outside of Serializer = will be +- deprecated soon +- - some extra tests on main.py functions +- +-(0.13.14) 2017-02-12: +- - fix for issue 97, clipped block scalar followed by empty lines and co= mment +- would result in two CommentTokens of which the first was dropped. +- (reported by Colm O'Connor) +- +-(0.13.13) 2017-01-28: +- - fix for issue 96, prevent insertion of extra empty line if indented m= apping entries +- are separated by an empty line (reported by Derrick Sawyer) +- +-(0.13.11) 2017-01-23: +- - allow ':' in flow style scalars if not followed by space. Also don't +- quote such scalar as this is no longer necessary. +- - add python 3.6 manylinux wheel to PyPI +- +-(0.13.10) 2017-01-22: +- - fix for issue 93, insert spurious blank line before single line comme= nt +- between indented sequence elements (reported by Alex) +- +-(0.13.9) 2017-01-18: +- - fix for issue 92, wrong import name reported by the-corinthian +- +-(0.13.8) 2017-01-18: +- - fix for issue 91, when a compiler is unavailable reported by Maximili= an Hils +- - fix for deepcopy issue with TimeStamps not preserving 'T', reported on +- `StackOverflow Q&A `_ by +- `Quuxplusone `_ +- +-(0.13.7) 2016-12-27: +- - fix for issue 85, constructor.py importing unicode_literals caused my= py to fail +- on 2.7 (reported by Peter Amstutz) +- +-(0.13.6) 2016-12-27: +- - fix for issue 83, collections.OrderedDict not representable by SafeRe= presenter +- (reported by Frazer McLean) +- +-(0.13.5) 2016-12-25: +- - fix for issue 84, deepcopy not properly working (reported by Peter Am= stutz) +- +-(0.13.4) 2016-12-05: +- - another fix for issue 82, change to non-global resolver data broke im= plicit type +- specification +- +-(0.13.3) 2016-12-05: +- - fix for issue 82, deepcopy not working (reported by code monk) +- +-(0.13.2) 2016-11-28: +- - fix for comments after empty (null) values (reported by dsw2127 and = cokelaer) +- +-(0.13.1) 2016-11-22: +- - optimisations on memory usage when loading YAML from large files (py3= -50%, py2 -85%) +- +-(0.13.0) 2016-11-20: +- - if ``load()`` or ``load_all()`` is called with only a single argument +- (stream or string) +- a UnsafeLoaderWarning will be issued once. If appropriate you can sur= press this +- warning by filtering it. Explicitly supplying the ``Loader=3Druamel.y= aml.Loader`` +- argument, will also prevent it from being issued. You should however = consider +- using ``safe_load()``, ``safe_load_all()`` if your YAML input does no= t use tags. +- - allow adding comments before and after keys (based on +- `StackOveflow Q&A `_ by +- `msinn `_) +- +-(0.12.18) 2016-11-16: +- - another fix for numpy (re-reported independently by PaulG & Nathanial= Burdic) +- +-(0.12.17) 2016-11-15: +- - only the RoundTripLoader included the Resolver that supports YAML 1.2 +- now all loaders do (reported by mixmastamyk) +- +-(0.12.16) 2016-11-13: +- - allow dot char (and many others) in anchor name +- Fix issue 72 (reported by Shalon Wood) +- - | +- Slightly smarter behaviour dumping strings when no style is +- specified. Single string scalars that start with single quotes +- or have newlines now are dumped double quoted "'abc\nklm'" instead of +- +- '''abc +- +- klm''' +- +-(0.12.14) 2016-09-21: +- - preserve round-trip sequences that are mapping keys +- (prompted by stackoverflow question 39595807 from Nowox) +- +-(0.12.13) 2016-09-15: +- - Fix for issue #60 representation of CommentedMap with merge +- keys incorrect (reported by Tal Liron) +- +-(0.12.11) 2016-09-06: +- - Fix issue 58 endless loop in scanning tokens (reported by +- Christopher Lambert) +- +-(0.12.10) 2016-09-05: +- - Make previous fix depend on unicode char width (32 bit unicode support +- is a problem on MacOS reported by David Tagatac) +- +-(0.12.8) 2016-09-05: +- - To be ignored Unicode characters were not properly regex matched +- (no specific tests, PR by Haraguroicha Hsu) +- +-(0.12.7) 2016-09-03: +- - fixing issue 54 empty lines with spaces (reported by Alex Harvey) +- +-(0.12.6) 2016-09-03: +- - fixing issue 46 empty lines between top-level keys were gobbled (but +- not between sequence elements, nor between keys in netsted mappings +- (reported by Alex Harvey) +- +-(0.12.5) 2016-08-20: +- - fixing issue 45 preserving datetime formatting (submitted by altuin) +- Several formatting parameters are preserved with some normalisation: +- - preserve 'T', 't' is replaced by 'T', multiple spaces between date +- and time reduced to one. +- - optional space before timezone is removed +- - still using microseconds, but now rounded (.1234567 -> .123457) +- - Z/-5/+01:00 preserved +- +-(0.12.4) 2016-08-19: +- - Fix for issue 44: missing preserve_quotes keyword argument (reported +- by M. Crusoe) +- +-(0.12.3) 2016-08-17: +- - correct 'in' operation for merged CommentedMaps in round-trip mode +- (implementation inspired by J.Ngo, but original not working for merge= s) +- - iteration over round-trip loaded mappings, that contain merges. Also +- keys(), items(), values() (Py3/Py2) and iterkeys(), iteritems(), +- itervalues(), viewkeys(), viewitems(), viewvalues() (Py2) +- - reuse of anchor name now generates warning, not an error. Round-tripp= ing such +- anchors works correctly. This inherited PyYAML issue was brought to a= ttention +- by G. Coddut (and was long standing https://bugs.debian.org/cgi-bin/b= ugreport.cgi?bug=3D515634) +- suppressing the warning:: +- +- import warnings +- from ruamel.yaml.error import ReusedAnchorWarning +- warnings.simplefilter("ignore", ReusedAnchorWarning) +- +-(0.12.2) 2016-08-16: +- - minor improvements based on feedback from M. Crusoe +- https://bitbucket.org/ruamel/yaml/issues/42/ +- +-(0.12.0) 2016-08-16: +- - drop support for Python 2.6 +- - include initial Type information (inspired by M. Crusoe) +- +-(0.11.15) 2016-08-07: +- - Change to prevent FutureWarning in NumPy, as reported by tgehring +- ("comparison to None will result in an elementwise object comparison = in the future") +- +-(0.11.14) 2016-07-06: +- - fix preserve_quotes missing on original Loaders (as reported +- by Leynos, bitbucket issue 38) +- +-(0.11.13) 2016-07-06: +- - documentation only, automated linux wheels +- +-(0.11.12) 2016-07-06: +- - added support for roundtrip of single/double quoted scalars using: +- ruamel.yaml.round_trip_load(stream, preserve_quotes=3DTrue) +- +-(0.11.10) 2016-05-02: +- +-- added .insert(pos, key, value, comment=3DNone) to CommentedMap +- +-(0.11.10) 2016-04-19: +- +-- indent=3D2, block_seq_indent=3D2 works as expected +- +-(0.11.0) 2016-02-18: +- - RoundTripLoader loads 1.2 by default (no sexagesimals, 012 octals nor +- yes/no/on/off booleans +- +-(0.10.11) 2015-09-17: +-- Fix issue 13: dependency on libyaml to be installed for yaml.h +- +-(0.10.10) 2015-09-15: +-- Python 3.5 tested with tox +-- pypy full test (old PyYAML tests failed on too many open file handles) +- +-(0.10.6-0.10.9) 2015-09-14: +-- Fix for issue 9 +-- Fix for issue 11: double dump losing comments +-- Include libyaml code +-- move code from 'py' subdir for proper namespace packaging. +- +-(0.10.5) 2015-08-25: +-- preservation of newlines after block scalars. Contributed by Sam Thursf= ield. +- +-(0.10) 2015-06-22: +-- preservation of hand crafted anchor names ( not of the form "idNNN") +-- preservation of map merges ( <<< ) +- +-(0.9) 2015-04-18: +-- collections read in by the RoundTripLoader now have a ``lc`` property +- that can be quired for line and column ( ``lc.line`` resp. ``lc.col``) +- +-(0.8) 2015-04-15: +-- bug fix for non-roundtrip save of ordereddict +-- adding/replacing end of line comments on block style mappings/sequences +- +-(0.7.2) 2015-03-29: +-- support for end-of-line comments on flow style sequences and mappings +- +-(0.7.1) 2015-03-27: +-- RoundTrip capability of flow style sequences ( 'a: b, c, d' ) +- +-(0.7) 2015-03-26: +-- tests (currently failing) for inline sequece and non-standard spacing b= etween +- block sequence dash and scalar (Anthony Sottile) +-- initial possibility (on list, i.e. CommentedSeq) to set the flow format +- explicitly +-- RoundTrip capability of flow style sequences ( 'a: b, c, d' ) +- +-(0.6.1) 2015-03-15: +-- setup.py changed so ruamel.ordereddict no longer is a dependency +- if not on CPython 2.x (used to test only for 2.x, which breaks pypy 2.5= .0 +- reported by Anthony Sottile) +- +-(0.6) 2015-03-11: +-- basic support for scalars with preserved newlines +-- html option for yaml command +-- check if yaml C library is available before trying to compile C extensi= on +-- include unreleased change in PyYAML dd 20141128 +- +-(0.5) 2015-01-14: +-- move configobj -> YAML generator to own module +-- added dependency on ruamel.base (based on feedback from Sess +- +- +-(0.4) 20141125: +-- move comment classes in own module comments +-- fix omap pre comment +-- make !!omap and !!set take parameters. There are still some restriction= s: +- - no comments before the !!tag +-- extra tests +- +-(0.3) 20141124: +-- fix value comment occuring as on previous line (looking like eol commen= t) +-- INI conversion in yaml + tests +-- (hidden) test in yaml for debugging with auto command +-- fix for missing comment in middel of simple map + test +- +-(0.2) 20141123: +-- add ext/_yaml.c etc to the source tree +-- tests for yaml to work on 2.6/3.3/3.4 +-- change install so that you can include ruamel.yaml instead of ruamel.ya= ml.py +-- add "yaml" utility with initial subcommands (test rt, from json) +- +-(0.1) 20141122: +-- merge py2 and py3 code bases +-- remove support for 2.5/3.0/3.1/3.2 (this merge relies on u"" as +- available in 3.3 and . imports not available in 2.5) +-- tox.ini for 2.7/3.4/2.6/3.3 +-- remove lib3/ and tests/lib3 directories and content +-- commit +-- correct --verbose for test application +-- DATA=3Dchanged to be relative to __file__ of code +-- DATA using os.sep +-- remove os.path from imports as os is already imported +-- have test_yaml.py exit with value 0 on success, 1 on failures, 2 on +- error +-- added support for octal integers starting with '0o' +- keep support for 01234 as well as 0o1234 +-- commit +-- added test_roundtrip_data: +- requirest a .data file and .roundtrip (empty), yaml_load .data +- and compare dump against original. +-- fix grammar as per David Pursehouse: +- https://bitbucket.org/xi/pyyaml/pull-request/5/fix-grammar-in-error-mes= sages/diff +-- http://www.json.org/ extra escaped char \/ +- add .skip-ext as libyaml is not updated +-- David Fraser: Extract a method to represent keys in mappings, so that +- a subclass can choose not to quote them, used in repesent_mapping +- https://bitbucket.org/davidfraser/pyyaml/ +-- add CommentToken and percolate through parser and composer and construc= tor +-- add Comments to wrapped mapping and sequence constructs (not to scalars) +-- generate YAML with comments +-- initial README +diff --git a/dynaconf/vendor/ruamel/yaml/LICENSE b/dynaconf/vendor/ruamel/= yaml/LICENSE +deleted file mode 100644 +index 5b863d3..0000000 +--- a/dynaconf/vendor/ruamel/yaml/LICENSE ++++ /dev/null +@@ -1,21 +0,0 @@ +- The MIT License (MIT) +- +- Copyright (c) 2014-2020 Anthon van der Neut, Ruamel bvba +- +- Permission is hereby granted, free of charge, to any person obtaining a = copy +- of this software and associated documentation files (the "Software"), to= deal +- in the Software without restriction, including without limitation the ri= ghts +- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- copies of the Software, and to permit persons to whom the Software is +- furnished to do so, subject to the following conditions: +- +- The above copyright notice and this permission notice shall be included = in +- all copies or substantial portions of the Software. +- +- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR +- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL = THE +- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, +- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I= N THE +- SOFTWARE. +diff --git a/dynaconf/vendor/ruamel/yaml/MANIFEST.in b/dynaconf/vendor/rua= mel/yaml/MANIFEST.in +deleted file mode 100644 +index 1aa7798..0000000 +--- a/dynaconf/vendor/ruamel/yaml/MANIFEST.in ++++ /dev/null +@@ -1,3 +0,0 @@ +-include README.rst LICENSE CHANGES setup.py +-prune ext* +-prune clib* +diff --git a/dynaconf/vendor/ruamel/yaml/PKG-INFO b/dynaconf/vendor/ruamel= /yaml/PKG-INFO +deleted file mode 100644 +index b0ce985..0000000 +--- a/dynaconf/vendor/ruamel/yaml/PKG-INFO ++++ /dev/null +@@ -1,782 +0,0 @@ +-Metadata-Version: 2.1 +-Name: ruamel.yaml +-Version: 0.16.10 +-Summary: ruamel.yaml is a YAML parser/emitter that supports roundtrip pre= servation of comments, seq/map flow style, and map key order +-Home-page: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree +-Author: Anthon van der Neut +-Author-email: a.van.der.neut@ruamel.eu +-License: MIT license +-Description:=20 +- ruamel.yaml +- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +-=20=20=20=20=20=20=20=20 +- ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. +-=20=20=20=20=20=20=20=20 +- :version: 0.16.10 +- :updated: 2020-02-12 +- :documentation: http://yaml.readthedocs.io +- :repository: https://bitbucket.org/ruamel/yaml +- :pypi: https://pypi.org/project/ruamel.yaml/ +-=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- Starting with version 0.15.0 the way YAML files are loaded and du= mped +- is changing. See the API doc for details. Currently existing +- functionality will throw a warning before being changed/removed. +- **For production systems you should pin the version being used wi= th +- ``ruamel.yaml<=3D0.15``**. There might be bug fixes in the 0.14 s= eries, +- but new functionality is likely only to be available via the new = API. +-=20=20=20=20=20=20=20=20 +- If your package uses ``ruamel.yaml`` and is not listed on PyPI, d= rop +- me an email, preferably with some information on how you use the +- package (or a link to bitbucket/github) and I'll keep you informed +- when the status of the API is stable enough to make the transitio= n. +-=20=20=20=20=20=20=20=20 +- * `Overview = `_ +- * `Installing `_ +- * `Basic Usage `_ +- * `Details `_ +- * `Examples `_ +- * `API `_ +- * `Differences with PyYAML `_ +-=20=20=20=20=20=20=20=20 +- .. image:: https://readthedocs.org/projects/yaml/badge/?version= =3Dstable +- :target: https://yaml.readthedocs.org/en/stable +-=20=20=20=20=20=20=20=20 +- .. image:: https://bestpractices.coreinfrastructure.org/projects/= 1128/badge +- :target: https://bestpractices.coreinfrastructure.org/projects= /1128 +-=20=20=20=20=20=20=20=20 +- .. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/= tree/_doc/_static/license.svg?format=3Draw +- :target: https://opensource.org/licenses/MIT +-=20=20=20=20=20=20=20=20 +- .. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/= tree/_doc/_static/pypi.svg?format=3Draw +- :target: https://pypi.org/project/ruamel.yaml/ +-=20=20=20=20=20=20=20=20 +- .. image:: https://sourceforge.net/p/oitnb/code/ci/default/tree/_= doc/_static/oitnb.svg?format=3Draw +- :target: https://pypi.org/project/oitnb/ +-=20=20=20=20=20=20=20=20 +- .. image:: http://www.mypy-lang.org/static/mypy_badge.svg +- :target: http://mypy-lang.org/ +-=20=20=20=20=20=20=20=20 +- ChangeLog +- =3D=3D=3D=3D=3D=3D=3D=3D=3D +-=20=20=20=20=20=20=20=20 +- .. should insert NEXT: at the beginning of line for next key (wit= h empty line) +-=20=20=20=20=20=20=20=20 +- 0.16.10 (2020-02-12): +- - (auto) updated image references in README to sourceforge +-=20=20=20=20=20=20=20=20 +- 0.16.9 (2020-02-11): +- - update CHANGES +-=20=20=20=20=20=20=20=20 +- 0.16.8 (2020-02-11): +- - update requirements so that ruamel.yaml.clib is installed for= 3.8, +- as it has become available (via manylinux builds) +-=20=20=20=20=20=20=20=20 +- 0.16.7 (2020-01-30): +- - fix typchecking issue on TaggedScalar (reported by Jens Niels= en) +- - fix error in dumping literal scalar in sequence with comments= before element +- (reported by `EJ Etherington `__) +-=20=20=20=20=20=20=20=20 +- 0.16.6 (2020-01-20): +- - fix empty string mapping key roundtripping with preservation = of quotes as `? ''` +- (reported via email by Tomer Aharoni). +- - fix incorrect state setting in class constructor (reported by= `Douglas Raillard +- `__) +- - adjust deprecation warning test for Hashable, as that no long= er warns (reported +- by `Jason Montleon `__) +-=20=20=20=20=20=20=20=20 +- 0.16.5 (2019-08-18): +- - allow for ``YAML(typ=3D['unsafe', 'pytypes'])`` +-=20=20=20=20=20=20=20=20 +- 0.16.4 (2019-08-16): +- - fix output of TAG directives with # (reported by `Thomas Smith +- `__) +-=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- 0.16.3 (2019-08-15): +- - split construct_object +- - change stuff back to keep mypy happy +- - move setting of version based on YAML directive to scanner, a= llowing to +- check for file version during TAG directive scanning +-=20=20=20=20=20=20=20=20 +- 0.16.2 (2019-08-15): +- - preserve YAML and TAG directives on roundtrip, correctly outp= ut # +- in URL for YAML 1.2 (both reported by `Thomas Smith +- `__) +-=20=20=20=20=20=20=20=20 +- 0.16.1 (2019-08-08): +- - Force the use of new version of ruamel.yaml.clib (reported by= `Alex Joz +- `__) +- - Allow '#' in tag URI as these are allowed in YAML 1.2 (report= ed by +- `Thomas Smith +- `__) +-=20=20=20=20=20=20=20=20 +- 0.16.0 (2019-07-25): +- - split of C source that generates .so file to ruamel.yaml.clib +- - duplicate keys are now an error when working with the old API= as well +-=20=20=20=20=20=20=20=20 +- 0.15.100 (2019-07-17): +- - fixing issue with dumping deep-copied data from commented YAM= L, by +- providing both the memo parameter to __deepcopy__, and by all= owing +- startmarks to be compared on their content (reported by `Theo= filos +- Petsios +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.99 (2019-07-12): +- - add `py.typed` to distribution, based on a PR submitted by +- `Michael Crusoe +- `__ +- - merge PR 40 (also by Michael Crusoe) to more accurately speci= fy +- repository in the README (also reported in a misunderstood is= sue +- some time ago) +-=20=20=20=20=20=20=20=20 +- 0.15.98 (2019-07-09): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.12, ne= eded +- for Python 3.8.0b2 (reported by `John Vandenberg +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.97 (2019-06-06): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.10, ne= eded for +- Python 3.8.0b1 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.9, nee= ded for +- Python 3.8.0a4 (reported by `Anthony Sottile +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.96 (2019-05-16): +- - fix failure to indent comments on round-trip anchored block s= tyle +- scalars in block sequence (reported by `William Kimball +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.95 (2019-05-16): +- - fix failure to round-trip anchored scalars in block sequence +- (reported by `William Kimball +- `__) +- - wheel files for Python 3.4 no longer provided (`Python 3.4 EO= L 2019-03-18 +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.94 (2019-04-23): +- - fix missing line-break after end-of-file comments not ending = in +- line-break (reported by `Philip Thompson +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.93 (2019-04-21): +- - fix failure to parse empty implicit flow mapping key +- - in YAML 1.1 plains scalars `y`, 'n', `Y`, and 'N' are now +- correctly recognised as booleans and such strings dumped quot= ed +- (reported by `Marcel Bollmann +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.92 (2019-04-16): +- - fix failure to parse empty implicit block mapping key (report= ed by=20 +- `Nolan W `__) +-=20=20=20=20=20=20=20=20 +- 0.15.91 (2019-04-05): +- - allowing duplicate keys would not work for merge keys (report= ed by mamacdon on +- `StackOverflow `__=20 +-=20=20=20=20=20=20=20=20 +- 0.15.90 (2019-04-04): +- - fix issue with updating `CommentedMap` from list of tuples (r= eported by=20 +- `Peter Henry `__) +-=20=20=20=20=20=20=20=20 +- 0.15.89 (2019-02-27): +- - fix for items with flow-mapping in block sequence output on s= ingle line +- (reported by `Zahari Dim `= __) +- - fix for safe dumping erroring in creation of representereror = when dumping namedtuple +- (reported and solution by `Jaakko Kantoj=C3=A4rvi `__) +-=20=20=20=20=20=20=20=20 +- 0.15.88 (2019-02-12): +- - fix inclusing of python code from the subpackage data (contai= ning extra tests, +- reported by `Florian Apolloner `__) +-=20=20=20=20=20=20=20=20 +- 0.15.87 (2019-01-22): +- - fix problem with empty lists and the code to reinsert merge k= eys (reported via email=20 +- by Zaloo) +-=20=20=20=20=20=20=20=20 +- 0.15.86 (2019-01-16): +- - reinsert merge key in its old position (reported by grumbler = on +- `StackOverflow = `__) +- - fix for issue with non-ASCII anchor names (reported and fix +- provided by Dandaleon Flux via email) +- - fix for issue when parsing flow mapping value starting with c= olon (in pure Python only) +- (reported by `FichteFoll `= __) +-=20=20=20=20=20=20=20=20 +- 0.15.85 (2019-01-08): +- - the types used by ``SafeConstructor`` for mappings and sequen= ces can +- now by set by assigning to ``XXXConstructor.yaml_base_dict_ty= pe`` +- (and ``..._list_type``), preventing the need to copy two meth= ods +- with 50+ lines that had ``var =3D {}`` hardcoded. (Implement= ed to +- help solve an feature request by `Anthony Sottile +- `__ in an easier way) +-=20=20=20=20=20=20=20=20 +- 0.15.84 (2019-01-07): +- - fix for ``CommentedMap.copy()`` not returning ``CommentedMap`= `, let alone copying comments etc. +- (reported by `Anthony Sottile `__) +-=20=20=20=20=20=20=20=20 +- 0.15.83 (2019-01-02): +- - fix for bug in roundtripping aliases used as key (reported vi= a email by Zaloo) +-=20=20=20=20=20=20=20=20 +- 0.15.82 (2018-12-28): +- - anchors and aliases on scalar int, float, string and bool are= now preserved. Anchors +- do not need a referring alias for these (reported by=20 +- `Alex Harvey `__) +- - anchors no longer lost on tagged objects when roundtripping (= reported by `Zaloo=20 +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.81 (2018-12-06): +- - fix issue dumping methods of metaclass derived classes (repor= ted and fix provided +- by `Douglas Raillard = `__) +-=20=20=20=20=20=20=20=20 +- 0.15.80 (2018-11-26): +- - fix issue emitting BEL character when round-tripping invalid = folded input +- (reported by Isaac on `StackOverflow `__) +-=20=20=20=20=20=20=20=20=20=20=20=20 +- 0.15.79 (2018-11-21): +- - fix issue with anchors nested deeper than alias (reported by = gaFF on +- `StackOverflow = `__) +-=20=20=20=20=20=20=20=20 +- 0.15.78 (2018-11-15): +- - fix setup issue for 3.8 (reported by `Sidney Kuyateh=20 +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.77 (2018-11-09): +- - setting `yaml.sort_base_mapping_type_on_output =3D False`, wi= ll prevent +- explicit sorting by keys in the base representer of mappings.= Roundtrip +- already did not do this. Usage only makes real sense for Pyth= on 3.6+ +- (feature request by `Sebastian Gerber `__). +- - implement Python version check in YAML metadata in ``_test/te= st_z_data.py`` +-=20=20=20=20=20=20=20=20 +- 0.15.76 (2018-11-01): +- - fix issue with empty mapping and sequence loaded as flow-style +- (mapping reported by `Min RK `_= _, sequence +- by `Maged Ahmed `__) +-=20=20=20=20=20=20=20=20 +- 0.15.75 (2018-10-27): +- - fix issue with single '?' scalar (reported by `Terrance=20 +- `__) +- - fix issue with duplicate merge keys (prompted by `answering=20 +- `__ a=20 +- `StackOverflow question `__ +- by `math `__) +-=20=20=20=20=20=20=20=20 +- 0.15.74 (2018-10-17): +- - fix dropping of comment on rt before sequence item that is se= quence item +- (reported by `Thorsten Kampe `__) +-=20=20=20=20=20=20=20=20 +- 0.15.73 (2018-10-16): +- - fix irregular output on pre-comment in sequence within sequen= ce (reported +- by `Thorsten Kampe `__) +- - allow non-compact (i.e. next line) dumping sequence/mapping w= ithin sequence. +-=20=20=20=20=20=20=20=20 +- 0.15.72 (2018-10-06): +- - fix regression on explicit 1.1 loading with the C based scann= er/parser +- (reported by `Tomas Vavra `__) +-=20=20=20=20=20=20=20=20 +- 0.15.71 (2018-09-26): +- - some of the tests now live in YAML files in the=20 +- `yaml.data `__ reposi= tory.=20 +- ``_test/test_z_data.py`` processes these. +- - fix regression where handcrafted CommentedMaps could not be i= nitiated (reported by=20 +- `Dan Helfman `__) +- - fix regression with non-root literal scalars that needed inde= nt indicator +- (reported by `Clark Breyman `__) +- - tag:yaml.org,2002:python/object/apply now also uses __qualnam= e__ on PY3 +- (reported by `Douglas RAILLARD `__) +- - issue with self-referring object creation +- (reported and fix by `Douglas RAILLARD `__) +-=20=20=20=20=20=20=20=20 +- 0.15.70 (2018-09-21): +- - reverted CommentedMap and CommentedSeq to subclass ordereddic= t resp. list, +- reimplemented merge maps so that both ``dict(**commented_map_= instance)`` and JSON +- dumping works. This also allows checking with ``isinstance()`= ` on ``dict`` resp. ``list``. +- (Proposed by `Stuart Berg `__, with feedback +- from `blhsing `__ on +- `StackOverflow = `__) +-=20=20=20=20=20=20=20=20 +- 0.15.69 (2018-09-20): +- - fix issue with dump_all gobbling end-of-document comments on = parsing +- (reported by `Pierre B. `__) +-=20=20=20=20=20=20=20=20 +- 0.15.68 (2018-09-20): +- - fix issue with parsabel, but incorrect output with nested flo= w-style sequences +- (reported by `Dougal Seeley `= __) +- - fix issue with loading Python objects that have __setstate__ = and recursion in parameters +- (reported by `Douglas RAILLARD `__) +-=20=20=20=20=20=20=20=20 +- 0.15.67 (2018-09-19): +- - fix issue with extra space inserted with non-root literal str= ings=20 +- (Issue reported and PR with fix provided by=20 +- `Naomi Seyfer `__.) +-=20=20=20=20=20=20=20=20 +- 0.15.66 (2018-09-07): +- - fix issue with fold indicating characters inserted in safe_lo= ad-ed folded strings +- (reported by `Maximilian Hils `= __). +-=20=20=20=20=20=20=20=20 +- 0.15.65 (2018-09-07): +- - fix issue #232 revert to throw ParserError for unexcpected ``= ]`` +- and ``}`` instead of IndexError. (Issue reported and PR with = fix +- provided by `Naomi Seyfer `__= .) +- - added ``key`` and ``reverse`` parameter (suggested by Jannik = Klemm via email) +- - indent root level literal scalars that have directive or docu= ment end markers +- at the beginning of a line +-=20=20=20=20=20=20=20=20 +- 0.15.64 (2018-08-30): +- - support round-trip of tagged sequences: ``!Arg [a, {b: 1}]`` +- - single entry mappings in flow sequences now written by defaul= t without braces, +- set ``yaml.brace_single_entry_mapping_in_flow_sequence=3DTrue= `` to force +- getting ``[a, {b: 1}, {c: {d: 2}}]`` instead of the default `= `[a, b: 1, c: {d: 2}]`` +- - fix issue when roundtripping floats starting with a dot such = as ``.5`` +- (reported by `Harrison Gregg `__) +-=20=20=20=20=20=20=20=20 +- 0.15.63 (2018-08-29): +- - small fix only necessary for Windows users that don't use whe= els. +-=20=20=20=20=20=20=20=20 +- 0.15.62 (2018-08-29): +- - C based reader/scanner & emitter now allow setting of 1.2 as = YAML version. +- ** The loading/dumping is still YAML 1.1 code**, so use the c= ommon subset of +- YAML 1.2 and 1.1 (reported by `Ge Yang `__) +-=20=20=20=20=20=20=20=20 +- 0.15.61 (2018-08-23): +- - support for round-tripping folded style scalars (initially re= quested=20 +- by `Johnathan Viduchinsky `__) +- - update of C code +- - speed up of scanning (~30% depending on the input) +-=20=20=20=20=20=20=20=20 +- 0.15.60 (2018-08-18): +- - again allow single entry map in flow sequence context (report= ed by=20 +- `Lee Goolsbee `__) +- - cleanup for mypy=20 +- - spurious print in library (reported by=20 +- `Lele Gaifax `__), now automatic= ally checked=20 +-=20=20=20=20=20=20=20=20 +- 0.15.59 (2018-08-17): +- - issue with C based loader and leading zeros (reported by=20 +- `Tom Hamilton Stubber `__) +-=20=20=20=20=20=20=20=20 +- 0.15.58 (2018-08-17): +- - simple mappings can now be used as keys when round-tripping:: +-=20=20=20=20=20=20=20=20 +- {a: 1, b: 2}: hello world +-=20=20=20=20=20=20=20=20=20=20=20=20=20=20 +- although using the obvious operations (del, popitem) on the k= ey will +- fail, you can mutilate it by going through its attributes. If= you load the +- above YAML in `d`, then changing the value is cumbersome: +-=20=20=20=20=20=20=20=20 +- d =3D {CommentedKeyMap([('a', 1), ('b', 2)]): "goodbye"} +-=20=20=20=20=20=20=20=20 +- and changing the key even more so: +-=20=20=20=20=20=20=20=20 +- d[CommentedKeyMap([('b', 1), ('a', 2)])] =3D d.pop( +- CommentedKeyMap([('a', 1), ('b', 2)])) +-=20=20=20=20=20=20=20=20 +- (you can use a `dict` instead of a list of tuples (or ordered= dict), but that might result +- in a different order, of the keys of the key, in the output) +- - check integers to dump with 1.2 patterns instead of 1.1 (repo= rted by=20 +- `Lele Gaifax `__) +-=20=20=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- 0.15.57 (2018-08-15): +- - Fix that CommentedSeq could no longer be used in adding or do= a sort +- (reported by `Christopher Wright `__) +-=20=20=20=20=20=20=20=20 +- 0.15.56 (2018-08-15): +- - fix issue with ``python -O`` optimizing away code (reported, = and detailed cause +- pinpointed, by `Alex Gr=C3=B6nholm `__) +-=20=20=20=20=20=20=20=20 +- 0.15.55 (2018-08-14): +- - unmade ``CommentedSeq`` a subclass of ``list``. It is now +- indirectly a subclass of the standard +- ``collections.abc.MutableSequence`` (without .abc if you are +- still on Python2.7). If you do ``isinstance(yaml.load('[1, 2]= '), +- list)``) anywhere in your code replace ``list`` with +- ``MutableSequence``. Directly, ``CommentedSeq`` is a subclas= s of +- the abstract baseclass ``ruamel.yaml.compat.MutableScliceable= Sequence``, +- with the result that *(extended) slicing is supported on=20 +- ``CommentedSeq``*. +- (reported by `Stuart Berg `__) +- - duplicate keys (or their values) with non-ascii now correctly +- report in Python2, instead of raising a Unicode error. +- (Reported by `Jonathan Pyle `__) +-=20=20=20=20=20=20=20=20 +- 0.15.54 (2018-08-13): +- - fix issue where a comment could pop-up twice in the output (r= eported by=20 +- `Mike Kazantsev `__ and by=20 +- `Nate Peterson `__) +- - fix issue where JSON object (mapping) without spaces was not = parsed +- properly (reported by `Marc Schmidt `__) +- - fix issue where comments after empty flow-style mappings were= not emitted +- (reported by `Qinfench Chen `__) +-=20=20=20=20=20=20=20=20 +- 0.15.53 (2018-08-12): +- - fix issue with flow style mapping with comments gobbled newli= ne (reported +- by `Christopher Lambert `__) +- - fix issue where single '+' under YAML 1.2 was interpreted as +- integer, erroring out (reported by `Jethro Yu +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.52 (2018-08-09): +- - added `.copy()` mapping representation for round-tripping +- (``CommentedMap``) to fix incomplete copies of merged mappings +- (reported by `Will Richards +- `__)=20 +- - Also unmade that class a subclass of ordereddict to solve inc= orrect behaviour +- for ``{**merged-mapping}`` and ``dict(**merged-mapping)`` (re= ported independently by +- `Tim Olsson `__ and=20 +- `Filip Matzner `__) +-=20=20=20=20=20=20=20=20 +- 0.15.51 (2018-08-08): +- - Fix method name dumps (were not dotted) and loads (reported b= y `Douglas Raillard=20 +- `__) +- - Fix spurious trailing white-space caused when the comment sta= rt +- column was no longer reached and there was no actual EOL comm= ent +- (e.g. following empty line) and doing substitutions, or when +- quotes around scalars got dropped. (reported by `Thomas Guil= let +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.50 (2018-08-05): +- - Allow ``YAML()`` as a context manager for output, thereby mak= ing it much easier +- to generate multi-documents in a stream.=20 +- - Fix issue with incorrect type information for `load()` and `d= ump()` (reported=20 +- by `Jimbo Jim `__) +-=20=20=20=20=20=20=20=20 +- 0.15.49 (2018-08-05): +- - fix preservation of leading newlines in root level literal st= yle scalar, +- and preserve comment after literal style indicator (``| # so= me comment``) +- Both needed for round-tripping multi-doc streams in=20 +- `ryd `__. +-=20=20=20=20=20=20=20=20 +- 0.15.48 (2018-08-03): +- - housekeeping: ``oitnb`` for formatting, mypy 0.620 upgrade an= d conformity +-=20=20=20=20=20=20=20=20 +- 0.15.47 (2018-07-31): +- - fix broken 3.6 manylinux1, the result of an unclean ``build``= (reported by=20 +- `Roman Sichnyi `__) +-=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- 0.15.46 (2018-07-29): +- - fixed DeprecationWarning for importing from ``collections`` o= n 3.7 +- (issue 210, reported by `Reinoud Elhorst +- `__). It was `difficult to f= ind +- why tox/pytest did not report +- `__ and as time +- consuming to actually `fix +- `__ the tests. +-=20=20=20=20=20=20=20=20 +- 0.15.45 (2018-07-26): +- - After adding failing test for ``YAML.load_all(Path())``, remo= ve StopIteration=20 +- (PR provided by `Zachary Buhman `__, +- also reported by `Steven Hiscocks `__. +-=20=20=20=20=20=20=20=20 +- 0.15.44 (2018-07-14): +- - Correct loading plain scalars consisting of numerals only and +- starting with `0`, when not explicitly specifying YAML version +- 1.1. This also fixes the issue about dumping string `'019'` as +- plain scalars as reported by `Min RK +- `__, that prompted this chance. +-=20=20=20=20=20=20=20=20 +- 0.15.43 (2018-07-12): +- - merge PR33: Python2.7 on Windows is narrow, but has no +- ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provi= ded by +- `Marcel Bargull `__) +- - ``register_class()`` now returns class (proposed by +- `Mike Nerone `__} +-=20=20=20=20=20=20=20=20 +- 0.15.42 (2018-07-01): +- - fix regression showing only on narrow Python 2.7 (py27mu) bui= lds +- (with help from +- `Marcel Bargull `__ and +- `Colm O'Connor `__). +- - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well= as +- 3.4/3.5/3.6/3.7/pypy +-=20=20=20=20=20=20=20=20 +- 0.15.41 (2018-06-27): +- - add detection of C-compile failure (investigation prompted by +- `StackOverlow `= __ by +- `Emmanuel Blot `__), +- which was removed while no longer dependent on ``libyaml``, C= -extensions +- compilation still needs a compiler though. +-=20=20=20=20=20=20=20=20 +- 0.15.40 (2018-06-18): +- - added links to landing places as suggested in issue 190 by +- `KostisA `__ +- - fixes issue #201: decoding unicode escaped tags on Python2, r= eported +- by `Dan Abolafia `__ +-=20=20=20=20=20=20=20=20 +- 0.15.39 (2018-06-17): +- - merge PR27 improving package startup time (and loading when r= egexp not +- actually used), provided by +- `Marcel Bargull `__ +-=20=20=20=20=20=20=20=20 +- 0.15.38 (2018-06-13): +- - fix for losing precision when roundtripping floats by +- `Rolf Wojtech `__ +- - fix for hardcoded dir separator not working for Windows by +- `Nuno Andr=C3=A9 `__ +- - typo fix by `Andrey Somov `__ +-=20=20=20=20=20=20=20=20 +- 0.15.37 (2018-03-21): +- - again trying to create installable files for 187 +-=20=20=20=20=20=20=20=20 +- 0.15.36 (2018-02-07): +- - fix issue 187, incompatibility of C extension with 3.7 (repor= ted by +- Daniel Blanchard) +-=20=20=20=20=20=20=20=20 +- 0.15.35 (2017-12-03): +- - allow ``None`` as stream when specifying ``transform`` parame= ters to +- ``YAML.dump()``. +- This is useful if the transforming function doesn't return a = meaningful value +- (inspired by `StackOverflow `__ by +- `rsaw `__). +-=20=20=20=20=20=20=20=20 +- 0.15.34 (2017-09-17): +- - fix for issue 157: CDumper not dumping floats (reported by Ja= n Smitka) +-=20=20=20=20=20=20=20=20 +- 0.15.33 (2017-08-31): +- - support for "undefined" round-tripping tagged scalar objects = (in addition to +- tagged mapping object). Inspired by a use case presented by M= atthew Patton +- on `StackOverflow `__. +- - fix issue 148: replace cryptic error message when using !!tim= estamp with an +- incorrectly formatted or non- scalar. Reported by FichteFoll. +-=20=20=20=20=20=20=20=20 +- 0.15.32 (2017-08-21): +- - allow setting ``yaml.default_flow_style =3D None`` (default: = ``False``) for +- for ``typ=3D'rt'``. +- - fix for issue 149: multiplications on ``ScalarFloat`` now ret= urn ``float`` +- (reported by jan.brezina@tul.cz) +-=20=20=20=20=20=20=20=20 +- 0.15.31 (2017-08-15): +- - fix Comment dumping +-=20=20=20=20=20=20=20=20 +- 0.15.30 (2017-08-14): +- - fix for issue with "compact JSON" not parsing: ``{"in":{},"ou= t":{}}`` +- (reported on `StackOverflow `__ by +- `mjalkio `_ +-=20=20=20=20=20=20=20=20 +- 0.15.29 (2017-08-14): +- - fix issue #51: different indents for mappings and sequences (= reported by +- Alex Harvey) +- - fix for flow sequence/mapping as element/value of block seque= nce with +- sequence-indent minus dash-offset not equal two. +-=20=20=20=20=20=20=20=20 +- 0.15.28 (2017-08-13): +- - fix issue #61: merge of merge cannot be __repr__-ed (reported= by Tal Liron) +-=20=20=20=20=20=20=20=20 +- 0.15.27 (2017-08-13): +- - fix issue 62, YAML 1.2 allows ``?`` and ``:`` in plain scalar= s if non-ambigious +- (reported by nowox) +- - fix lists within lists which would make comments disappear +-=20=20=20=20=20=20=20=20 +- 0.15.26 (2017-08-10): +- - fix for disappearing comment after empty flow sequence (repor= ted by +- oit-tzhimmash) +-=20=20=20=20=20=20=20=20 +- 0.15.25 (2017-08-09): +- - fix for problem with dumping (unloaded) floats (reported by e= yenseo) +-=20=20=20=20=20=20=20=20 +- 0.15.24 (2017-08-09): +- - added ScalarFloat which supports roundtripping of 23.1, 23.10= 0, +- 42.00E+56, 0.0, -0.0 etc. while keeping the format. Underscor= es in mantissas +- are not preserved/supported (yet, is anybody using that?). +- - (finally) fixed longstanding issue 23 (reported by `Antony So= ttile +- `__), now handling comment b= etween block +- mapping key and value correctly +- - warn on YAML 1.1 float input that is incorrect (triggered by = invalid YAML +- provided by Cecil Curry) +- - allow setting of boolean representation (`false`, `true`) by = using: +- ``yaml.boolean_representation =3D [u'False', u'True']`` +-=20=20=20=20=20=20=20=20 +- 0.15.23 (2017-08-01): +- - fix for round_tripping integers on 2.7.X > sys.maxint (report= ed by ccatterina) +-=20=20=20=20=20=20=20=20 +- 0.15.22 (2017-07-28): +- - fix for round_tripping singe excl. mark tags doubling (report= ed and fix by Jan Brezina) +-=20=20=20=20=20=20=20=20 +- 0.15.21 (2017-07-25): +- - fix for writing unicode in new API, (reported on +- `StackOverflow = `__ +-=20=20=20=20=20=20=20=20 +- 0.15.20 (2017-07-23): +- - wheels for windows including C extensions +-=20=20=20=20=20=20=20=20 +- 0.15.19 (2017-07-13): +- - added object constructor for rt, decorator ``yaml_object`` to= replace YAMLObject. +- - fix for problem using load_all with Path() instance +- - fix for load_all in combination with zero indent block style = literal +- (``pure=3DTrue`` only!) +-=20=20=20=20=20=20=20=20 +- 0.15.18 (2017-07-04): +- - missing ``pure`` attribute on ``YAML`` useful for implementin= g `!include` tag +- constructor for `including YAML files in a YAML file +- `__ +- - some documentation improvements +- - trigger of doc build on new revision +-=20=20=20=20=20=20=20=20 +- 0.15.17 (2017-07-03): +- - support for Unicode supplementary Plane **output** +- (input was already supported, triggered by +- `this `__ Stack= Overflow Q&A) +-=20=20=20=20=20=20=20=20 +- 0.15.16 (2017-07-01): +- - minor typing issues (reported and fix provided by +- `Manvendra Singh `__ +- - small doc improvements +-=20=20=20=20=20=20=20=20 +- 0.15.15 (2017-06-27): +- - fix for issue 135, typ=3D'safe' not dumping in Python 2.7 +- (reported by Andrzej Ostrowski `__) +-=20=20=20=20=20=20=20=20 +- 0.15.14 (2017-06-25): +- - fix for issue 133, in setup.py: change ModuleNotFoundError to +- ImportError (reported and fix by +- `Asley Drake `__) +-=20=20=20=20=20=20=20=20 +- 0.15.13 (2017-06-24): +- - suppress duplicate key warning on mappings with merge keys (r= eported by +- Cameron Sweeney) +-=20=20=20=20=20=20=20=20 +- 0.15.12 (2017-06-24): +- - remove fatal dependency of setup.py on wheel package (reporte= d by +- Cameron Sweeney) +-=20=20=20=20=20=20=20=20 +- 0.15.11 (2017-06-24): +- - fix for issue 130, regression in nested merge keys (reported = by +- `David Fee `__) +-=20=20=20=20=20=20=20=20 +- 0.15.10 (2017-06-23): +- - top level PreservedScalarString not indented if not explicitl= y asked to +- - remove Makefile (not very useful anyway) +- - some mypy additions +-=20=20=20=20=20=20=20=20 +- 0.15.9 (2017-06-16): +- - fix for issue 127: tagged scalars were always quoted and sepe= rated +- by a newline when in a block sequence (reported and largely f= ixed by +- `Tommy Wang `__) +-=20=20=20=20=20=20=20=20 +- 0.15.8 (2017-06-15): +- - allow plug-in install via ``install ruamel.yaml[jinja2]`` +-=20=20=20=20=20=20=20=20 +- 0.15.7 (2017-06-14): +- - add plug-in mechanism for load/dump pre resp. post-processing +-=20=20=20=20=20=20=20=20 +- 0.15.6 (2017-06-10): +- - a set() with duplicate elements now throws error in rt loading +- - support for toplevel column zero literal/folded scalar in exp= licit documents +-=20=20=20=20=20=20=20=20 +- 0.15.5 (2017-06-08): +- - repeat `load()` on a single `YAML()` instance would fail. +-=20=20=20=20=20=20=20=20 +- 0.15.4 (2017-06-08): +- - `transform` parameter on dump that expects a function taking a +- string and returning a string. This allows transformation of = the output +- before it is written to stream. This forces creation of the c= omplete output in memory! +- - some updates to the docs +-=20=20=20=20=20=20=20=20 +- 0.15.3 (2017-06-07): +- - No longer try to compile C extensions on Windows. Compilation= can be forced by setting +- the environment variable `RUAMEL_FORCE_EXT_BUILD` to some val= ue +- before starting the `pip install`. +-=20=20=20=20=20=20=20=20 +- 0.15.2 (2017-06-07): +- - update to conform to mypy 0.511: mypy --strict +-=20=20=20=20=20=20=20=20 +- 0.15.1 (2017-06-07): +- - `duplicate keys `__ +- in mappings generate an error (in the old API this change gen= erates a warning until 0.16) +- - dependecy on ruamel.ordereddict for 2.7 now via extras_require +-=20=20=20=20=20=20=20=20 +- 0.15.0 (2017-06-04): +- - it is now allowed to pass in a ``pathlib.Path`` as "stream" p= arameter to all +- load/dump functions +- - passing in a non-supported object (e.g. a string) as "stream"= will result in a +- much more meaningful YAMLStreamError. +- - assigning a normal string value to an existing CommentedMap k= ey or CommentedSeq +- element will result in a value cast to the previous value's t= ype if possible. +- - added ``YAML`` class for new API +-=20=20=20=20=20=20=20=20 +- 0.14.12 (2017-05-14): +- - fix for issue 119, deepcopy not returning subclasses (reporte= d and PR by +- Constantine Evans ) +-=20=20=20=20=20=20=20=20 +- 0.14.11 (2017-05-01): +- - fix for issue 103 allowing implicit documents after document = end marker line (``...``) +- in YAML 1.2 +-=20=20=20=20=20=20=20=20 +- 0.14.10 (2017-04-26): +- - fix problem with emitting using cyaml +-=20=20=20=20=20=20=20=20 +- 0.14.9 (2017-04-22): +- - remove dependency on ``typing`` while still supporting ``mypy= `` +- (http://stackoverflow.com/a/43516781/1307905) +- - fix unclarity in doc that stated 2.6 is supported (reported b= y feetdust) +-=20=20=20=20=20=20=20=20 +- 0.14.8 (2017-04-19): +- - fix Text not available on 3.5.0 and 3.5.1, now proactively se= tting version guards +- on all files (reported by `Jo=C3=A3o Paulo Magalh=C3=A3es `__) +-=20=20=20=20=20=20=20=20 +- 0.14.7 (2017-04-18): +- - round trip of integers (decimal, octal, hex, binary) now pres= erve +- leading zero(s) padding and underscores. Underscores are pres= umed +- to be at regular distances (i.e. ``0o12_345_67`` dumps back as +- ``0o1_23_45_67`` as the space from the last digit to the +- underscore before that is the determining factor). +-=20=20=20=20=20=20=20=20 +- 0.14.6 (2017-04-14): +- - binary, octal and hex integers are now preserved by default. = This +- was a known deficiency. Working on this was prompted by the i= ssue report (112) +- from devnoname120, as well as the additional experience with = `.replace()` +- on `scalarstring` classes. +- - fix issues 114: cannot install on Buildozer (reported by mixm= astamyk). +- Setting env. var ``RUAMEL_NO_PIP_INSTALL_CHECK`` will suppres= s ``pip``-check. +-=20=20=20=20=20=20=20=20 +- 0.14.5 (2017-04-04): +- - fix issue 109: None not dumping correctly at top level (repor= ted by Andrea Censi) +- - fix issue 110: .replace on Preserved/DoubleQuoted/SingleQuote= d ScalarString +- would give back "normal" string (reported by sandres23) +-=20=20=20=20=20=20=20=20 +- 0.14.4 (2017-03-31): +- - fix readme +-=20=20=20=20=20=20=20=20 +- 0.14.3 (2017-03-31): +- - fix for 0o52 not being a string in YAML 1.1 (reported on +- `StackOverflow Q&A 43138503 `__ by +- `Frank D `__) +-=20=20=20=20=20=20=20=20 +- 0.14.2 (2017-03-23): +- - fix for old default pip on Ubuntu 14.04 (reported by S=C3=A9b= astien Maccagnoni-Munch) +-=20=20=20=20=20=20=20=20 +- 0.14.1 (2017-03-22): +- - fix Text not available on 3.5.0 and 3.5.1 (reported by Charle= s Bouchard-L=C3=A9gar=C3=A9) +-=20=20=20=20=20=20=20=20 +- 0.14.0 (2017-03-21): +- - updates for mypy --strict +- - preparation for moving away from inheritance in Loader and Du= mper, calls from e.g. +- the Representer to the Serializer.serialize() are now done vi= a the attribute +- .serializer.serialize(). Usage of .serialize() outside of Ser= ializer will be +- deprecated soon +- - some extra tests on main.py functions +-=20=20=20=20=20=20=20=20 +- ---- +-=20=20=20=20=20=20=20=20 +- For older changes see the file +- `CHANGES `_ +-=20=20=20=20=20=20=20=20 +-Keywords: yaml 1.2 parser round-trip preserve quotes order config +-Platform: UNKNOWN +-Classifier: Development Status :: 4 - Beta +-Classifier: Intended Audience :: Developers +-Classifier: License :: OSI Approved :: MIT License +-Classifier: Operating System :: OS Independent +-Classifier: Programming Language :: Python +-Classifier: Programming Language :: Python :: 2.7 +-Classifier: Programming Language :: Python :: 3.5 +-Classifier: Programming Language :: Python :: 3.6 +-Classifier: Programming Language :: Python :: 3.7 +-Classifier: Programming Language :: Python :: 3.8 +-Classifier: Programming Language :: Python :: Implementation :: CPython +-Classifier: Programming Language :: Python :: Implementation :: Jython +-Classifier: Programming Language :: Python :: Implementation :: PyPy +-Classifier: Topic :: Software Development :: Libraries :: Python Modules +-Classifier: Topic :: Text Processing :: Markup +-Classifier: Typing :: Typed +-Description-Content-Type: text/x-rst +-Provides-Extra: docs +-Provides-Extra: jinja2 +diff --git a/dynaconf/vendor/ruamel/yaml/README.rst b/dynaconf/vendor/ruam= el/yaml/README.rst +deleted file mode 100644 +index 2a99cb9..0000000 +--- a/dynaconf/vendor/ruamel/yaml/README.rst ++++ /dev/null +@@ -1,752 +0,0 @@ +- +-ruamel.yaml +-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +- +-``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. +- +-:version: 0.16.10 +-:updated: 2020-02-12 +-:documentation: http://yaml.readthedocs.io +-:repository: https://bitbucket.org/ruamel/yaml +-:pypi: https://pypi.org/project/ruamel.yaml/ +- +- +-Starting with version 0.15.0 the way YAML files are loaded and dumped +-is changing. See the API doc for details. Currently existing +-functionality will throw a warning before being changed/removed. +-**For production systems you should pin the version being used with +-``ruamel.yaml<=3D0.15``**. There might be bug fixes in the 0.14 series, +-but new functionality is likely only to be available via the new API. +- +-If your package uses ``ruamel.yaml`` and is not listed on PyPI, drop +-me an email, preferably with some information on how you use the +-package (or a link to bitbucket/github) and I'll keep you informed +-when the status of the API is stable enough to make the transition. +- +-* `Overview `_ +-* `Installing `_ +-* `Basic Usage `_ +-* `Details `_ +-* `Examples `_ +-* `API `_ +-* `Differences with PyYAML `_ +- +-.. image:: https://readthedocs.org/projects/yaml/badge/?version=3Dstable +- :target: https://yaml.readthedocs.org/en/stable +- +-.. image:: https://bestpractices.coreinfrastructure.org/projects/1128/bad= ge +- :target: https://bestpractices.coreinfrastructure.org/projects/1128 +- +-.. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/_do= c/_static/license.svg?format=3Draw +- :target: https://opensource.org/licenses/MIT +- +-.. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/_do= c/_static/pypi.svg?format=3Draw +- :target: https://pypi.org/project/ruamel.yaml/ +- +-.. image:: https://sourceforge.net/p/oitnb/code/ci/default/tree/_doc/_sta= tic/oitnb.svg?format=3Draw +- :target: https://pypi.org/project/oitnb/ +- +-.. image:: http://www.mypy-lang.org/static/mypy_badge.svg +- :target: http://mypy-lang.org/ +- +-ChangeLog +-=3D=3D=3D=3D=3D=3D=3D=3D=3D +- +-.. should insert NEXT: at the beginning of line for next key (with empty = line) +- +-0.16.10 (2020-02-12): +- - (auto) updated image references in README to sourceforge +- +-0.16.9 (2020-02-11): +- - update CHANGES +- +-0.16.8 (2020-02-11): +- - update requirements so that ruamel.yaml.clib is installed for 3.8, +- as it has become available (via manylinux builds) +- +-0.16.7 (2020-01-30): +- - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) +- - fix error in dumping literal scalar in sequence with comments before = element +- (reported by `EJ Etherington `__) +- +-0.16.6 (2020-01-20): +- - fix empty string mapping key roundtripping with preservation of quote= s as `? ''` +- (reported via email by Tomer Aharoni). +- - fix incorrect state setting in class constructor (reported by `Dougla= s Raillard +- `_= _) +- - adjust deprecation warning test for Hashable, as that no longer warns= (reported +- by `Jason Montleon `__) +- +-0.16.5 (2019-08-18): +- - allow for ``YAML(typ=3D['unsafe', 'pytypes'])`` +- +-0.16.4 (2019-08-16): +- - fix output of TAG directives with # (reported by `Thomas Smith +- `_= _) +- +- +-0.16.3 (2019-08-15): +- - split construct_object +- - change stuff back to keep mypy happy +- - move setting of version based on YAML directive to scanner, allowing = to +- check for file version during TAG directive scanning +- +-0.16.2 (2019-08-15): +- - preserve YAML and TAG directives on roundtrip, correctly output # +- in URL for YAML 1.2 (both reported by `Thomas Smith +- `_= _) +- +-0.16.1 (2019-08-08): +- - Force the use of new version of ruamel.yaml.clib (reported by `Alex J= oz +- `_= _) +- - Allow '#' in tag URI as these are allowed in YAML 1.2 (reported by +- `Thomas Smith +- `_= _) +- +-0.16.0 (2019-07-25): +- - split of C source that generates .so file to ruamel.yaml.clib +- - duplicate keys are now an error when working with the old API as well +- +-0.15.100 (2019-07-17): +- - fixing issue with dumping deep-copied data from commented YAML, by +- providing both the memo parameter to __deepcopy__, and by allowing +- startmarks to be compared on their content (reported by `Theofilos +- Petsios +- `_= _) +- +-0.15.99 (2019-07-12): +- - add `py.typed` to distribution, based on a PR submitted by +- `Michael Crusoe +- `__ +- - merge PR 40 (also by Michael Crusoe) to more accurately specify +- repository in the README (also reported in a misunderstood issue +- some time ago) +- +-0.15.98 (2019-07-09): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.12, needed +- for Python 3.8.0b2 (reported by `John Vandenberg +- `_= _) +- +-0.15.97 (2019-06-06): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.10, needed for +- Python 3.8.0b1 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.9, needed for +- Python 3.8.0a4 (reported by `Anthony Sottile +- `_= _) +- +-0.15.96 (2019-05-16): +- - fix failure to indent comments on round-trip anchored block style +- scalars in block sequence (reported by `William Kimball +- `_= _) +- +-0.15.95 (2019-05-16): +- - fix failure to round-trip anchored scalars in block sequence +- (reported by `William Kimball +- `_= _) +- - wheel files for Python 3.4 no longer provided (`Python 3.4 EOL 2019-0= 3-18 +- `__) +- +-0.15.94 (2019-04-23): +- - fix missing line-break after end-of-file comments not ending in +- line-break (reported by `Philip Thompson +- `_= _) +- +-0.15.93 (2019-04-21): +- - fix failure to parse empty implicit flow mapping key +- - in YAML 1.1 plains scalars `y`, 'n', `Y`, and 'N' are now +- correctly recognised as booleans and such strings dumped quoted +- (reported by `Marcel Bollmann +- `_= _) +- +-0.15.92 (2019-04-16): +- - fix failure to parse empty implicit block mapping key (reported by=20 +- `Nolan W `__) +- +-0.15.91 (2019-04-05): +- - allowing duplicate keys would not work for merge keys (reported by ma= macdon on +- `StackOverflow `__=20 +- +-0.15.90 (2019-04-04): +- - fix issue with updating `CommentedMap` from list of tuples (reported = by=20 +- `Peter Henry `__) +- +-0.15.89 (2019-02-27): +- - fix for items with flow-mapping in block sequence output on single li= ne +- (reported by `Zahari Dim `__) +- - fix for safe dumping erroring in creation of representereror when dum= ping namedtuple +- (reported and solution by `Jaakko Kantoj=C3=A4rvi `__) +- +-0.15.88 (2019-02-12): +- - fix inclusing of python code from the subpackage data (containing ext= ra tests, +- reported by `Florian Apolloner `__) +- +-0.15.87 (2019-01-22): +- - fix problem with empty lists and the code to reinsert merge keys (rep= orted via email=20 +- by Zaloo) +- +-0.15.86 (2019-01-16): +- - reinsert merge key in its old position (reported by grumbler on +- `StackOverflow `__) +- - fix for issue with non-ASCII anchor names (reported and fix +- provided by Dandaleon Flux via email) +- - fix for issue when parsing flow mapping value starting with colon (in= pure Python only) +- (reported by `FichteFoll `__) +- +-0.15.85 (2019-01-08): +- - the types used by ``SafeConstructor`` for mappings and sequences can +- now by set by assigning to ``XXXConstructor.yaml_base_dict_type`` +- (and ``..._list_type``), preventing the need to copy two methods +- with 50+ lines that had ``var =3D {}`` hardcoded. (Implemented to +- help solve an feature request by `Anthony Sottile +- `__ in an easier way) +- +-0.15.84 (2019-01-07): +- - fix for ``CommentedMap.copy()`` not returning ``CommentedMap``, let a= lone copying comments etc. +- (reported by `Anthony Sottile `__) +- +-0.15.83 (2019-01-02): +- - fix for bug in roundtripping aliases used as key (reported via email = by Zaloo) +- +-0.15.82 (2018-12-28): +- - anchors and aliases on scalar int, float, string and bool are now pre= served. Anchors +- do not need a referring alias for these (reported by=20 +- `Alex Harvey `__) +- - anchors no longer lost on tagged objects when roundtripping (reported= by `Zaloo=20 +- `__) +- +-0.15.81 (2018-12-06): +- - fix issue dumping methods of metaclass derived classes (reported and = fix provided +- by `Douglas Raillard `__) +- +-0.15.80 (2018-11-26): +- - fix issue emitting BEL character when round-tripping invalid folded i= nput +- (reported by Isaac on `StackOverflow `__) +-=20=20=20=20 +-0.15.79 (2018-11-21): +- - fix issue with anchors nested deeper than alias (reported by gaFF on +- `StackOverflow `__) +- +-0.15.78 (2018-11-15): +- - fix setup issue for 3.8 (reported by `Sidney Kuyateh=20 +- `__) +- +-0.15.77 (2018-11-09): +- - setting `yaml.sort_base_mapping_type_on_output =3D False`, will preve= nt +- explicit sorting by keys in the base representer of mappings. Roundtr= ip +- already did not do this. Usage only makes real sense for Python 3.6+ +- (feature request by `Sebastian Gerber `__). +- - implement Python version check in YAML metadata in ``_test/test_z_dat= a.py`` +- +-0.15.76 (2018-11-01): +- - fix issue with empty mapping and sequence loaded as flow-style +- (mapping reported by `Min RK `__, seque= nce +- by `Maged Ahmed `__) +- +-0.15.75 (2018-10-27): +- - fix issue with single '?' scalar (reported by `Terrance=20 +- `__) +- - fix issue with duplicate merge keys (prompted by `answering=20 +- `__ a=20 +- `StackOverflow question `__ +- by `math `__) +- +-0.15.74 (2018-10-17): +- - fix dropping of comment on rt before sequence item that is sequence i= tem +- (reported by `Thorsten Kampe `_= _) +- +-0.15.73 (2018-10-16): +- - fix irregular output on pre-comment in sequence within sequence (repo= rted +- by `Thorsten Kampe `__) +- - allow non-compact (i.e. next line) dumping sequence/mapping within se= quence. +- +-0.15.72 (2018-10-06): +- - fix regression on explicit 1.1 loading with the C based scanner/parser +- (reported by `Tomas Vavra `__) +- +-0.15.71 (2018-09-26): +- - some of the tests now live in YAML files in the=20 +- `yaml.data `__ repository.=20 +- ``_test/test_z_data.py`` processes these. +- - fix regression where handcrafted CommentedMaps could not be initiated= (reported by=20 +- `Dan Helfman `__) +- - fix regression with non-root literal scalars that needed indent indic= ator +- (reported by `Clark Breyman `__) +- - tag:yaml.org,2002:python/object/apply now also uses __qualname__ on P= Y3 +- (reported by `Douglas RAILLARD `__) +- - issue with self-referring object creation +- (reported and fix by `Douglas RAILLARD `__) +- +-0.15.70 (2018-09-21): +- - reverted CommentedMap and CommentedSeq to subclass ordereddict resp. = list, +- reimplemented merge maps so that both ``dict(**commented_map_instance= )`` and JSON +- dumping works. This also allows checking with ``isinstance()`` on ``d= ict`` resp. ``list``. +- (Proposed by `Stuart Berg `__, wi= th feedback +- from `blhsing `__ on +- `StackOverflow `__) +- +-0.15.69 (2018-09-20): +- - fix issue with dump_all gobbling end-of-document comments on parsing +- (reported by `Pierre B. `__) +- +-0.15.68 (2018-09-20): +- - fix issue with parsabel, but incorrect output with nested flow-style = sequences +- (reported by `Dougal Seeley `__) +- - fix issue with loading Python objects that have __setstate__ and recu= rsion in parameters +- (reported by `Douglas RAILLARD `__) +- +-0.15.67 (2018-09-19): +- - fix issue with extra space inserted with non-root literal strings=20 +- (Issue reported and PR with fix provided by=20 +- `Naomi Seyfer `__.) +- +-0.15.66 (2018-09-07): +- - fix issue with fold indicating characters inserted in safe_load-ed fo= lded strings +- (reported by `Maximilian Hils `__). +- +-0.15.65 (2018-09-07): +- - fix issue #232 revert to throw ParserError for unexcpected ``]`` +- and ``}`` instead of IndexError. (Issue reported and PR with fix +- provided by `Naomi Seyfer `__.) +- - added ``key`` and ``reverse`` parameter (suggested by Jannik Klemm vi= a email) +- - indent root level literal scalars that have directive or document end= markers +- at the beginning of a line +- +-0.15.64 (2018-08-30): +- - support round-trip of tagged sequences: ``!Arg [a, {b: 1}]`` +- - single entry mappings in flow sequences now written by default withou= t braces, +- set ``yaml.brace_single_entry_mapping_in_flow_sequence=3DTrue`` to fo= rce +- getting ``[a, {b: 1}, {c: {d: 2}}]`` instead of the default ``[a, b: = 1, c: {d: 2}]`` +- - fix issue when roundtripping floats starting with a dot such as ``.5`` +- (reported by `Harrison Gregg `_= _) +- +-0.15.63 (2018-08-29): +- - small fix only necessary for Windows users that don't use wheels. +- +-0.15.62 (2018-08-29): +- - C based reader/scanner & emitter now allow setting of 1.2 as YAML ver= sion. +- ** The loading/dumping is still YAML 1.1 code**, so use the common su= bset of +- YAML 1.2 and 1.1 (reported by `Ge Yang `__) +- +-0.15.61 (2018-08-23): +- - support for round-tripping folded style scalars (initially requested= =20 +- by `Johnathan Viduchinsky `__) +- - update of C code +- - speed up of scanning (~30% depending on the input) +- +-0.15.60 (2018-08-18): +- - again allow single entry map in flow sequence context (reported by=20 +- `Lee Goolsbee `__) +- - cleanup for mypy=20 +- - spurious print in library (reported by=20 +- `Lele Gaifax `__), now automatically che= cked=20 +- +-0.15.59 (2018-08-17): +- - issue with C based loader and leading zeros (reported by=20 +- `Tom Hamilton Stubber `__) +- +-0.15.58 (2018-08-17): +- - simple mappings can now be used as keys when round-tripping:: +- +- {a: 1, b: 2}: hello world +-=20=20=20=20=20=20 +- although using the obvious operations (del, popitem) on the key will +- fail, you can mutilate it by going through its attributes. If you loa= d the +- above YAML in `d`, then changing the value is cumbersome: +- +- d =3D {CommentedKeyMap([('a', 1), ('b', 2)]): "goodbye"} +- +- and changing the key even more so: +- +- d[CommentedKeyMap([('b', 1), ('a', 2)])] =3D d.pop( +- CommentedKeyMap([('a', 1), ('b', 2)])) +- +- (you can use a `dict` instead of a list of tuples (or ordereddict), b= ut that might result +- in a different order, of the keys of the key, in the output) +- - check integers to dump with 1.2 patterns instead of 1.1 (reported by= =20 +- `Lele Gaifax `__) +-=20=20 +- +-0.15.57 (2018-08-15): +- - Fix that CommentedSeq could no longer be used in adding or do a sort +- (reported by `Christopher Wright `__) +- +-0.15.56 (2018-08-15): +- - fix issue with ``python -O`` optimizing away code (reported, and deta= iled cause +- pinpointed, by `Alex Gr=C3=B6nholm = `__) +- +-0.15.55 (2018-08-14): +- - unmade ``CommentedSeq`` a subclass of ``list``. It is now +- indirectly a subclass of the standard +- ``collections.abc.MutableSequence`` (without .abc if you are +- still on Python2.7). If you do ``isinstance(yaml.load('[1, 2]'), +- list)``) anywhere in your code replace ``list`` with +- ``MutableSequence``. Directly, ``CommentedSeq`` is a subclass of +- the abstract baseclass ``ruamel.yaml.compat.MutableScliceableSequence= ``, +- with the result that *(extended) slicing is supported on=20 +- ``CommentedSeq``*. +- (reported by `Stuart Berg `__) +- - duplicate keys (or their values) with non-ascii now correctly +- report in Python2, instead of raising a Unicode error. +- (Reported by `Jonathan Pyle `__) +- +-0.15.54 (2018-08-13): +- - fix issue where a comment could pop-up twice in the output (reported = by=20 +- `Mike Kazantsev `__ and by=20 +- `Nate Peterson `__) +- - fix issue where JSON object (mapping) without spaces was not parsed +- properly (reported by `Marc Schmidt `__) +- - fix issue where comments after empty flow-style mappings were not emi= tted +- (reported by `Qinfench Chen `__) +- +-0.15.53 (2018-08-12): +- - fix issue with flow style mapping with comments gobbled newline (repo= rted +- by `Christopher Lambert `__) +- - fix issue where single '+' under YAML 1.2 was interpreted as +- integer, erroring out (reported by `Jethro Yu +- `__) +- +-0.15.52 (2018-08-09): +- - added `.copy()` mapping representation for round-tripping +- (``CommentedMap``) to fix incomplete copies of merged mappings +- (reported by `Will Richards +- `__)=20 +- - Also unmade that class a subclass of ordereddict to solve incorrect b= ehaviour +- for ``{**merged-mapping}`` and ``dict(**merged-mapping)`` (reported i= ndependently by +- `Tim Olsson `__ and=20 +- `Filip Matzner `__) +- +-0.15.51 (2018-08-08): +- - Fix method name dumps (were not dotted) and loads (reported by `Dougl= as Raillard=20 +- `__) +- - Fix spurious trailing white-space caused when the comment start +- column was no longer reached and there was no actual EOL comment +- (e.g. following empty line) and doing substitutions, or when +- quotes around scalars got dropped. (reported by `Thomas Guillet +- `__) +- +-0.15.50 (2018-08-05): +- - Allow ``YAML()`` as a context manager for output, thereby making it m= uch easier +- to generate multi-documents in a stream.=20 +- - Fix issue with incorrect type information for `load()` and `dump()` (= reported=20 +- by `Jimbo Jim `__) +- +-0.15.49 (2018-08-05): +- - fix preservation of leading newlines in root level literal style scal= ar, +- and preserve comment after literal style indicator (``| # some comme= nt``) +- Both needed for round-tripping multi-doc streams in=20 +- `ryd `__. +- +-0.15.48 (2018-08-03): +- - housekeeping: ``oitnb`` for formatting, mypy 0.620 upgrade and confor= mity +- +-0.15.47 (2018-07-31): +- - fix broken 3.6 manylinux1, the result of an unclean ``build`` (report= ed by=20 +- `Roman Sichnyi `__) +- +- +-0.15.46 (2018-07-29): +- - fixed DeprecationWarning for importing from ``collections`` on 3.7 +- (issue 210, reported by `Reinoud Elhorst +- `__). It was `difficult to find +- why tox/pytest did not report +- `__ and as time +- consuming to actually `fix +- `__ the tests. +- +-0.15.45 (2018-07-26): +- - After adding failing test for ``YAML.load_all(Path())``, remove StopI= teration=20 +- (PR provided by `Zachary Buhman `__, +- also reported by `Steven Hiscocks = `__. +- +-0.15.44 (2018-07-14): +- - Correct loading plain scalars consisting of numerals only and +- starting with `0`, when not explicitly specifying YAML version +- 1.1. This also fixes the issue about dumping string `'019'` as +- plain scalars as reported by `Min RK +- `__, that prompted this chance. +- +-0.15.43 (2018-07-12): +- - merge PR33: Python2.7 on Windows is narrow, but has no +- ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by +- `Marcel Bargull `__) +- - ``register_class()`` now returns class (proposed by +- `Mike Nerone `__} +- +-0.15.42 (2018-07-01): +- - fix regression showing only on narrow Python 2.7 (py27mu) builds +- (with help from +- `Marcel Bargull `__ and +- `Colm O'Connor `__). +- - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as +- 3.4/3.5/3.6/3.7/pypy +- +-0.15.41 (2018-06-27): +- - add detection of C-compile failure (investigation prompted by +- `StackOverlow `__ by +- `Emmanuel Blot `__), +- which was removed while no longer dependent on ``libyaml``, C-extensi= ons +- compilation still needs a compiler though. +- +-0.15.40 (2018-06-18): +- - added links to landing places as suggested in issue 190 by +- `KostisA `__ +- - fixes issue #201: decoding unicode escaped tags on Python2, reported +- by `Dan Abolafia `__ +- +-0.15.39 (2018-06-17): +- - merge PR27 improving package startup time (and loading when regexp not +- actually used), provided by +- `Marcel Bargull `__ +- +-0.15.38 (2018-06-13): +- - fix for losing precision when roundtripping floats by +- `Rolf Wojtech `__ +- - fix for hardcoded dir separator not working for Windows by +- `Nuno Andr=C3=A9 `__ +- - typo fix by `Andrey Somov `__ +- +-0.15.37 (2018-03-21): +- - again trying to create installable files for 187 +- +-0.15.36 (2018-02-07): +- - fix issue 187, incompatibility of C extension with 3.7 (reported by +- Daniel Blanchard) +- +-0.15.35 (2017-12-03): +- - allow ``None`` as stream when specifying ``transform`` parameters to +- ``YAML.dump()``. +- This is useful if the transforming function doesn't return a meaningf= ul value +- (inspired by `StackOverflow `__ by +- `rsaw `__). +- +-0.15.34 (2017-09-17): +- - fix for issue 157: CDumper not dumping floats (reported by Jan Smitka) +- +-0.15.33 (2017-08-31): +- - support for "undefined" round-tripping tagged scalar objects (in addi= tion to +- tagged mapping object). Inspired by a use case presented by Matthew P= atton +- on `StackOverflow `__. +- - fix issue 148: replace cryptic error message when using !!timestamp w= ith an +- incorrectly formatted or non- scalar. Reported by FichteFoll. +- +-0.15.32 (2017-08-21): +- - allow setting ``yaml.default_flow_style =3D None`` (default: ``False`= `) for +- for ``typ=3D'rt'``. +- - fix for issue 149: multiplications on ``ScalarFloat`` now return ``fl= oat`` +- (reported by jan.brezina@tul.cz) +- +-0.15.31 (2017-08-15): +- - fix Comment dumping +- +-0.15.30 (2017-08-14): +- - fix for issue with "compact JSON" not parsing: ``{"in":{},"out":{}}`` +- (reported on `StackOverflow `__ by +- `mjalkio `_ +- +-0.15.29 (2017-08-14): +- - fix issue #51: different indents for mappings and sequences (reported= by +- Alex Harvey) +- - fix for flow sequence/mapping as element/value of block sequence with +- sequence-indent minus dash-offset not equal two. +- +-0.15.28 (2017-08-13): +- - fix issue #61: merge of merge cannot be __repr__-ed (reported by Tal = Liron) +- +-0.15.27 (2017-08-13): +- - fix issue 62, YAML 1.2 allows ``?`` and ``:`` in plain scalars if non= -ambigious +- (reported by nowox) +- - fix lists within lists which would make comments disappear +- +-0.15.26 (2017-08-10): +- - fix for disappearing comment after empty flow sequence (reported by +- oit-tzhimmash) +- +-0.15.25 (2017-08-09): +- - fix for problem with dumping (unloaded) floats (reported by eyenseo) +- +-0.15.24 (2017-08-09): +- - added ScalarFloat which supports roundtripping of 23.1, 23.100, +- 42.00E+56, 0.0, -0.0 etc. while keeping the format. Underscores in ma= ntissas +- are not preserved/supported (yet, is anybody using that?). +- - (finally) fixed longstanding issue 23 (reported by `Antony Sottile +- `__), now handling comment between b= lock +- mapping key and value correctly +- - warn on YAML 1.1 float input that is incorrect (triggered by invalid = YAML +- provided by Cecil Curry) +- - allow setting of boolean representation (`false`, `true`) by using: +- ``yaml.boolean_representation =3D [u'False', u'True']`` +- +-0.15.23 (2017-08-01): +- - fix for round_tripping integers on 2.7.X > sys.maxint (reported by cc= atterina) +- +-0.15.22 (2017-07-28): +- - fix for round_tripping singe excl. mark tags doubling (reported and f= ix by Jan Brezina) +- +-0.15.21 (2017-07-25): +- - fix for writing unicode in new API, (reported on +- `StackOverflow `__ +- +-0.15.20 (2017-07-23): +- - wheels for windows including C extensions +- +-0.15.19 (2017-07-13): +- - added object constructor for rt, decorator ``yaml_object`` to replace= YAMLObject. +- - fix for problem using load_all with Path() instance +- - fix for load_all in combination with zero indent block style literal +- (``pure=3DTrue`` only!) +- +-0.15.18 (2017-07-04): +- - missing ``pure`` attribute on ``YAML`` useful for implementing `!incl= ude` tag +- constructor for `including YAML files in a YAML file +- `__ +- - some documentation improvements +- - trigger of doc build on new revision +- +-0.15.17 (2017-07-03): +- - support for Unicode supplementary Plane **output** +- (input was already supported, triggered by +- `this `__ Stack Overflo= w Q&A) +- +-0.15.16 (2017-07-01): +- - minor typing issues (reported and fix provided by +- `Manvendra Singh `__ +- - small doc improvements +- +-0.15.15 (2017-06-27): +- - fix for issue 135, typ=3D'safe' not dumping in Python 2.7 +- (reported by Andrzej Ostrowski `__) +- +-0.15.14 (2017-06-25): +- - fix for issue 133, in setup.py: change ModuleNotFoundError to +- ImportError (reported and fix by +- `Asley Drake `__) +- +-0.15.13 (2017-06-24): +- - suppress duplicate key warning on mappings with merge keys (reported = by +- Cameron Sweeney) +- +-0.15.12 (2017-06-24): +- - remove fatal dependency of setup.py on wheel package (reported by +- Cameron Sweeney) +- +-0.15.11 (2017-06-24): +- - fix for issue 130, regression in nested merge keys (reported by +- `David Fee `__) +- +-0.15.10 (2017-06-23): +- - top level PreservedScalarString not indented if not explicitly asked = to +- - remove Makefile (not very useful anyway) +- - some mypy additions +- +-0.15.9 (2017-06-16): +- - fix for issue 127: tagged scalars were always quoted and seperated +- by a newline when in a block sequence (reported and largely fixed by +- `Tommy Wang `__) +- +-0.15.8 (2017-06-15): +- - allow plug-in install via ``install ruamel.yaml[jinja2]`` +- +-0.15.7 (2017-06-14): +- - add plug-in mechanism for load/dump pre resp. post-processing +- +-0.15.6 (2017-06-10): +- - a set() with duplicate elements now throws error in rt loading +- - support for toplevel column zero literal/folded scalar in explicit do= cuments +- +-0.15.5 (2017-06-08): +- - repeat `load()` on a single `YAML()` instance would fail. +- +-0.15.4 (2017-06-08): +- - `transform` parameter on dump that expects a function taking a +- string and returning a string. This allows transformation of the outp= ut +- before it is written to stream. This forces creation of the complete = output in memory! +- - some updates to the docs +- +-0.15.3 (2017-06-07): +- - No longer try to compile C extensions on Windows. Compilation can be = forced by setting +- the environment variable `RUAMEL_FORCE_EXT_BUILD` to some value +- before starting the `pip install`. +- +-0.15.2 (2017-06-07): +- - update to conform to mypy 0.511: mypy --strict +- +-0.15.1 (2017-06-07): +- - `duplicate keys `__ +- in mappings generate an error (in the old API this change generates a= warning until 0.16) +- - dependecy on ruamel.ordereddict for 2.7 now via extras_require +- +-0.15.0 (2017-06-04): +- - it is now allowed to pass in a ``pathlib.Path`` as "stream" parameter= to all +- load/dump functions +- - passing in a non-supported object (e.g. a string) as "stream" will re= sult in a +- much more meaningful YAMLStreamError. +- - assigning a normal string value to an existing CommentedMap key or Co= mmentedSeq +- element will result in a value cast to the previous value's type if p= ossible. +- - added ``YAML`` class for new API +- +-0.14.12 (2017-05-14): +- - fix for issue 119, deepcopy not returning subclasses (reported and PR= by +- Constantine Evans ) +- +-0.14.11 (2017-05-01): +- - fix for issue 103 allowing implicit documents after document end mark= er line (``...``) +- in YAML 1.2 +- +-0.14.10 (2017-04-26): +- - fix problem with emitting using cyaml +- +-0.14.9 (2017-04-22): +- - remove dependency on ``typing`` while still supporting ``mypy`` +- (http://stackoverflow.com/a/43516781/1307905) +- - fix unclarity in doc that stated 2.6 is supported (reported by feetdu= st) +- +-0.14.8 (2017-04-19): +- - fix Text not available on 3.5.0 and 3.5.1, now proactively setting ve= rsion guards +- on all files (reported by `Jo=C3=A3o Paulo Magalh=C3=A3es `__) +- +-0.14.7 (2017-04-18): +- - round trip of integers (decimal, octal, hex, binary) now preserve +- leading zero(s) padding and underscores. Underscores are presumed +- to be at regular distances (i.e. ``0o12_345_67`` dumps back as +- ``0o1_23_45_67`` as the space from the last digit to the +- underscore before that is the determining factor). +- +-0.14.6 (2017-04-14): +- - binary, octal and hex integers are now preserved by default. This +- was a known deficiency. Working on this was prompted by the issue rep= ort (112) +- from devnoname120, as well as the additional experience with `.replac= e()` +- on `scalarstring` classes. +- - fix issues 114: cannot install on Buildozer (reported by mixmastamyk). +- Setting env. var ``RUAMEL_NO_PIP_INSTALL_CHECK`` will suppress ``pip`= `-check. +- +-0.14.5 (2017-04-04): +- - fix issue 109: None not dumping correctly at top level (reported by A= ndrea Censi) +- - fix issue 110: .replace on Preserved/DoubleQuoted/SingleQuoted Scalar= String +- would give back "normal" string (reported by sandres23) +- +-0.14.4 (2017-03-31): +- - fix readme +- +-0.14.3 (2017-03-31): +- - fix for 0o52 not being a string in YAML 1.1 (reported on +- `StackOverflow Q&A 43138503 `__ by +- `Frank D `__) +- +-0.14.2 (2017-03-23): +- - fix for old default pip on Ubuntu 14.04 (reported by S=C3=A9bastien M= accagnoni-Munch) +- +-0.14.1 (2017-03-22): +- - fix Text not available on 3.5.0 and 3.5.1 (reported by Charles Boucha= rd-L=C3=A9gar=C3=A9) +- +-0.14.0 (2017-03-21): +- - updates for mypy --strict +- - preparation for moving away from inheritance in Loader and Dumper, ca= lls from e.g. +- the Representer to the Serializer.serialize() are now done via the at= tribute +- .serializer.serialize(). Usage of .serialize() outside of Serializer = will be +- deprecated soon +- - some extra tests on main.py functions +- +----- +- +-For older changes see the file +-`CHANGES `_ +diff --git a/dynaconf/vendor/ruamel/yaml/__init__.py b/dynaconf/vendor/rua= mel/yaml/__init__.py +deleted file mode 100644 +index ac49423..0000000 +--- a/dynaconf/vendor/ruamel/yaml/__init__.py ++++ /dev/null +@@ -1,10 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_B=3D'yaml' +-_A=3DFalse +-if _A:from typing import Dict,Any +-_package_data=3Ddict(full_package_name=3D'ruamel.yaml',version_info=3D(0,= 16,10),__version__=3D'0.16.10',author=3D'Anthon van der Neut',author_email= =3D'a.van.der.neut@ruamel.eu',description=3D'ruamel.yaml is a YAML parser/e= mitter that supports roundtrip preservation of comments, seq/map flow style= , and map key order',entry_points=3DNone,since=3D2014,extras_require=3D{':p= latform_python_implementation=3D=3D"CPython" and python_version<=3D"2.7"':[= 'ruamel.ordereddict'],':platform_python_implementation=3D=3D"CPython" and p= ython_version<"3.9"':['ruamel.yaml.clib>=3D0.1.2'],'jinja2':['ruamel.yaml.j= inja2>=3D0.2'],'docs':['ryd']},classifiers=3D['Programming Language :: Pyth= on :: 2.7','Programming Language :: Python :: 3.5','Programming Language ::= Python :: 3.6','Programming Language :: Python :: 3.7','Programming Langua= ge :: Python :: 3.8','Programming Language :: Python :: Implementation :: C= Python','Programming Language :: Python :: Implementation :: PyPy','Program= ming Language :: Python :: Implementation :: Jython','Topic :: Software Dev= elopment :: Libraries :: Python Modules','Topic :: Text Processing :: Marku= p','Typing :: Typed'],keywords=3D'yaml 1.2 parser round-trip preserve quote= s order config',read_the_docs=3D_B,supported=3D[(2,7),(3,5)],tox=3Ddict(env= =3D'*',deps=3D'ruamel.std.pathlib',fl8excl=3D'_test/lib'),universal=3DTrue,= rtfd=3D_B) +-version_info=3D_package_data['version_info'] +-__version__=3D_package_data['__version__'] +-try:from .cyaml import *;__with_libyaml__=3DTrue +-except (ImportError,ValueError):__with_libyaml__=3D_A +-from dynaconf.vendor.ruamel.yaml.main import * +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/anchor.py b/dynaconf/vendor/ruame= l/yaml/anchor.py +deleted file mode 100644 +index 8327508..0000000 +--- a/dynaconf/vendor/ruamel/yaml/anchor.py ++++ /dev/null +@@ -1,7 +0,0 @@ +-_A=3DFalse +-if _A:from typing import Any,Dict,Optional,List,Union,Optional,Iterator +-anchor_attrib=3D'_yaml_anchor' +-class Anchor: +- __slots__=3D'value','always_dump';attrib=3Danchor_attrib +- def __init__(A):A.value=3DNone;A.always_dump=3D_A +- def __repr__(A):B=3D', (always dump)'if A.always_dump else'';return 'Anc= hor({!r}{})'.format(A.value,B) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/comments.py b/dynaconf/vendor/rua= mel/yaml/comments.py +deleted file mode 100644 +index da872f8..0000000 +--- a/dynaconf/vendor/ruamel/yaml/comments.py ++++ /dev/null +@@ -1,485 +0,0 @@ +-from __future__ import absolute_import,print_function +-_G=3D'_od' +-_F=3D'CommentedMap' +-_E=3D'# ' +-_D=3DTrue +-_C=3D'\n' +-_B=3DFalse +-_A=3DNone +-import sys,copy +-from .compat import ordereddict +-from .compat import PY2,string_types,MutableSliceableSequence +-from .scalarstring import ScalarString +-from .anchor import Anchor +-if PY2:from collections import MutableSet,Sized,Set,Mapping +-else:from collections.abc import MutableSet,Sized,Set,Mapping +-if _B:from typing import Any,Dict,Optional,List,Union,Optional,Iterator +-__all__=3D['CommentedSeq','CommentedKeySeq',_F,'CommentedOrderedMap','Com= mentedSet','comment_attrib','merge_attrib'] +-comment_attrib=3D'_yaml_comment' +-format_attrib=3D'_yaml_format' +-line_col_attrib=3D'_yaml_line_col' +-merge_attrib=3D'_yaml_merge' +-tag_attrib=3D'_yaml_tag' +-class Comment: +- __slots__=3D'comment','_items','_end','_start';attrib=3Dcomment_attrib +- def __init__(A):A.comment=3D_A;A._items=3D{};A._end=3D[] +- def __str__(A): +- if bool(A._end):B=3D',\n end=3D'+str(A._end) +- else:B=3D'' +- return 'Comment(comment=3D{0},\n items=3D{1}{2})'.format(A.comment,A._= items,B) +- @property +- def items(self):return self._items +- @property +- def end(self):return self._end +- @end.setter +- def end(self,value):self._end=3Dvalue +- @property +- def start(self):return self._start +- @start.setter +- def start(self,value):self._start=3Dvalue +-def NoComment():0 +-class Format: +- __slots__=3D'_flow_style',;attrib=3Dformat_attrib +- def __init__(A):A._flow_style=3D_A +- def set_flow_style(A):A._flow_style=3D_D +- def set_block_style(A):A._flow_style=3D_B +- def flow_style(A,default=3D_A): +- if A._flow_style is _A:return default +- return A._flow_style +-class LineCol: +- attrib=3Dline_col_attrib +- def __init__(A):A.line=3D_A;A.col=3D_A;A.data=3D_A +- def add_kv_line_col(A,key,data): +- if A.data is _A:A.data=3D{} +- A.data[key]=3Ddata +- def key(A,k):return A._kv(k,0,1) +- def value(A,k):return A._kv(k,2,3) +- def _kv(A,k,x0,x1): +- if A.data is _A:return _A +- B=3DA.data[k];return B[x0],B[x1] +- def item(A,idx): +- if A.data is _A:return _A +- return A.data[idx][0],A.data[idx][1] +- def add_idx_line_col(A,key,data): +- if A.data is _A:A.data=3D{} +- A.data[key]=3Ddata +-class Tag: +- __slots__=3D'value',;attrib=3Dtag_attrib +- def __init__(A):A.value=3D_A +- def __repr__(A):return '{0.__class__.__name__}({0.value!r})'.format(A) +-class CommentedBase: +- @property +- def ca(self): +- A=3Dself +- if not hasattr(A,Comment.attrib):setattr(A,Comment.attrib,Comment()) +- return getattr(A,Comment.attrib) +- def yaml_end_comment_extend(A,comment,clear=3D_B): +- B=3Dcomment +- if B is _A:return +- if clear or A.ca.end is _A:A.ca.end=3D[] +- A.ca.end.extend(B) +- def yaml_key_comment_extend(C,key,comment,clear=3D_B): +- A=3Dcomment;B=3DC.ca._items.setdefault(key,[_A,_A,_A,_A]) +- if clear or B[1]is _A: +- if A[1]is not _A:assert isinstance(A[1],list) +- B[1]=3DA[1] +- else:B[1].extend(A[0]) +- B[0]=3DA[0] +- def yaml_value_comment_extend(C,key,comment,clear=3D_B): +- A=3Dcomment;B=3DC.ca._items.setdefault(key,[_A,_A,_A,_A]) +- if clear or B[3]is _A: +- if A[1]is not _A:assert isinstance(A[1],list) +- B[3]=3DA[1] +- else:B[3].extend(A[0]) +- B[2]=3DA[0] +- def yaml_set_start_comment(B,comment,indent=3D0): +- A=3Dcomment;from .error import CommentMark as C;from .tokens import Com= mentToken as D;E=3DB._yaml_get_pre_comment() +- if A[-1]=3D=3D_C:A=3DA[:-1] +- F=3DC(indent) +- for G in A.split(_C):E.append(D(_E+G+_C,F,_A)) +- def yaml_set_comment_before_after_key(J,key,before=3D_A,indent=3D0,after= =3D_A,after_indent=3D_A): +- H=3Dindent;E=3Dafter_indent;B=3Dafter;A=3Dbefore;from dynaconf.vendor.r= uamel.yaml.error import CommentMark as I;from dynaconf.vendor.ruamel.yaml.t= okens import CommentToken as K +- def F(s,mark):return K((_E if s else'')+s+_C,mark,_A) +- if E is _A:E=3DH+2 +- if A and len(A)>1 and A[-1]=3D=3D_C:A=3DA[:-1] +- if B and B[-1]=3D=3D_C:B=3DB[:-1] +- D=3DI(H);C=3DJ.ca.items.setdefault(key,[_A,[],_A,_A]) +- if A=3D=3D_C:C[1].append(F('',D)) +- elif A: +- for G in A.split(_C):C[1].append(F(G,D)) +- if B: +- D=3DI(E) +- if C[3]is _A:C[3]=3D[] +- for G in B.split(_C):C[3].append(F(G,D)) +- @property +- def fa(self): +- A=3Dself +- if not hasattr(A,Format.attrib):setattr(A,Format.attrib,Format()) +- return getattr(A,Format.attrib) +- def yaml_add_eol_comment(C,comment,key=3DNoComment,column=3D_A): +- H=3D'#';B=3Dcolumn;A=3Dcomment;from .tokens import CommentToken as D;fr= om .error import CommentMark as E +- if B is _A: +- try:B=3DC._yaml_get_column(key) +- except AttributeError:B=3D0 +- if A[0]!=3DH:A=3D_E+A +- if B is _A: +- if A[0]=3D=3DH:A=3D' '+A;B=3D0 +- F=3DE(B);G=3D[D(A,F,_A),_A];C._yaml_add_eol_comment(G,key=3Dkey) +- @property +- def lc(self): +- A=3Dself +- if not hasattr(A,LineCol.attrib):setattr(A,LineCol.attrib,LineCol()) +- return getattr(A,LineCol.attrib) +- def _yaml_set_line_col(A,line,col):A.lc.line=3Dline;A.lc.col=3Dcol +- def _yaml_set_kv_line_col(A,key,data):A.lc.add_kv_line_col(key,data) +- def _yaml_set_idx_line_col(A,key,data):A.lc.add_idx_line_col(key,data) +- @property +- def anchor(self): +- A=3Dself +- if not hasattr(A,Anchor.attrib):setattr(A,Anchor.attrib,Anchor()) +- return getattr(A,Anchor.attrib) +- def yaml_anchor(A): +- if not hasattr(A,Anchor.attrib):return _A +- return A.anchor +- def yaml_set_anchor(A,value,always_dump=3D_B):A.anchor.value=3Dvalue;A.a= nchor.always_dump=3Dalways_dump +- @property +- def tag(self): +- A=3Dself +- if not hasattr(A,Tag.attrib):setattr(A,Tag.attrib,Tag()) +- return getattr(A,Tag.attrib) +- def yaml_set_tag(A,value):A.tag.value=3Dvalue +- def copy_attributes(B,t,memo=3D_A): +- for A in [Comment.attrib,Format.attrib,LineCol.attrib,Anchor.attrib,Tag= .attrib,merge_attrib]: +- if hasattr(B,A): +- if memo is not _A:setattr(t,A,copy.deepcopy(getattr(B,A,memo))) +- else:setattr(t,A,getattr(B,A)) +- def _yaml_add_eol_comment(A,comment,key):raise NotImplementedError +- def _yaml_get_pre_comment(A):raise NotImplementedError +- def _yaml_get_column(A,key):raise NotImplementedError +-class CommentedSeq(MutableSliceableSequence,list,CommentedBase): +- __slots__=3DComment.attrib,'_lst' +- def __init__(A,*B,**C):list.__init__(A,*B,**C) +- def __getsingleitem__(A,idx):return list.__getitem__(A,idx) +- def __setsingleitem__(B,idx,value): +- C=3Didx;A=3Dvalue +- if C=3DC:break +- if D not in A.ca.items:continue +- B=3DD +- if B is not _A:E=3DA._yaml_get_columnX(B) +- return E +- def _yaml_get_pre_comment(A): +- B=3D[] +- if A.ca.comment is _A:A.ca.comment=3D[_A,B] +- else:A.ca.comment[1]=3DB +- return B +- def __deepcopy__(A,memo): +- C=3Dmemo;B=3DA.__class__();C[id(A)]=3DB +- for D in A:B.append(copy.deepcopy(D,C));A.copy_attributes(B,memo=3DC) +- return B +- def __add__(A,other):return list.__add__(A,other) +- def sort(A,key=3D_A,reverse=3D_B): +- C=3Dreverse +- if key is _A:B=3Dsorted(zip(A,range(len(A))),reverse=3DC);list.__init__= (A,[A[0]for A in B]) +- else:B=3Dsorted(zip(map(key,list.__iter__(A)),range(len(A))),reverse=3D= C);list.__init__(A,[list.__getitem__(A,C[1])for C in B]) +- D=3DA.ca.items;A.ca._items=3D{} +- for (F,G) in enumerate(B): +- E=3DG[1] +- if E in D:A.ca.items[F]=3DD[E] +- def __repr__(A):return list.__repr__(A) +-class CommentedKeySeq(tuple,CommentedBase): +- def _yaml_add_comment(A,comment,key=3DNoComment): +- B=3Dcomment +- if key is not NoComment:A.yaml_key_comment_extend(key,B) +- else:A.ca.comment=3DB +- def _yaml_add_eol_comment(A,comment,key):A._yaml_add_comment(comment,key= =3Dkey) +- def _yaml_get_columnX(A,key):return A.ca.items[key][0].start_mark.column +- def _yaml_get_column(A,key): +- C=3Dkey;E=3D_A;B=3D_A;F,G=3DC-1,C+1 +- if F in A.ca.items:B=3DF +- elif G in A.ca.items:B=3DG +- else: +- for (D,H) in enumerate(A): +- if D>=3DC:break +- if D not in A.ca.items:continue +- B=3DD +- if B is not _A:E=3DA._yaml_get_columnX(B) +- return E +- def _yaml_get_pre_comment(A): +- B=3D[] +- if A.ca.comment is _A:A.ca.comment=3D[_A,B] +- else:A.ca.comment[1]=3DB +- return B +-class CommentedMapView(Sized): +- __slots__=3D'_mapping', +- def __init__(A,mapping):A._mapping=3Dmapping +- def __len__(A):B=3Dlen(A._mapping);return B +-class CommentedMapKeysView(CommentedMapView,Set): +- __slots__=3D() +- @classmethod +- def _from_iterable(A,it):return set(it) +- def __contains__(A,key):return key in A._mapping +- def __iter__(A): +- for B in A._mapping:yield B +-class CommentedMapItemsView(CommentedMapView,Set): +- __slots__=3D() +- @classmethod +- def _from_iterable(A,it):return set(it) +- def __contains__(A,item): +- B,C=3Ditem +- try:D=3DA._mapping[B] +- except KeyError:return _B +- else:return D=3D=3DC +- def __iter__(A): +- for B in A._mapping._keys():yield(B,A._mapping[B]) +-class CommentedMapValuesView(CommentedMapView): +- __slots__=3D() +- def __contains__(A,value): +- for B in A._mapping: +- if value=3D=3DA._mapping[B]:return _D +- return _B +- def __iter__(A): +- for B in A._mapping._keys():yield A._mapping[B] +-class CommentedMap(ordereddict,CommentedBase): +- __slots__=3DComment.attrib,'_ok','_ref' +- def __init__(A,*B,**C):A._ok=3Dset();A._ref=3D[];ordereddict.__init__(A,= *B,**C) +- def _yaml_add_comment(A,comment,key=3DNoComment,value=3DNoComment): +- C=3Dvalue;B=3Dcomment +- if key is not NoComment:A.yaml_key_comment_extend(key,B);return +- if C is not NoComment:A.yaml_value_comment_extend(C,B) +- else:A.ca.comment=3DB +- def _yaml_add_eol_comment(A,comment,key):A._yaml_add_comment(comment,val= ue=3Dkey) +- def _yaml_get_columnX(A,key):return A.ca.items[key][2].start_mark.column +- def _yaml_get_column(A,key): +- E=3Dkey;H=3D_A;B=3D_A;C,F,I=3D_A,_A,_A +- for D in A: +- if C is not _A and D!=3DE:F=3DD;break +- if D=3D=3DE:C=3DI +- I=3DD +- if C in A.ca.items:B=3DC +- elif F in A.ca.items:B=3DF +- else: +- for G in A: +- if G>=3DE:break +- if G not in A.ca.items:continue +- B=3DG +- if B is not _A:H=3DA._yaml_get_columnX(B) +- return H +- def _yaml_get_pre_comment(A): +- B=3D[] +- if A.ca.comment is _A:A.ca.comment=3D[_A,B] +- else:A.ca.comment[1]=3DB +- return B +- def update(B,vals): +- A=3Dvals +- try:ordereddict.update(B,A) +- except TypeError: +- for C in A:B[C]=3DA[C] +- try:B._ok.update(A.keys()) +- except AttributeError: +- for C in A:B._ok.add(C[0]) +- def insert(A,pos,key,value,comment=3D_A): +- C=3Dcomment;B=3Dkey;ordereddict.insert(A,pos,B,value);A._ok.add(B) +- if C is not _A:A.yaml_add_eol_comment(C,key=3DB) +- def mlget(C,key,default=3D_A,list_ok=3D_B): +- D=3Dlist_ok;B=3Ddefault;A=3Dkey +- if not isinstance(A,list):return C.get(A,B) +- def E(key_list,level,d): +- B=3Dlevel;A=3Dkey_list +- if not D:assert isinstance(d,dict) +- if B>=3Dlen(A): +- if B>len(A):raise IndexError +- return d[A[B-1]] +- return E(A,B+1,d[A[B-1]]) +- try:return E(A,1,C) +- except KeyError:return B +- except (TypeError,IndexError): +- if not D:raise +- return B +- def __getitem__(B,key): +- A=3Dkey +- try:return ordereddict.__getitem__(B,A) +- except KeyError: +- for C in getattr(B,merge_attrib,[]): +- if A in C[1]:return C[1][A] +- raise +- def __setitem__(A,key,value): +- C=3Dvalue;B=3Dkey +- if B in A: +- if isinstance(C,string_types)and not isinstance(C,ScalarString)and isi= nstance(A[B],ScalarString):C=3Dtype(A[B])(C) +- ordereddict.__setitem__(A,B,C);A._ok.add(B) +- def _unmerged_contains(A,key): +- if key in A._ok:return _D +- return _A +- def __contains__(A,key):return bool(ordereddict.__contains__(A,key)) +- def get(A,key,default=3D_A): +- try:return A.__getitem__(key) +- except:return default +- def __repr__(A):return ordereddict.__repr__(A).replace(_F,'ordereddict') +- def non_merged_items(A): +- for B in ordereddict.__iter__(A): +- if B in A._ok:yield(B,ordereddict.__getitem__(A,B)) +- def __delitem__(A,key): +- B=3Dkey;A._ok.discard(B);ordereddict.__delitem__(A,B) +- for C in A._ref:C.update_key_value(B) +- def __iter__(A): +- for B in ordereddict.__iter__(A):yield B +- def _keys(A): +- for B in ordereddict.__iter__(A):yield B +- def __len__(A):return int(ordereddict.__len__(A)) +- def __eq__(A,other):return bool(dict(A)=3D=3Dother) +- if PY2: +- def keys(A):return list(A._keys()) +- def iterkeys(A):return A._keys() +- def viewkeys(A):return CommentedMapKeysView(A) +- else: +- def keys(A):return CommentedMapKeysView(A) +- if PY2: +- def _values(A): +- for B in ordereddict.__iter__(A):yield ordereddict.__getitem__(A,B) +- def values(A):return list(A._values()) +- def itervalues(A):return A._values() +- def viewvalues(A):return CommentedMapValuesView(A) +- else: +- def values(A):return CommentedMapValuesView(A) +- def _items(A): +- for B in ordereddict.__iter__(A):yield(B,ordereddict.__getitem__(A,B)) +- if PY2: +- def items(A):return list(A._items()) +- def iteritems(A):return A._items() +- def viewitems(A):return CommentedMapItemsView(A) +- else: +- def items(A):return CommentedMapItemsView(A) +- @property +- def merge(self): +- A=3Dself +- if not hasattr(A,merge_attrib):setattr(A,merge_attrib,[]) +- return getattr(A,merge_attrib) +- def copy(A): +- B=3Dtype(A)() +- for (C,D) in A._items():B[C]=3DD +- A.copy_attributes(B);return B +- def add_referent(A,cm): +- if cm not in A._ref:A._ref.append(cm) +- def add_yaml_merge(A,value): +- C=3Dvalue +- for B in C: +- B[1].add_referent(A) +- for (D,B) in B[1].items(): +- if ordereddict.__contains__(A,D):continue +- ordereddict.__setitem__(A,D,B) +- A.merge.extend(C) +- def update_key_value(B,key): +- A=3Dkey +- if A in B._ok:return +- for C in B.merge: +- if A in C[1]:ordereddict.__setitem__(B,A,C[1][A]);return +- ordereddict.__delitem__(B,A) +- def __deepcopy__(A,memo): +- C=3Dmemo;B=3DA.__class__();C[id(A)]=3DB +- for D in A:B[D]=3Dcopy.deepcopy(A[D],C) +- A.copy_attributes(B,memo=3DC);return B +-@classmethod +-def raise_immutable(cls,*A,**B):raise TypeError('{} objects are immutable= '.format(cls.__name__)) +-class CommentedKeyMap(CommentedBase,Mapping): +- __slots__=3DComment.attrib,_G +- def __init__(A,*B,**C): +- if hasattr(A,_G):raise_immutable(A) +- try:A._od=3Dordereddict(*B,**C) +- except TypeError: +- if PY2:A._od=3Dordereddict(B[0].items()) +- else:raise +- __delitem__=3D__setitem__=3Dclear=3Dpop=3Dpopitem=3Dsetdefault=3Dupdate= =3Draise_immutable +- def __getitem__(A,index):return A._od[index] +- def __iter__(A): +- for B in A._od.__iter__():yield B +- def __len__(A):return len(A._od) +- def __hash__(A):return hash(tuple(A.items())) +- def __repr__(A): +- if not hasattr(A,merge_attrib):return A._od.__repr__() +- return'ordereddict('+repr(list(A._od.items()))+')' +- @classmethod +- def fromkeys(A,v=3D_A):return CommentedKeyMap(dict.fromkeys(A,v)) +- def _yaml_add_comment(A,comment,key=3DNoComment): +- B=3Dcomment +- if key is not NoComment:A.yaml_key_comment_extend(key,B) +- else:A.ca.comment=3DB +- def _yaml_add_eol_comment(A,comment,key):A._yaml_add_comment(comment,key= =3Dkey) +- def _yaml_get_columnX(A,key):return A.ca.items[key][0].start_mark.column +- def _yaml_get_column(A,key): +- C=3Dkey;E=3D_A;B=3D_A;F,G=3DC-1,C+1 +- if F in A.ca.items:B=3DF +- elif G in A.ca.items:B=3DG +- else: +- for (D,H) in enumerate(A): +- if D>=3DC:break +- if D not in A.ca.items:continue +- B=3DD +- if B is not _A:E=3DA._yaml_get_columnX(B) +- return E +- def _yaml_get_pre_comment(A): +- B=3D[] +- if A.ca.comment is _A:A.ca.comment=3D[_A,B] +- else:A.ca.comment[1]=3DB +- return B +-class CommentedOrderedMap(CommentedMap):__slots__=3DComment.attrib, +-class CommentedSet(MutableSet,CommentedBase): +- __slots__=3DComment.attrib,'odict' +- def __init__(A,values=3D_A): +- B=3Dvalues;A.odict=3Dordereddict();MutableSet.__init__(A) +- if B is not _A:A|=3DB +- def _yaml_add_comment(A,comment,key=3DNoComment,value=3DNoComment): +- C=3Dvalue;B=3Dcomment +- if key is not NoComment:A.yaml_key_comment_extend(key,B);return +- if C is not NoComment:A.yaml_value_comment_extend(C,B) +- else:A.ca.comment=3DB +- def _yaml_add_eol_comment(A,comment,key):A._yaml_add_comment(comment,val= ue=3Dkey) +- def add(A,value):A.odict[value]=3D_A +- def discard(A,value):del A.odict[value] +- def __contains__(A,x):return x in A.odict +- def __iter__(A): +- for B in A.odict:yield B +- def __len__(A):return len(A.odict) +- def __repr__(A):return 'set({0!r})'.format(A.odict.keys()) +-class TaggedScalar(CommentedBase): +- def __init__(A,value=3D_A,style=3D_A,tag=3D_A): +- A.value=3Dvalue;A.style=3Dstyle +- if tag is not _A:A.yaml_set_tag(tag) +- def __str__(A):return A.value +-def dump_comments(d,name=3D'',sep=3D'.',out=3Dsys.stdout): +- G=3D'ca';E=3D'{}\n';D=3Dout;C=3Dsep;A=3Dname +- if isinstance(d,dict)and hasattr(d,G): +- if A:sys.stdout.write(E.format(A)) +- D.write(E.format(d.ca)) +- for B in d:dump_comments(d[B],name=3DA+C+B if A else B,sep=3DC,out=3DD) +- elif isinstance(d,list)and hasattr(d,G): +- if A:sys.stdout.write(E.format(A)) +- D.write(E.format(d.ca)) +- for (F,B) in enumerate(d):dump_comments(B,name=3DA+C+str(F)if A else st= r(F),sep=3DC,out=3DD) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/compat.py b/dynaconf/vendor/ruame= l/yaml/compat.py +deleted file mode 100644 +index 0512ad7..0000000 +--- a/dynaconf/vendor/ruamel/yaml/compat.py ++++ /dev/null +@@ -1,120 +0,0 @@ +-from __future__ import print_function +-_D=3D'RUAMELDEBUG' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import sys,os,types,traceback +-from abc import abstractmethod +-if _B:from typing import Any,Dict,Optional,List,Union,BinaryIO,IO,Text,Tu= ple,Optional +-_DEFAULT_YAML_VERSION=3D1,2 +-try:from ruamel.ordereddict import ordereddict +-except: +- try:from collections import OrderedDict +- except ImportError:from ordereddict import OrderedDict +- class ordereddict(OrderedDict): +- if not hasattr(OrderedDict,'insert'): +- def insert(A,pos,key,value): +- C=3Dvalue +- if pos>=3Dlen(A):A[key]=3DC;return +- B=3Dordereddict();B.update(A) +- for E in B:del A[E] +- for (F,D) in enumerate(B): +- if pos=3D=3DF:A[key]=3DC +- A[D]=3DB[D] +-PY2=3Dsys.version_info[0]=3D=3D2 +-PY3=3Dsys.version_info[0]=3D=3D3 +-if PY3: +- def utf8(s):return s +- def to_str(s):return s +- def to_unicode(s):return s +-else: +- if _B:unicode=3Dstr +- def utf8(s):return s.encode('utf-8') +- def to_str(s):return str(s) +- def to_unicode(s):return unicode(s) +-if PY3:string_types=3Dstr;integer_types=3Dint;class_types=3Dtype;text_typ= e=3Dstr;binary_type=3Dbytes;MAXSIZE=3Dsys.maxsize;unichr=3Dchr;import io;St= ringIO=3Dio.StringIO;BytesIO=3Dio.BytesIO;no_limit_int=3Dint;from collectio= ns.abc import Hashable,MutableSequence,MutableMapping,Mapping +-else:string_types=3Dbasestring;integer_types=3Dint,long;class_types=3Dtyp= e,types.ClassType;text_type=3Dunicode;binary_type=3Dstr;unichr=3Dunichr;fro= m StringIO import StringIO as _StringIO;StringIO=3D_StringIO;import cString= IO;BytesIO=3DcStringIO.StringIO;no_limit_int=3Dlong;from collections import= Hashable,MutableSequence,MutableMapping,Mapping +-if _B:StreamType=3DAny;StreamTextType=3DStreamType;VersionType=3DUnion[Li= st[int],str,Tuple[int,int]] +-if PY3:builtins_module=3D'builtins' +-else:builtins_module=3D'__builtin__' +-UNICODE_SIZE=3D4 if sys.maxunicode>65535 else 2 +-def with_metaclass(meta,*A):return meta('NewBase',A,{}) +-DBG_TOKEN=3D1 +-DBG_EVENT=3D2 +-DBG_NODE=3D4 +-_debug=3D_A +-if _D in os.environ: +- _debugx=3Dos.environ.get(_D) +- if _debugx is _A:_debug=3D0 +- else:_debug=3Dint(_debugx) +-if bool(_debug): +- class ObjectCounter: +- def __init__(A):A.map=3D{} +- def __call__(A,k):A.map[k]=3DA.map.get(k,0)+1 +- def dump(A): +- for B in sorted(A.map):sys.stdout.write('{} -> {}'.format(B,A.map[B])) +- object_counter=3DObjectCounter() +-def dbg(val=3D_A): +- global _debug +- if _debug is _A: +- A=3Dos.environ.get('YAMLDEBUG') +- if A is _A:_debug=3D0 +- else:_debug=3Dint(A) +- if val is _A:return _debug +- return _debug&val +-class Nprint: +- def __init__(A,file_name=3D_A):A._max_print=3D_A;A._count=3D_A;A._file_n= ame=3Dfile_name +- def __call__(A,*E,**F): +- if not bool(_debug):return +- B=3Dsys.stdout if A._file_name is _A else open(A._file_name,'a');C=3Dpr= int;D=3DF.copy();D['file']=3DB;C(*E,**D);B.flush() +- if A._max_print is not _A: +- if A._count is _A:A._count=3DA._max_print +- A._count-=3D1 +- if A._count=3D=3D0:C('forced exit\n');traceback.print_stack();B.flush(= );sys.exit(0) +- if A._file_name:B.close() +- def set_max_print(A,i):A._max_print=3Di;A._count=3D_A +-nprint=3DNprint() +-nprintf=3DNprint('/var/tmp/ruamel.yaml.log') +-def check_namespace_char(ch): +- A=3Dch +- if'!'<=3DA<=3D'~':return _C +- if'\xa0'<=3DA<=3D'\ud7ff':return _C +- if'\ue000'<=3DA<=3D'=EF=BF=BD'and A!=3D'\ufeff':return _C +- if'=F0=90=80=80'<=3DA<=3D'\U0010ffff':return _C +- return _B +-def check_anchorname_char(ch): +- if ch in',[]{}':return _B +- return check_namespace_char(ch) +-def version_tnf(t1,t2=3D_A): +- from dynaconf.vendor.ruamel.yaml import version_info as A +- if Alen(B):raise TypeError('not enough elements in value {} > {}'.f= ormat(E,len(B))) +- for (G,H) in enumerate(range(*D)):C[H]=3DB[G] +- def __delitem__(A,index): +- B=3Dindex +- if not isinstance(B,slice):return A.__delsingleitem__(B) +- for C in reversed(range(*B.indices(len(A)))):del A[C] +- @abstractmethod +- def __getsingleitem__(self,index):raise IndexError +- @abstractmethod +- def __setsingleitem__(self,index,value):raise IndexError +- @abstractmethod +- def __delsingleitem__(self,index):raise IndexError +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/composer.py b/dynaconf/vendor/rua= mel/yaml/composer.py +deleted file mode 100644 +index 9a0f8f0..0000000 +--- a/dynaconf/vendor/ruamel/yaml/composer.py ++++ /dev/null +@@ -1,82 +0,0 @@ +-from __future__ import absolute_import,print_function +-_B=3D'typ' +-_A=3DNone +-import warnings +-from .error import MarkedYAMLError,ReusedAnchorWarning +-from .compat import utf8,nprint,nprintf +-from .events import StreamStartEvent,StreamEndEvent,MappingStartEvent,Map= pingEndEvent,SequenceStartEvent,SequenceEndEvent,AliasEvent,ScalarEvent +-from .nodes import MappingNode,ScalarNode,SequenceNode +-if False:from typing import Any,Dict,Optional,List +-__all__=3D['Composer','ComposerError'] +-class ComposerError(MarkedYAMLError):0 +-class Composer: +- def __init__(A,loader=3D_A): +- A.loader=3Dloader +- if A.loader is not _A and getattr(A.loader,'_composer',_A)is _A:A.loade= r._composer=3DA +- A.anchors=3D{} +- @property +- def parser(self): +- A=3Dself +- if hasattr(A.loader,_B):A.loader.parser +- return A.loader._parser +- @property +- def resolver(self): +- A=3Dself +- if hasattr(A.loader,_B):A.loader.resolver +- return A.loader._resolver +- def check_node(A): +- if A.parser.check_event(StreamStartEvent):A.parser.get_event() +- return not A.parser.check_event(StreamEndEvent) +- def get_node(A): +- if not A.parser.check_event(StreamEndEvent):return A.compose_document() +- def get_single_node(A): +- A.parser.get_event();B=3D_A +- if not A.parser.check_event(StreamEndEvent):B=3DA.compose_document() +- if not A.parser.check_event(StreamEndEvent):C=3DA.parser.get_event();ra= ise ComposerError('expected a single document in the stream',B.start_mark,'= but found another document',C.start_mark) +- A.parser.get_event();return B +- def compose_document(A):A.parser.get_event();B=3DA.compose_node(_A,_A);A= .parser.get_event();A.anchors=3D{};return B +- def compose_node(A,parent,index): +- if A.parser.check_event(AliasEvent): +- C=3DA.parser.get_event();D=3DC.anchor +- if D not in A.anchors:raise ComposerError(_A,_A,'found undefined alias= %r'%utf8(D),C.start_mark) +- return A.anchors[D] +- C=3DA.parser.peek_event();B=3DC.anchor +- if B is not _A: +- if B in A.anchors:F=3D'\nfound duplicate anchor {!r}\nfirst occurrence= {}\nsecond occurrence {}'.format(B,A.anchors[B].start_mark,C.start_mark);w= arnings.warn(F,ReusedAnchorWarning) +- A.resolver.descend_resolver(parent,index) +- if A.parser.check_event(ScalarEvent):E=3DA.compose_scalar_node(B) +- elif A.parser.check_event(SequenceStartEvent):E=3DA.compose_sequence_no= de(B) +- elif A.parser.check_event(MappingStartEvent):E=3DA.compose_mapping_node= (B) +- A.resolver.ascend_resolver();return E +- def compose_scalar_node(C,anchor): +- D=3Danchor;A=3DC.parser.get_event();B=3DA.tag +- if B is _A or B=3D=3D'!':B=3DC.resolver.resolve(ScalarNode,A.value,A.im= plicit) +- E=3DScalarNode(B,A.value,A.start_mark,A.end_mark,style=3DA.style,commen= t=3DA.comment,anchor=3DD) +- if D is not _A:C.anchors[D]=3DE +- return E +- def compose_sequence_node(B,anchor): +- F=3Danchor;C=3DB.parser.get_event();D=3DC.tag +- if D is _A or D=3D=3D'!':D=3DB.resolver.resolve(SequenceNode,_A,C.impli= cit) +- A=3DSequenceNode(D,[],C.start_mark,_A,flow_style=3DC.flow_style,comment= =3DC.comment,anchor=3DF) +- if F is not _A:B.anchors[F]=3DA +- G=3D0 +- while not B.parser.check_event(SequenceEndEvent):A.value.append(B.compo= se_node(A,G));G+=3D1 +- E=3DB.parser.get_event() +- if A.flow_style is True and E.comment is not _A: +- if A.comment is not _A:nprint('Warning: unexpected end_event commment = in sequence node {}'.format(A.flow_style)) +- A.comment=3DE.comment +- A.end_mark=3DE.end_mark;B.check_end_doc_comment(E,A);return A +- def compose_mapping_node(B,anchor): +- F=3Danchor;C=3DB.parser.get_event();D=3DC.tag +- if D is _A or D=3D=3D'!':D=3DB.resolver.resolve(MappingNode,_A,C.implic= it) +- A=3DMappingNode(D,[],C.start_mark,_A,flow_style=3DC.flow_style,comment= =3DC.comment,anchor=3DF) +- if F is not _A:B.anchors[F]=3DA +- while not B.parser.check_event(MappingEndEvent):G=3DB.compose_node(A,_A= );H=3DB.compose_node(A,G);A.value.append((G,H)) +- E=3DB.parser.get_event() +- if A.flow_style is True and E.comment is not _A:A.comment=3DE.comment +- A.end_mark=3DE.end_mark;B.check_end_doc_comment(E,A);return A +- def check_end_doc_comment(C,end_event,node): +- B=3Dnode;A=3Dend_event +- if A.comment and A.comment[1]: +- if B.comment is _A:B.comment=3D[_A,_A] +- assert not isinstance(B,ScalarEvent);B.comment.append(A.comment[1]);A.= comment[1]=3D_A +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/configobjwalker.py b/dynaconf/ven= dor/ruamel/yaml/configobjwalker.py +deleted file mode 100644 +index ba9cafe..0000000 +--- a/dynaconf/vendor/ruamel/yaml/configobjwalker.py ++++ /dev/null +@@ -1,4 +0,0 @@ +-import warnings +-from .util import configobj_walker as new_configobj_walker +-if False:from typing import Any +-def configobj_walker(cfg):warnings.warn('configobj_walker has moved to ru= amel.yaml.util, please update your code');return new_configobj_walker(cfg) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/constructor.py b/dynaconf/vendor/= ruamel/yaml/constructor.py +deleted file mode 100644 +index 2400e6b..0000000 +--- a/dynaconf/vendor/ruamel/yaml/constructor.py ++++ /dev/null +@@ -1,728 +0,0 @@ +-from __future__ import print_function,absolute_import,division +-_AD=3D'expected the empty value, but found %r' +-_AC=3D'cannot find module %r (%s)' +-_AB=3D'expected non-empty name appended to the tag' +-_AA=3D'tag:yaml.org,2002:map' +-_A9=3D'tag:yaml.org,2002:seq' +-_A8=3D'tag:yaml.org,2002:set' +-_A7=3D'tag:yaml.org,2002:pairs' +-_A6=3D'tag:yaml.org,2002:omap' +-_A5=3D'tag:yaml.org,2002:timestamp' +-_A4=3D'tag:yaml.org,2002:binary' +-_A3=3D'tag:yaml.org,2002:float' +-_A2=3D'tag:yaml.org,2002:int' +-_A1=3D'tag:yaml.org,2002:bool' +-_A0=3D'tag:yaml.org,2002:null' +-_z=3D'could not determine a constructor for the tag %r' +-_y=3D'second' +-_x=3D'minute' +-_w=3D'day' +-_v=3D'month' +-_u=3D'year' +-_t=3D'failed to construct timestamp from "{}"' +-_s=3D'decodebytes' +-_r=3D'failed to convert base64 data into ascii: %s' +-_q=3D'.nan' +-_p=3D'.inf' +-_o=3D'expected a mapping or list of mappings for merging, but found %s' +-_n=3D'expected a mapping for merging, but found %s' +-_m=3D' Duplicate keys will become an error in futu= re releases, and are errors\n by default when using = the new API.\n ' +-_l=3D'\n To suppress this check see:\n = http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys= \n ' +-_k=3D'tag:yaml.org,2002:merge' +-_j=3D' Duplicate keys will become an error in future r= eleases, and are errors\n by default when using the new = API.\n ' +-_i=3D'\n To suppress this check see:\n = http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys\n = ' +-_h=3D'expected a sequence node, but found %s' +-_g=3D'expected a scalar node, but found %s' +-_f=3D'typ' +-_e=3D'while constructing a Python module' +-_d=3D'expected a single mapping item, but found %d items' +-_c=3D'expected a mapping of length 1, but found %s' +-_b=3D'expected a sequence, but found %s' +-_a=3D'failed to decode base64 data: %s' +-_Z=3D'tag:yaml.org,2002:value' +-_Y=3D'found duplicate key "{}"' +-_X=3D'found unhashable key' +-_W=3D'found unacceptable key (%s)' +-_V=3D'__setstate__' +-_U=3D'tz_hour' +-_T=3D'hour' +-_S=3D'ascii' +-_R=3D'tag:yaml.org,2002:str' +-_Q=3D'utf-8' +-_P=3D'expected a mapping node, but found %s' +-_O=3D'tz_minute' +-_N=3D'e' +-_M=3D'+-' +-_L=3D'while constructing an ordered map' +-_K=3D'tz_sign' +-_J=3D'-' +-_I=3D'fraction' +-_H=3D'.' +-_G=3D':' +-_F=3D'0' +-_E=3D'while constructing a mapping' +-_D=3D'_' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import datetime,base64,binascii,re,sys,types,warnings +-from .error import MarkedYAMLError,MarkedYAMLFutureWarning,MantissaNoDotY= AML1_1Warning +-from .nodes import * +-from .nodes import SequenceNode,MappingNode,ScalarNode +-from .compat import utf8,builtins_module,to_str,PY2,PY3,text_type,nprint,= nprintf,version_tnf +-from .compat import ordereddict,Hashable,MutableSequence +-from .compat import MutableMapping +-from .comments import * +-from .comments import CommentedMap,CommentedOrderedMap,CommentedSet,Comme= ntedKeySeq,CommentedSeq,TaggedScalar,CommentedKeyMap +-from .scalarstring import SingleQuotedScalarString,DoubleQuotedScalarStri= ng,LiteralScalarString,FoldedScalarString,PlainScalarString,ScalarString +-from .scalarint import ScalarInt,BinaryInt,OctalInt,HexInt,HexCapsInt +-from .scalarfloat import ScalarFloat +-from .scalarbool import ScalarBoolean +-from .timestamp import TimeStamp +-from .util import RegExp +-if _B:from typing import Any,Dict,List,Set,Generator,Union,Optional +-__all__=3D['BaseConstructor','SafeConstructor','Constructor','Constructor= Error','RoundTripConstructor'] +-class ConstructorError(MarkedYAMLError):0 +-class DuplicateKeyFutureWarning(MarkedYAMLFutureWarning):0 +-class DuplicateKeyError(MarkedYAMLFutureWarning):0 +-class BaseConstructor: +- yaml_constructors=3D{};yaml_multi_constructors=3D{} +- def __init__(self,preserve_quotes=3D_A,loader=3D_A): +- self.loader=3Dloader +- if self.loader is not _A and getattr(self.loader,'_constructor',_A)is _= A:self.loader._constructor=3Dself +- self.loader=3Dloader;self.yaml_base_dict_type=3Ddict;self.yaml_base_lis= t_type=3Dlist;self.constructed_objects=3D{};self.recursive_objects=3D{};sel= f.state_generators=3D[];self.deep_construct=3D_B;self._preserve_quotes=3Dpr= eserve_quotes;self.allow_duplicate_keys=3Dversion_tnf((0,15,1),(0,16)) +- @property +- def composer(self): +- if hasattr(self.loader,_f):return self.loader.composer +- try:return self.loader._composer +- except AttributeError:sys.stdout.write('slt {}\n'.format(type(self)));s= ys.stdout.write('slc {}\n'.format(self.loader._composer));sys.stdout.write(= '{}\n'.format(dir(self)));raise +- @property +- def resolver(self): +- if hasattr(self.loader,_f):return self.loader.resolver +- return self.loader._resolver +- def check_data(self):return self.composer.check_node() +- def get_data(self): +- if self.composer.check_node():return self.construct_document(self.compo= ser.get_node()) +- def get_single_data(self): +- node=3Dself.composer.get_single_node() +- if node is not _A:return self.construct_document(node) +- return _A +- def construct_document(self,node): +- data=3Dself.construct_object(node) +- while bool(self.state_generators): +- state_generators=3Dself.state_generators;self.state_generators=3D[] +- for generator in state_generators: +- for _dummy in generator:0 +- self.constructed_objects=3D{};self.recursive_objects=3D{};self.deep_con= struct=3D_B;return data +- def construct_object(self,node,deep=3D_B): +- if node in self.constructed_objects:return self.constructed_objects[nod= e] +- if deep:old_deep=3Dself.deep_construct;self.deep_construct=3D_C +- if node in self.recursive_objects:return self.recursive_objects[node] +- self.recursive_objects[node]=3D_A;data=3Dself.construct_non_recursive_o= bject(node);self.constructed_objects[node]=3Ddata;del self.recursive_object= s[node] +- if deep:self.deep_construct=3Dold_deep +- return data +- def construct_non_recursive_object(self,node,tag=3D_A): +- constructor=3D_A;tag_suffix=3D_A +- if tag is _A:tag=3Dnode.tag +- if tag in self.yaml_constructors:constructor=3Dself.yaml_constructors[t= ag] +- else: +- for tag_prefix in self.yaml_multi_constructors: +- if tag.startswith(tag_prefix):tag_suffix=3Dtag[len(tag_prefix):];cons= tructor=3Dself.yaml_multi_constructors[tag_prefix];break +- else: +- if _A in self.yaml_multi_constructors:tag_suffix=3Dtag;constructor=3D= self.yaml_multi_constructors[_A] +- elif _A in self.yaml_constructors:constructor=3Dself.yaml_constructor= s[_A] +- elif isinstance(node,ScalarNode):constructor=3Dself.__class__.constru= ct_scalar +- elif isinstance(node,SequenceNode):constructor=3Dself.__class__.const= ruct_sequence +- elif isinstance(node,MappingNode):constructor=3Dself.__class__.constr= uct_mapping +- if tag_suffix is _A:data=3Dconstructor(self,node) +- else:data=3Dconstructor(self,tag_suffix,node) +- if isinstance(data,types.GeneratorType): +- generator=3Ddata;data=3Dnext(generator) +- if self.deep_construct: +- for _dummy in generator:0 +- else:self.state_generators.append(generator) +- return data +- def construct_scalar(self,node): +- if not isinstance(node,ScalarNode):raise ConstructorError(_A,_A,_g%node= .id,node.start_mark) +- return node.value +- def construct_sequence(self,node,deep=3D_B): +- if not isinstance(node,SequenceNode):raise ConstructorError(_A,_A,_h%no= de.id,node.start_mark) +- return[self.construct_object(child,deep=3Ddeep)for child in node.value] +- def construct_mapping(self,node,deep=3D_B): +- if not isinstance(node,MappingNode):raise ConstructorError(_A,_A,_P%nod= e.id,node.start_mark) +- total_mapping=3Dself.yaml_base_dict_type() +- if getattr(node,'merge',_A)is not _A:todo=3D[(node.merge,_B),(node.valu= e,_B)] +- else:todo=3D[(node.value,_C)] +- for (values,check) in todo: +- mapping=3Dself.yaml_base_dict_type() +- for (key_node,value_node) in values: +- key=3Dself.construct_object(key_node,deep=3D_C) +- if not isinstance(key,Hashable): +- if isinstance(key,list):key=3Dtuple(key) +- if PY2: +- try:hash(key) +- except TypeError as exc:raise ConstructorError(_E,node.start_mark,_W= %exc,key_node.start_mark) +- elif not isinstance(key,Hashable):raise ConstructorError(_E,node.star= t_mark,_X,key_node.start_mark) +- value=3Dself.construct_object(value_node,deep=3Ddeep) +- if check: +- if self.check_mapping_key(node,key_node,mapping,key,value):mapping[k= ey]=3Dvalue +- else:mapping[key]=3Dvalue +- total_mapping.update(mapping) +- return total_mapping +- def check_mapping_key(self,node,key_node,mapping,key,value): +- if key in mapping: +- if not self.allow_duplicate_keys: +- mk=3Dmapping.get(key) +- if PY2: +- if isinstance(key,unicode):key=3Dkey.encode(_Q) +- if isinstance(value,unicode):value=3Dvalue.encode(_Q) +- if isinstance(mk,unicode):mk=3Dmk.encode(_Q) +- args=3D[_E,node.start_mark,'found duplicate key "{}" with value "{}" = (original value: "{}")'.format(key,value,mk),key_node.start_mark,_i,_j] +- if self.allow_duplicate_keys is _A:warnings.warn(DuplicateKeyFutureWa= rning(*args)) +- else:raise DuplicateKeyError(*args) +- return _B +- return _C +- def check_set_key(self,node,key_node,setting,key): +- if key in setting: +- if not self.allow_duplicate_keys: +- if PY2: +- if isinstance(key,unicode):key=3Dkey.encode(_Q) +- args=3D['while constructing a set',node.start_mark,_Y.format(key),key= _node.start_mark,_i,_j] +- if self.allow_duplicate_keys is _A:warnings.warn(DuplicateKeyFutureWa= rning(*args)) +- else:raise DuplicateKeyError(*args) +- def construct_pairs(self,node,deep=3D_B): +- if not isinstance(node,MappingNode):raise ConstructorError(_A,_A,_P%nod= e.id,node.start_mark) +- pairs=3D[] +- for (key_node,value_node) in node.value:key=3Dself.construct_object(key= _node,deep=3Ddeep);value=3Dself.construct_object(value_node,deep=3Ddeep);pa= irs.append((key,value)) +- return pairs +- @classmethod +- def add_constructor(cls,tag,constructor): +- if'yaml_constructors'not in cls.__dict__:cls.yaml_constructors=3Dcls.ya= ml_constructors.copy() +- cls.yaml_constructors[tag]=3Dconstructor +- @classmethod +- def add_multi_constructor(cls,tag_prefix,multi_constructor): +- if'yaml_multi_constructors'not in cls.__dict__:cls.yaml_multi_construct= ors=3Dcls.yaml_multi_constructors.copy() +- cls.yaml_multi_constructors[tag_prefix]=3Dmulti_constructor +-class SafeConstructor(BaseConstructor): +- def construct_scalar(self,node): +- if isinstance(node,MappingNode): +- for (key_node,value_node) in node.value: +- if key_node.tag=3D=3D_Z:return self.construct_scalar(value_node) +- return BaseConstructor.construct_scalar(self,node) +- def flatten_mapping(self,node): +- merge=3D[];index=3D0 +- while index[0-9][0-9][0-9][0-9])\n -(= ?P[0-9][0-9]?)\n -(?P[0-9][0-9]?)\n (?:((?P[Tt])|[ \\t]+) # explictly not retaining extra spaces\n (?P[0-9][0-9]?)\n :(?P[0-9][0-9])\n :(?P[0= -9][0-9])\n (?:\\.(?P[0-9]*))?\n (?:[ \\t]*(?P<= tz>Z|(?P[-+])(?P[0-9][0-9]?)\n (?::(?P[0-9][0-9]))?))?)?$',re.X) +- def construct_yaml_timestamp(self,node,values=3D_A): +- if values is _A: +- try:match=3Dself.timestamp_regexp.match(node.value) +- except TypeError:match=3D_A +- if match is _A:raise ConstructorError(_A,_A,_t.format(node.value),node= .start_mark) +- values=3Dmatch.groupdict() +- year=3Dint(values[_u]);month=3Dint(values[_v]);day=3Dint(values[_w]) +- if not values[_T]:return datetime.date(year,month,day) +- hour=3Dint(values[_T]);minute=3Dint(values[_x]);second=3Dint(values[_y]= );fraction=3D0 +- if values[_I]: +- fraction_s=3Dvalues[_I][:6] +- while len(fraction_s)<6:fraction_s+=3D_F +- fraction=3Dint(fraction_s) +- if len(values[_I])>6 and int(values[_I][6])>4:fraction+=3D1 +- delta=3D_A +- if values[_K]: +- tz_hour=3Dint(values[_U]);minutes=3Dvalues[_O];tz_minute=3Dint(minutes= )if minutes else 0;delta=3Ddatetime.timedelta(hours=3Dtz_hour,minutes=3Dtz_= minute) +- if values[_K]=3D=3D_J:delta=3D-delta +- data=3Ddatetime.datetime(year,month,day,hour,minute,second,fraction) +- if delta:data-=3Ddelta +- return data +- def construct_yaml_omap(self,node): +- omap=3Dordereddict();yield omap +- if not isinstance(node,SequenceNode):raise ConstructorError(_L,node.sta= rt_mark,_b%node.id,node.start_mark) +- for subnode in node.value: +- if not isinstance(subnode,MappingNode):raise ConstructorError(_L,node.= start_mark,_c%subnode.id,subnode.start_mark) +- if len(subnode.value)!=3D1:raise ConstructorError(_L,node.start_mark,_= d%len(subnode.value),subnode.start_mark) +- key_node,value_node=3Dsubnode.value[0];key=3Dself.construct_object(key= _node);assert key not in omap;value=3Dself.construct_object(value_node);oma= p[key]=3Dvalue +- def construct_yaml_pairs(self,node): +- A=3D'while constructing pairs';pairs=3D[];yield pairs +- if not isinstance(node,SequenceNode):raise ConstructorError(A,node.star= t_mark,_b%node.id,node.start_mark) +- for subnode in node.value: +- if not isinstance(subnode,MappingNode):raise ConstructorError(A,node.s= tart_mark,_c%subnode.id,subnode.start_mark) +- if len(subnode.value)!=3D1:raise ConstructorError(A,node.start_mark,_d= %len(subnode.value),subnode.start_mark) +- key_node,value_node=3Dsubnode.value[0];key=3Dself.construct_object(key= _node);value=3Dself.construct_object(value_node);pairs.append((key,value)) +- def construct_yaml_set(self,node):data=3Dset();yield data;value=3Dself.c= onstruct_mapping(node);data.update(value) +- def construct_yaml_str(self,node): +- value=3Dself.construct_scalar(node) +- if PY3:return value +- try:return value.encode(_S) +- except UnicodeEncodeError:return value +- def construct_yaml_seq(self,node):data=3Dself.yaml_base_list_type();yiel= d data;data.extend(self.construct_sequence(node)) +- def construct_yaml_map(self,node):data=3Dself.yaml_base_dict_type();yiel= d data;value=3Dself.construct_mapping(node);data.update(value) +- def construct_yaml_object(self,node,cls): +- data=3Dcls.__new__(cls);yield data +- if hasattr(data,_V):state=3Dself.construct_mapping(node,deep=3D_C);data= .__setstate__(state) +- else:state=3Dself.construct_mapping(node);data.__dict__.update(state) +- def construct_undefined(self,node):raise ConstructorError(_A,_A,_z%utf8(= node.tag),node.start_mark) +-SafeConstructor.add_constructor(_A0,SafeConstructor.construct_yaml_null) +-SafeConstructor.add_constructor(_A1,SafeConstructor.construct_yaml_bool) +-SafeConstructor.add_constructor(_A2,SafeConstructor.construct_yaml_int) +-SafeConstructor.add_constructor(_A3,SafeConstructor.construct_yaml_float) +-SafeConstructor.add_constructor(_A4,SafeConstructor.construct_yaml_binary) +-SafeConstructor.add_constructor(_A5,SafeConstructor.construct_yaml_timest= amp) +-SafeConstructor.add_constructor(_A6,SafeConstructor.construct_yaml_omap) +-SafeConstructor.add_constructor(_A7,SafeConstructor.construct_yaml_pairs) +-SafeConstructor.add_constructor(_A8,SafeConstructor.construct_yaml_set) +-SafeConstructor.add_constructor(_R,SafeConstructor.construct_yaml_str) +-SafeConstructor.add_constructor(_A9,SafeConstructor.construct_yaml_seq) +-SafeConstructor.add_constructor(_AA,SafeConstructor.construct_yaml_map) +-SafeConstructor.add_constructor(_A,SafeConstructor.construct_undefined) +-if PY2: +- class classobj:0 +-class Constructor(SafeConstructor): +- def construct_python_str(self,node):return utf8(self.construct_scalar(no= de)) +- def construct_python_unicode(self,node):return self.construct_scalar(nod= e) +- if PY3: +- def construct_python_bytes(self,node): +- try:value=3Dself.construct_scalar(node).encode(_S) +- except UnicodeEncodeError as exc:raise ConstructorError(_A,_A,_r%exc,n= ode.start_mark) +- try: +- if hasattr(base64,_s):return base64.decodebytes(value) +- else:return base64.decodestring(value) +- except binascii.Error as exc:raise ConstructorError(_A,_A,_a%exc,node.= start_mark) +- def construct_python_long(self,node): +- val=3Dself.construct_yaml_int(node) +- if PY3:return val +- return int(val) +- def construct_python_complex(self,node):return complex(self.construct_sc= alar(node)) +- def construct_python_tuple(self,node):return tuple(self.construct_sequen= ce(node)) +- def find_python_module(self,name,mark): +- if not name:raise ConstructorError(_e,mark,_AB,mark) +- try:__import__(name) +- except ImportError as exc:raise ConstructorError(_e,mark,_AC%(utf8(name= ),exc),mark) +- return sys.modules[name] +- def find_python_name(self,name,mark): +- A=3D'while constructing a Python object' +- if not name:raise ConstructorError(A,mark,_AB,mark) +- if _H in name: +- lname=3Dname.split(_H);lmodule_name=3Dlname;lobject_name=3D[] +- while len(lmodule_name)>1: +- lobject_name.insert(0,lmodule_name.pop());module_name=3D_H.join(lmodu= le_name) +- try:__import__(module_name);break +- except ImportError:continue +- else:module_name=3Dbuiltins_module;lobject_name=3D[name] +- try:__import__(module_name) +- except ImportError as exc:raise ConstructorError(A,mark,_AC%(utf8(modul= e_name),exc),mark) +- module=3Dsys.modules[module_name];object_name=3D_H.join(lobject_name);o= bj=3Dmodule +- while lobject_name: +- if not hasattr(obj,lobject_name[0]):raise ConstructorError(A,mark,'can= not find %r in the module %r'%(utf8(object_name),module.__name__),mark) +- obj=3Dgetattr(obj,lobject_name.pop(0)) +- return obj +- def construct_python_name(self,suffix,node): +- value=3Dself.construct_scalar(node) +- if value:raise ConstructorError('while constructing a Python name',node= .start_mark,_AD%utf8(value),node.start_mark) +- return self.find_python_name(suffix,node.start_mark) +- def construct_python_module(self,suffix,node): +- value=3Dself.construct_scalar(node) +- if value:raise ConstructorError(_e,node.start_mark,_AD%utf8(value),node= .start_mark) +- return self.find_python_module(suffix,node.start_mark) +- def make_python_instance(self,suffix,node,args=3D_A,kwds=3D_A,newobj=3D_= B): +- if not args:args=3D[] +- if not kwds:kwds=3D{} +- cls=3Dself.find_python_name(suffix,node.start_mark) +- if PY3: +- if newobj and isinstance(cls,type):return cls.__new__(cls,*args,**kwds) +- else:return cls(*args,**kwds) +- elif newobj and isinstance(cls,type(classobj))and not args and not kwds= :instance=3Dclassobj();instance.__class__=3Dcls;return instance +- elif newobj and isinstance(cls,type):return cls.__new__(cls,*args,**kwd= s) +- else:return cls(*args,**kwds) +- def set_python_instance_state(self,instance,state): +- if hasattr(instance,_V):instance.__setstate__(state) +- else: +- slotstate=3D{} +- if isinstance(state,tuple)and len(state)=3D=3D2:state,slotstate=3Dstate +- if hasattr(instance,'__dict__'):instance.__dict__.update(state) +- elif state:slotstate.update(state) +- for (key,value) in slotstate.items():setattr(instance,key,value) +- def construct_python_object(self,suffix,node):instance=3Dself.make_pytho= n_instance(suffix,node,newobj=3D_C);self.recursive_objects[node]=3Dinstance= ;yield instance;deep=3Dhasattr(instance,_V);state=3Dself.construct_mapping(= node,deep=3Ddeep);self.set_python_instance_state(instance,state) +- def construct_python_object_apply(self,suffix,node,newobj=3D_B): +- if isinstance(node,SequenceNode):args=3Dself.construct_sequence(node,de= ep=3D_C);kwds=3D{};state=3D{};listitems=3D[];dictitems=3D{} +- else:value=3Dself.construct_mapping(node,deep=3D_C);args=3Dvalue.get('a= rgs',[]);kwds=3Dvalue.get('kwds',{});state=3Dvalue.get('state',{});listitem= s=3Dvalue.get('listitems',[]);dictitems=3Dvalue.get('dictitems',{}) +- instance=3Dself.make_python_instance(suffix,node,args,kwds,newobj) +- if bool(state):self.set_python_instance_state(instance,state) +- if bool(listitems):instance.extend(listitems) +- if bool(dictitems): +- for key in dictitems:instance[key]=3Ddictitems[key] +- return instance +- def construct_python_object_new(self,suffix,node):return self.construct_= python_object_apply(suffix,node,newobj=3D_C) +-Constructor.add_constructor('tag:yaml.org,2002:python/none',Constructor.c= onstruct_yaml_null) +-Constructor.add_constructor('tag:yaml.org,2002:python/bool',Constructor.c= onstruct_yaml_bool) +-Constructor.add_constructor('tag:yaml.org,2002:python/str',Constructor.co= nstruct_python_str) +-Constructor.add_constructor('tag:yaml.org,2002:python/unicode',Constructo= r.construct_python_unicode) +-if PY3:Constructor.add_constructor('tag:yaml.org,2002:python/bytes',Const= ructor.construct_python_bytes) +-Constructor.add_constructor('tag:yaml.org,2002:python/int',Constructor.co= nstruct_yaml_int) +-Constructor.add_constructor('tag:yaml.org,2002:python/long',Constructor.c= onstruct_python_long) +-Constructor.add_constructor('tag:yaml.org,2002:python/float',Constructor.= construct_yaml_float) +-Constructor.add_constructor('tag:yaml.org,2002:python/complex',Constructo= r.construct_python_complex) +-Constructor.add_constructor('tag:yaml.org,2002:python/list',Constructor.c= onstruct_yaml_seq) +-Constructor.add_constructor('tag:yaml.org,2002:python/tuple',Constructor.= construct_python_tuple) +-Constructor.add_constructor('tag:yaml.org,2002:python/dict',Constructor.c= onstruct_yaml_map) +-Constructor.add_multi_constructor('tag:yaml.org,2002:python/name:',Constr= uctor.construct_python_name) +-Constructor.add_multi_constructor('tag:yaml.org,2002:python/module:',Cons= tructor.construct_python_module) +-Constructor.add_multi_constructor('tag:yaml.org,2002:python/object:',Cons= tructor.construct_python_object) +-Constructor.add_multi_constructor('tag:yaml.org,2002:python/object/apply:= ',Constructor.construct_python_object_apply) +-Constructor.add_multi_constructor('tag:yaml.org,2002:python/object/new:',= Constructor.construct_python_object_new) +-class RoundTripConstructor(SafeConstructor): +- def construct_scalar(self,node): +- A=3D'\x07' +- if not isinstance(node,ScalarNode):raise ConstructorError(_A,_A,_g%node= .id,node.start_mark) +- if node.style=3D=3D'|'and isinstance(node.value,text_type): +- lss=3DLiteralScalarString(node.value,anchor=3Dnode.anchor) +- if node.comment and node.comment[1]:lss.comment=3Dnode.comment[1][0] +- return lss +- if node.style=3D=3D'>'and isinstance(node.value,text_type): +- fold_positions=3D[];idx=3D-1 +- while _C: +- idx=3Dnode.value.find(A,idx+1) +- if idx<0:break +- fold_positions.append(idx-len(fold_positions)) +- fss=3DFoldedScalarString(node.value.replace(A,''),anchor=3Dnode.anchor) +- if node.comment and node.comment[1]:fss.comment=3Dnode.comment[1][0] +- if fold_positions:fss.fold_pos=3Dfold_positions +- return fss +- elif bool(self._preserve_quotes)and isinstance(node.value,text_type): +- if node.style=3D=3D"'":return SingleQuotedScalarString(node.value,anch= or=3Dnode.anchor) +- if node.style=3D=3D'"':return DoubleQuotedScalarString(node.value,anch= or=3Dnode.anchor) +- if node.anchor:return PlainScalarString(node.value,anchor=3Dnode.anchor) +- return node.value +- def construct_yaml_int(self,node): +- width=3D_A;value_su=3Dto_str(self.construct_scalar(node)) +- try:sx=3Dvalue_su.rstrip(_D);underscore=3D[len(sx)-sx.rindex(_D)-1,_B,_= B] +- except ValueError:underscore=3D_A +- except IndexError:underscore=3D_A +- value_s=3Dvalue_su.replace(_D,'');sign=3D+1 +- if value_s[0]=3D=3D_J:sign=3D-1 +- if value_s[0]in _M:value_s=3Dvalue_s[1:] +- if value_s=3D=3D_F:return 0 +- elif value_s.startswith('0b'): +- if self.resolver.processing_version>(1,1)and value_s[2]=3D=3D_F:width= =3Dlen(value_s[2:]) +- if underscore is not _A:underscore[1]=3Dvalue_su[2]=3D=3D_D;underscore= [2]=3Dlen(value_su[2:])>1 and value_su[-1]=3D=3D_D +- return BinaryInt(sign*int(value_s[2:],2),width=3Dwidth,underscore=3Dun= derscore,anchor=3Dnode.anchor) +- elif value_s.startswith('0x'): +- if self.resolver.processing_version>(1,1)and value_s[2]=3D=3D_F:width= =3Dlen(value_s[2:]) +- hex_fun=3DHexInt +- for ch in value_s[2:]: +- if ch in'ABCDEF':hex_fun=3DHexCapsInt;break +- if ch in'abcdef':break +- if underscore is not _A:underscore[1]=3Dvalue_su[2]=3D=3D_D;underscore= [2]=3Dlen(value_su[2:])>1 and value_su[-1]=3D=3D_D +- return hex_fun(sign*int(value_s[2:],16),width=3Dwidth,underscore=3Dund= erscore,anchor=3Dnode.anchor) +- elif value_s.startswith('0o'): +- if self.resolver.processing_version>(1,1)and value_s[2]=3D=3D_F:width= =3Dlen(value_s[2:]) +- if underscore is not _A:underscore[1]=3Dvalue_su[2]=3D=3D_D;underscore= [2]=3Dlen(value_su[2:])>1 and value_su[-1]=3D=3D_D +- return OctalInt(sign*int(value_s[2:],8),width=3Dwidth,underscore=3Dund= erscore,anchor=3Dnode.anchor) +- elif self.resolver.processing_version!=3D(1,2)and value_s[0]=3D=3D_F:re= turn sign*int(value_s,8) +- elif self.resolver.processing_version!=3D(1,2)and _G in value_s: +- digits=3D[int(part)for part in value_s.split(_G)];digits.reverse();bas= e=3D1;value=3D0 +- for digit in digits:value+=3Ddigit*base;base*=3D60 +- return sign*value +- elif self.resolver.processing_version>(1,1)and value_s[0]=3D=3D_F: +- if underscore is not _A:underscore[2]=3Dlen(value_su)>1 and value_su[-= 1]=3D=3D_D +- return ScalarInt(sign*int(value_s),width=3Dlen(value_s),underscore=3Du= nderscore) +- elif underscore:underscore[2]=3Dlen(value_su)>1 and value_su[-1]=3D=3D_= D;return ScalarInt(sign*int(value_s),width=3D_A,underscore=3Dunderscore,anc= hor=3Dnode.anchor) +- elif node.anchor:return ScalarInt(sign*int(value_s),width=3D_A,anchor= =3Dnode.anchor) +- else:return sign*int(value_s) +- def construct_yaml_float(self,node): +- A=3D'E' +- def leading_zeros(v): +- lead0=3D0;idx=3D0 +- while idx2:seqtyp.yaml_end_comment_extend(node.comment[2],= clear=3D_C) +- if node.anchor: +- from dynaconf.vendor.ruamel.yaml.serializer import templated_id +- if not templated_id(node.anchor):seqtyp.yaml_set_anchor(node.anchor) +- for (idx,child) in enumerate(node.value): +- if child.comment:seqtyp._yaml_add_comment(child.comment,key=3Didx);chi= ld.comment=3D_A +- ret_val.append(self.construct_object(child,deep=3Ddeep));seqtyp._yaml_= set_idx_line_col(idx,[child.start_mark.line,child.start_mark.column]) +- return ret_val +- def flatten_mapping(self,node): +- def constructed(value_node): +- if value_node in self.constructed_objects:value=3Dself.constructed_obj= ects[value_node] +- else:value=3Dself.construct_object(value_node,deep=3D_B) +- return value +- merge_map_list=3D[];index=3D0 +- while index2:maptyp.yaml_end_comment_extend(node.comment[2],= clear=3D_C) +- if node.anchor: +- from dynaconf.vendor.ruamel.yaml.serializer import templated_id +- if not templated_id(node.anchor):maptyp.yaml_set_anchor(node.anchor) +- last_key,last_value=3D_A,self._sentinel +- for (key_node,value_node) in node.value: +- key=3Dself.construct_object(key_node,deep=3D_C) +- if not isinstance(key,Hashable): +- if isinstance(key,MutableSequence): +- key_s=3DCommentedKeySeq(key) +- if key_node.flow_style is _C:key_s.fa.set_flow_style() +- elif key_node.flow_style is _B:key_s.fa.set_block_style() +- key=3Dkey_s +- elif isinstance(key,MutableMapping): +- key_m=3DCommentedKeyMap(key) +- if key_node.flow_style is _C:key_m.fa.set_flow_style() +- elif key_node.flow_style is _B:key_m.fa.set_block_style() +- key=3Dkey_m +- if PY2: +- try:hash(key) +- except TypeError as exc:raise ConstructorError(_E,node.start_mark,_W%= exc,key_node.start_mark) +- elif not isinstance(key,Hashable):raise ConstructorError(_E,node.start= _mark,_X,key_node.start_mark) +- value=3Dself.construct_object(value_node,deep=3Ddeep) +- if self.check_mapping_key(node,key_node,maptyp,key,value): +- if key_node.comment and len(key_node.comment)>4 and key_node.comment[= 4]: +- if last_value is _A:key_node.comment[0]=3Dkey_node.comment.pop(4);ma= ptyp._yaml_add_comment(key_node.comment,value=3Dlast_key) +- else:key_node.comment[2]=3Dkey_node.comment.pop(4);maptyp._yaml_add_= comment(key_node.comment,key=3Dkey) +- key_node.comment=3D_A +- if key_node.comment:maptyp._yaml_add_comment(key_node.comment,key=3Dk= ey) +- if value_node.comment:maptyp._yaml_add_comment(value_node.comment,val= ue=3Dkey) +- maptyp._yaml_set_kv_line_col(key,[key_node.start_mark.line,key_node.s= tart_mark.column,value_node.start_mark.line,value_node.start_mark.column]);= maptyp[key]=3Dvalue;last_key,last_value=3Dkey,value +- if merge_map:maptyp.add_yaml_merge(merge_map) +- def construct_setting(self,node,typ,deep=3D_B): +- if not isinstance(node,MappingNode):raise ConstructorError(_A,_A,_P%nod= e.id,node.start_mark) +- if node.comment: +- typ._yaml_add_comment(node.comment[:2]) +- if len(node.comment)>2:typ.yaml_end_comment_extend(node.comment[2],cle= ar=3D_C) +- if node.anchor: +- from dynaconf.vendor.ruamel.yaml.serializer import templated_id +- if not templated_id(node.anchor):typ.yaml_set_anchor(node.anchor) +- for (key_node,value_node) in node.value: +- key=3Dself.construct_object(key_node,deep=3D_C) +- if not isinstance(key,Hashable): +- if isinstance(key,list):key=3Dtuple(key) +- if PY2: +- try:hash(key) +- except TypeError as exc:raise ConstructorError(_E,node.start_mark,_W%= exc,key_node.start_mark) +- elif not isinstance(key,Hashable):raise ConstructorError(_E,node.start= _mark,_X,key_node.start_mark) +- value=3Dself.construct_object(value_node,deep=3Ddeep);self.check_set_k= ey(node,key_node,typ,key) +- if key_node.comment:typ._yaml_add_comment(key_node.comment,key=3Dkey) +- if value_node.comment:typ._yaml_add_comment(value_node.comment,value= =3Dkey) +- typ.add(key) +- def construct_yaml_seq(self,node): +- data=3DCommentedSeq();data._yaml_set_line_col(node.start_mark.line,node= .start_mark.column) +- if node.comment:data._yaml_add_comment(node.comment) +- yield data;data.extend(self.construct_rt_sequence(node,data));self.set_= collection_style(data,node) +- def construct_yaml_map(self,node):data=3DCommentedMap();data._yaml_set_l= ine_col(node.start_mark.line,node.start_mark.column);yield data;self.constr= uct_mapping(node,data,deep=3D_C);self.set_collection_style(data,node) +- def set_collection_style(self,data,node): +- if len(data)=3D=3D0:return +- if node.flow_style is _C:data.fa.set_flow_style() +- elif node.flow_style is _B:data.fa.set_block_style() +- def construct_yaml_object(self,node,cls): +- data=3Dcls.__new__(cls);yield data +- if hasattr(data,_V):state=3DSafeConstructor.construct_mapping(self,node= ,deep=3D_C);data.__setstate__(state) +- else:state=3DSafeConstructor.construct_mapping(self,node);data.__dict__= .update(state) +- def construct_yaml_omap(self,node): +- omap=3DCommentedOrderedMap();omap._yaml_set_line_col(node.start_mark.li= ne,node.start_mark.column) +- if node.flow_style is _C:omap.fa.set_flow_style() +- elif node.flow_style is _B:omap.fa.set_block_style() +- yield omap +- if node.comment: +- omap._yaml_add_comment(node.comment[:2]) +- if len(node.comment)>2:omap.yaml_end_comment_extend(node.comment[2],cl= ear=3D_C) +- if not isinstance(node,SequenceNode):raise ConstructorError(_L,node.sta= rt_mark,_b%node.id,node.start_mark) +- for subnode in node.value: +- if not isinstance(subnode,MappingNode):raise ConstructorError(_L,node.= start_mark,_c%subnode.id,subnode.start_mark) +- if len(subnode.value)!=3D1:raise ConstructorError(_L,node.start_mark,_= d%len(subnode.value),subnode.start_mark) +- key_node,value_node=3Dsubnode.value[0];key=3Dself.construct_object(key= _node);assert key not in omap;value=3Dself.construct_object(value_node) +- if key_node.comment:omap._yaml_add_comment(key_node.comment,key=3Dkey) +- if subnode.comment:omap._yaml_add_comment(subnode.comment,key=3Dkey) +- if value_node.comment:omap._yaml_add_comment(value_node.comment,value= =3Dkey) +- omap[key]=3Dvalue +- def construct_yaml_set(self,node):data=3DCommentedSet();data._yaml_set_l= ine_col(node.start_mark.line,node.start_mark.column);yield data;self.constr= uct_setting(node,data) +- def construct_undefined(self,node): +- try: +- if isinstance(node,MappingNode): +- data=3DCommentedMap();data._yaml_set_line_col(node.start_mark.line,no= de.start_mark.column) +- if node.flow_style is _C:data.fa.set_flow_style() +- elif node.flow_style is _B:data.fa.set_block_style() +- data.yaml_set_tag(node.tag);yield data +- if node.anchor:data.yaml_set_anchor(node.anchor) +- self.construct_mapping(node,data);return +- elif isinstance(node,ScalarNode): +- data2=3DTaggedScalar();data2.value=3Dself.construct_scalar(node);data= 2.style=3Dnode.style;data2.yaml_set_tag(node.tag);yield data2 +- if node.anchor:data2.yaml_set_anchor(node.anchor,always_dump=3D_C) +- return +- elif isinstance(node,SequenceNode): +- data3=3DCommentedSeq();data3._yaml_set_line_col(node.start_mark.line,= node.start_mark.column) +- if node.flow_style is _C:data3.fa.set_flow_style() +- elif node.flow_style is _B:data3.fa.set_block_style() +- data3.yaml_set_tag(node.tag);yield data3 +- if node.anchor:data3.yaml_set_anchor(node.anchor) +- data3.extend(self.construct_sequence(node));return +- except:pass +- raise ConstructorError(_A,_A,_z%utf8(node.tag),node.start_mark) +- def construct_yaml_timestamp(self,node,values=3D_A): +- B=3D't';A=3D'tz' +- try:match=3Dself.timestamp_regexp.match(node.value) +- except TypeError:match=3D_A +- if match is _A:raise ConstructorError(_A,_A,_t.format(node.value),node.= start_mark) +- values=3Dmatch.groupdict() +- if not values[_T]:return SafeConstructor.construct_yaml_timestamp(self,= node,values) +- for part in [B,_K,_U,_O]: +- if values[part]:break +- else:return SafeConstructor.construct_yaml_timestamp(self,node,values) +- year=3Dint(values[_u]);month=3Dint(values[_v]);day=3Dint(values[_w]);ho= ur=3Dint(values[_T]);minute=3Dint(values[_x]);second=3Dint(values[_y]);frac= tion=3D0 +- if values[_I]: +- fraction_s=3Dvalues[_I][:6] +- while len(fraction_s)<6:fraction_s+=3D_F +- fraction=3Dint(fraction_s) +- if len(values[_I])>6 and int(values[_I][6])>4:fraction+=3D1 +- delta=3D_A +- if values[_K]: +- tz_hour=3Dint(values[_U]);minutes=3Dvalues[_O];tz_minute=3Dint(minutes= )if minutes else 0;delta=3Ddatetime.timedelta(hours=3Dtz_hour,minutes=3Dtz_= minute) +- if values[_K]=3D=3D_J:delta=3D-delta +- if delta: +- dt=3Ddatetime.datetime(year,month,day,hour,minute);dt-=3Ddelta;data=3D= TimeStamp(dt.year,dt.month,dt.day,dt.hour,dt.minute,second,fraction);data._= yaml['delta']=3Ddelta;tz=3Dvalues[_K]+values[_U] +- if values[_O]:tz+=3D_G+values[_O] +- data._yaml[A]=3Dtz +- else: +- data=3DTimeStamp(year,month,day,hour,minute,second,fraction) +- if values[A]:data._yaml[A]=3Dvalues[A] +- if values[B]:data._yaml[B]=3D_C +- return data +- def construct_yaml_bool(self,node): +- b=3DSafeConstructor.construct_yaml_bool(self,node) +- if node.anchor:return ScalarBoolean(b,anchor=3Dnode.anchor) +- return b +-RoundTripConstructor.add_constructor(_A0,RoundTripConstructor.construct_y= aml_null) +-RoundTripConstructor.add_constructor(_A1,RoundTripConstructor.construct_y= aml_bool) +-RoundTripConstructor.add_constructor(_A2,RoundTripConstructor.construct_y= aml_int) +-RoundTripConstructor.add_constructor(_A3,RoundTripConstructor.construct_y= aml_float) +-RoundTripConstructor.add_constructor(_A4,RoundTripConstructor.construct_y= aml_binary) +-RoundTripConstructor.add_constructor(_A5,RoundTripConstructor.construct_y= aml_timestamp) +-RoundTripConstructor.add_constructor(_A6,RoundTripConstructor.construct_y= aml_omap) +-RoundTripConstructor.add_constructor(_A7,RoundTripConstructor.construct_y= aml_pairs) +-RoundTripConstructor.add_constructor(_A8,RoundTripConstructor.construct_y= aml_set) +-RoundTripConstructor.add_constructor(_R,RoundTripConstructor.construct_ya= ml_str) +-RoundTripConstructor.add_constructor(_A9,RoundTripConstructor.construct_y= aml_seq) +-RoundTripConstructor.add_constructor(_AA,RoundTripConstructor.construct_y= aml_map) +-RoundTripConstructor.add_constructor(_A,RoundTripConstructor.construct_un= defined) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/cyaml.py b/dynaconf/vendor/ruamel= /yaml/cyaml.py +deleted file mode 100644 +index 73ee79d..0000000 +--- a/dynaconf/vendor/ruamel/yaml/cyaml.py ++++ /dev/null +@@ -1,20 +0,0 @@ +-from __future__ import absolute_import +-_A=3DNone +-from _ruamel_yaml import CParser,CEmitter +-from .constructor import Constructor,BaseConstructor,SafeConstructor +-from .representer import Representer,SafeRepresenter,BaseRepresenter +-from .resolver import Resolver,BaseResolver +-if False:from typing import Any,Union,Optional;from .compat import Stream= TextType,StreamType,VersionType +-__all__=3D['CBaseLoader','CSafeLoader','CLoader','CBaseDumper','CSafeDump= er','CDumper'] +-class CBaseLoader(CParser,BaseConstructor,BaseResolver): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):CParser.__init_= _(A,stream);A._parser=3DA._composer=3DA;BaseConstructor.__init__(A,loader= =3DA);BaseResolver.__init__(A,loadumper=3DA) +-class CSafeLoader(CParser,SafeConstructor,Resolver): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):CParser.__init_= _(A,stream);A._parser=3DA._composer=3DA;SafeConstructor.__init__(A,loader= =3DA);Resolver.__init__(A,loadumper=3DA) +-class CLoader(CParser,Constructor,Resolver): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):CParser.__init_= _(A,stream);A._parser=3DA._composer=3DA;Constructor.__init__(A,loader=3DA);= Resolver.__init__(A,loadumper=3DA) +-class CBaseDumper(CEmitter,BaseRepresenter,BaseResolver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):CEmitter.__init= __(A,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,encoding=3D= encoding,allow_unicode=3Dallow_unicode,line_break=3Dline_break,explicit_sta= rt=3Dexplicit_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dta= gs);A._emitter=3DA._serializer=3DA._representer=3DA;BaseRepresenter.__init_= _(A,default_style=3Ddefault_style,default_flow_style=3Ddefault_flow_style,d= umper=3DA);BaseResolver.__init__(A,loadumper=3DA) +-class CSafeDumper(CEmitter,SafeRepresenter,Resolver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):A._emitter=3DA.= _serializer=3DA._representer=3DA;CEmitter.__init__(A,stream,canonical=3Dcan= onical,indent=3Dindent,width=3Dwidth,encoding=3Dencoding,allow_unicode=3Dal= low_unicode,line_break=3Dline_break,explicit_start=3Dexplicit_start,explici= t_end=3Dexplicit_end,version=3Dversion,tags=3Dtags);A._emitter=3DA._seriali= zer=3DA._representer=3DA;SafeRepresenter.__init__(A,default_style=3Ddefault= _style,default_flow_style=3Ddefault_flow_style);Resolver.__init__(A) +-class CDumper(CEmitter,Representer,Resolver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):CEmitter.__init= __(A,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,encoding=3D= encoding,allow_unicode=3Dallow_unicode,line_break=3Dline_break,explicit_sta= rt=3Dexplicit_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dta= gs);A._emitter=3DA._serializer=3DA._representer=3DA;Representer.__init__(A,= default_style=3Ddefault_style,default_flow_style=3Ddefault_flow_style);Reso= lver.__init__(A) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/dumper.py b/dynaconf/vendor/ruame= l/yaml/dumper.py +deleted file mode 100644 +index 8b31354..0000000 +--- a/dynaconf/vendor/ruamel/yaml/dumper.py ++++ /dev/null +@@ -1,16 +0,0 @@ +-from __future__ import absolute_import +-_A=3DNone +-from .emitter import Emitter +-from .serializer import Serializer +-from .representer import Representer,SafeRepresenter,BaseRepresenter,Roun= dTripRepresenter +-from .resolver import Resolver,BaseResolver,VersionedResolver +-if False:from typing import Any,Dict,List,Union,Optional;from .compat imp= ort StreamType,VersionType +-__all__=3D['BaseDumper','SafeDumper','Dumper','RoundTripDumper'] +-class BaseDumper(Emitter,Serializer,BaseRepresenter,BaseResolver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):Emitter.__init_= _(A,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,allow_unicod= e=3Dallow_unicode,line_break=3Dline_break,block_seq_indent=3Dblock_seq_inde= nt,dumper=3DA);Serializer.__init__(A,encoding=3Dencoding,explicit_start=3De= xplicit_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dtags,dum= per=3DA);BaseRepresenter.__init__(A,default_style=3Ddefault_style,default_f= low_style=3Ddefault_flow_style,dumper=3DA);BaseResolver.__init__(A,loadumpe= r=3DA) +-class SafeDumper(Emitter,Serializer,SafeRepresenter,Resolver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):Emitter.__init_= _(A,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,allow_unicod= e=3Dallow_unicode,line_break=3Dline_break,block_seq_indent=3Dblock_seq_inde= nt,dumper=3DA);Serializer.__init__(A,encoding=3Dencoding,explicit_start=3De= xplicit_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dtags,dum= per=3DA);SafeRepresenter.__init__(A,default_style=3Ddefault_style,default_f= low_style=3Ddefault_flow_style,dumper=3DA);Resolver.__init__(A,loadumper=3D= A) +-class Dumper(Emitter,Serializer,Representer,Resolver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):Emitter.__init_= _(A,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,allow_unicod= e=3Dallow_unicode,line_break=3Dline_break,block_seq_indent=3Dblock_seq_inde= nt,dumper=3DA);Serializer.__init__(A,encoding=3Dencoding,explicit_start=3De= xplicit_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dtags,dum= per=3DA);Representer.__init__(A,default_style=3Ddefault_style,default_flow_= style=3Ddefault_flow_style,dumper=3DA);Resolver.__init__(A,loadumper=3DA) +-class RoundTripDumper(Emitter,Serializer,RoundTripRepresenter,VersionedRe= solver): +- def __init__(A,stream,default_style=3D_A,default_flow_style=3D_A,canonic= al=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding= =3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,block_se= q_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):Emitter.__init_= _(A,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,allow_unicod= e=3Dallow_unicode,line_break=3Dline_break,block_seq_indent=3Dblock_seq_inde= nt,top_level_colon_align=3Dtop_level_colon_align,prefix_colon=3Dprefix_colo= n,dumper=3DA);Serializer.__init__(A,encoding=3Dencoding,explicit_start=3Dex= plicit_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dtags,dump= er=3DA);RoundTripRepresenter.__init__(A,default_style=3Ddefault_style,defau= lt_flow_style=3Ddefault_flow_style,dumper=3DA);VersionedResolver.__init__(A= ,loader=3DA) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/emitter.py b/dynaconf/vendor/ruam= el/yaml/emitter.py +deleted file mode 100644 +index 036530a..0000000 +--- a/dynaconf/vendor/ruamel/yaml/emitter.py ++++ /dev/null +@@ -1,678 +0,0 @@ +-from __future__ import absolute_import,print_function +-_a=3D'\x07' +-_Z=3D'\ufeff' +-_Y=3D'\ue000' +-_X=3D'\ud7ff' +-_W=3D'\x85' +-_V=3D'%%%02X' +-_U=3D'version' +-_T=3D"-;/?:@&=3D+$,_.~*'()[]" +-_S=3D'---' +-_R=3D' \n\x85\u2028\u2029' +-_Q=3D'\xa0' +-_P=3D'a' +-_O=3D'0' +-_N=3D',' +-_M=3D'...' +-_L=3D'\\' +-_K=3D'[' +-_J=3D"'" +-_I=3D'?' +-_H=3D'"' +-_G=3D'!' +-_F=3D'\n\x85\u2028\u2029' +-_E=3D'\n' +-_D=3D' ' +-_C=3DFalse +-_B=3DNone +-_A=3DTrue +-import sys +-from .error import YAMLError,YAMLStreamError +-from .events import * +-from .compat import utf8,text_type,PY2,nprint,dbg,DBG_EVENT,check_anchorn= ame_char +-if _C:from typing import Any,Dict,List,Union,Text,Tuple,Optional;from .co= mpat import StreamType +-__all__=3D['Emitter','EmitterError'] +-class EmitterError(YAMLError):0 +-class ScalarAnalysis: +- def __init__(self,scalar,empty,multiline,allow_flow_plain,allow_block_pl= ain,allow_single_quoted,allow_double_quoted,allow_block):self.scalar=3Dscal= ar;self.empty=3Dempty;self.multiline=3Dmultiline;self.allow_flow_plain=3Dal= low_flow_plain;self.allow_block_plain=3Dallow_block_plain;self.allow_single= _quoted=3Dallow_single_quoted;self.allow_double_quoted=3Dallow_double_quote= d;self.allow_block=3Dallow_block +-class Indents: +- def __init__(self):self.values=3D[] +- def append(self,val,seq):self.values.append((val,seq)) +- def pop(self):return self.values.pop()[0] +- def last_seq(self): +- try:return self.values[-2][1] +- except IndexError:return _C +- def seq_flow_align(self,seq_indent,column): +- if len(self.values)<2 or not self.values[-1][1]:return 0 +- base=3Dself.values[-1][0]if self.values[-1][0]is not _B else 0;return b= ase+seq_indent-column-1 +- def __len__(self):return len(self.values) +-class Emitter: +- DEFAULT_TAG_PREFIXES=3D{_G:_G,'tag:yaml.org,2002:':'!!'};MAX_SIMPLE_KEY_= LENGTH=3D128 +- def __init__(self,stream,canonical=3D_B,indent=3D_B,width=3D_B,allow_uni= code=3D_B,line_break=3D_B,block_seq_indent=3D_B,top_level_colon_align=3D_B,= prefix_colon=3D_B,brace_single_entry_mapping_in_flow_sequence=3D_B,dumper= =3D_B): +- self.dumper=3Ddumper +- if self.dumper is not _B and getattr(self.dumper,'_emitter',_B)is _B:se= lf.dumper._emitter=3Dself +- self.stream=3Dstream;self.encoding=3D_B;self.allow_space_break=3D_B;sel= f.states=3D[];self.state=3Dself.expect_stream_start;self.events=3D[];self.e= vent=3D_B;self.indents=3DIndents();self.indent=3D_B;self.flow_context=3D[];= self.root_context=3D_C;self.sequence_context=3D_C;self.mapping_context=3D_C= ;self.simple_key_context=3D_C;self.line=3D0;self.column=3D0;self.whitespace= =3D_A;self.indention=3D_A;self.compact_seq_seq=3D_A;self.compact_seq_map=3D= _A;self.no_newline=3D_B;self.open_ended=3D_C;self.colon=3D':';self.prefixed= _colon=3Dself.colon if prefix_colon is _B else prefix_colon+self.colon;self= .brace_single_entry_mapping_in_flow_sequence=3Dbrace_single_entry_mapping_i= n_flow_sequence;self.canonical=3Dcanonical;self.allow_unicode=3Dallow_unico= de;self.unicode_supplementary=3Dsys.maxunicode>65535;self.sequence_dash_off= set=3Dblock_seq_indent if block_seq_indent else 0;self.top_level_colon_alig= n=3Dtop_level_colon_align;self.best_sequence_indent=3D2;self.requested_inde= nt=3Dindent +- if indent and 1self.best_sequence_indent*2:self.best_width=3Dwidth +- self.best_line_break=3D_E +- if line_break in['\r',_E,'\r\n']:self.best_line_break=3Dline_break +- self.tag_prefixes=3D_B;self.prepared_anchor=3D_B;self.prepared_tag=3D_B= ;self.analysis=3D_B;self.style=3D_B;self.scalar_after_indicator=3D_A +- @property +- def stream(self): +- try:return self._stream +- except AttributeError:raise YAMLStreamError('output stream needs to spe= cified') +- @stream.setter +- def stream(self,val): +- if val is _B:return +- if not hasattr(val,'write'):raise YAMLStreamError('stream argument need= s to have a write() method') +- self._stream=3Dval +- @property +- def serializer(self): +- try: +- if hasattr(self.dumper,'typ'):return self.dumper.serializer +- return self.dumper._serializer +- except AttributeError:return self +- @property +- def flow_level(self):return len(self.flow_context) +- def dispose(self):self.states=3D[];self.state=3D_B +- def emit(self,event): +- if dbg(DBG_EVENT):nprint(event) +- self.events.append(event) +- while not self.need_more_events():self.event=3Dself.events.pop(0);self.= state();self.event=3D_B +- def need_more_events(self): +- if not self.events:return _A +- event=3Dself.events[0] +- if isinstance(event,DocumentStartEvent):return self.need_events(1) +- elif isinstance(event,SequenceStartEvent):return self.need_events(2) +- elif isinstance(event,MappingStartEvent):return self.need_events(3) +- else:return _C +- def need_events(self,count): +- level=3D0 +- for event in self.events[1:]: +- if isinstance(event,(DocumentStartEvent,CollectionStartEvent)):level+= =3D1 +- elif isinstance(event,(DocumentEndEvent,CollectionEndEvent)):level-=3D1 +- elif isinstance(event,StreamEndEvent):level=3D-1 +- if level<0:return _C +- return len(self.events)self.best_width:self.write_indent() +- self.states.append(self.expect_flow_sequence_item);self.expect_node(se= quence=3D_A) +- def expect_flow_sequence_item(self): +- if isinstance(self.event,SequenceEndEvent): +- self.indent=3Dself.indents.pop();popped=3Dself.flow_context.pop();asse= rt popped=3D=3D_K +- if self.canonical:self.write_indicator(_N,_C);self.write_indent() +- self.write_indicator(']',_C) +- if self.event.comment and self.event.comment[0]:self.write_post_commen= t(self.event) +- else:self.no_newline=3D_C +- self.state=3Dself.states.pop() +- else: +- self.write_indicator(_N,_C) +- if self.canonical or self.column>self.best_width:self.write_indent() +- self.states.append(self.expect_flow_sequence_item);self.expect_node(se= quence=3D_A) +- def expect_flow_mapping(self,single=3D_C): +- ind=3Dself.indents.seq_flow_align(self.best_sequence_indent,self.column= );map_init=3D'{' +- if single and self.flow_level and self.flow_context[-1]=3D=3D_K and not= self.canonical and not self.brace_single_entry_mapping_in_flow_sequence:ma= p_init=3D'' +- self.write_indicator(_D*ind+map_init,_A,whitespace=3D_A);self.flow_cont= ext.append(map_init);self.increase_indent(flow=3D_A,sequence=3D_C);self.sta= te=3Dself.expect_first_flow_mapping_key +- def expect_first_flow_mapping_key(self): +- if isinstance(self.event,MappingEndEvent): +- self.indent=3Dself.indents.pop();popped=3Dself.flow_context.pop();asse= rt popped=3D=3D'{';self.write_indicator('}',_C) +- if self.event.comment and self.event.comment[0]:self.write_post_commen= t(self.event) +- elif self.flow_level=3D=3D0:self.write_line_break() +- self.state=3Dself.states.pop() +- else: +- if self.canonical or self.column>self.best_width:self.write_indent() +- if not self.canonical and self.check_simple_key():self.states.append(s= elf.expect_flow_mapping_simple_value);self.expect_node(mapping=3D_A,simple_= key=3D_A) +- else:self.write_indicator(_I,_A);self.states.append(self.expect_flow_m= apping_value);self.expect_node(mapping=3D_A) +- def expect_flow_mapping_key(self): +- if isinstance(self.event,MappingEndEvent): +- self.indent=3Dself.indents.pop();popped=3Dself.flow_context.pop();asse= rt popped in['{',''] +- if self.canonical:self.write_indicator(_N,_C);self.write_indent() +- if popped!=3D'':self.write_indicator('}',_C) +- if self.event.comment and self.event.comment[0]:self.write_post_commen= t(self.event) +- else:self.no_newline=3D_C +- self.state=3Dself.states.pop() +- else: +- self.write_indicator(_N,_C) +- if self.canonical or self.column>self.best_width:self.write_indent() +- if not self.canonical and self.check_simple_key():self.states.append(s= elf.expect_flow_mapping_simple_value);self.expect_node(mapping=3D_A,simple_= key=3D_A) +- else:self.write_indicator(_I,_A);self.states.append(self.expect_flow_m= apping_value);self.expect_node(mapping=3D_A) +- def expect_flow_mapping_simple_value(self):self.write_indicator(self.pre= fixed_colon,_C);self.states.append(self.expect_flow_mapping_key);self.expec= t_node(mapping=3D_A) +- def expect_flow_mapping_value(self): +- if self.canonical or self.column>self.best_width:self.write_indent() +- self.write_indicator(self.prefixed_colon,_A);self.states.append(self.ex= pect_flow_mapping_key);self.expect_node(mapping=3D_A) +- def expect_block_sequence(self): +- if self.mapping_context:indentless=3Dnot self.indention +- else: +- indentless=3D_C +- if not self.compact_seq_seq and self.column!=3D0:self.write_line_break= () +- self.increase_indent(flow=3D_C,sequence=3D_A,indentless=3Dindentless);s= elf.state=3Dself.expect_first_block_sequence_item +- def expect_first_block_sequence_item(self):return self.expect_block_sequ= ence_item(first=3D_A) +- def expect_block_sequence_item(self,first=3D_C): +- if not first and isinstance(self.event,SequenceEndEvent): +- if self.event.comment and self.event.comment[1]:self.write_pre_comment= (self.event) +- self.indent=3Dself.indents.pop();self.state=3Dself.states.pop();self.n= o_newline=3D_C +- else: +- if self.event.comment and self.event.comment[1]:self.write_pre_comment= (self.event) +- nonl=3Dself.no_newline if self.column=3D=3D0 else _C;self.write_indent= ();ind=3Dself.sequence_dash_offset;self.write_indicator(_D*ind+'-',_A,inden= tion=3D_A) +- if nonl or self.sequence_dash_offset+2>self.best_sequence_indent:self.= no_newline=3D_A +- self.states.append(self.expect_block_sequence_item);self.expect_node(s= equence=3D_A) +- def expect_block_mapping(self): +- if not self.mapping_context and not(self.compact_seq_map or self.column= =3D=3D0):self.write_line_break() +- self.increase_indent(flow=3D_C,sequence=3D_C);self.state=3Dself.expect_= first_block_mapping_key +- def expect_first_block_mapping_key(self):return self.expect_block_mappin= g_key(first=3D_A) +- def expect_block_mapping_key(self,first=3D_C): +- if not first and isinstance(self.event,MappingEndEvent): +- if self.event.comment and self.event.comment[1]:self.write_pre_comment= (self.event) +- self.indent=3Dself.indents.pop();self.state=3Dself.states.pop() +- else: +- if self.event.comment and self.event.comment[1]:self.write_pre_comment= (self.event) +- self.write_indent() +- if self.check_simple_key(): +- if not isinstance(self.event,(SequenceStartEvent,MappingStartEvent)): +- try: +- if self.event.style=3D=3D_I:self.write_indicator(_I,_A,indention=3D= _A) +- except AttributeError:pass +- self.states.append(self.expect_block_mapping_simple_value);self.expec= t_node(mapping=3D_A,simple_key=3D_A) +- if isinstance(self.event,AliasEvent):self.stream.write(_D) +- else:self.write_indicator(_I,_A,indention=3D_A);self.states.append(sel= f.expect_block_mapping_value);self.expect_node(mapping=3D_A) +- def expect_block_mapping_simple_value(self): +- if getattr(self.event,'style',_B)!=3D_I: +- if self.indent=3D=3D0 and self.top_level_colon_align is not _B:c=3D_D*= (self.top_level_colon_align-self.column)+self.colon +- else:c=3Dself.prefixed_colon +- self.write_indicator(c,_C) +- self.states.append(self.expect_block_mapping_key);self.expect_node(mapp= ing=3D_A) +- def expect_block_mapping_value(self):self.write_indent();self.write_indi= cator(self.prefixed_colon,_A,indention=3D_A);self.states.append(self.expect= _block_mapping_key);self.expect_node(mapping=3D_A) +- def check_empty_sequence(self):return isinstance(self.event,SequenceStar= tEvent)and bool(self.events)and isinstance(self.events[0],SequenceEndEvent) +- def check_empty_mapping(self):return isinstance(self.event,MappingStartE= vent)and bool(self.events)and isinstance(self.events[0],MappingEndEvent) +- def check_empty_document(self): +- if not isinstance(self.event,DocumentStartEvent)or not self.events:retu= rn _C +- event=3Dself.events[0];return isinstance(event,ScalarEvent)and event.an= chor is _B and event.tag is _B and event.implicit and event.value=3D=3D'' +- def check_simple_key(self): +- length=3D0 +- if isinstance(self.event,NodeEvent)and self.event.anchor is not _B: +- if self.prepared_anchor is _B:self.prepared_anchor=3Dself.prepare_anch= or(self.event.anchor) +- length+=3Dlen(self.prepared_anchor) +- if isinstance(self.event,(ScalarEvent,CollectionStartEvent))and self.ev= ent.tag is not _B: +- if self.prepared_tag is _B:self.prepared_tag=3Dself.prepare_tag(self.e= vent.tag) +- length+=3Dlen(self.prepared_tag) +- if isinstance(self.event,ScalarEvent): +- if self.analysis is _B:self.analysis=3Dself.analyze_scalar(self.event.= value) +- length+=3Dlen(self.analysis.scalar) +- return length': +- if not self.flow_level and not self.simple_key_context and self.analys= is.allow_block:return self.event.style +- if not self.event.style and self.analysis.allow_double_quoted: +- if _J in self.event.value or _E in self.event.value:return _H +- if not self.event.style or self.event.style=3D=3D_J: +- if self.analysis.allow_single_quoted and not(self.simple_key_context a= nd self.analysis.multiline):return _J +- return _H +- def process_scalar(self): +- if self.analysis is _B:self.analysis=3Dself.analyze_scalar(self.event.v= alue) +- if self.style is _B:self.style=3Dself.choose_scalar_style() +- split=3Dnot self.simple_key_context +- if self.sequence_context and not self.flow_level:self.write_indent() +- if self.style=3D=3D_H:self.write_double_quoted(self.analysis.scalar,spl= it) +- elif self.style=3D=3D_J:self.write_single_quoted(self.analysis.scalar,s= plit) +- elif self.style=3D=3D'>':self.write_folded(self.analysis.scalar) +- elif self.style=3D=3D'|':self.write_literal(self.analysis.scalar,self.e= vent.comment) +- else:self.write_plain(self.analysis.scalar,split) +- self.analysis=3D_B;self.style=3D_B +- if self.event.comment:self.write_post_comment(self.event) +- def prepare_version(self,version): +- major,minor=3Dversion +- if major!=3D1:raise EmitterError('unsupported YAML version: %d.%d'%(maj= or,minor)) +- return'%d.%d'%(major,minor) +- def prepare_tag_handle(self,handle): +- if not handle:raise EmitterError('tag handle must not be empty') +- if handle[0]!=3D_G or handle[-1]!=3D_G:raise EmitterError("tag handle m= ust start and end with '!': %r"%utf8(handle)) +- for ch in handle[1:-1]: +- if not(_O<=3Dch<=3D'9'or'A'<=3Dch<=3D'Z'or _P<=3Dch<=3D'z'or ch in'-_'= ):raise EmitterError('invalid character %r in the tag handle: %r'%(utf8(ch)= ,utf8(handle))) +- return handle +- def prepare_tag_prefix(self,prefix): +- if not prefix:raise EmitterError('tag prefix must not be empty') +- chunks=3D[];start=3Dend=3D0 +- if prefix[0]=3D=3D_G:end=3D1 +- ch_set=3D_T +- if self.dumper: +- version=3Dgetattr(self.dumper,_U,(1,2)) +- if version is _B or version>=3D(1,2):ch_set+=3D'#' +- while end=3D(1,2):ch_set+=3D'#' +- while end'%suffix_text +- def prepare_anchor(self,anchor): +- if not anchor:raise EmitterError('anchor must not be empty') +- for ch in anchor: +- if not check_anchorname_char(ch):raise EmitterError('invalid character= %r in the anchor: %r'%(utf8(ch),utf8(anchor))) +- return anchor +- def analyze_scalar(self,scalar): +- A=3D'\x00 \t\r\n\x85\u2028\u2029' +- if not scalar:return ScalarAnalysis(scalar=3Dscalar,empty=3D_A,multilin= e=3D_C,allow_flow_plain=3D_C,allow_block_plain=3D_A,allow_single_quoted=3D_= A,allow_double_quoted=3D_A,allow_block=3D_C) +- block_indicators=3D_C;flow_indicators=3D_C;line_breaks=3D_C;special_cha= racters=3D_C;leading_space=3D_C;leading_break=3D_C;trailing_space=3D_C;trai= ling_break=3D_C;break_space=3D_C;space_break=3D_C +- if scalar.startswith(_S)or scalar.startswith(_M):block_indicators=3D_A;= flow_indicators=3D_A +- preceeded_by_whitespace=3D_A;followed_by_whitespace=3Dlen(scalar)=3D=3D= 1 or scalar[1]in A;previous_space=3D_C;previous_break=3D_C;index=3D0 +- while index\'"%@`':flow_indicators=3D_A;block_indicators=3D_A +- if ch in'?:': +- if self.serializer.use_version=3D=3D(1,1):flow_indicators=3D_A +- elif len(scalar)=3D=3D1:flow_indicators=3D_A +- if followed_by_whitespace:block_indicators=3D_A +- if ch=3D=3D'-'and followed_by_whitespace:flow_indicators=3D_A;block_i= ndicators=3D_A +- else: +- if ch in',[]{}':flow_indicators=3D_A +- if ch=3D=3D_I and self.serializer.use_version=3D=3D(1,1):flow_indicat= ors=3D_A +- if ch=3D=3D':': +- if followed_by_whitespace:flow_indicators=3D_A;block_indicators=3D_A +- if ch=3D=3D'#'and preceeded_by_whitespace:flow_indicators=3D_A;block_= indicators=3D_A +- if ch in _F:line_breaks=3D_A +- if not(ch=3D=3D_E or _D<=3Dch<=3D'~'): +- if(ch=3D=3D_W or _Q<=3Dch<=3D_X or _Y<=3Dch<=3D'=EF=BF=BD'or self.uni= code_supplementary and'=F0=90=80=80'<=3Dch<=3D'\U0010ffff')and ch!=3D_Z: +- if not self.allow_unicode:special_characters=3D_A +- else:special_characters=3D_A +- if ch=3D=3D_D: +- if index=3D=3D0:leading_space=3D_A +- if index=3D=3Dlen(scalar)-1:trailing_space=3D_A +- if previous_break:break_space=3D_A +- previous_space=3D_A;previous_break=3D_C +- elif ch in _F: +- if index=3D=3D0:leading_break=3D_A +- if index=3D=3Dlen(scalar)-1:trailing_break=3D_A +- if previous_space:space_break=3D_A +- previous_space=3D_C;previous_break=3D_A +- else:previous_space=3D_C;previous_break=3D_C +- index+=3D1;preceeded_by_whitespace=3Dch in A;followed_by_whitespace=3D= index+1>=3Dlen(scalar)or scalar[index+1]in A +- allow_flow_plain=3D_A;allow_block_plain=3D_A;allow_single_quoted=3D_A;a= llow_double_quoted=3D_A;allow_block=3D_A +- if leading_space or leading_break or trailing_space or trailing_break:a= llow_flow_plain=3Dallow_block_plain=3D_C +- if trailing_space:allow_block=3D_C +- if break_space:allow_flow_plain=3Dallow_block_plain=3Dallow_single_quot= ed=3D_C +- if special_characters:allow_flow_plain=3Dallow_block_plain=3Dallow_sing= le_quoted=3Dallow_block=3D_C +- elif space_break: +- allow_flow_plain=3Dallow_block_plain=3Dallow_single_quoted=3D_C +- if not self.allow_space_break:allow_block=3D_C +- if line_breaks:allow_flow_plain=3Dallow_block_plain=3D_C +- if flow_indicators:allow_flow_plain=3D_C +- if block_indicators:allow_block_plain=3D_C +- return ScalarAnalysis(scalar=3Dscalar,empty=3D_C,multiline=3Dline_break= s,allow_flow_plain=3Dallow_flow_plain,allow_block_plain=3Dallow_block_plain= ,allow_single_quoted=3Dallow_single_quoted,allow_double_quoted=3Dallow_doub= le_quoted,allow_block=3Dallow_block) +- def flush_stream(self): +- if hasattr(self.stream,'flush'):self.stream.flush() +- def write_stream_start(self): +- if self.encoding and self.encoding.startswith('utf-16'):self.stream.wri= te(_Z.encode(self.encoding)) +- def write_stream_end(self):self.flush_stream() +- def write_indicator(self,indicator,need_whitespace,whitespace=3D_C,inden= tion=3D_C): +- if self.whitespace or not need_whitespace:data=3Dindicator +- else:data=3D_D+indicator +- self.whitespace=3Dwhitespace;self.indention=3Dself.indention and indent= ion;self.column+=3Dlen(data);self.open_ended=3D_C +- if bool(self.encoding):data=3Ddata.encode(self.encoding) +- self.stream.write(data) +- def write_indent(self): +- indent=3Dself.indent or 0 +- if not self.indention or self.column>indent or self.column=3D=3Dindent = and not self.whitespace: +- if bool(self.no_newline):self.no_newline=3D_C +- else:self.write_line_break() +- if self.columnself.best_width and split and st= art!=3D0 and end!=3Dlen(text):self.write_indent() +- else: +- data=3Dtext[start:end];self.column+=3Dlen(data) +- if bool(self.encoding):data=3Ddata.encode(self.encoding) +- self.stream.write(data) +- start=3Dend +- elif breaks: +- if ch is _B or ch not in _F: +- if text[start]=3D=3D_E:self.write_line_break() +- for br in text[start:end]: +- if br=3D=3D_E:self.write_line_break() +- else:self.write_line_break(br) +- self.write_indent();start=3Dend +- elif ch is _B or ch in _R or ch=3D=3D_J: +- if start=3Dend)and self.column+(e= nd-start)>self.best_width and split: +- data=3Dtext[start:end]+_L +- if start-1:break +- if pos>0:indent=3Dself.best_sequence_indent +- if text[-1]not in _F:indicator=3D'-' +- elif len(text)=3D=3D1 or text[-2]in _F:indicator=3D'+' +- hints+=3Dindicator;return hints,indent,indicator +- def write_folded(self,text): +- hints,_indent,_indicator=3Dself.determine_block_hints(text);self.write_= indicator('>'+hints,_A) +- if _indicator=3D=3D'+':self.open_ended=3D_A +- self.write_line_break();leading_space=3D_A;spaces=3D_C;breaks=3D_A;star= t=3Dend=3D0 +- while end<=3Dlen(text): +- ch=3D_B +- if endself.best_width:self.write_inden= t() +- else: +- data=3Dtext[start:end];self.column+=3Dlen(data) +- if bool(self.encoding):data=3Ddata.encode(self.encoding) +- self.stream.write(data) +- start=3Dend +- elif ch is _B or ch in' \n\x85\u2028\u2029\x07': +- data=3Dtext[start:end];self.column+=3Dlen(data) +- if bool(self.encoding):data=3Ddata.encode(self.encoding) +- self.stream.write(data) +- if ch=3D=3D_a: +- if endself.best_width and split:self.w= rite_indent();self.whitespace=3D_C;self.indention=3D_C +- else: +- data=3Dtext[start:end];self.column+=3Dlen(data) +- if self.encoding:data=3Ddata.encode(self.encoding) +- self.stream.write(data) +- start=3Dend +- elif breaks: +- if ch not in _F: +- if text[start]=3D=3D_E:self.write_line_break() +- for br in text[start:end]: +- if br=3D=3D_E:self.write_line_break() +- else:self.write_line_break(br) +- self.write_indent();self.whitespace=3D_C;self.indention=3D_C;start= =3Dend +- elif ch is _B or ch in _R: +- data=3Dtext[start:end];self.column+=3Dlen(data) +- if self.encoding:data=3Ddata.encode(self.encoding) +- try:self.stream.write(data) +- except:sys.stdout.write(repr(data)+_E);raise +- start=3Dend +- if ch is not _B:spaces=3Dch=3D=3D_D;breaks=3Dch in _F +- end+=3D1 +- def write_comment(self,comment,pre=3D_C): +- value=3Dcomment.value +- if not pre and value[-1]=3D=3D_E:value=3Dvalue[:-1] +- try: +- col=3Dcomment.start_mark.column +- if comment.value and comment.value.startswith(_E):col=3Dself.column +- elif col0 and A.buffer[B-1]not in J: +- B-=3D1 +- if A.pointer-B>F/2-1:D=3DK;B+=3D5;break +- G=3D'';C=3DA.pointer +- while CF/2-1:G=3DK;C-=3D5;break +- I=3Dutf8(A.buffer[B:C]);H=3D'^';H=3D'^ (line: {})'.format(A.line+1);ret= urn L*E+D+I+G+_B+L*(E+A.pointer-B+len(D))+H +- def __str__(A): +- B=3DA.get_snippet();C=3D_H%(A.name,A.line+1,A.column+1) +- if B is not _A:C+=3D':\n'+B +- return C +-class CommentMark: +- __slots__=3D_D, +- def __init__(A,column):A.column=3Dcolumn +-class YAMLError(Exception):0 +-class MarkedYAMLError(YAMLError): +- def __init__(A,context=3D_A,context_mark=3D_A,problem=3D_A,problem_mark= =3D_A,note=3D_A,warn=3D_A):A.context=3Dcontext;A.context_mark=3Dcontext_mar= k;A.problem=3Dproblem;A.problem_mark=3Dproblem_mark;A.note=3Dnote +- def __str__(A): +- B=3D[] +- if A.context is not _A:B.append(A.context) +- if A.context_mark is not _A and(A.problem is _A or A.problem_mark is _A= or A.context_mark.name!=3DA.problem_mark.name or A.context_mark.line!=3DA.= problem_mark.line or A.context_mark.column!=3DA.problem_mark.column):B.appe= nd(str(A.context_mark)) +- if A.problem is not _A:B.append(A.problem) +- if A.problem_mark is not _A:B.append(str(A.problem_mark)) +- if A.note is not _A and A.note:C=3Dtextwrap.dedent(A.note);B.append(C) +- return _B.join(B) +-class YAMLStreamError(Exception):0 +-class YAMLWarning(Warning):0 +-class MarkedYAMLWarning(YAMLWarning): +- def __init__(A,context=3D_A,context_mark=3D_A,problem=3D_A,problem_mark= =3D_A,note=3D_A,warn=3D_A):A.context=3Dcontext;A.context_mark=3Dcontext_mar= k;A.problem=3Dproblem;A.problem_mark=3Dproblem_mark;A.note=3Dnote;A.warn=3D= warn +- def __str__(A): +- B=3D[] +- if A.context is not _A:B.append(A.context) +- if A.context_mark is not _A and(A.problem is _A or A.problem_mark is _A= or A.context_mark.name!=3DA.problem_mark.name or A.context_mark.line!=3DA.= problem_mark.line or A.context_mark.column!=3DA.problem_mark.column):B.appe= nd(str(A.context_mark)) +- if A.problem is not _A:B.append(A.problem) +- if A.problem_mark is not _A:B.append(str(A.problem_mark)) +- if A.note is not _A and A.note:C=3Dtextwrap.dedent(A.note);B.append(C) +- if A.warn is not _A and A.warn:D=3Dtextwrap.dedent(A.warn);B.append(D) +- return _B.join(B) +-class ReusedAnchorWarning(YAMLWarning):0 +-class UnsafeLoaderWarning(YAMLWarning):text=3D"\nThe default 'Loader' for= 'load(stream)' without further arguments can be unsafe.\nUse 'load(stream,= Loader=3Druamel.yaml.Loader)' explicitly if that is OK.\nAlternatively inc= lude the following in your code:\n\n import warnings\n warnings.simplefil= ter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)\n\nIn most other cases= you should consider using 'safe_load(stream)'" +-warnings.simplefilter(_I,UnsafeLoaderWarning) +-class MantissaNoDotYAML1_1Warning(YAMLWarning): +- def __init__(A,node,flt_str):A.node=3Dnode;A.flt=3Dflt_str +- def __str__(A):B=3DA.node.start_mark.line;C=3DA.node.start_mark.column;r= eturn '\nIn YAML 1.1 floating point values should have a dot (\'.\') in the= ir mantissa.\nSee the Floating-Point Language-Independent Type for YAML=E2= =84=A2 Version 1.1 specification\n( http://yaml.org/type/float.html ). This= dot is not required for JSON nor for YAML 1.2\n\nCorrect your float: "{}" = on line: {}, column: {}\n\nor alternatively include the following in your c= ode:\n\n import warnings\n warnings.simplefilter(\'ignore\', ruamel.yaml.= error.MantissaNoDotYAML1_1Warning)\n\n'.format(A.flt,B,C) +-warnings.simplefilter(_I,MantissaNoDotYAML1_1Warning) +-class YAMLFutureWarning(Warning):0 +-class MarkedYAMLFutureWarning(YAMLFutureWarning): +- def __init__(A,context=3D_A,context_mark=3D_A,problem=3D_A,problem_mark= =3D_A,note=3D_A,warn=3D_A):A.context=3Dcontext;A.context_mark=3Dcontext_mar= k;A.problem=3Dproblem;A.problem_mark=3Dproblem_mark;A.note=3Dnote;A.warn=3D= warn +- def __str__(A): +- B=3D[] +- if A.context is not _A:B.append(A.context) +- if A.context_mark is not _A and(A.problem is _A or A.problem_mark is _A= or A.context_mark.name!=3DA.problem_mark.name or A.context_mark.line!=3DA.= problem_mark.line or A.context_mark.column!=3DA.problem_mark.column):B.appe= nd(str(A.context_mark)) +- if A.problem is not _A:B.append(A.problem) +- if A.problem_mark is not _A:B.append(str(A.problem_mark)) +- if A.note is not _A and A.note:C=3Dtextwrap.dedent(A.note);B.append(C) +- if A.warn is not _A and A.warn:D=3Dtextwrap.dedent(A.warn);B.append(D) +- return _B.join(B) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/events.py b/dynaconf/vendor/ruame= l/yaml/events.py +deleted file mode 100644 +index 8c1356e..0000000 +--- a/dynaconf/vendor/ruamel/yaml/events.py ++++ /dev/null +@@ -1,45 +0,0 @@ +-_H=3D'explicit' +-_G=3D'style' +-_F=3D'flow_style' +-_E=3D'value' +-_D=3D'anchor' +-_C=3D'implicit' +-_B=3D'tag' +-_A=3DNone +-if False:from typing import Any,Dict,Optional,List +-def CommentCheck():0 +-class Event: +- __slots__=3D'start_mark','end_mark','comment' +- def __init__(A,start_mark=3D_A,end_mark=3D_A,comment=3DCommentCheck): +- B=3Dcomment;A.start_mark=3Dstart_mark;A.end_mark=3Dend_mark +- if B is CommentCheck:B=3D_A +- A.comment=3DB +- def __repr__(A): +- C=3D[B for B in[_D,_B,_C,_E,_F,_G]if hasattr(A,B)];B=3D', '.join(['%s= =3D%r'%(B,getattr(A,B))for B in C]) +- if A.comment not in[_A,CommentCheck]:B+=3D', comment=3D{!r}'.format(A.c= omment) +- return'%s(%s)'%(A.__class__.__name__,B) +-class NodeEvent(Event): +- __slots__=3D_D, +- def __init__(A,anchor,start_mark=3D_A,end_mark=3D_A,comment=3D_A):Event.= __init__(A,start_mark,end_mark,comment);A.anchor=3Danchor +-class CollectionStartEvent(NodeEvent): +- __slots__=3D_B,_C,_F,'nr_items' +- def __init__(A,anchor,tag,implicit,start_mark=3D_A,end_mark=3D_A,flow_st= yle=3D_A,comment=3D_A,nr_items=3D_A):NodeEvent.__init__(A,anchor,start_mark= ,end_mark,comment);A.tag=3Dtag;A.implicit=3Dimplicit;A.flow_style=3Dflow_st= yle;A.nr_items=3Dnr_items +-class CollectionEndEvent(Event):__slots__=3D() +-class StreamStartEvent(Event): +- __slots__=3D'encoding', +- def __init__(A,start_mark=3D_A,end_mark=3D_A,encoding=3D_A,comment=3D_A)= :Event.__init__(A,start_mark,end_mark,comment);A.encoding=3Dencoding +-class StreamEndEvent(Event):__slots__=3D() +-class DocumentStartEvent(Event): +- __slots__=3D_H,'version','tags' +- def __init__(A,start_mark=3D_A,end_mark=3D_A,explicit=3D_A,version=3D_A,= tags=3D_A,comment=3D_A):Event.__init__(A,start_mark,end_mark,comment);A.exp= licit=3Dexplicit;A.version=3Dversion;A.tags=3Dtags +-class DocumentEndEvent(Event): +- __slots__=3D_H, +- def __init__(A,start_mark=3D_A,end_mark=3D_A,explicit=3D_A,comment=3D_A)= :Event.__init__(A,start_mark,end_mark,comment);A.explicit=3Dexplicit +-class AliasEvent(NodeEvent):__slots__=3D() +-class ScalarEvent(NodeEvent): +- __slots__=3D_B,_C,_E,_G +- def __init__(A,anchor,tag,implicit,value,start_mark=3D_A,end_mark=3D_A,s= tyle=3D_A,comment=3D_A):NodeEvent.__init__(A,anchor,start_mark,end_mark,com= ment);A.tag=3Dtag;A.implicit=3Dimplicit;A.value=3Dvalue;A.style=3Dstyle +-class SequenceStartEvent(CollectionStartEvent):__slots__=3D() +-class SequenceEndEvent(CollectionEndEvent):__slots__=3D() +-class MappingStartEvent(CollectionStartEvent):__slots__=3D() +-class MappingEndEvent(CollectionEndEvent):__slots__=3D() +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/loader.py b/dynaconf/vendor/ruame= l/yaml/loader.py +deleted file mode 100644 +index 4c74755..0000000 +--- a/dynaconf/vendor/ruamel/yaml/loader.py ++++ /dev/null +@@ -1,18 +0,0 @@ +-from __future__ import absolute_import +-_A=3DNone +-from .reader import Reader +-from .scanner import Scanner,RoundTripScanner +-from .parser import Parser,RoundTripParser +-from .composer import Composer +-from .constructor import BaseConstructor,SafeConstructor,Constructor,Roun= dTripConstructor +-from .resolver import VersionedResolver +-if False:from typing import Any,Dict,List,Union,Optional;from .compat imp= ort StreamTextType,VersionType +-__all__=3D['BaseLoader','SafeLoader','Loader','RoundTripLoader'] +-class BaseLoader(Reader,Scanner,Parser,Composer,BaseConstructor,Versioned= Resolver): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):Reader.__init__= (A,stream,loader=3DA);Scanner.__init__(A,loader=3DA);Parser.__init__(A,load= er=3DA);Composer.__init__(A,loader=3DA);BaseConstructor.__init__(A,loader= =3DA);VersionedResolver.__init__(A,version,loader=3DA) +-class SafeLoader(Reader,Scanner,Parser,Composer,SafeConstructor,Versioned= Resolver): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):Reader.__init__= (A,stream,loader=3DA);Scanner.__init__(A,loader=3DA);Parser.__init__(A,load= er=3DA);Composer.__init__(A,loader=3DA);SafeConstructor.__init__(A,loader= =3DA);VersionedResolver.__init__(A,version,loader=3DA) +-class Loader(Reader,Scanner,Parser,Composer,Constructor,VersionedResolver= ): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):Reader.__init__= (A,stream,loader=3DA);Scanner.__init__(A,loader=3DA);Parser.__init__(A,load= er=3DA);Composer.__init__(A,loader=3DA);Constructor.__init__(A,loader=3DA);= VersionedResolver.__init__(A,version,loader=3DA) +-class RoundTripLoader(Reader,RoundTripScanner,RoundTripParser,Composer,Ro= undTripConstructor,VersionedResolver): +- def __init__(A,stream,version=3D_A,preserve_quotes=3D_A):Reader.__init__= (A,stream,loader=3DA);RoundTripScanner.__init__(A,loader=3DA);RoundTripPars= er.__init__(A,loader=3DA);Composer.__init__(A,loader=3DA);RoundTripConstruc= tor.__init__(A,preserve_quotes=3Dpreserve_quotes,loader=3DA);VersionedResol= ver.__init__(A,version,loader=3DA) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/main.py b/dynaconf/vendor/ruamel/= yaml/main.py +deleted file mode 100644 +index acd2e93..0000000 +--- a/dynaconf/vendor/ruamel/yaml/main.py ++++ /dev/null +@@ -1,462 +0,0 @@ +-from __future__ import absolute_import,unicode_literals,print_function +-_Q=3D'_emitter' +-_P=3D'_serializer' +-_O=3D'write' +-_N=3D'{}.dump(_all) takes two positional argument but at least three were= given ({!r})' +-_M=3D'read' +-_L=3D'_stream' +-_K=3D'typ' +-_J=3D'utf-8' +-_I=3D'base' +-_H=3D'{}.__init__() takes no positional argument but at least one was giv= en ({!r})' +-_G=3D'yaml_tag' +-_F=3D'open' +-_E=3D'rt' +-_D=3D'_' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import sys,os,warnings,glob +-from importlib import import_module +-import dynaconf.vendor.ruamel as ruamel +-from .error import UnsafeLoaderWarning,YAMLError +-from .tokens import * +-from .events import * +-from .nodes import * +-from .loader import BaseLoader,SafeLoader,Loader,RoundTripLoader +-from .dumper import BaseDumper,SafeDumper,Dumper,RoundTripDumper +-from .compat import StringIO,BytesIO,with_metaclass,PY3,nprint +-from .resolver import VersionedResolver,Resolver +-from .representer import BaseRepresenter,SafeRepresenter,Representer,Roun= dTripRepresenter +-from .constructor import BaseConstructor,SafeConstructor,Constructor,Roun= dTripConstructor +-from .loader import Loader as UnsafeLoader +-if _B: +- from typing import List,Set,Dict,Union,Any,Callable,Optional,Text;from .= compat import StreamType,StreamTextType,VersionType +- if PY3:from pathlib import Path +- else:Path=3DAny +-try:from _ruamel_yaml import CParser,CEmitter +-except:CParser=3DCEmitter=3D_A +-enforce=3Dobject() +-class YAML: +- def __init__(self,_kw=3Denforce,typ=3D_A,pure=3D_B,output=3D_A,plug_ins= =3D_A): +- if _kw is not enforce:raise TypeError(_H.format(self.__class__.__name__= ,_kw)) +- self.typ=3D[_E]if typ is _A else typ if isinstance(typ,list)else[typ];s= elf.pure=3Dpure;self._output=3Doutput;self._context_manager=3D_A;self.plug_= ins=3D[] +- for pu in ([]if plug_ins is _A else plug_ins)+self.official_plug_ins():= file_name=3Dpu.replace(os.sep,'.');self.plug_ins.append(import_module(file_= name)) +- self.Resolver=3Druamel.yaml.resolver.VersionedResolver;self.allow_unico= de=3D_C;self.Reader=3D_A;self.Representer=3D_A;self.Constructor=3D_A;self.S= canner=3D_A;self.Serializer=3D_A;self.default_flow_style=3D_A;typ_found=3D1= ;setup_rt=3D_B +- if _E in self.typ:setup_rt=3D_C +- elif'safe'in self.typ:self.Emitter=3Druamel.yaml.emitter.Emitter if pur= e or CEmitter is _A else CEmitter;self.Representer=3Druamel.yaml.represente= r.SafeRepresenter;self.Parser=3Druamel.yaml.parser.Parser if pure or CParse= r is _A else CParser;self.Composer=3Druamel.yaml.composer.Composer;self.Con= structor=3Druamel.yaml.constructor.SafeConstructor +- elif _I in self.typ:self.Emitter=3Druamel.yaml.emitter.Emitter;self.Rep= resenter=3Druamel.yaml.representer.BaseRepresenter;self.Parser=3Druamel.yam= l.parser.Parser if pure or CParser is _A else CParser;self.Composer=3Druame= l.yaml.composer.Composer;self.Constructor=3Druamel.yaml.constructor.BaseCon= structor +- elif'unsafe'in self.typ:self.Emitter=3Druamel.yaml.emitter.Emitter if p= ure or CEmitter is _A else CEmitter;self.Representer=3Druamel.yaml.represen= ter.Representer;self.Parser=3Druamel.yaml.parser.Parser if pure or CParser = is _A else CParser;self.Composer=3Druamel.yaml.composer.Composer;self.Const= ructor=3Druamel.yaml.constructor.Constructor +- else:setup_rt=3D_C;typ_found=3D0 +- if setup_rt:self.default_flow_style=3D_B;self.Emitter=3Druamel.yaml.emi= tter.Emitter;self.Serializer=3Druamel.yaml.serializer.Serializer;self.Repre= senter=3Druamel.yaml.representer.RoundTripRepresenter;self.Scanner=3Druamel= .yaml.scanner.RoundTripScanner;self.Parser=3Druamel.yaml.parser.RoundTripPa= rser;self.Composer=3Druamel.yaml.composer.Composer;self.Constructor=3Druame= l.yaml.constructor.RoundTripConstructor +- del setup_rt;self.stream=3D_A;self.canonical=3D_A;self.old_indent=3D_A;= self.width=3D_A;self.line_break=3D_A;self.map_indent=3D_A;self.sequence_ind= ent=3D_A;self.sequence_dash_offset=3D0;self.compact_seq_seq=3D_A;self.compa= ct_seq_map=3D_A;self.sort_base_mapping_type_on_output=3D_A;self.top_level_c= olon_align=3D_A;self.prefix_colon=3D_A;self.version=3D_A;self.preserve_quot= es=3D_A;self.allow_duplicate_keys=3D_B;self.encoding=3D_J;self.explicit_sta= rt=3D_A;self.explicit_end=3D_A;self.tags=3D_A;self.default_style=3D_A;self.= top_level_block_style_scalar_no_indent_error_1_1=3D_B;self.scalar_after_ind= icator=3D_A;self.brace_single_entry_mapping_in_flow_sequence=3D_B +- for module in self.plug_ins: +- if getattr(module,_K,_A)in self.typ:typ_found+=3D1;module.init_typ(sel= f);break +- if typ_found=3D=3D0:raise NotImplementedError('typ "{}"not recognised (= need to install plug-in?)'.format(self.typ)) +- @property +- def reader(self): +- try:return self._reader +- except AttributeError:self._reader=3Dself.Reader(_A,loader=3Dself);retu= rn self._reader +- @property +- def scanner(self): +- try:return self._scanner +- except AttributeError:self._scanner=3Dself.Scanner(loader=3Dself);retur= n self._scanner +- @property +- def parser(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr): +- if self.Parser is not CParser:setattr(self,attr,self.Parser(loader=3Ds= elf)) +- elif getattr(self,_L,_A)is _A:return _A +- else:setattr(self,attr,CParser(self._stream)) +- return getattr(self,attr) +- @property +- def composer(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr):setattr(self,attr,self.Composer(loader=3Dself= )) +- return getattr(self,attr) +- @property +- def constructor(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr):cnst=3Dself.Constructor(preserve_quotes=3Dsel= f.preserve_quotes,loader=3Dself);cnst.allow_duplicate_keys=3Dself.allow_dup= licate_keys;setattr(self,attr,cnst) +- return getattr(self,attr) +- @property +- def resolver(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr):setattr(self,attr,self.Resolver(version=3Dsel= f.version,loader=3Dself)) +- return getattr(self,attr) +- @property +- def emitter(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr): +- if self.Emitter is not CEmitter: +- _emitter=3Dself.Emitter(_A,canonical=3Dself.canonical,indent=3Dself.o= ld_indent,width=3Dself.width,allow_unicode=3Dself.allow_unicode,line_break= =3Dself.line_break,prefix_colon=3Dself.prefix_colon,brace_single_entry_mapp= ing_in_flow_sequence=3Dself.brace_single_entry_mapping_in_flow_sequence,dum= per=3Dself);setattr(self,attr,_emitter) +- if self.map_indent is not _A:_emitter.best_map_indent=3Dself.map_inde= nt +- if self.sequence_indent is not _A:_emitter.best_sequence_indent=3Dsel= f.sequence_indent +- if self.sequence_dash_offset is not _A:_emitter.sequence_dash_offset= =3Dself.sequence_dash_offset +- if self.compact_seq_seq is not _A:_emitter.compact_seq_seq=3Dself.com= pact_seq_seq +- if self.compact_seq_map is not _A:_emitter.compact_seq_map=3Dself.com= pact_seq_map +- else: +- if getattr(self,_L,_A)is _A:return _A +- return _A +- return getattr(self,attr) +- @property +- def serializer(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr):setattr(self,attr,self.Serializer(encoding=3D= self.encoding,explicit_start=3Dself.explicit_start,explicit_end=3Dself.expl= icit_end,version=3Dself.version,tags=3Dself.tags,dumper=3Dself)) +- return getattr(self,attr) +- @property +- def representer(self): +- attr=3D_D+sys._getframe().f_code.co_name +- if not hasattr(self,attr): +- repres=3Dself.Representer(default_style=3Dself.default_style,default_f= low_style=3Dself.default_flow_style,dumper=3Dself) +- if self.sort_base_mapping_type_on_output is not _A:repres.sort_base_ma= pping_type_on_output=3Dself.sort_base_mapping_type_on_output +- setattr(self,attr,repres) +- return getattr(self,attr) +- def load(self,stream): +- if not hasattr(stream,_M)and hasattr(stream,_F): +- with stream.open('rb')as fp:return self.load(fp) +- constructor,parser=3Dself.get_constructor_parser(stream) +- try:return constructor.get_single_data() +- finally: +- parser.dispose() +- try:self._reader.reset_reader() +- except AttributeError:pass +- try:self._scanner.reset_scanner() +- except AttributeError:pass +- def load_all(self,stream,_kw=3Denforce): +- if _kw is not enforce:raise TypeError(_H.format(self.__class__.__name__= ,_kw)) +- if not hasattr(stream,_M)and hasattr(stream,_F): +- with stream.open('r')as fp: +- for d in self.load_all(fp,_kw=3Denforce):yield d +- return +- constructor,parser=3Dself.get_constructor_parser(stream) +- try: +- while constructor.check_data():yield constructor.get_data() +- finally: +- parser.dispose() +- try:self._reader.reset_reader() +- except AttributeError:pass +- try:self._scanner.reset_scanner() +- except AttributeError:pass +- def get_constructor_parser(self,stream): +- if self.Parser is not CParser: +- if self.Reader is _A:self.Reader=3Druamel.yaml.reader.Reader +- if self.Scanner is _A:self.Scanner=3Druamel.yaml.scanner.Scanner +- self.reader.stream=3Dstream +- elif self.Reader is not _A: +- if self.Scanner is _A:self.Scanner=3Druamel.yaml.scanner.Scanner +- self.Parser=3Druamel.yaml.parser.Parser;self.reader.stream=3Dstream +- elif self.Scanner is not _A: +- if self.Reader is _A:self.Reader=3Druamel.yaml.reader.Reader +- self.Parser=3Druamel.yaml.parser.Parser;self.reader.stream=3Dstream +- else: +- rslvr=3Dself.Resolver +- class XLoader(self.Parser,self.Constructor,rslvr): +- def __init__(selfx,stream,version=3Dself.version,preserve_quotes=3D_A= ):CParser.__init__(selfx,stream);selfx._parser=3Dselfx._composer=3Dselfx;se= lf.Constructor.__init__(selfx,loader=3Dselfx);selfx.allow_duplicate_keys=3D= self.allow_duplicate_keys;rslvr.__init__(selfx,version=3Dversion,loadumper= =3Dselfx) +- self._stream=3Dstream;loader=3DXLoader(stream);return loader,loader +- return self.constructor,self.parser +- def dump(self,data,stream=3D_A,_kw=3Denforce,transform=3D_A): +- if self._context_manager: +- if not self._output:raise TypeError('Missing output stream while dumpi= ng from context manager') +- if _kw is not enforce:raise TypeError('{}.dump() takes one positional = argument but at least two were given ({!r})'.format(self.__class__.__name__= ,_kw)) +- if transform is not _A:raise TypeError('{}.dump() in the context manag= er cannot have transform keyword '.format(self.__class__.__name__)) +- self._context_manager.dump(data) +- else: +- if stream is _A:raise TypeError('Need a stream argument when not dumpi= ng from context manager') +- return self.dump_all([data],stream,_kw,transform=3Dtransform) +- def dump_all(self,documents,stream,_kw=3Denforce,transform=3D_A): +- if self._context_manager:raise NotImplementedError +- if _kw is not enforce:raise TypeError(_N.format(self.__class__.__name__= ,_kw)) +- self._output=3Dstream;self._context_manager=3DYAMLContextManager(self,t= ransform=3Dtransform) +- for data in documents:self._context_manager.dump(data) +- self._context_manager.teardown_output();self._output=3D_A;self._context= _manager=3D_A +- def Xdump_all(self,documents,stream,_kw=3Denforce,transform=3D_A): +- if not hasattr(stream,_O)and hasattr(stream,_F): +- with stream.open('w')as fp:return self.dump_all(documents,fp,_kw,trans= form=3Dtransform) +- if _kw is not enforce:raise TypeError(_N.format(self.__class__.__name__= ,_kw)) +- if self.top_level_colon_align is _C:tlca=3Dmax([len(str(x))for x in doc= uments[0]]) +- else:tlca=3Dself.top_level_colon_align +- if transform is not _A: +- fstream=3Dstream +- if self.encoding is _A:stream=3DStringIO() +- else:stream=3DBytesIO() +- serializer,representer,emitter=3Dself.get_serializer_representer_emitte= r(stream,tlca) +- try: +- self.serializer.open() +- for data in documents: +- try:self.representer.represent(data) +- except AttributeError:raise +- self.serializer.close() +- finally: +- try:self.emitter.dispose() +- except AttributeError:raise +- delattr(self,_P);delattr(self,_Q) +- if transform: +- val=3Dstream.getvalue() +- if self.encoding:val=3Dval.decode(self.encoding) +- if fstream is _A:transform(val) +- else:fstream.write(transform(val)) +- return _A +- def get_serializer_representer_emitter(self,stream,tlca): +- if self.Emitter is not CEmitter: +- if self.Serializer is _A:self.Serializer=3Druamel.yaml.serializer.Seri= alizer +- self.emitter.stream=3Dstream;self.emitter.top_level_colon_align=3Dtlca +- if self.scalar_after_indicator is not _A:self.emitter.scalar_after_ind= icator=3Dself.scalar_after_indicator +- return self.serializer,self.representer,self.emitter +- if self.Serializer is not _A: +- self.Emitter=3Druamel.yaml.emitter.Emitter;self.emitter.stream=3Dstrea= m;self.emitter.top_level_colon_align=3Dtlca +- if self.scalar_after_indicator is not _A:self.emitter.scalar_after_ind= icator=3Dself.scalar_after_indicator +- return self.serializer,self.representer,self.emitter +- rslvr=3Druamel.yaml.resolver.BaseResolver if _I in self.typ else ruamel= .yaml.resolver.Resolver +- class XDumper(CEmitter,self.Representer,rslvr): +- def __init__(selfx,stream,default_style=3D_A,default_flow_style=3D_A,c= anonical=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,enc= oding=3D_A,explicit_start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A,blo= ck_seq_indent=3D_A,top_level_colon_align=3D_A,prefix_colon=3D_A):CEmitter._= _init__(selfx,stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,en= coding=3Dencoding,allow_unicode=3Dallow_unicode,line_break=3Dline_break,exp= licit_start=3Dexplicit_start,explicit_end=3Dexplicit_end,version=3Dversion,= tags=3Dtags);selfx._emitter=3Dselfx._serializer=3Dselfx._representer=3Dself= x;self.Representer.__init__(selfx,default_style=3Ddefault_style,default_flo= w_style=3Ddefault_flow_style);rslvr.__init__(selfx) +- self._stream=3Dstream;dumper=3DXDumper(stream,default_style=3Dself.defa= ult_style,default_flow_style=3Dself.default_flow_style,canonical=3Dself.can= onical,indent=3Dself.old_indent,width=3Dself.width,allow_unicode=3Dself.all= ow_unicode,line_break=3Dself.line_break,explicit_start=3Dself.explicit_star= t,explicit_end=3Dself.explicit_end,version=3Dself.version,tags=3Dself.tags)= ;self._emitter=3Dself._serializer=3Ddumper;return dumper,dumper,dumper +- def map(self,**kw): +- if _E in self.typ:from dynaconf.vendor.ruamel.yaml.comments import Comm= entedMap;return CommentedMap(**kw) +- else:return dict(**kw) +- def seq(self,*args): +- if _E in self.typ:from dynaconf.vendor.ruamel.yaml.comments import Comm= entedSeq;return CommentedSeq(*args) +- else:return list(*args) +- def official_plug_ins(self):bd=3Dos.path.dirname(__file__);gpbd=3Dos.pat= h.dirname(os.path.dirname(bd));res=3D[x.replace(gpbd,'')[1:-3]for x in glob= .glob(bd+'/*/__plug_in__.py')];return res +- def register_class(self,cls): +- tag=3Dgetattr(cls,_G,'!'+cls.__name__) +- try:self.representer.add_representer(cls,cls.to_yaml) +- except AttributeError: +- def t_y(representer,data):return representer.represent_yaml_object(tag= ,data,cls,flow_style=3Drepresenter.default_flow_style) +- self.representer.add_representer(cls,t_y) +- try:self.constructor.add_constructor(tag,cls.from_yaml) +- except AttributeError: +- def f_y(constructor,node):return constructor.construct_yaml_object(nod= e,cls) +- self.constructor.add_constructor(tag,f_y) +- return cls +- def parse(self,stream): +- _,parser=3Dself.get_constructor_parser(stream) +- try: +- while parser.check_event():yield parser.get_event() +- finally: +- parser.dispose() +- try:self._reader.reset_reader() +- except AttributeError:pass +- try:self._scanner.reset_scanner() +- except AttributeError:pass +- def __enter__(self):self._context_manager=3DYAMLContextManager(self);ret= urn self +- def __exit__(self,typ,value,traceback): +- if typ:nprint(_K,typ) +- self._context_manager.teardown_output();self._context_manager=3D_A +- def _indent(self,mapping=3D_A,sequence=3D_A,offset=3D_A): +- if mapping is not _A:self.map_indent=3Dmapping +- if sequence is not _A:self.sequence_indent=3Dsequence +- if offset is not _A:self.sequence_dash_offset=3Doffset +- @property +- def indent(self):return self._indent +- @indent.setter +- def indent(self,val):self.old_indent=3Dval +- @property +- def block_seq_indent(self):return self.sequence_dash_offset +- @block_seq_indent.setter +- def block_seq_indent(self,val):self.sequence_dash_offset=3Dval +- def compact(self,seq_seq=3D_A,seq_map=3D_A):self.compact_seq_seq=3Dseq_s= eq;self.compact_seq_map=3Dseq_map +-class YAMLContextManager: +- def __init__(self,yaml,transform=3D_A): +- self._yaml=3Dyaml;self._output_inited=3D_B;self._output_path=3D_A;self.= _output=3Dself._yaml._output;self._transform=3Dtransform +- if not hasattr(self._output,_O)and hasattr(self._output,_F):self._outpu= t_path=3Dself._output;self._output=3Dself._output_path.open('w') +- if self._transform is not _A: +- self._fstream=3Dself._output +- if self._yaml.encoding is _A:self._output=3DStringIO() +- else:self._output=3DBytesIO() +- def teardown_output(self): +- if self._output_inited:self._yaml.serializer.close() +- else:return +- try:self._yaml.emitter.dispose() +- except AttributeError:raise +- try:delattr(self._yaml,_P);delattr(self._yaml,_Q) +- except AttributeError:raise +- if self._transform: +- val=3Dself._output.getvalue() +- if self._yaml.encoding:val=3Dval.decode(self._yaml.encoding) +- if self._fstream is _A:self._transform(val) +- else:self._fstream.write(self._transform(val));self._fstream.flush();s= elf._output=3Dself._fstream +- if self._output_path is not _A:self._output.close() +- def init_output(self,first_data): +- if self._yaml.top_level_colon_align is _C:tlca=3Dmax([len(str(x))for x = in first_data]) +- else:tlca=3Dself._yaml.top_level_colon_align +- self._yaml.get_serializer_representer_emitter(self._output,tlca);self._= yaml.serializer.open();self._output_inited=3D_C +- def dump(self,data): +- if not self._output_inited:self.init_output(data) +- try:self._yaml.representer.represent(data) +- except AttributeError:raise +-def yaml_object(yml): +- def yo_deco(cls): +- tag=3Dgetattr(cls,_G,'!'+cls.__name__) +- try:yml.representer.add_representer(cls,cls.to_yaml) +- except AttributeError: +- def t_y(representer,data):return representer.represent_yaml_object(tag= ,data,cls,flow_style=3Drepresenter.default_flow_style) +- yml.representer.add_representer(cls,t_y) +- try:yml.constructor.add_constructor(tag,cls.from_yaml) +- except AttributeError: +- def f_y(constructor,node):return constructor.construct_yaml_object(nod= e,cls) +- yml.constructor.add_constructor(tag,f_y) +- return cls +- return yo_deco +-def scan(stream,Loader=3DLoader): +- loader=3DLoader(stream) +- try: +- while loader.scanner.check_token():yield loader.scanner.get_token() +- finally:loader._parser.dispose() +-def parse(stream,Loader=3DLoader): +- loader=3DLoader(stream) +- try: +- while loader._parser.check_event():yield loader._parser.get_event() +- finally:loader._parser.dispose() +-def compose(stream,Loader=3DLoader): +- loader=3DLoader(stream) +- try:return loader.get_single_node() +- finally:loader.dispose() +-def compose_all(stream,Loader=3DLoader): +- loader=3DLoader(stream) +- try: +- while loader.check_node():yield loader._composer.get_node() +- finally:loader._parser.dispose() +-def load(stream,Loader=3D_A,version=3D_A,preserve_quotes=3D_A): +- if Loader is _A:warnings.warn(UnsafeLoaderWarning.text,UnsafeLoaderWarni= ng,stacklevel=3D2);Loader=3DUnsafeLoader +- loader=3DLoader(stream,version,preserve_quotes=3Dpreserve_quotes) +- try:return loader._constructor.get_single_data() +- finally: +- loader._parser.dispose() +- try:loader._reader.reset_reader() +- except AttributeError:pass +- try:loader._scanner.reset_scanner() +- except AttributeError:pass +-def load_all(stream,Loader=3D_A,version=3D_A,preserve_quotes=3D_A): +- if Loader is _A:warnings.warn(UnsafeLoaderWarning.text,UnsafeLoaderWarni= ng,stacklevel=3D2);Loader=3DUnsafeLoader +- loader=3DLoader(stream,version,preserve_quotes=3Dpreserve_quotes) +- try: +- while loader._constructor.check_data():yield loader._constructor.get_da= ta() +- finally: +- loader._parser.dispose() +- try:loader._reader.reset_reader() +- except AttributeError:pass +- try:loader._scanner.reset_scanner() +- except AttributeError:pass +-def safe_load(stream,version=3D_A):return load(stream,SafeLoader,version) +-def safe_load_all(stream,version=3D_A):return load_all(stream,SafeLoader,= version) +-def round_trip_load(stream,version=3D_A,preserve_quotes=3D_A):return load= (stream,RoundTripLoader,version,preserve_quotes=3Dpreserve_quotes) +-def round_trip_load_all(stream,version=3D_A,preserve_quotes=3D_A):return = load_all(stream,RoundTripLoader,version,preserve_quotes=3Dpreserve_quotes) +-def emit(events,stream=3D_A,Dumper=3DDumper,canonical=3D_A,indent=3D_A,wi= dth=3D_A,allow_unicode=3D_A,line_break=3D_A): +- getvalue=3D_A +- if stream is _A:stream=3DStringIO();getvalue=3Dstream.getvalue +- dumper=3DDumper(stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwid= th,allow_unicode=3Dallow_unicode,line_break=3Dline_break) +- try: +- for event in events:dumper.emit(event) +- finally: +- try:dumper._emitter.dispose() +- except AttributeError:raise;dumper.dispose() +- if getvalue is not _A:return getvalue() +-enc=3D_A if PY3 else _J +-def serialize_all(nodes,stream=3D_A,Dumper=3DDumper,canonical=3D_A,indent= =3D_A,width=3D_A,allow_unicode=3D_A,line_break=3D_A,encoding=3Denc,explicit= _start=3D_A,explicit_end=3D_A,version=3D_A,tags=3D_A): +- getvalue=3D_A +- if stream is _A: +- if encoding is _A:stream=3DStringIO() +- else:stream=3DBytesIO() +- getvalue=3Dstream.getvalue +- dumper=3DDumper(stream,canonical=3Dcanonical,indent=3Dindent,width=3Dwid= th,allow_unicode=3Dallow_unicode,line_break=3Dline_break,encoding=3Dencodin= g,version=3Dversion,tags=3Dtags,explicit_start=3Dexplicit_start,explicit_en= d=3Dexplicit_end) +- try: +- dumper._serializer.open() +- for node in nodes:dumper.serialize(node) +- dumper._serializer.close() +- finally: +- try:dumper._emitter.dispose() +- except AttributeError:raise;dumper.dispose() +- if getvalue is not _A:return getvalue() +-def serialize(node,stream=3D_A,Dumper=3DDumper,**kwds):return serialize_a= ll([node],stream,Dumper=3DDumper,**kwds) +-def dump_all(documents,stream=3D_A,Dumper=3DDumper,default_style=3D_A,def= ault_flow_style=3D_A,canonical=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D= _A,line_break=3D_A,encoding=3Denc,explicit_start=3D_A,explicit_end=3D_A,ver= sion=3D_A,tags=3D_A,block_seq_indent=3D_A,top_level_colon_align=3D_A,prefix= _colon=3D_A): +- getvalue=3D_A +- if top_level_colon_align is _C:top_level_colon_align=3Dmax([len(str(x))f= or x in documents[0]]) +- if stream is _A: +- if encoding is _A:stream=3DStringIO() +- else:stream=3DBytesIO() +- getvalue=3Dstream.getvalue +- dumper=3DDumper(stream,default_style=3Ddefault_style,default_flow_style= =3Ddefault_flow_style,canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,a= llow_unicode=3Dallow_unicode,line_break=3Dline_break,encoding=3Dencoding,ex= plicit_start=3Dexplicit_start,explicit_end=3Dexplicit_end,version=3Dversion= ,tags=3Dtags,block_seq_indent=3Dblock_seq_indent,top_level_colon_align=3Dto= p_level_colon_align,prefix_colon=3Dprefix_colon) +- try: +- dumper._serializer.open() +- for data in documents: +- try:dumper._representer.represent(data) +- except AttributeError:raise +- dumper._serializer.close() +- finally: +- try:dumper._emitter.dispose() +- except AttributeError:raise;dumper.dispose() +- if getvalue is not _A:return getvalue() +- return _A +-def dump(data,stream=3D_A,Dumper=3DDumper,default_style=3D_A,default_flow= _style=3D_A,canonical=3D_A,indent=3D_A,width=3D_A,allow_unicode=3D_A,line_b= reak=3D_A,encoding=3Denc,explicit_start=3D_A,explicit_end=3D_A,version=3D_A= ,tags=3D_A,block_seq_indent=3D_A):return dump_all([data],stream,Dumper=3DDu= mper,default_style=3Ddefault_style,default_flow_style=3Ddefault_flow_style,= canonical=3Dcanonical,indent=3Dindent,width=3Dwidth,allow_unicode=3Dallow_u= nicode,line_break=3Dline_break,encoding=3Dencoding,explicit_start=3Dexplici= t_start,explicit_end=3Dexplicit_end,version=3Dversion,tags=3Dtags,block_seq= _indent=3Dblock_seq_indent) +-def safe_dump_all(documents,stream=3D_A,**kwds):return dump_all(documents= ,stream,Dumper=3DSafeDumper,**kwds) +-def safe_dump(data,stream=3D_A,**kwds):return dump_all([data],stream,Dump= er=3DSafeDumper,**kwds) +-def round_trip_dump(data,stream=3D_A,Dumper=3DRoundTripDumper,default_sty= le=3D_A,default_flow_style=3D_A,canonical=3D_A,indent=3D_A,width=3D_A,allow= _unicode=3D_A,line_break=3D_A,encoding=3Denc,explicit_start=3D_A,explicit_e= nd=3D_A,version=3D_A,tags=3D_A,block_seq_indent=3D_A,top_level_colon_align= =3D_A,prefix_colon=3D_A):allow_unicode=3D_C if allow_unicode is _A else all= ow_unicode;return dump_all([data],stream,Dumper=3DDumper,default_style=3Dde= fault_style,default_flow_style=3Ddefault_flow_style,canonical=3Dcanonical,i= ndent=3Dindent,width=3Dwidth,allow_unicode=3Dallow_unicode,line_break=3Dlin= e_break,encoding=3Dencoding,explicit_start=3Dexplicit_start,explicit_end=3D= explicit_end,version=3Dversion,tags=3Dtags,block_seq_indent=3Dblock_seq_ind= ent,top_level_colon_align=3Dtop_level_colon_align,prefix_colon=3Dprefix_col= on) +-def add_implicit_resolver(tag,regexp,first=3D_A,Loader=3D_A,Dumper=3D_A,r= esolver=3DResolver): +- A=3D'add_implicit_resolver' +- if Loader is _A and Dumper is _A:resolver.add_implicit_resolver(tag,rege= xp,first);return +- if Loader: +- if hasattr(Loader,A):Loader.add_implicit_resolver(tag,regexp,first) +- elif issubclass(Loader,(BaseLoader,SafeLoader,ruamel.yaml.loader.Loader= ,RoundTripLoader)):Resolver.add_implicit_resolver(tag,regexp,first) +- else:raise NotImplementedError +- if Dumper: +- if hasattr(Dumper,A):Dumper.add_implicit_resolver(tag,regexp,first) +- elif issubclass(Dumper,(BaseDumper,SafeDumper,ruamel.yaml.dumper.Dumper= ,RoundTripDumper)):Resolver.add_implicit_resolver(tag,regexp,first) +- else:raise NotImplementedError +-def add_path_resolver(tag,path,kind=3D_A,Loader=3D_A,Dumper=3D_A,resolver= =3DResolver): +- A=3D'add_path_resolver' +- if Loader is _A and Dumper is _A:resolver.add_path_resolver(tag,path,kin= d);return +- if Loader: +- if hasattr(Loader,A):Loader.add_path_resolver(tag,path,kind) +- elif issubclass(Loader,(BaseLoader,SafeLoader,ruamel.yaml.loader.Loader= ,RoundTripLoader)):Resolver.add_path_resolver(tag,path,kind) +- else:raise NotImplementedError +- if Dumper: +- if hasattr(Dumper,A):Dumper.add_path_resolver(tag,path,kind) +- elif issubclass(Dumper,(BaseDumper,SafeDumper,ruamel.yaml.dumper.Dumper= ,RoundTripDumper)):Resolver.add_path_resolver(tag,path,kind) +- else:raise NotImplementedError +-def add_constructor(tag,object_constructor,Loader=3D_A,constructor=3DCons= tructor): +- if Loader is _A:constructor.add_constructor(tag,object_constructor) +- else: +- if hasattr(Loader,'add_constructor'):Loader.add_constructor(tag,object_= constructor);return +- if issubclass(Loader,BaseLoader):BaseConstructor.add_constructor(tag,ob= ject_constructor) +- elif issubclass(Loader,SafeLoader):SafeConstructor.add_constructor(tag,= object_constructor) +- elif issubclass(Loader,Loader):Constructor.add_constructor(tag,object_c= onstructor) +- elif issubclass(Loader,RoundTripLoader):RoundTripConstructor.add_constr= uctor(tag,object_constructor) +- else:raise NotImplementedError +-def add_multi_constructor(tag_prefix,multi_constructor,Loader=3D_A,constr= uctor=3DConstructor): +- if Loader is _A:constructor.add_multi_constructor(tag_prefix,multi_const= ructor) +- else: +- if _B and hasattr(Loader,'add_multi_constructor'):Loader.add_multi_cons= tructor(tag_prefix,constructor);return +- if issubclass(Loader,BaseLoader):BaseConstructor.add_multi_constructor(= tag_prefix,multi_constructor) +- elif issubclass(Loader,SafeLoader):SafeConstructor.add_multi_constructo= r(tag_prefix,multi_constructor) +- elif issubclass(Loader,ruamel.yaml.loader.Loader):Constructor.add_multi= _constructor(tag_prefix,multi_constructor) +- elif issubclass(Loader,RoundTripLoader):RoundTripConstructor.add_multi_= constructor(tag_prefix,multi_constructor) +- else:raise NotImplementedError +-def add_representer(data_type,object_representer,Dumper=3D_A,representer= =3DRepresenter): +- if Dumper is _A:representer.add_representer(data_type,object_representer) +- else: +- if hasattr(Dumper,'add_representer'):Dumper.add_representer(data_type,o= bject_representer);return +- if issubclass(Dumper,BaseDumper):BaseRepresenter.add_representer(data_t= ype,object_representer) +- elif issubclass(Dumper,SafeDumper):SafeRepresenter.add_representer(data= _type,object_representer) +- elif issubclass(Dumper,Dumper):Representer.add_representer(data_type,ob= ject_representer) +- elif issubclass(Dumper,RoundTripDumper):RoundTripRepresenter.add_repres= enter(data_type,object_representer) +- else:raise NotImplementedError +-def add_multi_representer(data_type,multi_representer,Dumper=3D_A,represe= nter=3DRepresenter): +- if Dumper is _A:representer.add_multi_representer(data_type,multi_repres= enter) +- else: +- if hasattr(Dumper,'add_multi_representer'):Dumper.add_multi_representer= (data_type,multi_representer);return +- if issubclass(Dumper,BaseDumper):BaseRepresenter.add_multi_representer(= data_type,multi_representer) +- elif issubclass(Dumper,SafeDumper):SafeRepresenter.add_multi_represente= r(data_type,multi_representer) +- elif issubclass(Dumper,Dumper):Representer.add_multi_representer(data_t= ype,multi_representer) +- elif issubclass(Dumper,RoundTripDumper):RoundTripRepresenter.add_multi_= representer(data_type,multi_representer) +- else:raise NotImplementedError +-class YAMLObjectMetaclass(type): +- def __init__(cls,name,bases,kwds): +- super(YAMLObjectMetaclass,cls).__init__(name,bases,kwds) +- if _G in kwds and kwds[_G]is not _A:cls.yaml_constructor.add_constructo= r(cls.yaml_tag,cls.from_yaml);cls.yaml_representer.add_representer(cls,cls.= to_yaml) +-class YAMLObject(with_metaclass(YAMLObjectMetaclass)): +- __slots__=3D();yaml_constructor=3DConstructor;yaml_representer=3DReprese= nter;yaml_tag=3D_A;yaml_flow_style=3D_A +- @classmethod +- def from_yaml(cls,constructor,node):return constructor.construct_yaml_ob= ject(node,cls) +- @classmethod +- def to_yaml(cls,representer,data):return representer.represent_yaml_obje= ct(cls.yaml_tag,data,cls,flow_style=3Dcls.yaml_flow_style) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/nodes.py b/dynaconf/vendor/ruamel= /yaml/nodes.py +deleted file mode 100644 +index ffbd8cb..0000000 +--- a/dynaconf/vendor/ruamel/yaml/nodes.py ++++ /dev/null +@@ -1,32 +0,0 @@ +-from __future__ import print_function +-_A=3DNone +-import sys +-from .compat import string_types +-if False:from typing import Dict,Any,Text +-class Node: +- __slots__=3D'tag','value','start_mark','end_mark','comment','anchor' +- def __init__(A,tag,value,start_mark,end_mark,comment=3D_A,anchor=3D_A):A= .tag=3Dtag;A.value=3Dvalue;A.start_mark=3Dstart_mark;A.end_mark=3Dend_mark;= A.comment=3Dcomment;A.anchor=3Danchor +- def __repr__(A):B=3DA.value;B=3Drepr(B);return'%s(tag=3D%r, value=3D%s)'= %(A.__class__.__name__,A.tag,B) +- def dump(A,indent=3D0): +- F=3D' {}comment: {})\n';D=3D' ';B=3Dindent +- if isinstance(A.value,string_types): +- sys.stdout.write('{}{}(tag=3D{!r}, value=3D{!r})\n'.format(D*B,A.__cla= ss__.__name__,A.tag,A.value)) +- if A.comment:sys.stdout.write(F.format(D*B,A.comment)) +- return +- sys.stdout.write('{}{}(tag=3D{!r})\n'.format(D*B,A.__class__.__name__,A= .tag)) +- if A.comment:sys.stdout.write(F.format(D*B,A.comment)) +- for C in A.value: +- if isinstance(C,tuple): +- for E in C:E.dump(B+1) +- elif isinstance(C,Node):C.dump(B+1) +- else:sys.stdout.write('Node value type? {}\n'.format(type(C))) +-class ScalarNode(Node): +- __slots__=3D'style',;id=3D'scalar' +- def __init__(A,tag,value,start_mark=3D_A,end_mark=3D_A,style=3D_A,commen= t=3D_A,anchor=3D_A):Node.__init__(A,tag,value,start_mark,end_mark,comment= =3Dcomment,anchor=3Danchor);A.style=3Dstyle +-class CollectionNode(Node): +- __slots__=3D'flow_style', +- def __init__(A,tag,value,start_mark=3D_A,end_mark=3D_A,flow_style=3D_A,c= omment=3D_A,anchor=3D_A):Node.__init__(A,tag,value,start_mark,end_mark,comm= ent=3Dcomment);A.flow_style=3Dflow_style;A.anchor=3Danchor +-class SequenceNode(CollectionNode):__slots__=3D();id=3D'sequence' +-class MappingNode(CollectionNode): +- __slots__=3D'merge',;id=3D'mapping' +- def __init__(A,tag,value,start_mark=3D_A,end_mark=3D_A,flow_style=3D_A,c= omment=3D_A,anchor=3D_A):CollectionNode.__init__(A,tag,value,start_mark,end= _mark,flow_style,comment,anchor);A.merge=3D_A +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/parser.py b/dynaconf/vendor/ruame= l/yaml/parser.py +deleted file mode 100644 +index 2fc791c..0000000 +--- a/dynaconf/vendor/ruamel/yaml/parser.py ++++ /dev/null +@@ -1,216 +0,0 @@ +-from __future__ import absolute_import +-_F=3D'expected , but found %r' +-_E=3D'typ' +-_D=3D'!' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-from .error import MarkedYAMLError +-from .tokens import * +-from .events import * +-from .scanner import Scanner,RoundTripScanner,ScannerError +-from .compat import utf8,nprint,nprintf +-if _B:from typing import Any,Dict,Optional,List +-__all__=3D['Parser','RoundTripParser','ParserError'] +-class ParserError(MarkedYAMLError):0 +-class Parser: +- DEFAULT_TAGS=3D{_D:_D,'!!':'tag:yaml.org,2002:'} +- def __init__(self,loader): +- self.loader=3Dloader +- if self.loader is not _A and getattr(self.loader,'_parser',_A)is _A:sel= f.loader._parser=3Dself +- self.reset_parser() +- def reset_parser(self):self.current_event=3D_A;self.tag_handles=3D{};sel= f.states=3D[];self.marks=3D[];self.state=3Dself.parse_stream_start +- def dispose(self):self.reset_parser() +- @property +- def scanner(self): +- if hasattr(self.loader,_E):return self.loader.scanner +- return self.loader._scanner +- @property +- def resolver(self): +- if hasattr(self.loader,_E):return self.loader.resolver +- return self.loader._resolver +- def check_event(self,*choices): +- if self.current_event is _A: +- if self.state:self.current_event=3Dself.state() +- if self.current_event is not _A: +- if not choices:return _C +- for choice in choices: +- if isinstance(self.current_event,choice):return _C +- return _B +- def peek_event(self): +- if self.current_event is _A: +- if self.state:self.current_event=3Dself.state() +- return self.current_event +- def get_event(self): +- if self.current_event is _A: +- if self.state:self.current_event=3Dself.state() +- value=3Dself.current_event;self.current_event=3D_A;return value +- def parse_stream_start(self):token=3Dself.scanner.get_token();token.move= _comment(self.scanner.peek_token());event=3DStreamStartEvent(token.start_ma= rk,token.end_mark,encoding=3Dtoken.encoding);self.state=3Dself.parse_implic= it_document_start;return event +- def parse_implicit_document_start(self): +- if not self.scanner.check_token(DirectiveToken,DocumentStartToken,Strea= mEndToken):self.tag_handles=3Dself.DEFAULT_TAGS;token=3Dself.scanner.peek_t= oken();start_mark=3Dend_mark=3Dtoken.start_mark;event=3DDocumentStartEvent(= start_mark,end_mark,explicit=3D_B);self.states.append(self.parse_document_e= nd);self.state=3Dself.parse_block_node;return event +- else:return self.parse_document_start() +- def parse_document_start(self): +- while self.scanner.check_token(DocumentEndToken):self.scanner.get_token= () +- if not self.scanner.check_token(StreamEndToken): +- token=3Dself.scanner.peek_token();start_mark=3Dtoken.start_mark;versio= n,tags=3Dself.process_directives() +- if not self.scanner.check_token(DocumentStartToken):raise ParserError(= _A,_A,"expected '', but found %r"%self.scanner.peek_token()= .id,self.scanner.peek_token().start_mark) +- token=3Dself.scanner.get_token();end_mark=3Dtoken.end_mark;event=3DDoc= umentStartEvent(start_mark,end_mark,explicit=3D_C,version=3Dversion,tags=3D= tags);self.states.append(self.parse_document_end);self.state=3Dself.parse_d= ocument_content +- else:token=3Dself.scanner.get_token();event=3DStreamEndEvent(token.star= t_mark,token.end_mark,comment=3Dtoken.comment);assert not self.states;asser= t not self.marks;self.state=3D_A +- return event +- def parse_document_end(self): +- token=3Dself.scanner.peek_token();start_mark=3Dend_mark=3Dtoken.start_m= ark;explicit=3D_B +- if self.scanner.check_token(DocumentEndToken):token=3Dself.scanner.get_= token();end_mark=3Dtoken.end_mark;explicit=3D_C +- event=3DDocumentEndEvent(start_mark,end_mark,explicit=3Dexplicit) +- if self.resolver.processing_version=3D=3D(1,1):self.state=3Dself.parse_= document_start +- else:self.state=3Dself.parse_implicit_document_start +- return event +- def parse_document_content(self): +- if self.scanner.check_token(DirectiveToken,DocumentStartToken,DocumentE= ndToken,StreamEndToken):event=3Dself.process_empty_scalar(self.scanner.peek= _token().start_mark);self.state=3Dself.states.pop();return event +- else:return self.parse_block_node() +- def process_directives(self): +- yaml_version=3D_A;self.tag_handles=3D{} +- while self.scanner.check_token(DirectiveToken): +- token=3Dself.scanner.get_token() +- if token.name=3D=3D'YAML': +- if yaml_version is not _A:raise ParserError(_A,_A,'found duplicate YA= ML directive',token.start_mark) +- major,minor=3Dtoken.value +- if major!=3D1:raise ParserError(_A,_A,'found incompatible YAML docume= nt (version 1.* is required)',token.start_mark) +- yaml_version=3Dtoken.value +- elif token.name=3D=3D'TAG': +- handle,prefix=3Dtoken.value +- if handle in self.tag_handles:raise ParserError(_A,_A,'duplicate tag = handle %r'%utf8(handle),token.start_mark) +- self.tag_handles[handle]=3Dprefix +- if bool(self.tag_handles):value=3Dyaml_version,self.tag_handles.copy() +- else:value=3Dyaml_version,_A +- if self.loader is not _A and hasattr(self.loader,'tags'): +- self.loader.version=3Dyaml_version +- if self.loader.tags is _A:self.loader.tags=3D{} +- for k in self.tag_handles:self.loader.tags[k]=3Dself.tag_handles[k] +- for key in self.DEFAULT_TAGS: +- if key not in self.tag_handles:self.tag_handles[key]=3Dself.DEFAULT_TA= GS[key] +- return value +- def parse_block_node(self):return self.parse_node(block=3D_C) +- def parse_flow_node(self):return self.parse_node() +- def parse_block_node_or_indentless_sequence(self):return self.parse_node= (block=3D_C,indentless_sequence=3D_C) +- def transform_tag(self,handle,suffix):return self.tag_handles[handle]+su= ffix +- def parse_node(self,block=3D_B,indentless_sequence=3D_B): +- if self.scanner.check_token(AliasToken):token=3Dself.scanner.get_token(= );event=3DAliasEvent(token.value,token.start_mark,token.end_mark);self.stat= e=3Dself.states.pop();return event +- anchor=3D_A;tag=3D_A;start_mark=3Dend_mark=3Dtag_mark=3D_A +- if self.scanner.check_token(AnchorToken): +- token=3Dself.scanner.get_token();start_mark=3Dtoken.start_mark;end_mar= k=3Dtoken.end_mark;anchor=3Dtoken.value +- if self.scanner.check_token(TagToken):token=3Dself.scanner.get_token()= ;tag_mark=3Dtoken.start_mark;end_mark=3Dtoken.end_mark;tag=3Dtoken.value +- elif self.scanner.check_token(TagToken): +- token=3Dself.scanner.get_token();start_mark=3Dtag_mark=3Dtoken.start_m= ark;end_mark=3Dtoken.end_mark;tag=3Dtoken.value +- if self.scanner.check_token(AnchorToken):token=3Dself.scanner.get_toke= n();start_mark=3Dtag_mark=3Dtoken.start_mark;end_mark=3Dtoken.end_mark;anch= or=3Dtoken.value +- if tag is not _A: +- handle,suffix=3Dtag +- if handle is not _A: +- if handle not in self.tag_handles:raise ParserError('while parsing a = node',start_mark,'found undefined tag handle %r'%utf8(handle),tag_mark) +- tag=3Dself.transform_tag(handle,suffix) +- else:tag=3Dsuffix +- if start_mark is _A:start_mark=3Dend_mark=3Dself.scanner.peek_token().s= tart_mark +- event=3D_A;implicit=3Dtag is _A or tag=3D=3D_D +- if indentless_sequence and self.scanner.check_token(BlockEntryToken): +- comment=3D_A;pt=3Dself.scanner.peek_token() +- if pt.comment and pt.comment[0]:comment=3D[pt.comment[0],[]];pt.commen= t[0]=3D_A +- end_mark=3Dself.scanner.peek_token().end_mark;event=3DSequenceStartEve= nt(anchor,tag,implicit,start_mark,end_mark,flow_style=3D_B,comment=3Dcommen= t);self.state=3Dself.parse_indentless_sequence_entry;return event +- if self.scanner.check_token(ScalarToken): +- token=3Dself.scanner.get_token();end_mark=3Dtoken.end_mark +- if token.plain and tag is _A or tag=3D=3D_D:implicit=3D_C,_B +- elif tag is _A:implicit=3D_B,_C +- else:implicit=3D_B,_B +- event=3DScalarEvent(anchor,tag,implicit,token.value,start_mark,end_mar= k,style=3Dtoken.style,comment=3Dtoken.comment);self.state=3Dself.states.pop= () +- elif self.scanner.check_token(FlowSequenceStartToken):pt=3Dself.scanner= .peek_token();end_mark=3Dpt.end_mark;event=3DSequenceStartEvent(anchor,tag,= implicit,start_mark,end_mark,flow_style=3D_C,comment=3Dpt.comment);self.sta= te=3Dself.parse_flow_sequence_first_entry +- elif self.scanner.check_token(FlowMappingStartToken):pt=3Dself.scanner.= peek_token();end_mark=3Dpt.end_mark;event=3DMappingStartEvent(anchor,tag,im= plicit,start_mark,end_mark,flow_style=3D_C,comment=3Dpt.comment);self.state= =3Dself.parse_flow_mapping_first_key +- elif block and self.scanner.check_token(BlockSequenceStartToken): +- end_mark=3Dself.scanner.peek_token().start_mark;pt=3Dself.scanner.peek= _token();comment=3Dpt.comment +- if comment is _A or comment[1]is _A:comment=3Dpt.split_comment() +- event=3DSequenceStartEvent(anchor,tag,implicit,start_mark,end_mark,flo= w_style=3D_B,comment=3Dcomment);self.state=3Dself.parse_block_sequence_firs= t_entry +- elif block and self.scanner.check_token(BlockMappingStartToken):end_mar= k=3Dself.scanner.peek_token().start_mark;comment=3Dself.scanner.peek_token(= ).comment;event=3DMappingStartEvent(anchor,tag,implicit,start_mark,end_mark= ,flow_style=3D_B,comment=3Dcomment);self.state=3Dself.parse_block_mapping_f= irst_key +- elif anchor is not _A or tag is not _A:event=3DScalarEvent(anchor,tag,(= implicit,_B),'',start_mark,end_mark);self.state=3Dself.states.pop() +- else: +- if block:node=3D'block' +- else:node=3D'flow' +- token=3Dself.scanner.peek_token();raise ParserError('while parsing a %= s node'%node,start_mark,'expected the node content, but found %r'%token.id,= token.start_mark) +- return event +- def parse_block_sequence_first_entry(self):token=3Dself.scanner.get_toke= n();self.marks.append(token.start_mark);return self.parse_block_sequence_en= try() +- def parse_block_sequence_entry(self): +- if self.scanner.check_token(BlockEntryToken): +- token=3Dself.scanner.get_token();token.move_comment(self.scanner.peek_= token()) +- if not self.scanner.check_token(BlockEntryToken,BlockEndToken):self.st= ates.append(self.parse_block_sequence_entry);return self.parse_block_node() +- else:self.state=3Dself.parse_block_sequence_entry;return self.process_= empty_scalar(token.end_mark) +- if not self.scanner.check_token(BlockEndToken):token=3Dself.scanner.pee= k_token();raise ParserError('while parsing a block collection',self.marks[-= 1],_F%token.id,token.start_mark) +- token=3Dself.scanner.get_token();event=3DSequenceEndEvent(token.start_m= ark,token.end_mark,comment=3Dtoken.comment);self.state=3Dself.states.pop();= self.marks.pop();return event +- def parse_indentless_sequence_entry(self): +- if self.scanner.check_token(BlockEntryToken): +- token=3Dself.scanner.get_token();token.move_comment(self.scanner.peek_= token()) +- if not self.scanner.check_token(BlockEntryToken,KeyToken,ValueToken,Bl= ockEndToken):self.states.append(self.parse_indentless_sequence_entry);retur= n self.parse_block_node() +- else:self.state=3Dself.parse_indentless_sequence_entry;return self.pro= cess_empty_scalar(token.end_mark) +- token=3Dself.scanner.peek_token();event=3DSequenceEndEvent(token.start_= mark,token.start_mark,comment=3Dtoken.comment);self.state=3Dself.states.pop= ();return event +- def parse_block_mapping_first_key(self):token=3Dself.scanner.get_token()= ;self.marks.append(token.start_mark);return self.parse_block_mapping_key() +- def parse_block_mapping_key(self): +- if self.scanner.check_token(KeyToken): +- token=3Dself.scanner.get_token();token.move_comment(self.scanner.peek_= token()) +- if not self.scanner.check_token(KeyToken,ValueToken,BlockEndToken):sel= f.states.append(self.parse_block_mapping_value);return self.parse_block_nod= e_or_indentless_sequence() +- else:self.state=3Dself.parse_block_mapping_value;return self.process_e= mpty_scalar(token.end_mark) +- if self.resolver.processing_version>(1,1)and self.scanner.check_token(V= alueToken):self.state=3Dself.parse_block_mapping_value;return self.process_= empty_scalar(self.scanner.peek_token().start_mark) +- if not self.scanner.check_token(BlockEndToken):token=3Dself.scanner.pee= k_token();raise ParserError('while parsing a block mapping',self.marks[-1],= _F%token.id,token.start_mark) +- token=3Dself.scanner.get_token();token.move_comment(self.scanner.peek_t= oken());event=3DMappingEndEvent(token.start_mark,token.end_mark,comment=3Dt= oken.comment);self.state=3Dself.states.pop();self.marks.pop();return event +- def parse_block_mapping_value(self): +- if self.scanner.check_token(ValueToken): +- token=3Dself.scanner.get_token() +- if self.scanner.check_token(ValueToken):token.move_comment(self.scanne= r.peek_token()) +- elif not self.scanner.check_token(KeyToken):token.move_comment(self.sc= anner.peek_token(),empty=3D_C) +- if not self.scanner.check_token(KeyToken,ValueToken,BlockEndToken):sel= f.states.append(self.parse_block_mapping_key);return self.parse_block_node_= or_indentless_sequence() +- else: +- self.state=3Dself.parse_block_mapping_key;comment=3Dtoken.comment +- if comment is _A: +- token=3Dself.scanner.peek_token();comment=3Dtoken.comment +- if comment:token._comment=3D[_A,comment[1]];comment=3D[comment[0],_A] +- return self.process_empty_scalar(token.end_mark,comment=3Dcomment) +- else:self.state=3Dself.parse_block_mapping_key;token=3Dself.scanner.pee= k_token();return self.process_empty_scalar(token.start_mark) +- def parse_flow_sequence_first_entry(self):token=3Dself.scanner.get_token= ();self.marks.append(token.start_mark);return self.parse_flow_sequence_entr= y(first=3D_C) +- def parse_flow_sequence_entry(self,first=3D_B): +- if not self.scanner.check_token(FlowSequenceEndToken): +- if not first: +- if self.scanner.check_token(FlowEntryToken):self.scanner.get_token() +- else:token=3Dself.scanner.peek_token();raise ParserError('while parsi= ng a flow sequence',self.marks[-1],"expected ',' or ']', but got %r"%token.= id,token.start_mark) +- if self.scanner.check_token(KeyToken):token=3Dself.scanner.peek_token(= );event=3DMappingStartEvent(_A,_A,_C,token.start_mark,token.end_mark,flow_s= tyle=3D_C);self.state=3Dself.parse_flow_sequence_entry_mapping_key;return e= vent +- elif not self.scanner.check_token(FlowSequenceEndToken):self.states.ap= pend(self.parse_flow_sequence_entry);return self.parse_flow_node() +- token=3Dself.scanner.get_token();event=3DSequenceEndEvent(token.start_m= ark,token.end_mark,comment=3Dtoken.comment);self.state=3Dself.states.pop();= self.marks.pop();return event +- def parse_flow_sequence_entry_mapping_key(self): +- token=3Dself.scanner.get_token() +- if not self.scanner.check_token(ValueToken,FlowEntryToken,FlowSequenceE= ndToken):self.states.append(self.parse_flow_sequence_entry_mapping_value);r= eturn self.parse_flow_node() +- else:self.state=3Dself.parse_flow_sequence_entry_mapping_value;return s= elf.process_empty_scalar(token.end_mark) +- def parse_flow_sequence_entry_mapping_value(self): +- if self.scanner.check_token(ValueToken): +- token=3Dself.scanner.get_token() +- if not self.scanner.check_token(FlowEntryToken,FlowSequenceEndToken):s= elf.states.append(self.parse_flow_sequence_entry_mapping_end);return self.p= arse_flow_node() +- else:self.state=3Dself.parse_flow_sequence_entry_mapping_end;return se= lf.process_empty_scalar(token.end_mark) +- else:self.state=3Dself.parse_flow_sequence_entry_mapping_end;token=3Dse= lf.scanner.peek_token();return self.process_empty_scalar(token.start_mark) +- def parse_flow_sequence_entry_mapping_end(self):self.state=3Dself.parse_= flow_sequence_entry;token=3Dself.scanner.peek_token();return MappingEndEven= t(token.start_mark,token.start_mark) +- def parse_flow_mapping_first_key(self):token=3Dself.scanner.get_token();= self.marks.append(token.start_mark);return self.parse_flow_mapping_key(firs= t=3D_C) +- def parse_flow_mapping_key(self,first=3D_B): +- if not self.scanner.check_token(FlowMappingEndToken): +- if not first: +- if self.scanner.check_token(FlowEntryToken):self.scanner.get_token() +- else:token=3Dself.scanner.peek_token();raise ParserError('while parsi= ng a flow mapping',self.marks[-1],"expected ',' or '}', but got %r"%token.i= d,token.start_mark) +- if self.scanner.check_token(KeyToken): +- token=3Dself.scanner.get_token() +- if not self.scanner.check_token(ValueToken,FlowEntryToken,FlowMapping= EndToken):self.states.append(self.parse_flow_mapping_value);return self.par= se_flow_node() +- else:self.state=3Dself.parse_flow_mapping_value;return self.process_e= mpty_scalar(token.end_mark) +- elif self.resolver.processing_version>(1,1)and self.scanner.check_toke= n(ValueToken):self.state=3Dself.parse_flow_mapping_value;return self.proces= s_empty_scalar(self.scanner.peek_token().end_mark) +- elif not self.scanner.check_token(FlowMappingEndToken):self.states.app= end(self.parse_flow_mapping_empty_value);return self.parse_flow_node() +- token=3Dself.scanner.get_token();event=3DMappingEndEvent(token.start_ma= rk,token.end_mark,comment=3Dtoken.comment);self.state=3Dself.states.pop();s= elf.marks.pop();return event +- def parse_flow_mapping_value(self): +- if self.scanner.check_token(ValueToken): +- token=3Dself.scanner.get_token() +- if not self.scanner.check_token(FlowEntryToken,FlowMappingEndToken):se= lf.states.append(self.parse_flow_mapping_key);return self.parse_flow_node() +- else:self.state=3Dself.parse_flow_mapping_key;return self.process_empt= y_scalar(token.end_mark) +- else:self.state=3Dself.parse_flow_mapping_key;token=3Dself.scanner.peek= _token();return self.process_empty_scalar(token.start_mark) +- def parse_flow_mapping_empty_value(self):self.state=3Dself.parse_flow_ma= pping_key;return self.process_empty_scalar(self.scanner.peek_token().start_= mark) +- def process_empty_scalar(self,mark,comment=3D_A):return ScalarEvent(_A,_= A,(_C,_B),'',mark,mark,comment=3Dcomment) +-class RoundTripParser(Parser): +- def transform_tag(self,handle,suffix): +- if handle=3D=3D'!!'and suffix in('null','bool','int','float','binary','= timestamp','omap','pairs','set','str','seq','map'):return Parser.transform_= tag(self,handle,suffix) +- return handle+suffix +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/py.typed b/dynaconf/vendor/ruamel= /yaml/py.typed +deleted file mode 100644 +index e69de29..0000000 +diff --git a/dynaconf/vendor/ruamel/yaml/reader.py b/dynaconf/vendor/ruame= l/yaml/reader.py +deleted file mode 100644 +index 06bd083..0000000 +--- a/dynaconf/vendor/ruamel/yaml/reader.py ++++ /dev/null +@@ -1,117 +0,0 @@ +-from __future__ import absolute_import +-_F=3D'\ufeff' +-_E=3D'\x00' +-_D=3DFalse +-_C=3D'ascii' +-_B=3D'\n' +-_A=3DNone +-import codecs +-from .error import YAMLError,FileMark,StringMark,YAMLStreamError +-from .compat import text_type,binary_type,PY3,UNICODE_SIZE +-from .util import RegExp +-if _D:from typing import Any,Dict,Optional,List,Union,Text,Tuple,Optional +-__all__=3D['Reader','ReaderError'] +-class ReaderError(YAMLError): +- def __init__(A,name,position,character,encoding,reason):A.name=3Dname;A.= character=3Dcharacter;A.position=3Dposition;A.encoding=3Dencoding;A.reason= =3Dreason +- def __str__(A): +- if isinstance(A.character,binary_type):return'\'%s\' codec can\'t decod= e byte #x%02x: %s\n in "%s", position %d'%(A.encoding,ord(A.character),A.r= eason,A.name,A.position) +- else:return'unacceptable character #x%04x: %s\n in "%s", position %d'%= (A.character,A.reason,A.name,A.position) +-class Reader: +- def __init__(A,stream,loader=3D_A): +- A.loader=3Dloader +- if A.loader is not _A and getattr(A.loader,'_reader',_A)is _A:A.loader.= _reader=3DA +- A.reset_reader();A.stream=3Dstream +- def reset_reader(A):A.name=3D_A;A.stream_pointer=3D0;A.eof=3DTrue;A.buff= er=3D'';A.pointer=3D0;A.raw_buffer=3D_A;A.raw_decode=3D_A;A.encoding=3D_A;A= .index=3D0;A.line=3D0;A.column=3D0 +- @property +- def stream(self): +- try:return self._stream +- except AttributeError:raise YAMLStreamError('input stream needs to spec= ified') +- @stream.setter +- def stream(self,val): +- B=3Dval;A=3Dself +- if B is _A:return +- A._stream=3D_A +- if isinstance(B,text_type):A.name=3D'';A.check_printabl= e(B);A.buffer=3DB+_E +- elif isinstance(B,binary_type):A.name=3D'';A.raw_buffer=3D= B;A.determine_encoding() +- else: +- if not hasattr(B,'read'):raise YAMLStreamError('stream argument needs = to have a read() method') +- A._stream=3DB;A.name=3Dgetattr(A.stream,'name','');A.eof=3D_D;A.= raw_buffer=3D_A;A.determine_encoding() +- def peek(A,index=3D0): +- B=3Dindex +- try:return A.buffer[A.pointer+B] +- except IndexError:A.update(B+1);return A.buffer[A.pointer+B] +- def prefix(A,length=3D1): +- B=3Dlength +- if A.pointer+B>=3Dlen(A.buffer):A.update(B) +- return A.buffer[A.pointer:A.pointer+B] +- def forward_1_1(A,length=3D1): +- B=3Dlength +- if A.pointer+B+1>=3Dlen(A.buffer):A.update(B+1) +- while B!=3D0: +- C=3DA.buffer[A.pointer];A.pointer+=3D1;A.index+=3D1 +- if C in'\n\x85\u2028\u2029'or C=3D=3D'\r'and A.buffer[A.pointer]!=3D_B= :A.line+=3D1;A.column=3D0 +- elif C!=3D_F:A.column+=3D1 +- B-=3D1 +- def forward(A,length=3D1): +- B=3Dlength +- if A.pointer+B+1>=3Dlen(A.buffer):A.update(B+1) +- while B!=3D0: +- C=3DA.buffer[A.pointer];A.pointer+=3D1;A.index+=3D1 +- if C=3D=3D_B or C=3D=3D'\r'and A.buffer[A.pointer]!=3D_B:A.line+=3D1;A= .column=3D0 +- elif C!=3D_F:A.column+=3D1 +- B-=3D1 +- def get_mark(A): +- if A.stream is _A:return StringMark(A.name,A.index,A.line,A.column,A.bu= ffer,A.pointer) +- else:return FileMark(A.name,A.index,A.line,A.column) +- def determine_encoding(A): +- while not A.eof and(A.raw_buffer is _A or len(A.raw_buffer)<2):A.update= _raw() +- if isinstance(A.raw_buffer,binary_type): +- if A.raw_buffer.startswith(codecs.BOM_UTF16_LE):A.raw_decode=3Dcodecs.= utf_16_le_decode;A.encoding=3D'utf-16-le' +- elif A.raw_buffer.startswith(codecs.BOM_UTF16_BE):A.raw_decode=3Dcodec= s.utf_16_be_decode;A.encoding=3D'utf-16-be' +- else:A.raw_decode=3Dcodecs.utf_8_decode;A.encoding=3D'utf-8' +- A.update(1) +- if UNICODE_SIZE=3D=3D2:NON_PRINTABLE=3DRegExp('[^\t\n\r -~\x85\xa0-\ud7f= f\ue000-=EF=BF=BD]') +- else:NON_PRINTABLE=3DRegExp('[^\t\n\r -~\x85\xa0-\ud7ff\ue000-=EF=BF=BD= =F0=90=80=80-\U0010ffff]') +- _printable_ascii=3D('\t\n\r'+''.join(map(chr,range(32,127)))).encode(_C) +- @classmethod +- def _get_non_printable_ascii(D,data): +- A=3Ddata.encode(_C);B=3DA.translate(_A,D._printable_ascii) +- if not B:return _A +- C=3DB[:1];return A.index(C),C.decode(_C) +- @classmethod +- def _get_non_printable_regex(B,data): +- A=3DB.NON_PRINTABLE.search(data) +- if not bool(A):return _A +- return A.start(),A.group() +- @classmethod +- def _get_non_printable(A,data): +- try:return A._get_non_printable_ascii(data) +- except UnicodeEncodeError:return A._get_non_printable_regex(data) +- def check_printable(A,data): +- B=3DA._get_non_printable(data) +- if B is not _A:C,D=3DB;E=3DA.index+(len(A.buffer)-A.pointer)+C;raise Re= aderError(A.name,E,ord(D),'unicode','special characters are not allowed') +- def update(A,length): +- if A.raw_buffer is _A:return +- A.buffer=3DA.buffer[A.pointer:];A.pointer=3D0 +- while len(A.buffer)': +- comment=3Dgetattr(value,_F,_A) +- if comment:comment=3D[_A,[comment]] +- node=3DScalarNode(tag,value,style=3Dstyle,comment=3Dcomment,anchor=3Dan= chor) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- return node +- def represent_sequence(self,tag,sequence,flow_style=3D_A): +- value=3D[];node=3DSequenceNode(tag,value,flow_style=3Dflow_style) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- best_style=3D_B +- for item in sequence: +- node_item=3Dself.represent_data(item) +- if not(isinstance(node_item,ScalarNode)and not node_item.style):best_s= tyle=3D_C +- value.append(node_item) +- if flow_style is _A: +- if self.default_flow_style is not _A:node.flow_style=3Dself.default_fl= ow_style +- else:node.flow_style=3Dbest_style +- return node +- def represent_omap(self,tag,omap,flow_style=3D_A): +- value=3D[];node=3DSequenceNode(tag,value,flow_style=3Dflow_style) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- best_style=3D_B +- for item_key in omap:item_val=3Domap[item_key];node_item=3Dself.represe= nt_data({item_key:item_val});value.append(node_item) +- if flow_style is _A: +- if self.default_flow_style is not _A:node.flow_style=3Dself.default_fl= ow_style +- else:node.flow_style=3Dbest_style +- return node +- def represent_mapping(self,tag,mapping,flow_style=3D_A): +- value=3D[];node=3DMappingNode(tag,value,flow_style=3Dflow_style) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- best_style=3D_B +- if hasattr(mapping,'items'): +- mapping=3Dlist(mapping.items()) +- if self.sort_base_mapping_type_on_output: +- try:mapping=3Dsorted(mapping) +- except TypeError:pass +- for (item_key,item_value) in mapping: +- node_key=3Dself.represent_key(item_key);node_value=3Dself.represent_da= ta(item_value) +- if not(isinstance(node_key,ScalarNode)and not node_key.style):best_sty= le=3D_C +- if not(isinstance(node_value,ScalarNode)and not node_value.style):best= _style=3D_C +- value.append((node_key,node_value)) +- if flow_style is _A: +- if self.default_flow_style is not _A:node.flow_style=3Dself.default_fl= ow_style +- else:node.flow_style=3Dbest_style +- return node +- def ignore_aliases(self,data):return _C +-class SafeRepresenter(BaseRepresenter): +- def ignore_aliases(self,data): +- if data is _A or isinstance(data,tuple)and data=3D=3D():return _B +- if isinstance(data,(binary_type,text_type,bool,int,float)):return _B +- return _C +- def represent_none(self,data):return self.represent_scalar(_L,_T) +- if PY3: +- def represent_str(self,data):return self.represent_scalar(_D,data) +- def represent_binary(self,data): +- if hasattr(base64,'encodebytes'):data=3Dbase64.encodebytes(data).decod= e(_E) +- else:data=3Dbase64.encodestring(data).decode(_E) +- return self.represent_scalar(_M,data,style=3D_J) +- else: +- def represent_str(self,data): +- tag=3D_A;style=3D_A +- try:data=3Dunicode(data,_E);tag=3D_D +- except UnicodeDecodeError: +- try:data=3Dunicode(data,_U);tag=3D_D +- except UnicodeDecodeError:data=3Ddata.encode(_V);tag=3D_M;style=3D_J +- return self.represent_scalar(tag,data,style=3Dstyle) +- def represent_unicode(self,data):return self.represent_scalar(_D,data) +- def represent_bool(self,data,anchor=3D_A): +- try:value=3Dself.dumper.boolean_representation[bool(data)] +- except AttributeError: +- if data:value=3D'true' +- else:value=3D'false' +- return self.represent_scalar('tag:yaml.org,2002:bool',value,anchor=3Dan= chor) +- def represent_int(self,data):return self.represent_scalar(_G,text_type(d= ata)) +- if PY2: +- def represent_long(self,data):return self.represent_scalar(_G,text_type= (data)) +- inf_value=3D1e+300 +- while repr(inf_value)!=3Drepr(inf_value*inf_value):inf_value*=3Dinf_value +- def represent_float(self,data): +- if data!=3Ddata or data=3D=3D_K and data=3D=3D1.0:value=3D_W +- elif data=3D=3Dself.inf_value:value=3D_X +- elif data=3D=3D-self.inf_value:value=3D_Y +- else: +- value=3Dto_unicode(repr(data)).lower() +- if getattr(self.serializer,'use_version',_A)=3D=3D(1,1): +- if _H not in value and'e'in value:value=3Dvalue.replace('e','.0e',1) +- return self.represent_scalar(_N,value) +- def represent_list(self,data):return self.represent_sequence(_O,data) +- def represent_dict(self,data):return self.represent_mapping(_P,data) +- def represent_ordereddict(self,data):return self.represent_omap('tag:yam= l.org,2002:omap',data) +- def represent_set(self,data): +- value=3D{} +- for key in data:value[key]=3D_A +- return self.represent_mapping(_Z,value) +- def represent_date(self,data):value=3Dto_unicode(data.isoformat());retur= n self.represent_scalar(_Q,value) +- def represent_datetime(self,data):value=3Dto_unicode(data.isoformat(' ')= );return self.represent_scalar(_Q,value) +- def represent_yaml_object(self,tag,data,cls,flow_style=3D_A): +- if hasattr(data,_a):state=3Ddata.__getstate__() +- else:state=3Ddata.__dict__.copy() +- return self.represent_mapping(tag,state,flow_style=3Dflow_style) +- def represent_undefined(self,data):raise RepresenterError('cannot repres= ent an object: %s'%(data,)) +-SafeRepresenter.add_representer(type(_A),SafeRepresenter.represent_none) +-SafeRepresenter.add_representer(str,SafeRepresenter.represent_str) +-if PY2:SafeRepresenter.add_representer(unicode,SafeRepresenter.represent_= unicode) +-else:SafeRepresenter.add_representer(bytes,SafeRepresenter.represent_bina= ry) +-SafeRepresenter.add_representer(bool,SafeRepresenter.represent_bool) +-SafeRepresenter.add_representer(int,SafeRepresenter.represent_int) +-if PY2:SafeRepresenter.add_representer(long,SafeRepresenter.represent_lon= g) +-SafeRepresenter.add_representer(float,SafeRepresenter.represent_float) +-SafeRepresenter.add_representer(list,SafeRepresenter.represent_list) +-SafeRepresenter.add_representer(tuple,SafeRepresenter.represent_list) +-SafeRepresenter.add_representer(dict,SafeRepresenter.represent_dict) +-SafeRepresenter.add_representer(set,SafeRepresenter.represent_set) +-SafeRepresenter.add_representer(ordereddict,SafeRepresenter.represent_ord= ereddict) +-if sys.version_info>=3D(2,7):import collections;SafeRepresenter.add_repre= senter(collections.OrderedDict,SafeRepresenter.represent_ordereddict) +-SafeRepresenter.add_representer(datetime.date,SafeRepresenter.represent_d= ate) +-SafeRepresenter.add_representer(datetime.datetime,SafeRepresenter.represe= nt_datetime) +-SafeRepresenter.add_representer(_A,SafeRepresenter.represent_undefined) +-class Representer(SafeRepresenter): +- if PY2: +- def represent_str(self,data): +- tag=3D_A;style=3D_A +- try:data=3Dunicode(data,_E);tag=3D_D +- except UnicodeDecodeError: +- try:data=3Dunicode(data,_U);tag=3D'tag:yaml.org,2002:python/str' +- except UnicodeDecodeError:data=3Ddata.encode(_V);tag=3D_M;style=3D_J +- return self.represent_scalar(tag,data,style=3Dstyle) +- def represent_unicode(self,data): +- tag=3D_A +- try:data.encode(_E);tag=3D'tag:yaml.org,2002:python/unicode' +- except UnicodeEncodeError:tag=3D_D +- return self.represent_scalar(tag,data) +- def represent_long(self,data): +- tag=3D_G +- if int(data)is not data:tag=3D'tag:yaml.org,2002:python/long' +- return self.represent_scalar(tag,to_unicode(data)) +- def represent_complex(self,data): +- if data.imag=3D=3D_K:data=3D'%r'%data.real +- elif data.real=3D=3D_K:data=3D'%rj'%data.imag +- elif data.imag>0:data=3D'%r+%rj'%(data.real,data.imag) +- else:data=3D'%r%rj'%(data.real,data.imag) +- return self.represent_scalar('tag:yaml.org,2002:python/complex',data) +- def represent_tuple(self,data):return self.represent_sequence('tag:yaml.= org,2002:python/tuple',data) +- def represent_name(self,data): +- try:name=3D_I%(data.__module__,data.__qualname__) +- except AttributeError:name=3D_I%(data.__module__,data.__name__) +- return self.represent_scalar('tag:yaml.org,2002:python/name:'+name,'') +- def represent_module(self,data):return self.represent_scalar('tag:yaml.o= rg,2002:python/module:'+data.__name__,'') +- if PY2: +- def represent_instance(self,data): +- cls=3Ddata.__class__;class_name=3D_I%(cls.__module__,cls.__name__);arg= s=3D_A;state=3D_A +- if hasattr(data,'__getinitargs__'):args=3Dlist(data.__getinitargs__()) +- if hasattr(data,_a):state=3Ddata.__getstate__() +- else:state=3Ddata.__dict__ +- if args is _A and isinstance(state,dict):return self.represent_mapping= (_b+class_name,state) +- if isinstance(state,dict)and not state:return self.represent_sequence(= _R+class_name,args) +- value=3D{} +- if bool(args):value[_c]=3Dargs +- value[_d]=3Dstate;return self.represent_mapping(_R+class_name,value) +- def represent_object(self,data): +- cls=3Dtype(data) +- if cls in copyreg.dispatch_table:reduce=3Dcopyreg.dispatch_table[cls](d= ata) +- elif hasattr(data,'__reduce_ex__'):reduce=3Ddata.__reduce_ex__(2) +- elif hasattr(data,'__reduce__'):reduce=3Ddata.__reduce__() +- else:raise RepresenterError('cannot represent object: %r'%(data,)) +- reduce=3D(list(reduce)+[_A]*5)[:5];function,args,state,listitems,dictit= ems=3Dreduce;args=3Dlist(args) +- if state is _A:state=3D{} +- if listitems is not _A:listitems=3Dlist(listitems) +- if dictitems is not _A:dictitems=3Ddict(dictitems) +- if function.__name__=3D=3D'__newobj__':function=3Dargs[0];args=3Dargs[1= :];tag=3D_R;newobj=3D_B +- else:tag=3D'tag:yaml.org,2002:python/object/apply:';newobj=3D_C +- try:function_name=3D_I%(function.__module__,function.__qualname__) +- except AttributeError:function_name=3D_I%(function.__module__,function.= __name__) +- if not args and not listitems and not dictitems and isinstance(state,di= ct)and newobj:return self.represent_mapping(_b+function_name,state) +- if not listitems and not dictitems and isinstance(state,dict)and not st= ate:return self.represent_sequence(tag+function_name,args) +- value=3D{} +- if args:value[_c]=3Dargs +- if state or not isinstance(state,dict):value[_d]=3Dstate +- if listitems:value['listitems']=3Dlistitems +- if dictitems:value['dictitems']=3Ddictitems +- return self.represent_mapping(tag+function_name,value) +-if PY2:Representer.add_representer(str,Representer.represent_str);Represe= nter.add_representer(unicode,Representer.represent_unicode);Representer.add= _representer(long,Representer.represent_long) +-Representer.add_representer(complex,Representer.represent_complex) +-Representer.add_representer(tuple,Representer.represent_tuple) +-Representer.add_representer(type,Representer.represent_name) +-if PY2:Representer.add_representer(types.ClassType,Representer.represent_= name) +-Representer.add_representer(types.FunctionType,Representer.represent_name) +-Representer.add_representer(types.BuiltinFunctionType,Representer.represe= nt_name) +-Representer.add_representer(types.ModuleType,Representer.represent_module) +-if PY2:Representer.add_multi_representer(types.InstanceType,Representer.r= epresent_instance) +-Representer.add_multi_representer(object,Representer.represent_object) +-Representer.add_multi_representer(type,Representer.represent_name) +-from .comments import CommentedMap,CommentedOrderedMap,CommentedSeq,Comme= ntedKeySeq,CommentedKeyMap,CommentedSet,comment_attrib,merge_attrib,TaggedS= calar +-class RoundTripRepresenter(SafeRepresenter): +- def __init__(self,default_style=3D_A,default_flow_style=3D_A,dumper=3D_A= ): +- if not hasattr(dumper,_S)and default_flow_style is _A:default_flow_styl= e=3D_C +- SafeRepresenter.__init__(self,default_style=3Ddefault_style,default_flo= w_style=3Ddefault_flow_style,dumper=3Ddumper) +- def ignore_aliases(self,data): +- try: +- if data.anchor is not _A and data.anchor.value is not _A:return _C +- except AttributeError:pass +- return SafeRepresenter.ignore_aliases(self,data) +- def represent_none(self,data): +- if len(self.represented_objects)=3D=3D0 and not self.serializer.use_exp= licit_start:return self.represent_scalar(_L,_T) +- return self.represent_scalar(_L,'') +- def represent_literal_scalarstring(self,data): +- tag=3D_A;style=3D_J;anchor=3Ddata.yaml_anchor(any=3D_B) +- if PY2 and not isinstance(data,unicode):data=3Dunicode(data,_E) +- tag=3D_D;return self.represent_scalar(tag,data,style=3Dstyle,anchor=3Da= nchor) +- represent_preserved_scalarstring=3Drepresent_literal_scalarstring +- def represent_folded_scalarstring(self,data): +- tag=3D_A;style=3D'>';anchor=3Ddata.yaml_anchor(any=3D_B) +- for fold_pos in reversed(getattr(data,'fold_pos',[])): +- if data[fold_pos]=3D=3D' 'and(fold_pos>0 and not data[fold_pos-1].issp= ace())and(fold_pos0:sl.insert(pos,A);pos-=3Dunderscore[0] +- s=3D''.join(sl) +- if underscore[1]:s=3DA+s +- if underscore[2]:s+=3DA +- return self.represent_scalar(_G,prefix+s,anchor=3Danchor) +- def represent_scalar_int(self,data): +- if data._width is not _A:s=3D'{:0{}d}'.format(data,data._width) +- else:s=3Dformat(data,'d') +- anchor=3Ddata.yaml_anchor(any=3D_B);return self.insert_underscore('',s,= data._underscore,anchor=3Danchor) +- def represent_binary_int(self,data): +- if data._width is not _A:s=3D'{:0{}b}'.format(data,data._width) +- else:s=3Dformat(data,'b') +- anchor=3Ddata.yaml_anchor(any=3D_B);return self.insert_underscore('0b',= s,data._underscore,anchor=3Danchor) +- def represent_octal_int(self,data): +- if data._width is not _A:s=3D'{:0{}o}'.format(data,data._width) +- else:s=3Dformat(data,'o') +- anchor=3Ddata.yaml_anchor(any=3D_B);return self.insert_underscore('0o',= s,data._underscore,anchor=3Danchor) +- def represent_hex_int(self,data): +- if data._width is not _A:s=3D'{:0{}x}'.format(data,data._width) +- else:s=3Dformat(data,'x') +- anchor=3Ddata.yaml_anchor(any=3D_B);return self.insert_underscore('0x',= s,data._underscore,anchor=3Danchor) +- def represent_hex_caps_int(self,data): +- if data._width is not _A:s=3D'{:0{}X}'.format(data,data._width) +- else:s=3Dformat(data,'X') +- anchor=3Ddata.yaml_anchor(any=3D_B);return self.insert_underscore('0x',= s,data._underscore,anchor=3Danchor) +- def represent_scalar_float(self,data): +- C=3D'+';B=3D'{:{}0{}d}';A=3D'0';value=3D_A;anchor=3Ddata.yaml_anchor(an= y=3D_B) +- if data!=3Ddata or data=3D=3D_K and data=3D=3D1.0:value=3D_W +- elif data=3D=3Dself.inf_value:value=3D_X +- elif data=3D=3D-self.inf_value:value=3D_Y +- if value:return self.represent_scalar(_N,value,anchor=3Danchor) +- if data._exp is _A and data._prec>0 and data._prec=3D=3Ddata._width-1:v= alue=3D'{}{:d}.'.format(data._m_sign if data._m_sign else'',abs(int(data))) +- elif data._exp is _A: +- prec=3Ddata._prec;ms=3Ddata._m_sign if data._m_sign else'';value=3D'{}= {:0{}.{}f}'.format(ms,abs(data),data._width-len(ms),data._width-prec-1) +- if prec=3D=3D0 or prec=3D=3D1 and ms!=3D'':value=3Dvalue.replace('0.',= _H) +- while len(value)0 else data._width+1 +- if data<0:w+=3D1 +- m=3Dm[:w];e=3Dint(es);m1,m2=3Dm.split(_H) +- while len(m1)+len(m2)=3D0 else 0):m2+=3DA +- if data._m_sign and data>0:m1=3DC+m1 +- esgn=3DC if data._e_sign else'' +- if data._prec<0: +- if m2!=3DA:e-=3Dlen(m2) +- else:m2=3D'' +- while len(m1)+len(m2)-(1 if data._m_sign else 0)0:m2=3DA*(data._m_lead0-1)+m1+m2;m1=3DA;m2=3Dm2[:-da= ta._m_lead0];e+=3Ddata._m_lead0 +- while len(m1)=3Dlen(node.comment):continue +- nc=3Dnode.comment[idx] +- if nc is not _A:assert val is _A or val=3D=3Dnc;comments[idx]=3Dnc +- node.comment=3Dcomments;return node +- def represent_key(self,data): +- if isinstance(data,CommentedKeySeq):self.alias_key=3D_A;return self.rep= resent_sequence(_O,data,flow_style=3D_B) +- if isinstance(data,CommentedKeyMap):self.alias_key=3D_A;return self.rep= resent_mapping(_P,data,flow_style=3D_B) +- return SafeRepresenter.represent_key(self,data) +- def represent_mapping(self,tag,mapping,flow_style=3D_A): +- value=3D[] +- try:flow_style=3Dmapping.fa.flow_style(flow_style) +- except AttributeError:flow_style=3Dflow_style +- try:anchor=3Dmapping.yaml_anchor() +- except AttributeError:anchor=3D_A +- node=3DMappingNode(tag,value,flow_style=3Dflow_style,anchor=3Danchor) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- best_style=3D_B +- try: +- comment=3Dgetattr(mapping,comment_attrib);node.comment=3Dcomment.comme= nt +- if node.comment and node.comment[1]: +- for ct in node.comment[1]:ct.reset() +- item_comments=3Dcomment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]:ct.reset() +- try:node.comment.append(comment.end) +- except AttributeError:pass +- except AttributeError:item_comments=3D{} +- merge_list=3D[m[1]for m in getattr(mapping,merge_attrib,[])] +- try:merge_pos=3Dgetattr(mapping,merge_attrib,[[0]])[0][0] +- except IndexError:merge_pos=3D0 +- item_count=3D0 +- if bool(merge_list):items=3Dmapping.non_merged_items() +- else:items=3Dmapping.items() +- for (item_key,item_value) in items: +- item_count+=3D1;node_key=3Dself.represent_key(item_key);node_value=3Ds= elf.represent_data(item_value);item_comment=3Ditem_comments.get(item_key) +- if item_comment: +- assert getattr(node_key,_F,_A)is _A;node_key.comment=3Ditem_comment[:= 2];nvc=3Dgetattr(node_value,_F,_A) +- if nvc is not _A:nvc[0]=3Ditem_comment[2];nvc[1]=3Ditem_comment[3] +- else:node_value.comment=3Ditem_comment[2:] +- if not(isinstance(node_key,ScalarNode)and not node_key.style):best_sty= le=3D_C +- if not(isinstance(node_value,ScalarNode)and not node_value.style):best= _style=3D_C +- value.append((node_key,node_value)) +- if flow_style is _A: +- if(item_count!=3D0 or bool(merge_list))and self.default_flow_style is = not _A:node.flow_style=3Dself.default_flow_style +- else:node.flow_style=3Dbest_style +- if bool(merge_list): +- if len(merge_list)=3D=3D1:arg=3Dself.represent_data(merge_list[0]) +- else:arg=3Dself.represent_data(merge_list);arg.flow_style=3D_B +- value.insert(merge_pos,(ScalarNode('tag:yaml.org,2002:merge','<<'),arg= )) +- return node +- def represent_omap(self,tag,omap,flow_style=3D_A): +- value=3D[] +- try:flow_style=3Domap.fa.flow_style(flow_style) +- except AttributeError:flow_style=3Dflow_style +- try:anchor=3Domap.yaml_anchor() +- except AttributeError:anchor=3D_A +- node=3DSequenceNode(tag,value,flow_style=3Dflow_style,anchor=3Danchor) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- best_style=3D_B +- try: +- comment=3Dgetattr(omap,comment_attrib);node.comment=3Dcomment.comment +- if node.comment and node.comment[1]: +- for ct in node.comment[1]:ct.reset() +- item_comments=3Dcomment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]:ct.reset() +- try:node.comment.append(comment.end) +- except AttributeError:pass +- except AttributeError:item_comments=3D{} +- for item_key in omap: +- item_val=3Domap[item_key];node_item=3Dself.represent_data({item_key:it= em_val});item_comment=3Ditem_comments.get(item_key) +- if item_comment: +- if item_comment[1]:node_item.comment=3D[_A,item_comment[1]] +- assert getattr(node_item.value[0][0],_F,_A)is _A;node_item.value[0][0= ].comment=3D[item_comment[0],_A];nvc=3Dgetattr(node_item.value[0][1],_F,_A) +- if nvc is not _A:nvc[0]=3Ditem_comment[2];nvc[1]=3Ditem_comment[3] +- else:node_item.value[0][1].comment=3Ditem_comment[2:] +- value.append(node_item) +- if flow_style is _A: +- if self.default_flow_style is not _A:node.flow_style=3Dself.default_fl= ow_style +- else:node.flow_style=3Dbest_style +- return node +- def represent_set(self,setting): +- flow_style=3D_C;tag=3D_Z;value=3D[];flow_style=3Dsetting.fa.flow_style(= flow_style) +- try:anchor=3Dsetting.yaml_anchor() +- except AttributeError:anchor=3D_A +- node=3DMappingNode(tag,value,flow_style=3Dflow_style,anchor=3Danchor) +- if self.alias_key is not _A:self.represented_objects[self.alias_key]=3D= node +- best_style=3D_B +- try: +- comment=3Dgetattr(setting,comment_attrib);node.comment=3Dcomment.comme= nt +- if node.comment and node.comment[1]: +- for ct in node.comment[1]:ct.reset() +- item_comments=3Dcomment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]:ct.reset() +- try:node.comment.append(comment.end) +- except AttributeError:pass +- except AttributeError:item_comments=3D{} +- for item_key in setting.odict: +- node_key=3Dself.represent_key(item_key);node_value=3Dself.represent_da= ta(_A);item_comment=3Ditem_comments.get(item_key) +- if item_comment:assert getattr(node_key,_F,_A)is _A;node_key.comment= =3Ditem_comment[:2] +- node_key.style=3Dnode_value.style=3D'?' +- if not(isinstance(node_key,ScalarNode)and not node_key.style):best_sty= le=3D_C +- if not(isinstance(node_value,ScalarNode)and not node_value.style):best= _style=3D_C +- value.append((node_key,node_value)) +- best_style=3Dbest_style;return node +- def represent_dict(self,data): +- try:t=3Ddata.tag.value +- except AttributeError:t=3D_A +- if t: +- if t.startswith('!!'):tag=3D_e+t[2:] +- else:tag=3Dt +- else:tag=3D_P +- return self.represent_mapping(tag,data) +- def represent_list(self,data): +- try:t=3Ddata.tag.value +- except AttributeError:t=3D_A +- if t: +- if t.startswith('!!'):tag=3D_e+t[2:] +- else:tag=3Dt +- else:tag=3D_O +- return self.represent_sequence(tag,data) +- def represent_datetime(self,data): +- B=3D'tz';A=3D'delta';inter=3D'T'if data._yaml['t']else' ';_yaml=3Ddata.= _yaml +- if _yaml[A]:data+=3D_yaml[A];value=3Ddata.isoformat(inter) +- else:value=3Ddata.isoformat(inter) +- if _yaml[B]:value+=3D_yaml[B] +- return self.represent_scalar(_Q,to_unicode(value)) +- def represent_tagged_scalar(self,data): +- try:tag=3Ddata.tag.value +- except AttributeError:tag=3D_A +- try:anchor=3Ddata.yaml_anchor() +- except AttributeError:anchor=3D_A +- return self.represent_scalar(tag,data.value,style=3Ddata.style,anchor= =3Danchor) +- def represent_scalar_bool(self,data): +- try:anchor=3Ddata.yaml_anchor() +- except AttributeError:anchor=3D_A +- return SafeRepresenter.represent_bool(self,data,anchor=3Danchor) +-RoundTripRepresenter.add_representer(type(_A),RoundTripRepresenter.repres= ent_none) +-RoundTripRepresenter.add_representer(LiteralScalarString,RoundTripReprese= nter.represent_literal_scalarstring) +-RoundTripRepresenter.add_representer(FoldedScalarString,RoundTripRepresen= ter.represent_folded_scalarstring) +-RoundTripRepresenter.add_representer(SingleQuotedScalarString,RoundTripRe= presenter.represent_single_quoted_scalarstring) +-RoundTripRepresenter.add_representer(DoubleQuotedScalarString,RoundTripRe= presenter.represent_double_quoted_scalarstring) +-RoundTripRepresenter.add_representer(PlainScalarString,RoundTripRepresent= er.represent_plain_scalarstring) +-RoundTripRepresenter.add_representer(ScalarInt,RoundTripRepresenter.repre= sent_scalar_int) +-RoundTripRepresenter.add_representer(BinaryInt,RoundTripRepresenter.repre= sent_binary_int) +-RoundTripRepresenter.add_representer(OctalInt,RoundTripRepresenter.repres= ent_octal_int) +-RoundTripRepresenter.add_representer(HexInt,RoundTripRepresenter.represen= t_hex_int) +-RoundTripRepresenter.add_representer(HexCapsInt,RoundTripRepresenter.repr= esent_hex_caps_int) +-RoundTripRepresenter.add_representer(ScalarFloat,RoundTripRepresenter.rep= resent_scalar_float) +-RoundTripRepresenter.add_representer(ScalarBoolean,RoundTripRepresenter.r= epresent_scalar_bool) +-RoundTripRepresenter.add_representer(CommentedSeq,RoundTripRepresenter.re= present_list) +-RoundTripRepresenter.add_representer(CommentedMap,RoundTripRepresenter.re= present_dict) +-RoundTripRepresenter.add_representer(CommentedOrderedMap,RoundTripReprese= nter.represent_ordereddict) +-if sys.version_info>=3D(2,7):import collections;RoundTripRepresenter.add_= representer(collections.OrderedDict,RoundTripRepresenter.represent_orderedd= ict) +-RoundTripRepresenter.add_representer(CommentedSet,RoundTripRepresenter.re= present_set) +-RoundTripRepresenter.add_representer(TaggedScalar,RoundTripRepresenter.re= present_tagged_scalar) +-RoundTripRepresenter.add_representer(TimeStamp,RoundTripRepresenter.repre= sent_datetime) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/resolver.py b/dynaconf/vendor/rua= mel/yaml/resolver.py +deleted file mode 100644 +index 7377ca5..0000000 +--- a/dynaconf/vendor/ruamel/yaml/resolver.py ++++ /dev/null +@@ -1,160 +0,0 @@ +-from __future__ import absolute_import +-_J=3D'yaml_implicit_resolvers' +-_I=3D'typ' +-_H=3D'-+0123456789' +-_G=3D'tag:yaml.org,2002:int' +-_F=3D'-+0123456789.' +-_E=3D'tag:yaml.org,2002:float' +-_D=3D'tag:yaml.org,2002:bool' +-_C=3DTrue +-_B=3DFalse +-_A=3DNone +-import re +-if _B:from typing import Any,Dict,List,Union,Text,Optional;from .compat i= mport VersionType +-from .compat import string_types,_DEFAULT_YAML_VERSION +-from .error import * +-from .nodes import MappingNode,ScalarNode,SequenceNode +-from .util import RegExp +-__all__=3D['BaseResolver','Resolver','VersionedResolver'] +-implicit_resolvers=3D[([(1,2)],_D,RegExp('^(?:true|True|TRUE|false|False|= FALSE)$',re.X),list('tTfF')),([(1,1)],_D,RegExp('^(?:y|Y|yes|Yes|YES|n|N|no= |No|NO\n |true|True|TRUE|false|False|FALSE\n |on|On|ON|off|Of= f|OFF)$',re.X),list('yYnNtTfFoO')),([(1,2)],_E,RegExp('^(?:\n [-+]?= (?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)?\n |[-+]?(?:[0-9][0-9_= ]*)(?:[eE][-+]?[0-9]+)\n |[-+]?\\.[0-9_]+(?:[eE][-+][0-9]+)?\n = |[-+]?\\.(?:inf|Inf|INF)\n |\\.(?:nan|NaN|NAN))$',re.X),list(_F)),= ([(1,1)],_E,RegExp('^(?:\n [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-= +]?[0-9]+)?\n |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+)\n |\\= .[0-9_]+(?:[eE][-+][0-9]+)?\n |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.= [0-9_]* # sexagesimal float\n |[-+]?\\.(?:inf|Inf|INF)\n |\\= .(?:nan|NaN|NAN))$',re.X),list(_F)),([(1,2)],_G,RegExp('^(?:[-+]?0b[0-1_]+\= n |[-+]?0o?[0-7_]+\n |[-+]?[0-9_]+\n |[-+]?0x[0-9a-fA-= F_]+)$',re.X),list(_H)),([(1,1)],_G,RegExp('^(?:[-+]?0b[0-1_]+\n |[-= +]?0?[0-7_]+\n |[-+]?(?:0|[1-9][0-9_]*)\n |[-+]?0x[0-9a-fA-F_= ]+\n |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$',re.X),list(_H)),([(1,2),= (1,1)],'tag:yaml.org,2002:merge',RegExp('^(?:<<)$'),['<']),([(1,2),(1,1)],'= tag:yaml.org,2002:null',RegExp('^(?: ~\n |null|Null|NULL\n | = )$',re.X),['~','n','N','']),([(1,2),(1,1)],'tag:yaml.org,2002:timestamp',Re= gExp('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n |[0-9][0-9][0= -9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n (?:[Tt]|[ \\t]+)[0-9][0-9]?\n = :[0-9][0-9] :[0-9][0-9] (?:\\.[0-9]*)?\n (?:[ \\t]*(?:Z|[-+][0= -9][0-9]?(?::[0-9][0-9])?))?)$',re.X),list('0123456789')),([(1,2),(1,1)],'t= ag:yaml.org,2002:value',RegExp('^(?:=3D)$'),['=3D']),([(1,2),(1,1)],'tag:ya= ml.org,2002:yaml',RegExp('^(?:!|&|\\*)$'),list('!&*'))] +-class ResolverError(YAMLError):0 +-class BaseResolver: +- DEFAULT_SCALAR_TAG=3D'tag:yaml.org,2002:str';DEFAULT_SEQUENCE_TAG=3D'tag= :yaml.org,2002:seq';DEFAULT_MAPPING_TAG=3D'tag:yaml.org,2002:map';yaml_impl= icit_resolvers=3D{};yaml_path_resolvers=3D{} +- def __init__(self,loadumper=3D_A): +- self.loadumper=3Dloadumper +- if self.loadumper is not _A and getattr(self.loadumper,'_resolver',_A)i= s _A:self.loadumper._resolver=3Dself.loadumper +- self._loader_version=3D_A;self.resolver_exact_paths=3D[];self.resolver_= prefix_paths=3D[] +- @property +- def parser(self): +- if self.loadumper is not _A: +- if hasattr(self.loadumper,_I):return self.loadumper.parser +- return self.loadumper._parser +- return _A +- @classmethod +- def add_implicit_resolver_base(cls,tag,regexp,first): +- if _J not in cls.__dict__:cls.yaml_implicit_resolvers=3Ddict(((k,cls.ya= ml_implicit_resolvers[k][:])for k in cls.yaml_implicit_resolvers)) +- if first is _A:first=3D[_A] +- for ch in first:cls.yaml_implicit_resolvers.setdefault(ch,[]).append((t= ag,regexp)) +- @classmethod +- def add_implicit_resolver(cls,tag,regexp,first): +- if _J not in cls.__dict__:cls.yaml_implicit_resolvers=3Ddict(((k,cls.ya= ml_implicit_resolvers[k][:])for k in cls.yaml_implicit_resolvers)) +- if first is _A:first=3D[_A] +- for ch in first:cls.yaml_implicit_resolvers.setdefault(ch,[]).append((t= ag,regexp)) +- implicit_resolvers.append(([(1,2),(1,1)],tag,regexp,first)) +- @classmethod +- def add_path_resolver(cls,tag,path,kind=3D_A): +- if'yaml_path_resolvers'not in cls.__dict__:cls.yaml_path_resolvers=3Dcl= s.yaml_path_resolvers.copy() +- new_path=3D[] +- for element in path: +- if isinstance(element,(list,tuple)): +- if len(element)=3D=3D2:node_check,index_check=3Delement +- elif len(element)=3D=3D1:node_check=3Delement[0];index_check=3D_C +- else:raise ResolverError('Invalid path element: %s'%(element,)) +- else:node_check=3D_A;index_check=3Delement +- if node_check is str:node_check=3DScalarNode +- elif node_check is list:node_check=3DSequenceNode +- elif node_check is dict:node_check=3DMappingNode +- elif node_check not in[ScalarNode,SequenceNode,MappingNode]and not isi= nstance(node_check,string_types)and node_check is not _A:raise ResolverErro= r('Invalid node checker: %s'%(node_check,)) +- if not isinstance(index_check,(string_types,int))and index_check is no= t _A:raise ResolverError('Invalid index checker: %s'%(index_check,)) +- new_path.append((node_check,index_check)) +- if kind is str:kind=3DScalarNode +- elif kind is list:kind=3DSequenceNode +- elif kind is dict:kind=3DMappingNode +- elif kind not in[ScalarNode,SequenceNode,MappingNode]and kind is not _A= :raise ResolverError('Invalid node kind: %s'%(kind,)) +- cls.yaml_path_resolvers[tuple(new_path),kind]=3Dtag +- def descend_resolver(self,current_node,current_index): +- if not self.yaml_path_resolvers:return +- exact_paths=3D{};prefix_paths=3D[] +- if current_node: +- depth=3Dlen(self.resolver_prefix_paths) +- for (path,kind) in self.resolver_prefix_paths[-1]: +- if self.check_resolver_prefix(depth,path,kind,current_node,current_in= dex): +- if len(path)>depth:prefix_paths.append((path,kind)) +- else:exact_paths[kind]=3Dself.yaml_path_resolvers[path,kind] +- else: +- for (path,kind) in self.yaml_path_resolvers: +- if not path:exact_paths[kind]=3Dself.yaml_path_resolvers[path,kind] +- else:prefix_paths.append((path,kind)) +- self.resolver_exact_paths.append(exact_paths);self.resolver_prefix_path= s.append(prefix_paths) +- def ascend_resolver(self): +- if not self.yaml_path_resolvers:return +- self.resolver_exact_paths.pop();self.resolver_prefix_paths.pop() +- def check_resolver_prefix(self,depth,path,kind,current_node,current_inde= x): +- node_check,index_check=3Dpath[depth-1] +- if isinstance(node_check,string_types): +- if current_node.tag!=3Dnode_check:return _B +- elif node_check is not _A: +- if not isinstance(current_node,node_check):return _B +- if index_check is _C and current_index is not _A:return _B +- if(index_check is _B or index_check is _A)and current_index is _A:retur= n _B +- if isinstance(index_check,string_types): +- if not(isinstance(current_index,ScalarNode)and index_check=3D=3Dcurren= t_index.value):return _B +- elif isinstance(index_check,int)and not isinstance(index_check,bool): +- if index_check!=3Dcurrent_index:return _B +- return _C +- def resolve(self,kind,value,implicit): +- if kind is ScalarNode and implicit[0]: +- if value=3D=3D'':resolvers=3Dself.yaml_implicit_resolvers.get('',[]) +- else:resolvers=3Dself.yaml_implicit_resolvers.get(value[0],[]) +- resolvers+=3Dself.yaml_implicit_resolvers.get(_A,[]) +- for (tag,regexp) in resolvers: +- if regexp.match(value):return tag +- implicit=3Dimplicit[1] +- if bool(self.yaml_path_resolvers): +- exact_paths=3Dself.resolver_exact_paths[-1] +- if kind in exact_paths:return exact_paths[kind] +- if _A in exact_paths:return exact_paths[_A] +- if kind is ScalarNode:return self.DEFAULT_SCALAR_TAG +- elif kind is SequenceNode:return self.DEFAULT_SEQUENCE_TAG +- elif kind is MappingNode:return self.DEFAULT_MAPPING_TAG +- @property +- def processing_version(self):return _A +-class Resolver(BaseResolver):0 +-for ir in implicit_resolvers: +- if(1,2)in ir[0]:Resolver.add_implicit_resolver_base(*ir[1:]) +-class VersionedResolver(BaseResolver): +- def __init__(self,version=3D_A,loader=3D_A,loadumper=3D_A): +- if loader is _A and loadumper is not _A:loader=3Dloadumper +- BaseResolver.__init__(self,loader);self._loader_version=3Dself.get_load= er_version(version);self._version_implicit_resolver=3D{} +- def add_version_implicit_resolver(self,version,tag,regexp,first): +- if first is _A:first=3D[_A] +- impl_resolver=3Dself._version_implicit_resolver.setdefault(version,{}) +- for ch in first:impl_resolver.setdefault(ch,[]).append((tag,regexp)) +- def get_loader_version(self,version): +- if version is _A or isinstance(version,tuple):return version +- if isinstance(version,list):return tuple(version) +- return tuple(map(int,version.split('.'))) +- @property +- def versioned_resolver(self): +- version=3Dself.processing_version +- if version not in self._version_implicit_resolver: +- for x in implicit_resolvers: +- if version in x[0]:self.add_version_implicit_resolver(version,x[1],x[= 2],x[3]) +- return self._version_implicit_resolver[version] +- def resolve(self,kind,value,implicit): +- if kind is ScalarNode and implicit[0]: +- if value=3D=3D'':resolvers=3Dself.versioned_resolver.get('',[]) +- else:resolvers=3Dself.versioned_resolver.get(value[0],[]) +- resolvers+=3Dself.versioned_resolver.get(_A,[]) +- for (tag,regexp) in resolvers: +- if regexp.match(value):return tag +- implicit=3Dimplicit[1] +- if bool(self.yaml_path_resolvers): +- exact_paths=3Dself.resolver_exact_paths[-1] +- if kind in exact_paths:return exact_paths[kind] +- if _A in exact_paths:return exact_paths[_A] +- if kind is ScalarNode:return self.DEFAULT_SCALAR_TAG +- elif kind is SequenceNode:return self.DEFAULT_SEQUENCE_TAG +- elif kind is MappingNode:return self.DEFAULT_MAPPING_TAG +- @property +- def processing_version(self): +- try:version=3Dself.loadumper._scanner.yaml_version +- except AttributeError: +- try: +- if hasattr(self.loadumper,_I):version=3Dself.loadumper.version +- else:version=3Dself.loadumper._serializer.use_version +- except AttributeError:version=3D_A +- if version is _A: +- version=3Dself._loader_version +- if version is _A:version=3D_DEFAULT_YAML_VERSION +- return version +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/scalarbool.py b/dynaconf/vendor/r= uamel/yaml/scalarbool.py +deleted file mode 100644 +index 84c7cc2..0000000 +--- a/dynaconf/vendor/ruamel/yaml/scalarbool.py ++++ /dev/null +@@ -1,21 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_B=3DFalse +-_A=3DNone +-from .anchor import Anchor +-if _B:from typing import Text,Any,Dict,List +-__all__=3D['ScalarBoolean'] +-class ScalarBoolean(int): +- def __new__(D,*E,**A): +- B=3DA.pop('anchor',_A);C=3Dint.__new__(D,*E,**A) +- if B is not _A:C.yaml_set_anchor(B,always_dump=3DTrue) +- return C +- @property +- def anchor(self): +- A=3Dself +- if not hasattr(A,Anchor.attrib):setattr(A,Anchor.attrib,Anchor()) +- return getattr(A,Anchor.attrib) +- def yaml_anchor(A,any=3D_B): +- if not hasattr(A,Anchor.attrib):return _A +- if any or A.anchor.always_dump:return A.anchor +- return _A +- def yaml_set_anchor(A,value,always_dump=3D_B):A.anchor.value=3Dvalue;A.a= nchor.always_dump=3Dalways_dump +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/scalarfloat.py b/dynaconf/vendor/= ruamel/yaml/scalarfloat.py +deleted file mode 100644 +index fab3a1b..0000000 +--- a/dynaconf/vendor/ruamel/yaml/scalarfloat.py ++++ /dev/null +@@ -1,33 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_B=3DFalse +-_A=3DNone +-import sys +-from .compat import no_limit_int +-from .anchor import Anchor +-if _B:from typing import Text,Any,Dict,List +-__all__=3D['ScalarFloat','ExponentialFloat','ExponentialCapsFloat'] +-class ScalarFloat(float): +- def __new__(D,*E,**A): +- F=3DA.pop('width',_A);G=3DA.pop('prec',_A);H=3DA.pop('m_sign',_A);I=3DA= .pop('m_lead0',0);J=3DA.pop('exp',_A);K=3DA.pop('e_width',_A);L=3DA.pop('e_= sign',_A);M=3DA.pop('underscore',_A);C=3DA.pop('anchor',_A);B=3Dfloat.__new= __(D,*E,**A);B._width=3DF;B._prec=3DG;B._m_sign=3DH;B._m_lead0=3DI;B._exp= =3DJ;B._e_width=3DK;B._e_sign=3DL;B._underscore=3DM +- if C is not _A:B.yaml_set_anchor(C,always_dump=3DTrue) +- return B +- def __iadd__(A,a):return float(A)+a;B=3Dtype(A)(A+a);B._width=3DA._width= ;B._underscore=3DA._underscore[:]if A._underscore is not _A else _A;return B +- def __ifloordiv__(A,a):return float(A)//a;B=3Dtype(A)(A//a);B._width=3DA= ._width;B._underscore=3DA._underscore[:]if A._underscore is not _A else _A;= return B +- def __imul__(A,a):return float(A)*a;B=3Dtype(A)(A*a);B._width=3DA._width= ;B._underscore=3DA._underscore[:]if A._underscore is not _A else _A;B._prec= =3DA._prec;return B +- def __ipow__(A,a):return float(A)**a;B=3Dtype(A)(A**a);B._width=3DA._wid= th;B._underscore=3DA._underscore[:]if A._underscore is not _A else _A;retur= n B +- def __isub__(A,a):return float(A)-a;B=3Dtype(A)(A-a);B._width=3DA._width= ;B._underscore=3DA._underscore[:]if A._underscore is not _A else _A;return B +- @property +- def anchor(self): +- A=3Dself +- if not hasattr(A,Anchor.attrib):setattr(A,Anchor.attrib,Anchor()) +- return getattr(A,Anchor.attrib) +- def yaml_anchor(A,any=3D_B): +- if not hasattr(A,Anchor.attrib):return _A +- if any or A.anchor.always_dump:return A.anchor +- return _A +- def yaml_set_anchor(A,value,always_dump=3D_B):A.anchor.value=3Dvalue;A.a= nchor.always_dump=3Dalways_dump +- def dump(A,out=3Dsys.stdout):out.write('ScalarFloat({}| w:{}, p:{}, s:{}= , lz:{}, _:{}|{}, w:{}, s:{})\n'.format(A,A._width,A._prec,A._m_sign,A._m_l= ead0,A._underscore,A._exp,A._e_width,A._e_sign)) +-class ExponentialFloat(ScalarFloat): +- def __new__(A,value,width=3D_A,underscore=3D_A):return ScalarFloat.__new= __(A,value,width=3Dwidth,underscore=3Dunderscore) +-class ExponentialCapsFloat(ScalarFloat): +- def __new__(A,value,width=3D_A,underscore=3D_A):return ScalarFloat.__new= __(A,value,width=3Dwidth,underscore=3Dunderscore) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/scalarint.py b/dynaconf/vendor/ru= amel/yaml/scalarint.py +deleted file mode 100644 +index e61b7eb..0000000 +--- a/dynaconf/vendor/ruamel/yaml/scalarint.py ++++ /dev/null +@@ -1,37 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_B=3DFalse +-_A=3DNone +-from .compat import no_limit_int +-from .anchor import Anchor +-if _B:from typing import Text,Any,Dict,List +-__all__=3D['ScalarInt','BinaryInt','OctalInt','HexInt','HexCapsInt','Deci= malInt'] +-class ScalarInt(no_limit_int): +- def __new__(D,*E,**A): +- F=3DA.pop('width',_A);G=3DA.pop('underscore',_A);C=3DA.pop('anchor',_A)= ;B=3Dno_limit_int.__new__(D,*E,**A);B._width=3DF;B._underscore=3DG +- if C is not _A:B.yaml_set_anchor(C,always_dump=3DTrue) +- return B +- def __iadd__(A,a):B=3Dtype(A)(A+a);B._width=3DA._width;B._underscore=3DA= ._underscore[:]if A._underscore is not _A else _A;return B +- def __ifloordiv__(A,a):B=3Dtype(A)(A//a);B._width=3DA._width;B._undersco= re=3DA._underscore[:]if A._underscore is not _A else _A;return B +- def __imul__(A,a):B=3Dtype(A)(A*a);B._width=3DA._width;B._underscore=3DA= ._underscore[:]if A._underscore is not _A else _A;return B +- def __ipow__(A,a):B=3Dtype(A)(A**a);B._width=3DA._width;B._underscore=3D= A._underscore[:]if A._underscore is not _A else _A;return B +- def __isub__(A,a):B=3Dtype(A)(A-a);B._width=3DA._width;B._underscore=3DA= ._underscore[:]if A._underscore is not _A else _A;return B +- @property +- def anchor(self): +- A=3Dself +- if not hasattr(A,Anchor.attrib):setattr(A,Anchor.attrib,Anchor()) +- return getattr(A,Anchor.attrib) +- def yaml_anchor(A,any=3D_B): +- if not hasattr(A,Anchor.attrib):return _A +- if any or A.anchor.always_dump:return A.anchor +- return _A +- def yaml_set_anchor(A,value,always_dump=3D_B):A.anchor.value=3Dvalue;A.a= nchor.always_dump=3Dalways_dump +-class BinaryInt(ScalarInt): +- def __new__(A,value,width=3D_A,underscore=3D_A,anchor=3D_A):return Scala= rInt.__new__(A,value,width=3Dwidth,underscore=3Dunderscore,anchor=3Danchor) +-class OctalInt(ScalarInt): +- def __new__(A,value,width=3D_A,underscore=3D_A,anchor=3D_A):return Scala= rInt.__new__(A,value,width=3Dwidth,underscore=3Dunderscore,anchor=3Danchor) +-class HexInt(ScalarInt): +- def __new__(A,value,width=3D_A,underscore=3D_A,anchor=3D_A):return Scala= rInt.__new__(A,value,width=3Dwidth,underscore=3Dunderscore,anchor=3Danchor) +-class HexCapsInt(ScalarInt): +- def __new__(A,value,width=3D_A,underscore=3D_A,anchor=3D_A):return Scala= rInt.__new__(A,value,width=3Dwidth,underscore=3Dunderscore,anchor=3Danchor) +-class DecimalInt(ScalarInt): +- def __new__(A,value,width=3D_A,underscore=3D_A,anchor=3D_A):return Scala= rInt.__new__(A,value,width=3Dwidth,underscore=3Dunderscore,anchor=3Danchor) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/scalarstring.py b/dynaconf/vendor= /ruamel/yaml/scalarstring.py +deleted file mode 100644 +index 53b9c39..0000000 +--- a/dynaconf/vendor/ruamel/yaml/scalarstring.py ++++ /dev/null +@@ -1,59 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_D=3D'comment' +-_C=3D'\n' +-_B=3DFalse +-_A=3DNone +-from .compat import text_type +-from .anchor import Anchor +-if _B:from typing import Text,Any,Dict,List +-__all__=3D['ScalarString','LiteralScalarString','FoldedScalarString','Sin= gleQuotedScalarString','DoubleQuotedScalarString','PlainScalarString','Pres= ervedScalarString'] +-class ScalarString(text_type): +- __slots__=3DAnchor.attrib +- def __new__(D,*E,**A): +- B=3DA.pop('anchor',_A);C=3Dtext_type.__new__(D,*E,**A) +- if B is not _A:C.yaml_set_anchor(B,always_dump=3DTrue) +- return C +- def replace(A,old,new,maxreplace=3D-1):return type(A)(text_type.replace(= A,old,new,maxreplace)) +- @property +- def anchor(self): +- A=3Dself +- if not hasattr(A,Anchor.attrib):setattr(A,Anchor.attrib,Anchor()) +- return getattr(A,Anchor.attrib) +- def yaml_anchor(A,any=3D_B): +- if not hasattr(A,Anchor.attrib):return _A +- if any or A.anchor.always_dump:return A.anchor +- return _A +- def yaml_set_anchor(A,value,always_dump=3D_B):A.anchor.value=3Dvalue;A.a= nchor.always_dump=3Dalways_dump +-class LiteralScalarString(ScalarString): +- __slots__=3D_D;style=3D'|' +- def __new__(A,value,anchor=3D_A):return ScalarString.__new__(A,value,anc= hor=3Danchor) +-PreservedScalarString=3DLiteralScalarString +-class FoldedScalarString(ScalarString): +- __slots__=3D'fold_pos',_D;style=3D'>' +- def __new__(A,value,anchor=3D_A):return ScalarString.__new__(A,value,anc= hor=3Danchor) +-class SingleQuotedScalarString(ScalarString): +- __slots__=3D();style=3D"'" +- def __new__(A,value,anchor=3D_A):return ScalarString.__new__(A,value,anc= hor=3Danchor) +-class DoubleQuotedScalarString(ScalarString): +- __slots__=3D();style=3D'"' +- def __new__(A,value,anchor=3D_A):return ScalarString.__new__(A,value,anc= hor=3Danchor) +-class PlainScalarString(ScalarString): +- __slots__=3D();style=3D'' +- def __new__(A,value,anchor=3D_A):return ScalarString.__new__(A,value,anc= hor=3Danchor) +-def preserve_literal(s):return LiteralScalarString(s.replace('\r\n',_C).r= eplace('\r',_C)) +-def walk_tree(base,map=3D_A): +- A=3Dbase;from dynaconf.vendor.ruamel.yaml.compat import string_types as = E,MutableMapping as G,MutableSequence as H +- if map is _A:map=3D{_C:preserve_literal} +- if isinstance(A,G): +- for F in A: +- C=3DA[F] +- if isinstance(C,E): +- for B in map: +- if B in C:A[F]=3Dmap[B](C);break +- else:walk_tree(C) +- elif isinstance(A,H): +- for (I,D) in enumerate(A): +- if isinstance(D,E): +- for B in map: +- if B in D:A[I]=3Dmap[B](D);break +- else:walk_tree(D) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/scanner.py b/dynaconf/vendor/ruam= el/yaml/scanner.py +deleted file mode 100644 +index dfbd1b4..0000000 +--- a/dynaconf/vendor/ruamel/yaml/scanner.py ++++ /dev/null +@@ -1,602 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_o=3D'\u2028\u2029' +-_n=3D'\r\n' +-_m=3D'\r\n\x85' +-_l=3D'while scanning a quoted scalar' +-_k=3D'0123456789ABCDEFabcdef' +-_j=3D' \r\n\x85\u2028\u2029' +-_i=3D'\x07' +-_h=3D'expected a comment or a line break, but found %r' +-_g=3D'directive' +-_f=3D'\ufeff' +-_e=3D"could not find expected ':'" +-_d=3D'while scanning a simple key' +-_c=3D'typ' +-_b=3D'\\' +-_a=3D'\t' +-_Z=3D"expected ' ', but found %r" +-_Y=3D'while scanning a %s' +-_X=3D'\r\n\x85\u2028\u2029' +-_W=3D'while scanning a block scalar' +-_V=3D'expected alphabetic or numeric character, but found %r' +-_U=3D'a' +-_T=3D'...' +-_S=3D'---' +-_R=3D'>' +-_Q=3D'9' +-_P=3D'"' +-_O=3D':' +-_N=3D'-' +-_M=3D' \t' +-_L=3D'\x00 \r\n\x85\u2028\u2029' +-_K=3D'0' +-_J=3D"'" +-_I=3D'\x00' +-_H=3D'!' +-_G=3D'while scanning a directive' +-_F=3D'#' +-_E=3D'\n' +-_D=3D' ' +-_C=3DNone +-_B=3DFalse +-_A=3DTrue +-from .error import MarkedYAMLError +-from .tokens import * +-from .compat import utf8,unichr,PY3,check_anchorname_char,nprint +-if _B:from typing import Any,Dict,Optional,List,Union,Text;from .compat i= mport VersionType +-__all__=3D['Scanner','RoundTripScanner','ScannerError'] +-_THE_END=3D'\n\x00\r\x85\u2028\u2029' +-_THE_END_SPACE_TAB=3D' \n\x00\t\r\x85\u2028\u2029' +-_SPACE_TAB=3D_M +-class ScannerError(MarkedYAMLError):0 +-class SimpleKey: +- def __init__(self,token_number,required,index,line,column,mark):self.tok= en_number=3Dtoken_number;self.required=3Drequired;self.index=3Dindex;self.l= ine=3Dline;self.column=3Dcolumn;self.mark=3Dmark +-class Scanner: +- def __init__(self,loader=3D_C): +- self.loader=3Dloader +- if self.loader is not _C and getattr(self.loader,'_scanner',_C)is _C:se= lf.loader._scanner=3Dself +- self.reset_scanner();self.first_time=3D_B;self.yaml_version=3D_C +- @property +- def flow_level(self):return len(self.flow_context) +- def reset_scanner(self):self.done=3D_B;self.flow_context=3D[];self.token= s=3D[];self.fetch_stream_start();self.tokens_taken=3D0;self.indent=3D-1;sel= f.indents=3D[];self.allow_simple_key=3D_A;self.possible_simple_keys=3D{} +- @property +- def reader(self): +- try:return self._scanner_reader +- except AttributeError: +- if hasattr(self.loader,_c):self._scanner_reader=3Dself.loader.reader +- else:self._scanner_reader=3Dself.loader._reader +- return self._scanner_reader +- @property +- def scanner_processing_version(self): +- if hasattr(self.loader,_c):return self.loader.resolver.processing_versi= on +- return self.loader.processing_version +- def check_token(self,*choices): +- while self.need_more_tokens():self.fetch_more_tokens() +- if bool(self.tokens): +- if not choices:return _A +- for choice in choices: +- if isinstance(self.tokens[0],choice):return _A +- return _B +- def peek_token(self): +- while self.need_more_tokens():self.fetch_more_tokens() +- if bool(self.tokens):return self.tokens[0] +- def get_token(self): +- while self.need_more_tokens():self.fetch_more_tokens() +- if bool(self.tokens):self.tokens_taken+=3D1;return self.tokens.pop(0) +- def need_more_tokens(self): +- if self.done:return _B +- if not self.tokens:return _A +- self.stale_possible_simple_keys() +- if self.next_possible_simple_key()=3D=3Dself.tokens_taken:return _A +- return _B +- def fetch_comment(self,comment):raise NotImplementedError +- def fetch_more_tokens(self): +- comment=3Dself.scan_to_next_token() +- if comment is not _C:return self.fetch_comment(comment) +- self.stale_possible_simple_keys();self.unwind_indent(self.reader.column= );ch=3Dself.reader.peek() +- if ch=3D=3D_I:return self.fetch_stream_end() +- if ch=3D=3D'%'and self.check_directive():return self.fetch_directive() +- if ch=3D=3D_N and self.check_document_start():return self.fetch_documen= t_start() +- if ch=3D=3D'.'and self.check_document_end():return self.fetch_document_= end() +- if ch=3D=3D'[':return self.fetch_flow_sequence_start() +- if ch=3D=3D'{':return self.fetch_flow_mapping_start() +- if ch=3D=3D']':return self.fetch_flow_sequence_end() +- if ch=3D=3D'}':return self.fetch_flow_mapping_end() +- if ch=3D=3D',':return self.fetch_flow_entry() +- if ch=3D=3D_N and self.check_block_entry():return self.fetch_block_entr= y() +- if ch=3D=3D'?'and self.check_key():return self.fetch_key() +- if ch=3D=3D_O and self.check_value():return self.fetch_value() +- if ch=3D=3D'*':return self.fetch_alias() +- if ch=3D=3D'&':return self.fetch_anchor() +- if ch=3D=3D_H:return self.fetch_tag() +- if ch=3D=3D'|'and not self.flow_level:return self.fetch_literal() +- if ch=3D=3D_R and not self.flow_level:return self.fetch_folded() +- if ch=3D=3D_J:return self.fetch_single() +- if ch=3D=3D_P:return self.fetch_double() +- if self.check_plain():return self.fetch_plain() +- raise ScannerError('while scanning for the next token',_C,'found charac= ter %r that cannot start any token'%utf8(ch),self.reader.get_mark()) +- def next_possible_simple_key(self): +- min_token_number=3D_C +- for level in self.possible_simple_keys: +- key=3Dself.possible_simple_keys[level] +- if min_token_number is _C or key.token_number1024: +- if key.required:raise ScannerError(_d,key.mark,_e,self.reader.get_mar= k()) +- del self.possible_simple_keys[level] +- def save_possible_simple_key(self): +- required=3Dnot self.flow_level and self.indent=3D=3Dself.reader.column +- if self.allow_simple_key:self.remove_possible_simple_key();token_number= =3Dself.tokens_taken+len(self.tokens);key=3DSimpleKey(token_number,required= ,self.reader.index,self.reader.line,self.reader.column,self.reader.get_mark= ());self.possible_simple_keys[self.flow_level]=3Dkey +- def remove_possible_simple_key(self): +- if self.flow_level in self.possible_simple_keys: +- key=3Dself.possible_simple_keys[self.flow_level] +- if key.required:raise ScannerError(_d,key.mark,_e,self.reader.get_mark= ()) +- del self.possible_simple_keys[self.flow_level] +- def unwind_indent(self,column): +- if bool(self.flow_level):return +- while self.indent>column:mark=3Dself.reader.get_mark();self.indent=3Dse= lf.indents.pop();self.tokens.append(BlockEndToken(mark,mark)) +- def add_indent(self,column): +- if self.indent\'"%@`';srp=3Dse= lf.reader.peek;ch=3Dsrp() +- if self.scanner_processing_version=3D=3D(1,1):return ch not in A or srp= (1)not in _THE_END_SPACE_TAB and(ch=3D=3D_N or not self.flow_level and ch i= n B) +- if ch not in A:return _A +- ch1=3Dsrp(1) +- if ch=3D=3D_N and ch1 not in _THE_END_SPACE_TAB:return _A +- if ch=3D=3D_O and bool(self.flow_level)and ch1 not in _SPACE_TAB:return= _A +- return srp(1)not in _THE_END_SPACE_TAB and(ch=3D=3D_N or not self.flow_= level and ch in B) +- def scan_to_next_token(self): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward +- if self.reader.index=3D=3D0 and srp()=3D=3D_f:srf() +- found=3D_B;_the_end=3D_THE_END +- while not found: +- while srp()=3D=3D_D:srf() +- if srp()=3D=3D_F: +- while srp()not in _the_end:srf() +- if self.scan_line_break(): +- if not self.flow_level:self.allow_simple_key=3D_A +- else:found=3D_A +- return _C +- def scan_directive(self): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward;start_mark=3Dself.read= er.get_mark();srf();name=3Dself.scan_directive_name(start_mark);value=3D_C +- if name=3D=3D'YAML':value=3Dself.scan_yaml_directive_value(start_mark);= end_mark=3Dself.reader.get_mark() +- elif name=3D=3D'TAG':value=3Dself.scan_tag_directive_value(start_mark);= end_mark=3Dself.reader.get_mark() +- else: +- end_mark=3Dself.reader.get_mark() +- while srp()not in _THE_END:srf() +- self.scan_directive_ignored_line(start_mark);return DirectiveToken(name= ,value,start_mark,end_mark) +- def scan_directive_name(self,start_mark): +- length=3D0;srp=3Dself.reader.peek;ch=3Dsrp(length) +- while _K<=3Dch<=3D_Q or'A'<=3Dch<=3D'Z'or _U<=3Dch<=3D'z'or ch in'-_:.'= :length+=3D1;ch=3Dsrp(length) +- if not length:raise ScannerError(_G,start_mark,_V%utf8(ch),self.reader.= get_mark()) +- value=3Dself.reader.prefix(length);self.reader.forward(length);ch=3Dsrp= () +- if ch not in _L:raise ScannerError(_G,start_mark,_V%utf8(ch),self.reade= r.get_mark()) +- return value +- def scan_yaml_directive_value(self,start_mark): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward +- while srp()=3D=3D_D:srf() +- major=3Dself.scan_yaml_directive_number(start_mark) +- if srp()!=3D'.':raise ScannerError(_G,start_mark,"expected a digit or '= .', but found %r"%utf8(srp()),self.reader.get_mark()) +- srf();minor=3Dself.scan_yaml_directive_number(start_mark) +- if srp()not in _L:raise ScannerError(_G,start_mark,"expected a digit or= ' ', but found %r"%utf8(srp()),self.reader.get_mark()) +- self.yaml_version=3Dmajor,minor;return self.yaml_version +- def scan_yaml_directive_number(self,start_mark): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward;ch=3Dsrp() +- if not _K<=3Dch<=3D_Q:raise ScannerError(_G,start_mark,'expected a digi= t, but found %r'%utf8(ch),self.reader.get_mark()) +- length=3D0 +- while _K<=3Dsrp(length)<=3D_Q:length+=3D1 +- value=3Dint(self.reader.prefix(length));srf(length);return value +- def scan_tag_directive_value(self,start_mark): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward +- while srp()=3D=3D_D:srf() +- handle=3Dself.scan_tag_directive_handle(start_mark) +- while srp()=3D=3D_D:srf() +- prefix=3Dself.scan_tag_directive_prefix(start_mark);return handle,prefix +- def scan_tag_directive_handle(self,start_mark): +- value=3Dself.scan_tag_handle(_g,start_mark);ch=3Dself.reader.peek() +- if ch!=3D_D:raise ScannerError(_G,start_mark,_Z%utf8(ch),self.reader.ge= t_mark()) +- return value +- def scan_tag_directive_prefix(self,start_mark): +- value=3Dself.scan_tag_uri(_g,start_mark);ch=3Dself.reader.peek() +- if ch not in _L:raise ScannerError(_G,start_mark,_Z%utf8(ch),self.reade= r.get_mark()) +- return value +- def scan_directive_ignored_line(self,start_mark): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward +- while srp()=3D=3D_D:srf() +- if srp()=3D=3D_F: +- while srp()not in _THE_END:srf() +- ch=3Dsrp() +- if ch not in _THE_END:raise ScannerError(_G,start_mark,_h%utf8(ch),self= .reader.get_mark()) +- self.scan_line_break() +- def scan_anchor(self,TokenClass): +- A=3D'while scanning an %s';srp=3Dself.reader.peek;start_mark=3Dself.rea= der.get_mark();indicator=3Dsrp() +- if indicator=3D=3D'*':name=3D'alias' +- else:name=3D'anchor' +- self.reader.forward();length=3D0;ch=3Dsrp(length) +- while check_anchorname_char(ch):length+=3D1;ch=3Dsrp(length) +- if not length:raise ScannerError(A%(name,),start_mark,_V%utf8(ch),self.= reader.get_mark()) +- value=3Dself.reader.prefix(length);self.reader.forward(length) +- if ch not in'\x00 \t\r\n\x85\u2028\u2029?:,[]{}%@`':raise ScannerError(= A%(name,),start_mark,_V%utf8(ch),self.reader.get_mark()) +- end_mark=3Dself.reader.get_mark();return TokenClass(value,start_mark,en= d_mark) +- def scan_tag(self): +- A=3D'tag';srp=3Dself.reader.peek;start_mark=3Dself.reader.get_mark();ch= =3Dsrp(1) +- if ch=3D=3D'<': +- handle=3D_C;self.reader.forward(2);suffix=3Dself.scan_tag_uri(A,start_= mark) +- if srp()!=3D_R:raise ScannerError('while parsing a tag',start_mark,"ex= pected '>', but found %r"%utf8(srp()),self.reader.get_mark()) +- self.reader.forward() +- elif ch in _THE_END_SPACE_TAB:handle=3D_C;suffix=3D_H;self.reader.forwa= rd() +- else: +- length=3D1;use_handle=3D_B +- while ch not in _L: +- if ch=3D=3D_H:use_handle=3D_A;break +- length+=3D1;ch=3Dsrp(length) +- handle=3D_H +- if use_handle:handle=3Dself.scan_tag_handle(A,start_mark) +- else:handle=3D_H;self.reader.forward() +- suffix=3Dself.scan_tag_uri(A,start_mark) +- ch=3Dsrp() +- if ch not in _L:raise ScannerError('while scanning a tag',start_mark,_Z= %utf8(ch),self.reader.get_mark()) +- value=3Dhandle,suffix;end_mark=3Dself.reader.get_mark();return TagToken= (value,start_mark,end_mark) +- def scan_block_scalar(self,style,rt=3D_B): +- A=3D'|>';srp=3Dself.reader.peek +- if style=3D=3D_R:folded=3D_A +- else:folded=3D_B +- chunks=3D[];start_mark=3Dself.reader.get_mark();self.reader.forward();c= homping,increment=3Dself.scan_block_scalar_indicators(start_mark);block_sca= lar_comment=3Dself.scan_block_scalar_ignored_line(start_mark);min_indent=3D= self.indent+1 +- if increment is _C: +- if min_indent<1 and(style not in A or self.scanner_processing_version= =3D=3D(1,1)and getattr(self.loader,'top_level_block_style_scalar_no_indent_= error_1_1',_B)):min_indent=3D1 +- breaks,max_indent,end_mark=3Dself.scan_block_scalar_indentation();inde= nt=3Dmax(min_indent,max_indent) +- else: +- if min_indent<1:min_indent=3D1 +- indent=3Dmin_indent+increment-1;breaks,end_mark=3Dself.scan_block_scal= ar_breaks(indent) +- line_break=3D'' +- while self.reader.column=3D=3Dindent and srp()!=3D_I: +- chunks.extend(breaks);leading_non_space=3Dsrp()not in _M;length=3D0 +- while srp(length)not in _THE_END:length+=3D1 +- chunks.append(self.reader.prefix(length));self.reader.forward(length);= line_break=3Dself.scan_line_break();breaks,end_mark=3Dself.scan_block_scala= r_breaks(indent) +- if style in A and min_indent=3D=3D0: +- if self.check_document_start()or self.check_document_end():break +- if self.reader.column=3D=3Dindent and srp()!=3D_I: +- if rt and folded and line_break=3D=3D_E:chunks.append(_i) +- if folded and line_break=3D=3D_E and leading_non_space and srp()not i= n _M: +- if not breaks:chunks.append(_D) +- else:chunks.append(line_break) +- else:break +- trailing=3D[] +- if chomping in[_C,_A]:chunks.append(line_break) +- if chomping is _A:chunks.extend(breaks) +- elif chomping in[_C,_B]:trailing.extend(breaks) +- token=3DScalarToken(''.join(chunks),_B,start_mark,end_mark,style) +- if block_scalar_comment is not _C:token.add_pre_comments([block_scalar_= comment]) +- if len(trailing)>0: +- comment=3Dself.scan_to_next_token() +- while comment:trailing.append(_D*comment[1].column+comment[0]);comment= =3Dself.scan_to_next_token() +- comment_end_mark=3Dself.reader.get_mark();comment=3DCommentToken(''.jo= in(trailing),end_mark,comment_end_mark);token.add_post_comment(comment) +- return token +- def scan_block_scalar_indicators(self,start_mark): +- D=3D'expected indentation indicator in the range 1-9, but found 0';C=3D= '0123456789';B=3D'+';A=3D'+-';srp=3Dself.reader.peek;chomping=3D_C;incremen= t=3D_C;ch=3Dsrp() +- if ch in A: +- if ch=3D=3DB:chomping=3D_A +- else:chomping=3D_B +- self.reader.forward();ch=3Dsrp() +- if ch in C: +- increment=3Dint(ch) +- if increment=3D=3D0:raise ScannerError(_W,start_mark,D,self.reader.ge= t_mark()) +- self.reader.forward() +- elif ch in C: +- increment=3Dint(ch) +- if increment=3D=3D0:raise ScannerError(_W,start_mark,D,self.reader.get= _mark()) +- self.reader.forward();ch=3Dsrp() +- if ch in A: +- if ch=3D=3DB:chomping=3D_A +- else:chomping=3D_B +- self.reader.forward() +- ch=3Dsrp() +- if ch not in _L:raise ScannerError(_W,start_mark,'expected chomping or = indentation indicators, but found %r'%utf8(ch),self.reader.get_mark()) +- return chomping,increment +- def scan_block_scalar_ignored_line(self,start_mark): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward;prefix=3D'';comment=3D= _C +- while srp()=3D=3D_D:prefix+=3Dsrp();srf() +- if srp()=3D=3D_F: +- comment=3Dprefix +- while srp()not in _THE_END:comment+=3Dsrp();srf() +- ch=3Dsrp() +- if ch not in _THE_END:raise ScannerError(_W,start_mark,_h%utf8(ch),self= .reader.get_mark()) +- self.scan_line_break();return comment +- def scan_block_scalar_indentation(self): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward;chunks=3D[];max_indent= =3D0;end_mark=3Dself.reader.get_mark() +- while srp()in _j: +- if srp()!=3D_D:chunks.append(self.scan_line_break());end_mark=3Dself.r= eader.get_mark() +- else: +- srf() +- if self.reader.column>max_indent:max_indent=3Dself.reader.column +- return chunks,max_indent,end_mark +- def scan_block_scalar_breaks(self,indent): +- chunks=3D[];srp=3Dself.reader.peek;srf=3Dself.reader.forward;end_mark= =3Dself.reader.get_mark() +- while self.reader.column(1,1)and ch=3D=3D_F: +- if ch=3D=3D'%':chunks.append(self.reader.prefix(length));self.reader.f= orward(length);length=3D0;chunks.append(self.scan_uri_escapes(name,start_ma= rk)) +- else:length+=3D1 +- ch=3Dsrp(length) +- if length!=3D0:chunks.append(self.reader.prefix(length));self.reader.fo= rward(length);length=3D0 +- if not chunks:raise ScannerError('while parsing a %s'%(name,),start_mar= k,'expected URI, but found %r'%utf8(ch),self.reader.get_mark()) +- return ''.join(chunks) +- def scan_uri_escapes(self,name,start_mark): +- A=3D'utf-8';srp=3Dself.reader.peek;srf=3Dself.reader.forward;code_bytes= =3D[];mark=3Dself.reader.get_mark() +- while srp()=3D=3D'%': +- srf() +- for k in range(2): +- if srp(k)not in _k:raise ScannerError(_Y%(name,),start_mark,'expected= URI escape sequence of 2 hexdecimal numbers, but found %r'%utf8(srp(k)),se= lf.reader.get_mark()) +- if PY3:code_bytes.append(int(self.reader.prefix(2),16)) +- else:code_bytes.append(chr(int(self.reader.prefix(2),16))) +- srf(2) +- try: +- if PY3:value=3Dbytes(code_bytes).decode(A) +- else:value=3Dunicode(b''.join(code_bytes),A) +- except UnicodeDecodeError as exc:raise ScannerError(_Y%(name,),start_ma= rk,str(exc),mark) +- return value +- def scan_line_break(self): +- ch=3Dself.reader.peek() +- if ch in _m: +- if self.reader.prefix(2)=3D=3D_n:self.reader.forward(2) +- else:self.reader.forward() +- return _E +- elif ch in _o:self.reader.forward();return ch +- return'' +-class RoundTripScanner(Scanner): +- def check_token(self,*choices): +- while self.need_more_tokens():self.fetch_more_tokens() +- self._gather_comments() +- if bool(self.tokens): +- if not choices:return _A +- for choice in choices: +- if isinstance(self.tokens[0],choice):return _A +- return _B +- def peek_token(self): +- while self.need_more_tokens():self.fetch_more_tokens() +- self._gather_comments() +- if bool(self.tokens):return self.tokens[0] +- return _C +- def _gather_comments(self): +- comments=3D[] +- if not self.tokens:return comments +- if isinstance(self.tokens[0],CommentToken):comment=3Dself.tokens.pop(0)= ;self.tokens_taken+=3D1;comments.append(comment) +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- if not self.tokens:return comments +- if isinstance(self.tokens[0],CommentToken):self.tokens_taken+=3D1;comm= ent=3Dself.tokens.pop(0);comments.append(comment) +- if len(comments)>=3D1:self.tokens[0].add_pre_comments(comments) +- if not self.done and len(self.tokens)<2:self.fetch_more_tokens() +- def get_token(self): +- while self.need_more_tokens():self.fetch_more_tokens() +- self._gather_comments() +- if bool(self.tokens): +- if len(self.tokens)>1 and isinstance(self.tokens[0],(ScalarToken,Value= Token,FlowSequenceEndToken,FlowMappingEndToken))and isinstance(self.tokens[= 1],CommentToken)and self.tokens[0].end_mark.line=3D=3Dself.tokens[1].start_= mark.line: +- self.tokens_taken+=3D1;c=3Dself.tokens.pop(1);self.fetch_more_tokens() +- while len(self.tokens)>1 and isinstance(self.tokens[1],CommentToken):= self.tokens_taken+=3D1;c1=3Dself.tokens.pop(1);c.value=3Dc.value+_D*c1.star= t_mark.column+c1.value;self.fetch_more_tokens() +- self.tokens[0].add_post_comment(c) +- elif len(self.tokens)>1 and isinstance(self.tokens[0],ScalarToken)and = isinstance(self.tokens[1],CommentToken)and self.tokens[0].end_mark.line!=3D= self.tokens[1].start_mark.line: +- self.tokens_taken+=3D1;c=3Dself.tokens.pop(1);c.value=3D_E*(c.start_m= ark.line-self.tokens[0].end_mark.line)+_D*c.start_mark.column+c.value;self.= tokens[0].add_post_comment(c);self.fetch_more_tokens() +- while len(self.tokens)>1 and isinstance(self.tokens[1],CommentToken):= self.tokens_taken+=3D1;c1=3Dself.tokens.pop(1);c.value=3Dc.value+_D*c1.star= t_mark.column+c1.value;self.fetch_more_tokens() +- self.tokens_taken+=3D1;return self.tokens.pop(0) +- return _C +- def fetch_comment(self,comment): +- value,start_mark,end_mark=3Dcomment +- while value and value[-1]=3D=3D_D:value=3Dvalue[:-1] +- self.tokens.append(CommentToken(value,start_mark,end_mark)) +- def scan_to_next_token(self): +- srp=3Dself.reader.peek;srf=3Dself.reader.forward +- if self.reader.index=3D=3D0 and srp()=3D=3D_f:srf() +- found=3D_B +- while not found: +- while srp()=3D=3D_D:srf() +- ch=3Dsrp() +- if ch=3D=3D_F: +- start_mark=3Dself.reader.get_mark();comment=3Dch;srf() +- while ch not in _THE_END: +- ch=3Dsrp() +- if ch=3D=3D_I:comment+=3D_E;break +- comment+=3Dch;srf() +- ch=3Dself.scan_line_break() +- while len(ch)>0:comment+=3Dch;ch=3Dself.scan_line_break() +- end_mark=3Dself.reader.get_mark() +- if not self.flow_level:self.allow_simple_key=3D_A +- return comment,start_mark,end_mark +- if bool(self.scan_line_break()): +- start_mark=3Dself.reader.get_mark() +- if not self.flow_level:self.allow_simple_key=3D_A +- ch=3Dsrp() +- if ch=3D=3D_E: +- start_mark=3Dself.reader.get_mark();comment=3D'' +- while ch:ch=3Dself.scan_line_break(empty_line=3D_A);comment+=3Dch +- if srp()=3D=3D_F:comment=3Dcomment.rsplit(_E,1)[0]+_E +- end_mark=3Dself.reader.get_mark();return comment,start_mark,end_mark +- else:found=3D_A +- return _C +- def scan_line_break(self,empty_line=3D_B): +- ch=3Dself.reader.peek() +- if ch in _m: +- if self.reader.prefix(2)=3D=3D_n:self.reader.forward(2) +- else:self.reader.forward() +- return _E +- elif ch in _o:self.reader.forward();return ch +- elif empty_line and ch in'\t ':self.reader.forward();return ch +- return'' +- def scan_block_scalar(self,style,rt=3D_A):return Scanner.scan_block_scal= ar(self,style,rt=3Drt) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/serializer.py b/dynaconf/vendor/r= uamel/yaml/serializer.py +deleted file mode 100644 +index 158ca05..0000000 +--- a/dynaconf/vendor/ruamel/yaml/serializer.py ++++ /dev/null +@@ -1,91 +0,0 @@ +-from __future__ import absolute_import +-_F=3D'serializer is not opened' +-_E=3D'serializer is closed' +-_D=3D'typ' +-_C=3DFalse +-_B=3DTrue +-_A=3DNone +-from .error import YAMLError +-from .compat import nprint,DBG_NODE,dbg,string_types,nprintf +-from .util import RegExp +-from .events import StreamStartEvent,StreamEndEvent,MappingStartEvent,Map= pingEndEvent,SequenceStartEvent,SequenceEndEvent,AliasEvent,ScalarEvent,Doc= umentStartEvent,DocumentEndEvent +-from .nodes import MappingNode,ScalarNode,SequenceNode +-if _C:from typing import Any,Dict,Union,Text,Optional;from .compat import= VersionType +-__all__=3D['Serializer','SerializerError'] +-class SerializerError(YAMLError):0 +-class Serializer: +- ANCHOR_TEMPLATE=3D'id%03d';ANCHOR_RE=3DRegExp('id(?!000$)\\d{3,}') +- def __init__(A,encoding=3D_A,explicit_start=3D_A,explicit_end=3D_A,versi= on=3D_A,tags=3D_A,dumper=3D_A): +- B=3Dversion;A.dumper=3Ddumper +- if A.dumper is not _A:A.dumper._serializer=3DA +- A.use_encoding=3Dencoding;A.use_explicit_start=3Dexplicit_start;A.use_e= xplicit_end=3Dexplicit_end +- if isinstance(B,string_types):A.use_version=3Dtuple(map(int,B.split('.'= ))) +- else:A.use_version=3DB +- A.use_tags=3Dtags;A.serialized_nodes=3D{};A.anchors=3D{};A.last_anchor_= id=3D0;A.closed=3D_A;A._templated_id=3D_A +- @property +- def emitter(self): +- A=3Dself +- if hasattr(A.dumper,_D):return A.dumper.emitter +- return A.dumper._emitter +- @property +- def resolver(self): +- A=3Dself +- if hasattr(A.dumper,_D):A.dumper.resolver +- return A.dumper._resolver +- def open(A): +- if A.closed is _A:A.emitter.emit(StreamStartEvent(encoding=3DA.use_enco= ding));A.closed=3D_C +- elif A.closed:raise SerializerError(_E) +- else:raise SerializerError('serializer is already opened') +- def close(A): +- if A.closed is _A:raise SerializerError(_F) +- elif not A.closed:A.emitter.emit(StreamEndEvent());A.closed=3D_B +- def serialize(A,node): +- B=3Dnode +- if dbg(DBG_NODE):nprint('Serializing nodes');B.dump() +- if A.closed is _A:raise SerializerError(_F) +- elif A.closed:raise SerializerError(_E) +- A.emitter.emit(DocumentStartEvent(explicit=3DA.use_explicit_start,versi= on=3DA.use_version,tags=3DA.use_tags));A.anchor_node(B);A.serialize_node(B,= _A,_A);A.emitter.emit(DocumentEndEvent(explicit=3DA.use_explicit_end));A.se= rialized_nodes=3D{};A.anchors=3D{};A.last_anchor_id=3D0 +- def anchor_node(B,node): +- A=3Dnode +- if A in B.anchors: +- if B.anchors[A]is _A:B.anchors[A]=3DB.generate_anchor(A) +- else: +- C=3D_A +- try: +- if A.anchor.always_dump:C=3DA.anchor.value +- except:pass +- B.anchors[A]=3DC +- if isinstance(A,SequenceNode): +- for D in A.value:B.anchor_node(D) +- elif isinstance(A,MappingNode): +- for (E,F) in A.value:B.anchor_node(E);B.anchor_node(F) +- def generate_anchor(A,node): +- try:B=3Dnode.anchor.value +- except:B=3D_A +- if B is _A:A.last_anchor_id+=3D1;return A.ANCHOR_TEMPLATE%A.last_anchor= _id +- return B +- def serialize_node(B,node,parent,index): +- F=3Dindex;A=3Dnode;G=3DB.anchors[A] +- if A in B.serialized_nodes:B.emitter.emit(AliasEvent(G)) +- else: +- B.serialized_nodes[A]=3D_B;B.resolver.descend_resolver(parent,F) +- if isinstance(A,ScalarNode):K=3DB.resolver.resolve(ScalarNode,A.value,= (_B,_C));L=3DB.resolver.resolve(ScalarNode,A.value,(_C,_B));E=3DA.tag=3D=3D= K,A.tag=3D=3DL,A.tag.startswith('tag:yaml.org,2002:');B.emitter.emit(Scalar= Event(G,A.tag,E,A.value,style=3DA.style,comment=3DA.comment)) +- elif isinstance(A,SequenceNode): +- E=3DA.tag=3D=3DB.resolver.resolve(SequenceNode,A.value,_B);C=3DA.comm= ent;D=3D_A;H=3D_A +- if A.flow_style is _B: +- if C:H=3DC[0] +- if C and len(C)>2:D=3DC[2] +- else:D=3D_A +- B.emitter.emit(SequenceStartEvent(G,A.tag,E,flow_style=3DA.flow_style= ,comment=3DA.comment));F=3D0 +- for M in A.value:B.serialize_node(M,A,F);F+=3D1 +- B.emitter.emit(SequenceEndEvent(comment=3D[H,D])) +- elif isinstance(A,MappingNode): +- E=3DA.tag=3D=3DB.resolver.resolve(MappingNode,A.value,_B);C=3DA.comme= nt;D=3D_A;I=3D_A +- if A.flow_style is _B: +- if C:I=3DC[0] +- if C and len(C)>2:D=3DC[2] +- B.emitter.emit(MappingStartEvent(G,A.tag,E,flow_style=3DA.flow_style,= comment=3DA.comment,nr_items=3Dlen(A.value))) +- for (J,N) in A.value:B.serialize_node(J,A,_A);B.serialize_node(N,A,J) +- B.emitter.emit(MappingEndEvent(comment=3D[I,D])) +- B.resolver.ascend_resolver() +-def templated_id(s):return Serializer.ANCHOR_RE.match(s) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/setup.cfg b/dynaconf/vendor/ruame= l/yaml/setup.cfg +deleted file mode 100644 +index 8bfd5a1..0000000 +--- a/dynaconf/vendor/ruamel/yaml/setup.cfg ++++ /dev/null +@@ -1,4 +0,0 @@ +-[egg_info] +-tag_build =3D=20 +-tag_date =3D 0 +- +diff --git a/dynaconf/vendor/ruamel/yaml/setup.py b/dynaconf/vendor/ruamel= /yaml/setup.py +deleted file mode 100644 +index 690e172..0000000 +--- a/dynaconf/vendor/ruamel/yaml/setup.py ++++ /dev/null +@@ -1,402 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_V=3D'bdist_wheel' +-_U=3D'--version' +-_T=3D'extra_packages' +-_S=3D'universal' +-_R=3D'nested' +-_Q=3D'setting distdir {}/{}' +-_P=3D'nsp' +-_O=3D'PYDISTBASE' +-_N=3D'True' +-_M=3D'DVDEBUG' +-_L=3D'LICENSE' +-_K=3D'Jython' +-_J=3D'install' +-_I=3D'full_package_name' +-_H=3D'__init__.py' +-_G=3D'python' +-_F=3D'setup.py' +-_E=3D'utf-8' +-_D=3DTrue +-_C=3DFalse +-_B=3D'.' +-_A=3DNone +-import sys,os,datetime,traceback +-sys.path=3D[path for path in sys.path if path not in[os.getcwd(),'']] +-import platform +-from _ast import * +-from ast import parse +-from setuptools import setup,Extension,Distribution +-from setuptools.command import install_lib +-from setuptools.command.sdist import sdist as _sdist +-try:from setuptools.namespaces import Installer as NameSpaceInstaller +-except ImportError:msg=3D'You should use the latest setuptools. The names= paces.py file that this setup.py uses was added in setuptools 28.7.0 (Oct 2= 016)';print(msg);sys.exit() +-if __name__!=3D'__main__':raise NotImplementedError('should never include= setup.py') +-full_package_name=3D_A +-if sys.version_info<(3,):string_type=3Dbasestring +-else:string_type=3Dstr +-if sys.version_info<(3,4): +- class Bytes:0 +- class NameConstant:0 +-if sys.version_info>=3D(3,8):from ast import Str,Num,Bytes,NameConstant +-if sys.version_info<(3,):open_kw=3Ddict() +-else:open_kw=3Ddict(encoding=3D_E) +-if sys.version_info<(2,7)or platform.python_implementation()=3D=3D_K: +- class Set:0 +-if os.environ.get(_M,'')=3D=3D'': +- def debug(*args,**kw):0 +-else: +- def debug(*args,**kw): +- with open(os.environ[_M],'a')as fp:kw1=3Dkw.copy();kw1['file']=3Dfp;pri= nt('{:%Y-%d-%mT%H:%M:%S}'.format(datetime.datetime.now()),file=3Dfp,end=3D'= ');print(*args,**kw1) +-def literal_eval(node_or_string): +- _safe_names=3D{'None':_A,_N:_D,'False':_C} +- if isinstance(node_or_string,string_type):node_or_string=3Dparse(node_or= _string,mode=3D'eval') +- if isinstance(node_or_string,Expression):node_or_string=3Dnode_or_string= .body +- else:raise TypeError('only string or AST nodes supported') +- def _convert(node): +- if isinstance(node,Str): +- if sys.version_info<(3,)and not isinstance(node.s,unicode):return node= .s.decode(_E) +- return node.s +- elif isinstance(node,Bytes):return node.s +- elif isinstance(node,Num):return node.n +- elif isinstance(node,Tuple):return tuple(map(_convert,node.elts)) +- elif isinstance(node,List):return list(map(_convert,node.elts)) +- elif isinstance(node,Set):return set(map(_convert,node.elts)) +- elif isinstance(node,Dict):return dict(((_convert(k),_convert(v))for(k,= v)in zip(node.keys,node.values))) +- elif isinstance(node,NameConstant):return node.value +- elif sys.version_info<(3,4)and isinstance(node,Name): +- if node.id in _safe_names:return _safe_names[node.id] +- elif isinstance(node,UnaryOp)and isinstance(node.op,(UAdd,USub))and isi= nstance(node.operand,(Num,UnaryOp,BinOp)): +- operand=3D_convert(node.operand) +- if isinstance(node.op,UAdd):return+operand +- else:return-operand +- elif isinstance(node,BinOp)and isinstance(node.op,(Add,Sub))and isinsta= nce(node.right,(Num,UnaryOp,BinOp))and isinstance(node.left,(Num,UnaryOp,Bi= nOp)): +- left=3D_convert(node.left);right=3D_convert(node.right) +- if isinstance(node.op,Add):return left+right +- else:return left-right +- elif isinstance(node,Call): +- func_id=3Dgetattr(node.func,'id',_A) +- if func_id=3D=3D'dict':return dict(((k.arg,_convert(k.value))for k in = node.keywords)) +- elif func_id=3D=3D'set':return set(_convert(node.args[0])) +- elif func_id=3D=3D'date':return datetime.date(*[_convert(k)for k in no= de.args]) +- elif func_id=3D=3D'datetime':return datetime.datetime(*[_convert(k)for= k in node.args]) +- err=3DSyntaxError('malformed node or string: '+repr(node));err.filename= =3D'';err.lineno=3Dnode.lineno;err.offset=3Dnode.col_offset;err.tex= t=3Drepr(node);err.node=3Dnode;raise err +- return _convert(node_or_string) +-def _package_data(fn): +- data=3D{} +- with open(fn,**open_kw)as fp: +- parsing=3D_C;lines=3D[] +- for line in fp.readlines(): +- if sys.version_info<(3,):line=3Dline.decode(_E) +- if line.startswith('_package_data'): +- if'dict('in line:parsing=3D_G;lines.append('dict(\n') +- elif line.endswith('=3D {\n'):parsing=3D_G;lines.append('{\n') +- else:raise NotImplementedError +- continue +- if not parsing:continue +- if parsing=3D=3D_G: +- if line.startswith(')')or line.startswith('}'): +- lines.append(line) +- try:data=3Dliteral_eval(''.join(lines)) +- except SyntaxError as e: +- context=3D2;from_line=3De.lineno-(context+1);to_line=3De.lineno+(co= ntext-1);w=3Dlen(str(to_line)) +- for (index,line) in enumerate(lines): +- if from_line<=3Dindex<=3Dto_line: +- print('{0:{1}}: {2}'.format(index,w,line).encode(_E),end=3D'') +- if index=3D=3De.lineno-1:print('{0:{1}} {2}^--- {3}'.format(' ',= w,' '*e.offset,e.node)) +- raise +- break +- lines.append(line) +- else:raise NotImplementedError +- return data +-pkg_data=3D_package_data(__file__.replace(_F,_H)) +-exclude_files=3D[_F] +-def _check_convert_version(tup): +- ret_val=3Dstr(tup[0]);next_sep=3D_B;nr_digits=3D0;post_dev=3D_C +- for x in tup[1:]: +- if isinstance(x,int): +- nr_digits+=3D1 +- if nr_digits>2:raise ValueError('too many consecutive digits after '+r= et_val) +- ret_val+=3Dnext_sep+str(x);next_sep=3D_B;continue +- first_letter=3Dx[0].lower();next_sep=3D'' +- if first_letter in'abcr': +- if post_dev:raise ValueError('release level specified after post/dev: = '+x) +- nr_digits=3D0;ret_val+=3D'rc'if first_letter=3D=3D'r'else first_letter +- elif first_letter in'pd':nr_digits=3D1;post_dev=3D_D;ret_val+=3D'.post'= if first_letter=3D=3D'p'else'.dev' +- else:raise ValueError('First letter of "'+x+'" not recognised') +- if nr_digits=3D=3D1 and post_dev:ret_val+=3D'0' +- return ret_val +-version_info=3Dpkg_data['version_info'] +-version_str=3D_check_convert_version(version_info) +-class MyInstallLib(install_lib.install_lib): +- def install(self): +- fpp=3Dpkg_data[_I].split(_B);full_exclude_files=3D[os.path.join(*fpp+[x= ])for x in exclude_files];alt_files=3D[];outfiles=3Dinstall_lib.install_lib= .install(self) +- for x in outfiles: +- for full_exclude_file in full_exclude_files: +- if full_exclude_file in x:os.remove(x);break +- else:alt_files.append(x) +- return alt_files +-class MySdist(_sdist): +- def initialize_options(self): +- _sdist.initialize_options(self);dist_base=3Dos.environ.get(_O);fpn=3Dge= tattr(getattr(self,_P,self),_I,_A) +- if fpn and dist_base:print(_Q.format(dist_base,fpn));self.dist_dir=3Dos= .path.join(dist_base,fpn) +-try: +- from wheel.bdist_wheel import bdist_wheel as _bdist_wheel +- class MyBdistWheel(_bdist_wheel): +- def initialize_options(self): +- _bdist_wheel.initialize_options(self);dist_base=3Dos.environ.get(_O);f= pn=3Dgetattr(getattr(self,_P,self),_I,_A) +- if fpn and dist_base:print(_Q.format(dist_base,fpn));self.dist_dir=3Do= s.path.join(dist_base,fpn) +- _bdist_wheel_available=3D_D +-except ImportError:_bdist_wheel_available=3D_C +-class NameSpacePackager: +- def __init__(self,pkg_data): +- assert isinstance(pkg_data,dict);self._pkg_data=3Dpkg_data;self.full_pa= ckage_name=3Dself.pn(self._pkg_data[_I]);self._split=3D_A;self.depth=3Dself= .full_package_name.count(_B);self.nested=3Dself._pkg_data.get(_R,_C) +- if self.nested:NameSpaceInstaller.install_namespaces=3Dlambda x:_A +- self.command=3D_A;self.python_version();self._pkg=3D[_A,_A] +- if sys.argv[0]=3D=3D_F and sys.argv[1]=3D=3D_J and'--single-version-ext= ernally-managed'not in sys.argv: +- if os.environ.get('READTHEDOCS',_A)=3D=3D_N:os.system('pip install .')= ;sys.exit(0) +- if not os.environ.get('RUAMEL_NO_PIP_INSTALL_CHECK',_C):print('error: = you have to install with "pip install ."');sys.exit(1) +- if self._pkg_data.get(_S):Distribution.is_pure=3Dlambda *args:_D +- else:Distribution.is_pure=3Dlambda *args:_C +- for x in sys.argv: +- if x[0]=3D=3D'-'or x=3D=3D_F:continue +- self.command=3Dx;break +- def pn(self,s): +- if sys.version_info<(3,)and isinstance(s,unicode):return s.encode(_E) +- return s +- @property +- def split(self): +- skip=3D[] +- if self._split is _A: +- fpn=3Dself.full_package_name.split(_B);self._split=3D[] +- while fpn:self._split.insert(0,_B.join(fpn));fpn=3Dfpn[:-1] +- for d in sorted(os.listdir(_B)): +- if not os.path.isdir(d)or d=3D=3Dself._split[0]or d[0]in'._':continue +- x=3Dos.path.join(d,_H) +- if os.path.exists(x): +- pd=3D_package_data(x) +- if pd.get(_R,_C):skip.append(d);continue +- self._split.append(self.full_package_name+_B+d) +- if sys.version_info<(3,):self._split=3D[y.encode(_E)if isinstance(y,un= icode)else y for y in self._split] +- if skip:0 +- return self._split +- @property +- def namespace_packages(self):return self.split[:self.depth] +- def namespace_directories(self,depth=3D_A): +- res=3D[] +- for (index,d) in enumerate(self.split[:depth]): +- if index>0:d=3Dos.path.join(*d.split(_B)) +- res.append(_B+d) +- return res +- @property +- def package_dir(self): +- d=3D{self.full_package_name:_B} +- if _T in self._pkg_data:return d +- if len(self.split)>1:d[self.split[0]]=3Dself.namespace_directories(1)[0] +- return d +- def create_dirs(self): +- directories=3Dself.namespace_directories(self.depth) +- if not directories:return +- if not os.path.exists(directories[0]): +- for d in directories: +- os.mkdir(d) +- with open(os.path.join(d,_H),'w')as fp:fp.write('import pkg_resources= \npkg_resources.declare_namespace(__name__)\n') +- def python_version(self): +- supported=3Dself._pkg_data.get('supported') +- if supported is _A:return +- if len(supported)=3D=3D1:minimum=3Dsupported[0] +- else: +- for x in supported: +- if x[0]=3D=3Dsys.version_info[0]:minimum=3Dx;break +- else:return +- if sys.version_info>>>>> LICENSE file not found <<<<<\n\n') +- if self._pkg_data.get(_S):fp.write('[bdist_wheel]\nuniversal =3D 1\n') +- try:setup(**kw) +- except Exception:raise +- finally:os.remove(file_name) +- return _D +-def main(): +- A=3D'tarfmt';dump_kw=3D'--dump-kw' +- if dump_kw in sys.argv:import wheel,distutils,setuptools;print('python: = ',sys.version);print('setuptools:',setuptools.__version__);print('distut= ils: ',distutils.__version__);print('wheel: ',wheel.__version__) +- nsp=3DNameSpacePackager(pkg_data);nsp.check();nsp.create_dirs();MySdist.= nsp=3Dnsp +- if pkg_data.get(A):MySdist.tarfmt=3Dpkg_data.get(A) +- cmdclass=3Ddict(install_lib=3DMyInstallLib,sdist=3DMySdist) +- if _bdist_wheel_available:MyBdistWheel.nsp=3Dnsp;cmdclass[_V]=3DMyBdistW= heel +- kw=3Ddict(name=3Dnsp.full_package_name,namespace_packages=3Dnsp.namespac= e_packages,version=3Dversion_str,packages=3Dnsp.packages,python_requires=3D= nsp.python_requires,url=3Dnsp.url,author=3Dnsp.author,author_email=3Dnsp.au= thor_email,cmdclass=3Dcmdclass,package_dir=3Dnsp.package_dir,entry_points= =3Dnsp.entry_points(),description=3Dnsp.description,install_requires=3Dnsp.= install_requires,extras_require=3Dnsp.extras_require,license=3Dnsp.license,= classifiers=3Dnsp.classifiers,keywords=3Dnsp.keywords,package_data=3Dnsp.pa= ckage_data,ext_modules=3Dnsp.ext_modules,test_suite=3Dnsp.test_suite) +- if _U not in sys.argv and('--verbose'in sys.argv or dump_kw in sys.argv): +- for k in sorted(kw):v=3Dkw[k];print(' "{0}": "{1}",'.format(k,v)) +- if dump_kw in sys.argv:sys.argv.remove(dump_kw) +- try: +- with open('README.rst')as fp:kw['long_description']=3Dfp.read();kw['lon= g_description_content_type']=3D'text/x-rst' +- except Exception:pass +- if nsp.wheel(kw,setup):return +- for x in ['-c','egg_info','--egg-base','pip-egg-info']: +- if x not in sys.argv:break +- else: +- for p in nsp.install_pre: +- import subprocess;setup_path=3Dos.path.join(*p.split(_B)+[_F]);try_dir= =3Dos.path.dirname(sys.executable) +- while len(try_dir)>1: +- full_path_setup_py=3Dos.path.join(try_dir,setup_path) +- if os.path.exists(full_path_setup_py):pip=3Dsys.executable.replace(_G= ,'pip');cmd=3D[pip,_J,os.path.dirname(full_path_setup_py)];subprocess.check= _output(cmd);break +- try_dir=3Dos.path.dirname(try_dir) +- setup(**kw) +-main() +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/timestamp.py b/dynaconf/vendor/ru= amel/yaml/timestamp.py +deleted file mode 100644 +index fafab94..0000000 +--- a/dynaconf/vendor/ruamel/yaml/timestamp.py ++++ /dev/null +@@ -1,8 +0,0 @@ +-from __future__ import print_function,absolute_import,division,unicode_li= terals +-_A=3DFalse +-import datetime,copy +-if _A:from typing import Any,Dict,Optional,List +-class TimeStamp(datetime.datetime): +- def __init__(A,*B,**C):A._yaml=3Ddict(t=3D_A,tz=3DNone,delta=3D0) +- def __new__(A,*B,**C):return datetime.datetime.__new__(A,*B,**C) +- def __deepcopy__(A,memo):B=3DTimeStamp(A.year,A.month,A.day,A.hour,A.min= ute,A.second);B._yaml=3Dcopy.deepcopy(A._yaml);return B +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/tokens.py b/dynaconf/vendor/ruame= l/yaml/tokens.py +deleted file mode 100644 +index 97b4c46..0000000 +--- a/dynaconf/vendor/ruamel/yaml/tokens.py ++++ /dev/null +@@ -1,97 +0,0 @@ +-from __future__ import unicode_literals +-_F=3D', line: ' +-_E=3D'pre_done' +-_D=3DFalse +-_C=3D'value' +-_B=3D'_comment' +-_A=3DNone +-if _D:from typing import Text,Any,Dict,Optional,List;from .error import S= treamMark +-SHOWLINES=3DTrue +-class Token: +- __slots__=3D'start_mark','end_mark',_B +- def __init__(A,start_mark,end_mark):A.start_mark=3Dstart_mark;A.end_mark= =3Dend_mark +- def __repr__(A): +- C=3D[B for B in A.__slots__ if not B.endswith('_mark')];C.sort();B=3D',= '.join(['%s=3D%r'%(B,getattr(A,B))for B in C]) +- if SHOWLINES: +- try:B+=3D_F+str(A.start_mark.line) +- except:pass +- try:B+=3D', comment: '+str(A._comment) +- except:pass +- return '{}({})'.format(A.__class__.__name__,B) +- def add_post_comment(A,comment): +- if not hasattr(A,_B):A._comment=3D[_A,_A] +- A._comment[0]=3Dcomment +- def add_pre_comments(A,comments): +- if not hasattr(A,_B):A._comment=3D[_A,_A] +- assert A._comment[1]is _A;A._comment[1]=3Dcomments +- def get_comment(A):return getattr(A,_B,_A) +- @property +- def comment(self):return getattr(self,_B,_A) +- def move_comment(C,target,empty=3D_D): +- D=3Dtarget;A=3DC.comment +- if A is _A:return +- if isinstance(D,(StreamEndToken,DocumentStartToken)):return +- delattr(C,_B);B=3DD.comment +- if not B: +- if empty:A=3D[A[0],A[1],_A,_A,A[0]] +- D._comment=3DA;return C +- if A[0]and B[0]or A[1]and B[1]:raise NotImplementedError('overlap in co= mment %r %r'%(A,B)) +- if A[0]:B[0]=3DA[0] +- if A[1]:B[1]=3DA[1] +- return C +- def split_comment(B): +- A=3DB.comment +- if A is _A or A[0]is _A:return _A +- C=3D[A[0],_A] +- if A[1]is _A:delattr(B,_B) +- return C +-class DirectiveToken(Token): +- __slots__=3D'name',_C;id=3D'' +- def __init__(A,name,value,start_mark,end_mark):Token.__init__(A,start_ma= rk,end_mark);A.name=3Dname;A.value=3Dvalue +-class DocumentStartToken(Token):__slots__=3D();id=3D'' +-class DocumentEndToken(Token):__slots__=3D();id=3D'' +-class StreamStartToken(Token): +- __slots__=3D'encoding',;id=3D'' +- def __init__(A,start_mark=3D_A,end_mark=3D_A,encoding=3D_A):Token.__init= __(A,start_mark,end_mark);A.encoding=3Dencoding +-class StreamEndToken(Token):__slots__=3D();id=3D'' +-class BlockSequenceStartToken(Token):__slots__=3D();id=3D'' +-class BlockMappingStartToken(Token):__slots__=3D();id=3D'' +-class BlockEndToken(Token):__slots__=3D();id=3D'' +-class FlowSequenceStartToken(Token):__slots__=3D();id=3D'[' +-class FlowMappingStartToken(Token):__slots__=3D();id=3D'{' +-class FlowSequenceEndToken(Token):__slots__=3D();id=3D']' +-class FlowMappingEndToken(Token):__slots__=3D();id=3D'}' +-class KeyToken(Token):__slots__=3D();id=3D'?' +-class ValueToken(Token):__slots__=3D();id=3D':' +-class BlockEntryToken(Token):__slots__=3D();id=3D'-' +-class FlowEntryToken(Token):__slots__=3D();id=3D',' +-class AliasToken(Token): +- __slots__=3D_C,;id=3D'' +- def __init__(A,value,start_mark,end_mark):Token.__init__(A,start_mark,en= d_mark);A.value=3Dvalue +-class AnchorToken(Token): +- __slots__=3D_C,;id=3D'' +- def __init__(A,value,start_mark,end_mark):Token.__init__(A,start_mark,en= d_mark);A.value=3Dvalue +-class TagToken(Token): +- __slots__=3D_C,;id=3D'' +- def __init__(A,value,start_mark,end_mark):Token.__init__(A,start_mark,en= d_mark);A.value=3Dvalue +-class ScalarToken(Token): +- __slots__=3D_C,'plain','style';id=3D'' +- def __init__(A,value,plain,start_mark,end_mark,style=3D_A):Token.__init_= _(A,start_mark,end_mark);A.value=3Dvalue;A.plain=3Dplain;A.style=3Dstyle +-class CommentToken(Token): +- __slots__=3D_C,_E;id=3D'' +- def __init__(A,value,start_mark,end_mark):Token.__init__(A,start_mark,en= d_mark);A.value=3Dvalue +- def reset(A): +- if hasattr(A,_E):delattr(A,_E) +- def __repr__(A): +- B=3D'{!r}'.format(A.value) +- if SHOWLINES: +- try:B+=3D_F+str(A.start_mark.line);B+=3D', col: '+str(A.start_mark.col= umn) +- except:pass +- return 'CommentToken({})'.format(B) +- def __eq__(A,other): +- B=3Dother +- if A.start_mark!=3DB.start_mark:return _D +- if A.end_mark!=3DB.end_mark:return _D +- if A.value!=3DB.value:return _D +- return True +- def __ne__(A,other):return not A.__eq__(other) +\ No newline at end of file +diff --git a/dynaconf/vendor/ruamel/yaml/util.py b/dynaconf/vendor/ruamel/= yaml/util.py +deleted file mode 100644 +index c8c1c6b..0000000 +--- a/dynaconf/vendor/ruamel/yaml/util.py ++++ /dev/null +@@ -1,69 +0,0 @@ +-from __future__ import absolute_import,print_function +-_B=3D'lazy_self' +-_A=3D' ' +-from functools import partial +-import re +-from .compat import text_type,binary_type +-if False:from typing import Any,Dict,Optional,List,Text;from .compat impo= rt StreamTextType +-class LazyEval: +- def __init__(A,func,*C,**D): +- def B():B=3Dfunc(*C,**D);object.__setattr__(A,_B,lambda:B);return B +- object.__setattr__(A,_B,B) +- def __getattribute__(B,name): +- A=3Dobject.__getattribute__(B,_B) +- if name=3D=3D_B:return A +- return getattr(A(),name) +- def __setattr__(A,name,value):setattr(A.lazy_self(),name,value) +-RegExp=3Dpartial(LazyEval,re.compile) +-def load_yaml_guess_indent(stream,**N): +- D=3Dstream;B=3DNone;from .main import round_trip_load as O +- def K(l): +- A=3D0 +- while AE:G=3DA-E +- if J.endswith(':'): +- I=3DK(C);A=3D0 +- while C[A]=3D=3D_A:A+=3D1 +- E=3DA;continue +- E=3DB +- if H is B and G is not B:H=3DG +- return O(F,**N),H,L +-def configobj_walker(cfg): +- B=3Dcfg;from configobj import ConfigObj as D;assert isinstance(B,D) +- for A in B.initial_comment: +- if A.strip():yield A +- for C in _walk_section(B): +- if C.strip():yield C +- for A in B.final_comment: +- if A.strip():yield A +-def _walk_section(s,level=3D0): +- L=3D' ';I=3D"'";H=3D'\n';F=3Dlevel;from configobj import Section as J;a= ssert isinstance(s,J);D=3DL*F +- for A in s.scalars: +- for B in s.comments[A]:yield D+B.strip() +- C=3Ds[A] +- if H in C:G=3DD+L;C=3D'|\n'+G+C.strip().replace(H,H+G) +- elif':'in C:C=3DI+C.replace(I,"''")+I +- E=3D'{0}{1}: {2}'.format(D,A,C);B=3Ds.inline_comments[A] +- if B:E+=3D_A+B +- yield E +- for A in s.sections: +- for B in s.comments[A]:yield D+B.strip() +- E=3D'{0}{1}:'.format(D,A);B=3Ds.inline_comments[A] +- if B:E+=3D_A+B +- yield E +- for K in _walk_section(s[A],level=3DF+1):yield K +\ No newline at end of file +diff --git a/dynaconf/vendor/toml/README.md b/dynaconf/vendor/toml/README.= md +deleted file mode 100644 +index cbe16fd..0000000 +--- a/dynaconf/vendor/toml/README.md ++++ /dev/null +@@ -1,5 +0,0 @@ +-## python-toml +- +-Vendored dep taken from: https://github.com/uiri/toml +-Licensed under BSD: https://github.com/uiri/toml/blob/master/LICENSE +-Current version: 0.10.8 +diff --git a/dynaconf/vendor/toml/__init__.py b/dynaconf/vendor/toml/__ini= t__.py +deleted file mode 100644 +index 45ba32b..0000000 +--- a/dynaconf/vendor/toml/__init__.py ++++ /dev/null +@@ -1,16 +0,0 @@ +-from . import encoder,decoder +-__version__=3D'0.10.1' +-_spec_=3D'0.5.0' +-load=3Ddecoder.load +-loads=3Ddecoder.loads +-TomlDecoder=3Ddecoder.TomlDecoder +-TomlDecodeError=3Ddecoder.TomlDecodeError +-TomlPreserveCommentDecoder=3Ddecoder.TomlPreserveCommentDecoder +-dump=3Dencoder.dump +-dumps=3Dencoder.dumps +-TomlEncoder=3Dencoder.TomlEncoder +-TomlArraySeparatorEncoder=3Dencoder.TomlArraySeparatorEncoder +-TomlPreserveInlineDictEncoder=3Dencoder.TomlPreserveInlineDictEncoder +-TomlNumpyEncoder=3Dencoder.TomlNumpyEncoder +-TomlPreserveCommentEncoder=3Dencoder.TomlPreserveCommentEncoder +-TomlPathlibEncoder=3Dencoder.TomlPathlibEncoder +\ No newline at end of file +diff --git a/dynaconf/vendor/toml/decoder.py b/dynaconf/vendor/toml/decode= r.py +deleted file mode 100644 +index 315c36e..0000000 +--- a/dynaconf/vendor/toml/decoder.py ++++ /dev/null +@@ -1,515 +0,0 @@ +-_W=3D'Reserved escape sequence used' +-_V=3D'\\U' +-_U=3D'false' +-_T=3D'true' +-_S=3D'\t' +-_R=3D'}' +-_Q=3D'+' +-_P=3D'_' +-_O=3D'-' +-_N=3D',' +-_M=3D']' +-_L=3D' ' +-_K=3D'{' +-_J=3D'=3D' +-_I=3D'[' +-_H=3D'\\' +-_G=3D'\n' +-_F=3D'.' +-_E=3DNone +-_D=3D"'" +-_C=3D'"' +-_B=3DTrue +-_A=3DFalse +-import datetime,io +-from os import linesep +-import re,sys +-from .tz import TomlTz +-if sys.version_info<(3,):_range=3Dxrange +-else:unicode=3Dstr;_range=3Drange;basestring=3Dstr;unichr=3Dchr +-def _detect_pathlib_path(p): +- if(3,4)<=3Dsys.version_info: +- import pathlib as A +- if isinstance(p,A.PurePath):return _B +- return _A +-def _ispath(p): +- if isinstance(p,(bytes,basestring)):return _B +- return _detect_pathlib_path(p) +-def _getpath(p): +- if(3,6)<=3Dsys.version_info:import os;return os.fspath(p) +- if _detect_pathlib_path(p):return str(p) +- return p +-try:FNFError=3DFileNotFoundError +-except NameError:FNFError=3DIOError +-TIME_RE=3Dre.compile('([0-9]{2}):([0-9]{2}):([0-9]{2})(\\.([0-9]{3,6}))?') +-class TomlDecodeError(ValueError): +- def __init__(A,msg,doc,pos):C=3Ddoc;B=3Dpos;D=3DC.count(_G,0,B)+1;E=3DB-= C.rfind(_G,0,B);F=3D'{} (line {} column {} char {})'.format(msg,D,E,B);Valu= eError.__init__(A,F);A.msg=3Dmsg;A.doc=3DC;A.pos=3DB;A.lineno=3DD;A.colno= =3DE +-_number_with_underscores=3Dre.compile('([0-9])(_([0-9]))*') +-class CommentValue: +- def __init__(A,val,comment,beginline,_dict):A.val=3Dval;B=3D_G if beginl= ine else _L;A.comment=3DB+comment;A._dict=3D_dict +- def __getitem__(A,key):return A.val[key] +- def __setitem__(A,key,value):A.val[key]=3Dvalue +- def dump(A,dump_value_func): +- B=3Ddump_value_func(A.val) +- if isinstance(A.val,A._dict):return A.comment+_G+unicode(B) +- else:return unicode(B)+A.comment +-def _strictly_valid_num(n): +- n=3Dn.strip() +- if not n:return _A +- if n[0]=3D=3D_P:return _A +- if n[-1]=3D=3D_P:return _A +- if'_.'in n or'._'in n:return _A +- if len(n)=3D=3D1:return _B +- if n[0]=3D=3D'0'and n[1]not in[_F,'o','b','x']:return _A +- if n[0]=3D=3D_Q or n[0]=3D=3D_O: +- n=3Dn[1:] +- if len(n)>1 and n[0]=3D=3D'0'and n[1]!=3D_F:return _A +- if'__'in n:return _A +- return _B +-def load(f,_dict=3Ddict,decoder=3D_E): +- B=3D_dict;A=3Ddecoder +- if _ispath(f): +- with io.open(_getpath(f),encoding=3D'utf-8')as G:return loads(G.read(),= B,A) +- elif isinstance(f,list): +- from os import path as D;from warnings import warn +- if not[A for A in f if D.exists(A)]:C=3D'Load expects a list to contain= filenames only.';C+=3Dlinesep;C+=3D'The list needs to contain the path of = at least one existing file.';raise FNFError(C) +- if A is _E:A=3DTomlDecoder(B) +- E=3DA.get_empty_table() +- for F in f: +- if D.exists(F):E.update(load(F,B,A)) +- else:warn('Non-existent filename in list with at least one valid filen= ame') +- return E +- else: +- try:return loads(f.read(),B,A) +- except AttributeError:raise TypeError('You can only load a file descrip= tor, filename or list') +-_groupname_re=3Dre.compile('^[A-Za-z0-9_-]+$') +-def loads(s,_dict=3Ddict,decoder=3D_E): +- q=3D"Invalid group name '";K=3Ddecoder;d=3D[] +- if K is _E:K=3DTomlDecoder(_dict) +- e=3DK.get_empty_table();G=3De +- if not isinstance(s,basestring):raise TypeError('Expecting something lik= e a string') +- if not isinstance(s,unicode):s=3Ds.decode('utf8') +- I=3Ds;B=3Dlist(s);b=3D0;J=3D_A;Q=3D'';D=3D_A;L=3D_A;V=3D_B;U=3D_A;W=3D_A= ;O=3D0;c=3D'';j=3D'';k=3D1 +- for (A,E) in enumerate(B): +- if E=3D=3D'\r'and B[A+1]=3D=3D_G:B[A]=3D_L;continue +- if O: +- c+=3DE +- if E=3D=3D_G:raise TomlDecodeError('Key name found without value. Reac= hed end of line.',I,A) +- if J: +- if E=3D=3DQ: +- S=3D_A;F=3D1 +- while A>=3DF and B[A-F]=3D=3D_H:S=3Dnot S;F+=3D1 +- if not S:O=3D2;J=3D_A;Q=3D'' +- continue +- elif O=3D=3D1: +- if E.isspace():O=3D2;continue +- elif E=3D=3D_F:W=3D_B;continue +- elif E.isalnum()or E=3D=3D_P or E=3D=3D_O:continue +- elif W and B[A-1]=3D=3D_F and(E=3D=3D_C or E=3D=3D_D):J=3D_B;Q=3DE;co= ntinue +- elif O=3D=3D2: +- if E.isspace(): +- if W: +- X=3DB[A+1] +- if not X.isspace()and X!=3D_F:O=3D1 +- continue +- if E=3D=3D_F: +- W=3D_B;X=3DB[A+1] +- if not X.isspace()and X!=3D_F:O=3D1 +- continue +- if E=3D=3D_J:O=3D0;j=3Dc[:-1].rstrip();c=3D'';W=3D_A +- else:raise TomlDecodeError("Found invalid character in key name: '"+E+= "'. Try quoting the key name.",I,A) +- if E=3D=3D_D and Q!=3D_C: +- F=3D1 +- try: +- while B[A-F]=3D=3D_D: +- F+=3D1 +- if F=3D=3D3:break +- except IndexError:pass +- if F=3D=3D3:D=3Dnot D;J=3DD +- else:J=3Dnot J +- if J:Q=3D_D +- else:Q=3D'' +- if E=3D=3D_C and Q!=3D_D: +- S=3D_A;F=3D1;f=3D_A +- try: +- while B[A-F]=3D=3D_C: +- F+=3D1 +- if F=3D=3D3:f=3D_B;break +- if F=3D=3D1 or F=3D=3D3 and f: +- while B[A-F]=3D=3D_H:S=3Dnot S;F+=3D1 +- except IndexError:pass +- if not S: +- if f:D=3Dnot D;J=3DD +- else:J=3Dnot J +- if J:Q=3D_C +- else:Q=3D'' +- if E=3D=3D'#'and(not J and not U and not L): +- R=3DA;l=3D'' +- try: +- while B[R]!=3D_G:l+=3Ds[R];B[R]=3D_L;R+=3D1 +- except IndexError:break +- if not b:K.preserve_comment(k,j,l,V) +- if E=3D=3D_I and(not J and not U and not L): +- if V: +- if len(B)>A+1 and B[A+1]=3D=3D_I:L=3D_B +- else:U=3D_B +- else:b+=3D1 +- if E=3D=3D_M and not J: +- if U:U=3D_A +- elif L: +- if B[A-1]=3D=3D_M:L=3D_A +- else:b-=3D1 +- if E=3D=3D_G: +- if J or D: +- if not D:raise TomlDecodeError('Unbalanced quotes',I,A) +- if(B[A-1]=3D=3D_D or B[A-1]=3D=3D_C)and B[A-2]=3D=3DB[A-1]: +- B[A]=3DB[A-1] +- if B[A-3]=3D=3DB[A-1]:B[A-3]=3D_L +- elif b:B[A]=3D_L +- else:V=3D_B +- k+=3D1 +- elif V and B[A]!=3D_L and B[A]!=3D_S: +- V=3D_A +- if not U and not L: +- if B[A]=3D=3D_J:raise TomlDecodeError('Found empty keyname. ',I,A) +- O=3D1;c+=3DE +- if O:raise TomlDecodeError('Key name found without value. Reached end of= file.',I,len(s)) +- if J:raise TomlDecodeError('Unterminated string found. Reached end of fi= le.',I,len(s)) +- s=3D''.join(B);s=3Ds.split(_G);T=3D_E;D=3D'';P=3D_A;N=3D0 +- for (g,C) in enumerate(s): +- if g>0:N+=3Dlen(s[g-1])+1 +- K.embed_comments(g,G) +- if not D or P or _G not in D:C=3DC.strip() +- if C=3D=3D''and(not T or P):continue +- if T: +- if P:D+=3DC +- else:D+=3DC +- P=3D_A;h=3D_A +- if D[0]=3D=3D_I:h=3DC[-1]=3D=3D_M +- elif len(C)>2:h=3DC[-1]=3D=3DD[0]and C[-2]=3D=3DD[0]and C[-3]=3D=3DD[0] +- if h: +- try:o,r=3DK.load_value(D) +- except ValueError as Y:raise TomlDecodeError(str(Y),I,N) +- G[T]=3Do;T=3D_E;D=3D'' +- else: +- F=3Dlen(D)-1 +- while F>-1 and D[F]=3D=3D_H:P=3Dnot P;F-=3D1 +- if P:D=3DD[:-1] +- else:D+=3D_G +- continue +- if C[0]=3D=3D_I: +- L=3D_A +- if len(C)=3D=3D1:raise TomlDecodeError('Opening key group bracket on l= ine by itself.',I,N) +- if C[1]=3D=3D_I:L=3D_B;C=3DC[2:];Z=3D']]' +- else:C=3DC[1:];Z=3D_M +- A=3D1;p=3DK._get_split_on_quotes(C);i=3D_A +- for m in p: +- if not i and Z in m:break +- A+=3Dm.count(Z);i=3Dnot i +- C=3DC.split(Z,A) +- if len(C)0 and(H[A][0]=3D=3D_C or H[A][0]=3D=3D_D): +- a=3DH[A];R=3DA+1 +- while not a[0]=3D=3Da[-1]: +- R+=3D1 +- if R>len(H)+2:raise TomlDecodeError(q+a+"' Something "+'went wrong.= ',I,N) +- a=3D_F.join(H[A:R]).strip() +- H[A]=3Da[1:-1];H[A+1:R]=3D[] +- elif not _groupname_re.match(H[A]):raise TomlDecodeError(q+H[A]+"'. T= ry quoting it.",I,N) +- A+=3D1 +- G=3De +- for A in _range(len(H)): +- M=3DH[A] +- if M=3D=3D'':raise TomlDecodeError("Can't have a keygroup with an emp= ty name",I,N) +- try: +- G[M] +- if A=3D=3Dlen(H)-1: +- if M in d: +- d.remove(M) +- if L:raise TomlDecodeError("An implicitly defined table can't be a= n array",I,N) +- elif L:G[M].append(K.get_empty_table()) +- else:raise TomlDecodeError('What? '+M+' already exists?'+str(G),I,N) +- except TypeError: +- G=3DG[-1] +- if M not in G: +- G[M]=3DK.get_empty_table() +- if A=3D=3Dlen(H)-1 and L:G[M]=3D[K.get_empty_table()] +- except KeyError: +- if A!=3Dlen(H)-1:d.append(M) +- G[M]=3DK.get_empty_table() +- if A=3D=3Dlen(H)-1 and L:G[M]=3D[K.get_empty_table()] +- G=3DG[M] +- if L: +- try:G=3DG[-1] +- except KeyError:pass +- elif C[0]=3D=3D_K: +- if C[-1]!=3D_R:raise TomlDecodeError('Line breaks are not allowed in i= nlineobjects',I,N) +- try:K.load_inline_object(C,G,T,P) +- except ValueError as Y:raise TomlDecodeError(str(Y),I,N) +- elif _J in C: +- try:n=3DK.load_line(C,G,T,P) +- except ValueError as Y:raise TomlDecodeError(str(Y),I,N) +- if n is not _E:T,D,P=3Dn +- return e +-def _load_date(val): +- I=3D'Z';A=3Dval;G=3D0;F=3D_E +- try: +- if len(A)>19: +- if A[19]=3D=3D_F: +- if A[-1].upper()=3D=3DI:C=3DA[20:-1];D=3DI +- else: +- B=3DA[20:] +- if _Q in B:E=3DB.index(_Q);C=3DB[:E];D=3DB[E:] +- elif _O in B:E=3DB.index(_O);C=3DB[:E];D=3DB[E:] +- else:D=3D_E;C=3DB +- if D is not _E:F=3DTomlTz(D) +- G=3Dint(int(C)*10**(6-len(C))) +- else:F=3DTomlTz(A[19:]) +- except ValueError:F=3D_E +- if _O not in A[1:]:return _E +- try: +- if len(A)=3D=3D10:H=3Ddatetime.date(int(A[:4]),int(A[5:7]),int(A[8:10])) +- else:H=3Ddatetime.datetime(int(A[:4]),int(A[5:7]),int(A[8:10]),int(A[11= :13]),int(A[14:16]),int(A[17:19]),G,F) +- except ValueError:return _E +- return H +-def _load_unicode_escapes(v,hexbytes,prefix): +- G=3D'Invalid escape sequence: ';E=3Dprefix;C=3D_A;A=3Dlen(v)-1 +- while A>-1 and v[A]=3D=3D_H:C=3Dnot C;A-=3D1 +- for D in hexbytes: +- if C: +- C=3D_A;A=3Dlen(D)-1 +- while A>-1 and D[A]=3D=3D_H:C=3Dnot C;A-=3D1 +- v+=3DE;v+=3DD;continue +- B=3D'';A=3D0;F=3D4 +- if E=3D=3D_V:F=3D8 +- B=3D''.join(D[A:A+F]).lower() +- if B.strip('0123456789abcdef'):raise ValueError(G+B) +- if B[0]=3D=3D'd'and B[1].strip('01234567'):raise ValueError(G+B+'. Only= scalar unicode points are allowed.') +- v+=3Dunichr(int(B,16));v+=3Dunicode(D[len(B):]) +- return v +-_escapes=3D['0','b','f','n','r','t',_C] +-_escapedchars=3D['\x00','\x08','\x0c',_G,'\r',_S,_C] +-_escape_to_escapedchars=3Ddict(zip(_escapes,_escapedchars)) +-def _unescape(v): +- A=3D0;B=3D_A +- while A0: +- C=3DB.pop(0) +- try:H,A=3DC.split(_J,1) +- except ValueError:raise ValueError('Invalid inline table encountered') +- A=3DA.strip() +- if A[0]=3D=3DA[-1]and A[0]in(_C,_D)or(A[0]in'-0123456789'or A in(_T,_U= )or A[0]=3D=3D_I and A[-1]=3D=3D_M or A[0]=3D=3D_K and A[-1]=3D=3D_R):D.app= end(C) +- elif len(B)>0:B[0]=3DC+_N+B[0] +- else:raise ValueError('Invalid inline table value encountered') +- for F in D: +- G=3DE.load_line(F,currentlevel,multikey,multibackslash) +- if G is not _E:break +- def _get_split_on_quotes(F,line): +- A=3Dline.split(_C);D=3D_A;C=3D[] +- if len(A)>1 and _D in A[0]: +- B=3DA[0].split(_D);A=3DA[1:] +- while len(B)%2=3D=3D0 and len(A): +- B[-1]+=3D_C+A[0];A=3DA[1:] +- if _D in B[-1]:B=3DB[:-1]+B[-1].split(_D) +- C+=3DB +- for E in A: +- if D:C.append(E) +- else:C+=3DE.split(_D);D=3Dnot D +- return C +- def load_line(E,line,currentlevel,multikey,multibackslash): +- S=3D'Duplicate keys!';L=3Dmultikey;K=3Dline;G=3Dmultibackslash;D=3Dcurr= entlevel;H=3D1;M=3DE._get_split_on_quotes(K);C=3D_A +- for F in M: +- if not C and _J in F:break +- H+=3DF.count(_J);C=3Dnot C +- A=3DK.split(_J,H);N=3D_strictly_valid_num(A[-1]) +- if _number_with_underscores.match(A[-1]):A[-1]=3DA[-1].replace(_P,'') +- while len(A[-1])and(A[-1][0]!=3D_L and A[-1][0]!=3D_S and A[-1][0]!=3D_= D and A[-1][0]!=3D_C and A[-1][0]!=3D_I and A[-1][0]!=3D_K and A[-1].strip(= )!=3D_T and A[-1].strip()!=3D_U): +- try:float(A[-1]);break +- except ValueError:pass +- if _load_date(A[-1])is not _E:break +- if TIME_RE.match(A[-1]):break +- H+=3D1;P=3DA[-1];A=3DK.split(_J,H) +- if P=3D=3DA[-1]:raise ValueError('Invalid date or number') +- if N:N=3D_strictly_valid_num(A[-1]) +- A=3D[_J.join(A[:-1]).strip(),A[-1].strip()] +- if _F in A[0]: +- if _C in A[0]or _D in A[0]: +- M=3DE._get_split_on_quotes(A[0]);C=3D_A;B=3D[] +- for F in M: +- if C:B.append(F) +- else:B+=3D[A.strip()for A in F.split(_F)] +- C=3Dnot C +- else:B=3DA[0].split(_F) +- while B[-1]=3D=3D'':B=3DB[:-1] +- for I in B[:-1]: +- if I=3D=3D'':continue +- if I not in D:D[I]=3DE.get_empty_table() +- D=3DD[I] +- A[0]=3DB[-1].strip() +- elif(A[0][0]=3D=3D_C or A[0][0]=3D=3D_D)and A[0][-1]=3D=3DA[0][0]:A[0]= =3D_unescape(A[0][1:-1]) +- J,Q=3DE._load_line_multiline_str(A[1]) +- if J>-1: +- while J>-1 and A[1][J+Q]=3D=3D_H:G=3Dnot G;J-=3D1 +- if G:O=3DA[1][:-1] +- else:O=3DA[1]+_G +- L=3DA[0] +- else:R,T=3DE.load_value(A[1],N) +- try:D[A[0]];raise ValueError(S) +- except TypeError:raise ValueError(S) +- except KeyError: +- if L:return L,O,G +- else:D[A[0]]=3DR +- def _load_line_multiline_str(C,p): +- B=3D0 +- if len(p)<3:return-1,B +- if p[0]=3D=3D_I and(p.strip()[-1]!=3D_M and C._load_array_isstrarray(p)= ): +- A=3Dp[1:].strip().split(_N) +- while len(A)>1 and A[-1][0]!=3D_C and A[-1][0]!=3D_D:A=3DA[:-2]+[A[-2]= +_N+A[-1]] +- A=3DA[-1];B=3Dlen(p)-len(A);p=3DA +- if p[0]!=3D_C and p[0]!=3D_D:return-1,B +- if p[1]!=3Dp[0]or p[2]!=3Dp[0]:return-1,B +- if len(p)>5 and p[-1]=3D=3Dp[0]and p[-2]=3D=3Dp[0]and p[-3]=3D=3Dp[0]:r= eturn-1,B +- return len(p)-1,B +- def load_value(E,v,strictly_valid=3D_B): +- a=3D'float';Z=3D'int';Y=3D'bool' +- if not v:raise ValueError('Empty value is invalid') +- if v=3D=3D_T:return _B,Y +- elif v=3D=3D_U:return _A,Y +- elif v[0]=3D=3D_C or v[0]=3D=3D_D: +- F=3Dv[0];B=3Dv[1:].split(F);G=3D_A;H=3D0 +- if len(B)>1 and B[0]=3D=3D''and B[1]=3D=3D'':B=3DB[2:];G=3D_B +- I=3D_A +- for J in B: +- if J=3D=3D'': +- if G:H+=3D1 +- else:I=3D_B +- else: +- K=3D_A +- try: +- A=3D-1;N=3DJ[A] +- while N=3D=3D_H:K=3Dnot K;A-=3D1;N=3DJ[A] +- except IndexError:pass +- if not K: +- if I:raise ValueError('Found tokens after a closed '+'string. Inval= id TOML.') +- elif not G or H>1:I=3D_B +- else:H=3D0 +- if F=3D=3D_C: +- T=3Dv.split(_H)[1:];C=3D_A +- for A in T: +- if A=3D=3D'':C=3Dnot C +- else: +- if A[0]not in _escapes and(A[0]!=3D'u'and A[0]!=3D'U'and not C):rai= se ValueError(_W) +- if C:C=3D_A +- for L in ['\\u',_V]: +- if L in v:O=3Dv.split(L);v=3D_load_unicode_escapes(O[0],O[1:],L) +- v=3D_unescape(v) +- if len(v)>1 and v[1]=3D=3DF and(len(v)<3 or v[1]=3D=3Dv[2]):v=3Dv[2:-2] +- return v[1:-1],'str' +- elif v[0]=3D=3D_I:return E.load_array(v),'array' +- elif v[0]=3D=3D_K:P=3DE.get_empty_inline_table();E.load_inline_object(v= ,P);return P,'inline_object' +- elif TIME_RE.match(v):U,V,W,b,Q=3DTIME_RE.match(v).groups();X=3Ddatetim= e.time(int(U),int(V),int(W),int(Q)if Q else 0);return X,'time' +- else: +- R=3D_load_date(v) +- if R is not _E:return R,'date' +- if not strictly_valid:raise ValueError('Weirdness with leading zeroes = or underscores in your number.') +- D=3DZ;S=3D_A +- if v[0]=3D=3D_O:S=3D_B;v=3Dv[1:] +- elif v[0]=3D=3D_Q:v=3Dv[1:] +- v=3Dv.replace(_P,'');M=3Dv.lower() +- if _F in v or'x'not in v and('e'in v or'E'in v): +- if _F in v and v.split(_F,1)[1]=3D=3D'':raise ValueError('This float = is missing digits after the point') +- if v[0]not in'0123456789':raise ValueError("This float doesn't have a= leading digit") +- v=3Dfloat(v);D=3Da +- elif len(M)=3D=3D3 and(M=3D=3D'inf'or M=3D=3D'nan'):v=3Dfloat(v);D=3Da +- if D=3D=3DZ:v=3Dint(v,0) +- if S:return 0-v,D +- return v,D +- def bounded_string(C,s): +- if len(s)=3D=3D0:return _B +- if s[-1]!=3Ds[0]:return _A +- A=3D-2;B=3D_A +- while len(s)+A>0: +- if s[A]=3D=3D_H:B=3Dnot B;A-=3D1 +- else:break +- return not B +- def _load_array_isstrarray(A,a): +- a=3Da[1:-1].strip() +- if a!=3D''and(a[0]=3D=3D_C or a[0]=3D=3D_D):return _B +- return _A +- def load_array(H,a): +- I=3D_E;N=3D[];a=3Da.strip() +- if _I not in a[1:-1]or''!=3Da[1:-1].split(_I)[0].strip(): +- Q=3DH._load_array_isstrarray(a) +- if not a[1:-1].strip().startswith(_K):a=3Da[1:-1].split(_N) +- else: +- O=3D[];E=3D1;A=3D2;J=3D1 if a[E]=3D=3D_K else 0;F=3D_A +- while A-1 and a[K]=3D=3D_H:F=3Dnot F;K-=3D1 +- F=3Dnot F +- if not F and a[A]=3D=3D_K:J+=3D1 +- if F or a[A]!=3D_R:A+=3D1;continue +- elif a[A]=3D=3D_R and J>1:J-=3D1;A+=3D1;continue +- A+=3D1;O.append(a[E:A]);E=3DA+1 +- while E2 and C[0]=3D=3DC[1]=3D=3DC[2= ]and C[-2]!=3DC[0]and C[-3]!=3DC[0]: +- a[B]=3Da[B]+_N+a[B+1];C=3Da[B].strip() +- if B=3D(3,):unicode=3Dstr +-def dump(o,f,encoder=3D_A): +- if not f.write:raise TypeError('You can only dump an object to a file de= scriptor') +- A=3Ddumps(o,encoder=3Dencoder);f.write(A);return A +-def dumps(o,encoder=3D_A): +- C=3Dencoder;A=3D'' +- if C is _A:C=3DTomlEncoder(o.__class__) +- B,D=3DC.dump_sections(o,'');A+=3DB;G=3D[id(o)] +- while D: +- H=3D[id(A)for A in D] +- for K in G: +- if K in H:raise ValueError('Circular reference detected') +- G+=3DH;I=3DC.get_empty_table() +- for E in D: +- B,F=3DC.dump_sections(D[E],E) +- if B or not B and not F: +- if A and A[-2:]!=3D'\n\n':A+=3D_E +- A+=3D_C+E+_G +- if B:A+=3DB +- for J in F:I[E+_B+J]=3DF[J] +- D=3DI +- return A +-def _dump_str(v): +- G=3D"'";F=3D'\\';C=3D'"' +- if sys.version_info<(3,)and hasattr(v,'decode')and isinstance(v,str):v= =3Dv.decode('utf-8') +- v=3D'%r'%v +- if v[0]=3D=3D'u':v=3Dv[1:] +- D=3Dv.startswith(G) +- if D or v.startswith(C):v=3Dv[1:-1] +- if D:v=3Dv.replace("\\'",G);v=3Dv.replace(C,'\\"') +- v=3Dv.split('\\x') +- while len(v)>1: +- A=3D-1 +- if not v[0]:v=3Dv[1:] +- v[0]=3Dv[0].replace('\\\\',F);B=3Dv[0][A]!=3DF +- while v[0][:A]and v[0][A]=3D=3DF:B=3Dnot B;A-=3D1 +- if B:E=3D'x' +- else:E=3D'u00' +- v=3D[v[0]+E+v[1]]+v[2:] +- return unicode(C+v[0]+C) +-def _dump_float(v):return '{}'.format(v).replace('e+0','e+').replace('e-0= ','e-') +-def _dump_time(v): +- A=3Dv.utcoffset() +- if A is _A:return v.isoformat() +- return v.isoformat()[:-6] +-class TomlEncoder: +- def __init__(A,_dict=3Ddict,preserve=3D_D):A._dict=3D_dict;A.preserve=3D= preserve;A.dump_funcs=3D{str:_dump_str,unicode:_dump_str,list:A.dump_list,b= ool:lambda v:unicode(v).lower(),int:lambda v:v,float:_dump_float,Decimal:_d= ump_float,datetime.datetime:lambda v:v.isoformat().replace('+00:00','Z'),da= tetime.time:_dump_time,datetime.date:lambda v:v.isoformat()} +- def get_empty_table(A):return A._dict() +- def dump_list(B,v): +- A=3D_C +- for C in v:A+=3D' '+unicode(B.dump_value(C))+',' +- A+=3D']';return A +- def dump_inline_table(B,section): +- A=3Dsection;C=3D'' +- if isinstance(A,dict): +- D=3D[] +- for (E,F) in A.items():G=3DB.dump_inline_table(F);D.append(E+_F+G) +- C+=3D'{ '+', '.join(D)+' }\n';return C +- else:return unicode(B.dump_value(A)) +- def dump_value(B,v): +- A=3DB.dump_funcs.get(type(v)) +- if A is _A and hasattr(v,'__iter__'):A=3DB.dump_funcs[list] +- return A(v)if A is not _A else B.dump_funcs[str](v) +- def dump_sections(C,o,sup): +- D=3Dsup;F=3D'' +- if D!=3D''and D[-1]!=3D_B:D+=3D_B +- M=3DC._dict();G=3D'' +- for A in o: +- A=3Dunicode(A);B=3DA +- if not re.match('^[A-Za-z0-9_-]+$',A):B=3D_dump_str(A) +- if not isinstance(o[A],dict): +- N=3D_D +- if isinstance(o[A],list): +- for L in o[A]: +- if isinstance(L,dict):N=3DTrue +- if N: +- for L in o[A]: +- H=3D_E;G+=3D'[['+D+B+']]\n';I,J=3DC.dump_sections(L,D+B) +- if I: +- if I[0]=3D=3D_C:H+=3DI +- else:G+=3DI +- while J: +- O=3DC._dict() +- for K in J: +- E,P=3DC.dump_sections(J[K],D+B+_B+K) +- if E:H+=3D_C+D+B+_B+K+_G;H+=3DE +- for E in P:O[K+_B+E]=3DP[E] +- J=3DO +- G+=3DH +- elif o[A]is not _A:F+=3DB+_F+unicode(C.dump_value(o[A]))+_E +- elif C.preserve and isinstance(o[A],InlineTableDict):F+=3DB+_F+C.dump_= inline_table(o[A]) +- else:M[B]=3Do[A] +- F+=3DG;return F,M +-class TomlPreserveInlineDictEncoder(TomlEncoder): +- def __init__(A,_dict=3Ddict):super(TomlPreserveInlineDictEncoder,A).__in= it__(_dict,True) +-class TomlArraySeparatorEncoder(TomlEncoder): +- def __init__(B,_dict=3Ddict,preserve=3D_D,separator=3D','): +- A=3Dseparator;super(TomlArraySeparatorEncoder,B).__init__(_dict,preserv= e) +- if A.strip()=3D=3D'':A=3D','+A +- elif A.strip(' \t\n\r,'):raise ValueError('Invalid separator for arrays= ') +- B.separator=3DA +- def dump_list(D,v): +- B=3D[];C=3D_C +- for A in v:B.append(D.dump_value(A)) +- while B!=3D[]: +- E=3D[] +- for A in B: +- if isinstance(A,list): +- for F in A:E.append(F) +- else:C+=3D' '+unicode(A)+D.separator +- B=3DE +- C+=3D']';return C +-class TomlNumpyEncoder(TomlEncoder): +- def __init__(A,_dict=3Ddict,preserve=3D_D):import numpy as B;super(TomlN= umpyEncoder,A).__init__(_dict,preserve);A.dump_funcs[B.float16]=3D_dump_flo= at;A.dump_funcs[B.float32]=3D_dump_float;A.dump_funcs[B.float64]=3D_dump_fl= oat;A.dump_funcs[B.int16]=3DA._dump_int;A.dump_funcs[B.int32]=3DA._dump_int= ;A.dump_funcs[B.int64]=3DA._dump_int +- def _dump_int(A,v):return '{}'.format(int(v)) +-class TomlPreserveCommentEncoder(TomlEncoder): +- def __init__(A,_dict=3Ddict,preserve=3D_D):from dynaconf.vendor.toml.dec= oder import CommentValue as B;super(TomlPreserveCommentEncoder,A).__init__(= _dict,preserve);A.dump_funcs[B]=3Dlambda v:v.dump(A.dump_value) +-class TomlPathlibEncoder(TomlEncoder): +- def _dump_pathlib_path(A,v):return _dump_str(str(v)) +- def dump_value(A,v): +- if(3,4)<=3Dsys.version_info: +- import pathlib as B +- if isinstance(v,B.PurePath):v=3Dstr(v) +- return super(TomlPathlibEncoder,A).dump_value(v) +\ No newline at end of file +diff --git a/dynaconf/vendor/toml/ordered.py b/dynaconf/vendor/toml/ordere= d.py +deleted file mode 100644 +index 0261b32..0000000 +--- a/dynaconf/vendor/toml/ordered.py ++++ /dev/null +@@ -1,7 +0,0 @@ +-from collections import OrderedDict +-from . import TomlEncoder +-from . import TomlDecoder +-class TomlOrderedDecoder(TomlDecoder): +- def __init__(A):super(A.__class__,A).__init__(_dict=3DOrderedDict) +-class TomlOrderedEncoder(TomlEncoder): +- def __init__(A):super(A.__class__,A).__init__(_dict=3DOrderedDict) +\ No newline at end of file +diff --git a/dynaconf/vendor/toml/tz.py b/dynaconf/vendor/toml/tz.py +deleted file mode 100644 +index 4d6fec9..0000000 +--- a/dynaconf/vendor/toml/tz.py ++++ /dev/null +@@ -1,10 +0,0 @@ +-from datetime import tzinfo,timedelta +-class TomlTz(tzinfo): +- def __init__(A,toml_offset): +- B=3Dtoml_offset +- if B=3D=3D'Z':A._raw_offset=3D'+00:00' +- else:A._raw_offset=3DB +- A._sign=3D-1 if A._raw_offset[0]=3D=3D'-'else 1;A._hours=3Dint(A._raw_o= ffset[1:3]);A._minutes=3Dint(A._raw_offset[4:6]) +- def tzname(A,dt):return'UTC'+A._raw_offset +- def utcoffset(A,dt):return A._sign*timedelta(hours=3DA._hours,minutes=3D= A._minutes) +- def dst(A,dt):return timedelta(0) +\ No newline at end of file +diff --git a/dynaconf/vendor/vendor.txt b/dynaconf/vendor/vendor.txt +index add308d..daa2b60 100644 +--- a/dynaconf/vendor/vendor.txt ++++ b/dynaconf/vendor/vendor.txt +@@ -1,5 +1 @@ + python-box=3D=3D4.2.3 +-toml=3D=3D0.10.8 +-click=3D=3D7.1.x +-python-dotenv=3D=3D0.13.0 +-ruamel.yaml=3D=3D0.16.10 +diff --git a/dynaconf/vendor_src/box/converters.py b/dynaconf/vendor_src/b= ox/converters.py +index c9a2293..ae42bf6 100644 +--- a/dynaconf/vendor_src/box/converters.py ++++ b/dynaconf/vendor_src/box/converters.py +@@ -9,9 +9,9 @@ import sys + import warnings + from pathlib import Path +=20 +-import dynaconf.vendor.ruamel.yaml as yaml ++import ruamel.yaml as yaml + from dynaconf.vendor.box.exceptions import BoxError, BoxWarning +-from dynaconf.vendor import toml ++import toml +=20 +=20 + BOX_PARAMETERS =3D ('default_box', 'default_box_attr', 'conversion_box', +diff --git a/dynaconf/vendor_src/box/from_file.py b/dynaconf/vendor_src/bo= x/from_file.py +index 2e2a6ad..3f76819 100644 +--- a/dynaconf/vendor_src/box/from_file.py ++++ b/dynaconf/vendor_src/box/from_file.py +@@ -3,8 +3,8 @@ + from json import JSONDecodeError + from pathlib import Path + from typing import Union +-from dynaconf.vendor.toml import TomlDecodeError +-from dynaconf.vendor.ruamel.yaml import YAMLError ++from toml import TomlDecodeError ++from ruamel.yaml import YAMLError +=20 +=20 + from .exceptions import BoxError +diff --git a/dynaconf/vendor_src/click/README.md b/dynaconf/vendor_src/cli= ck/README.md +deleted file mode 100644 +index 0f7bac3..0000000 +--- a/dynaconf/vendor_src/click/README.md ++++ /dev/null +@@ -1,5 +0,0 @@ +-## python-click +- +-Vendored dep taken from: https://github.com/pallets/click +-Licensed under MIT: https://github.com/pallets/clickl/blob/master/LICENSE +-Current version: 7.1.x +diff --git a/dynaconf/vendor_src/click/__init__.py b/dynaconf/vendor_src/c= lick/__init__.py +deleted file mode 100644 +index 9cd0129..0000000 +--- a/dynaconf/vendor_src/click/__init__.py ++++ /dev/null +@@ -1,75 +0,0 @@ +-""" +-Click is a simple Python module inspired by the stdlib optparse to make +-writing command line scripts fun. Unlike other modules, it's based +-around a simple API that does not come with too much magic and is +-composable. +-""" +-from .core import Argument +-from .core import BaseCommand +-from .core import Command +-from .core import CommandCollection +-from .core import Context +-from .core import Group +-from .core import MultiCommand +-from .core import Option +-from .core import Parameter +-from .decorators import argument +-from .decorators import command +-from .decorators import confirmation_option +-from .decorators import group +-from .decorators import help_option +-from .decorators import make_pass_decorator +-from .decorators import option +-from .decorators import pass_context +-from .decorators import pass_obj +-from .decorators import password_option +-from .decorators import version_option +-from .exceptions import Abort +-from .exceptions import BadArgumentUsage +-from .exceptions import BadOptionUsage +-from .exceptions import BadParameter +-from .exceptions import ClickException +-from .exceptions import FileError +-from .exceptions import MissingParameter +-from .exceptions import NoSuchOption +-from .exceptions import UsageError +-from .formatting import HelpFormatter +-from .formatting import wrap_text +-from .globals import get_current_context +-from .parser import OptionParser +-from .termui import clear +-from .termui import confirm +-from .termui import echo_via_pager +-from .termui import edit +-from .termui import get_terminal_size +-from .termui import getchar +-from .termui import launch +-from .termui import pause +-from .termui import progressbar +-from .termui import prompt +-from .termui import secho +-from .termui import style +-from .termui import unstyle +-from .types import BOOL +-from .types import Choice +-from .types import DateTime +-from .types import File +-from .types import FLOAT +-from .types import FloatRange +-from .types import INT +-from .types import IntRange +-from .types import ParamType +-from .types import Path +-from .types import STRING +-from .types import Tuple +-from .types import UNPROCESSED +-from .types import UUID +-from .utils import echo +-from .utils import format_filename +-from .utils import get_app_dir +-from .utils import get_binary_stream +-from .utils import get_os_args +-from .utils import get_text_stream +-from .utils import open_file +- +-__version__ =3D "8.0.0.dev" +diff --git a/dynaconf/vendor_src/click/_bashcomplete.py b/dynaconf/vendor_= src/click/_bashcomplete.py +deleted file mode 100644 +index b9e4900..0000000 +--- a/dynaconf/vendor_src/click/_bashcomplete.py ++++ /dev/null +@@ -1,371 +0,0 @@ +-import copy +-import os +-import re +-from collections import abc +- +-from .core import Argument +-from .core import MultiCommand +-from .core import Option +-from .parser import split_arg_string +-from .types import Choice +-from .utils import echo +- +-WORDBREAK =3D "=3D" +- +-# Note, only BASH version 4.4 and later have the nosort option. +-COMPLETION_SCRIPT_BASH =3D """ +-%(complete_func)s() { +- local IFS=3D$'\n' +- COMPREPLY=3D( $( env COMP_WORDS=3D"${COMP_WORDS[*]}" \\ +- COMP_CWORD=3D$COMP_CWORD \\ +- %(autocomplete_var)s=3Dcomplete $1 ) ) +- return 0 +-} +- +-%(complete_func)setup() { +- local COMPLETION_OPTIONS=3D"" +- local BASH_VERSION_ARR=3D(${BASH_VERSION//./ }) +- # Only BASH version 4.4 and later have the nosort option. +- if [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq = 4 ] \ +-&& [ ${BASH_VERSION_ARR[1]} -ge 4 ]); then +- COMPLETION_OPTIONS=3D"-o nosort" +- fi +- +- complete $COMPLETION_OPTIONS -F %(complete_func)s %(script_names)s +-} +- +-%(complete_func)setup +-""" +- +-COMPLETION_SCRIPT_ZSH =3D """ +-#compdef %(script_names)s +- +-%(complete_func)s() { +- local -a completions +- local -a completions_with_descriptions +- local -a response +- (( ! $+commands[%(script_names)s] )) && return 1 +- +- response=3D("${(@f)$( env COMP_WORDS=3D\"${words[*]}\" \\ +- COMP_CWORD=3D$((CURRENT-1)) \\ +- %(autocomplete_var)s=3D\"complete_zsh\" \\ +- %(script_names)s )}") +- +- for key descr in ${(kv)response}; do +- if [[ "$descr" =3D=3D "_" ]]; then +- completions+=3D("$key") +- else +- completions_with_descriptions+=3D("$key":"$descr") +- fi +- done +- +- if [ -n "$completions_with_descriptions" ]; then +- _describe -V unsorted completions_with_descriptions -U +- fi +- +- if [ -n "$completions" ]; then +- compadd -U -V unsorted -a completions +- fi +- compstate[insert]=3D"automenu" +-} +- +-compdef %(complete_func)s %(script_names)s +-""" +- +-COMPLETION_SCRIPT_FISH =3D ( +- "complete --no-files --command %(script_names)s --arguments" +- ' "(env %(autocomplete_var)s=3Dcomplete_fish' +- " COMP_WORDS=3D(commandline -cp) COMP_CWORD=3D(commandline -t)" +- ' %(script_names)s)"' +-) +- +-_completion_scripts =3D { +- "bash": COMPLETION_SCRIPT_BASH, +- "zsh": COMPLETION_SCRIPT_ZSH, +- "fish": COMPLETION_SCRIPT_FISH, +-} +- +-_invalid_ident_char_re =3D re.compile(r"[^a-zA-Z0-9_]") +- +- +-def get_completion_script(prog_name, complete_var, shell): +- cf_name =3D _invalid_ident_char_re.sub("", prog_name.replace("-", "_"= )) +- script =3D _completion_scripts.get(shell, COMPLETION_SCRIPT_BASH) +- return ( +- script +- % { +- "complete_func": f"_{cf_name}_completion", +- "script_names": prog_name, +- "autocomplete_var": complete_var, +- } +- ).strip() + ";" +- +- +-def resolve_ctx(cli, prog_name, args): +- """Parse into a hierarchy of contexts. Contexts are connected +- through the parent variable. +- +- :param cli: command definition +- :param prog_name: the program that is running +- :param args: full list of args +- :return: the final context/command parsed +- """ +- ctx =3D cli.make_context(prog_name, args, resilient_parsing=3DTrue) +- args =3D ctx.protected_args + ctx.args +- while args: +- if isinstance(ctx.command, MultiCommand): +- if not ctx.command.chain: +- cmd_name, cmd, args =3D ctx.command.resolve_command(ctx, = args) +- if cmd is None: +- return ctx +- ctx =3D cmd.make_context( +- cmd_name, args, parent=3Dctx, resilient_parsing=3DTrue +- ) +- args =3D ctx.protected_args + ctx.args +- else: +- # Walk chained subcommand contexts saving the last one. +- while args: +- cmd_name, cmd, args =3D ctx.command.resolve_command(c= tx, args) +- if cmd is None: +- return ctx +- sub_ctx =3D cmd.make_context( +- cmd_name, +- args, +- parent=3Dctx, +- allow_extra_args=3DTrue, +- allow_interspersed_args=3DFalse, +- resilient_parsing=3DTrue, +- ) +- args =3D sub_ctx.args +- ctx =3D sub_ctx +- args =3D sub_ctx.protected_args + sub_ctx.args +- else: +- break +- return ctx +- +- +-def start_of_option(param_str): +- """ +- :param param_str: param_str to check +- :return: whether or not this is the start of an option declaration +- (i.e. starts "-" or "--") +- """ +- return param_str and param_str[:1] =3D=3D "-" +- +- +-def is_incomplete_option(all_args, cmd_param): +- """ +- :param all_args: the full original list of args supplied +- :param cmd_param: the current command parameter +- :return: whether or not the last option declaration (i.e. starts +- "-" or "--") is incomplete and corresponds to this cmd_param. In +- other words whether this cmd_param option can still accept +- values +- """ +- if not isinstance(cmd_param, Option): +- return False +- if cmd_param.is_flag: +- return False +- last_option =3D None +- for index, arg_str in enumerate( +- reversed([arg for arg in all_args if arg !=3D WORDBREAK]) +- ): +- if index + 1 > cmd_param.nargs: +- break +- if start_of_option(arg_str): +- last_option =3D arg_str +- +- return True if last_option and last_option in cmd_param.opts else Fal= se +- +- +-def is_incomplete_argument(current_params, cmd_param): +- """ +- :param current_params: the current params and values for this +- argument as already entered +- :param cmd_param: the current command parameter +- :return: whether or not the last argument is incomplete and +- corresponds to this cmd_param. In other words whether or not the +- this cmd_param argument can still accept values +- """ +- if not isinstance(cmd_param, Argument): +- return False +- current_param_values =3D current_params[cmd_param.name] +- if current_param_values is None: +- return True +- if cmd_param.nargs =3D=3D -1: +- return True +- if ( +- isinstance(current_param_values, abc.Iterable) +- and cmd_param.nargs > 1 +- and len(current_param_values) < cmd_param.nargs +- ): +- return True +- return False +- +- +-def get_user_autocompletions(ctx, args, incomplete, cmd_param): +- """ +- :param ctx: context associated with the parsed command +- :param args: full list of args +- :param incomplete: the incomplete text to autocomplete +- :param cmd_param: command definition +- :return: all the possible user-specified completions for the param +- """ +- results =3D [] +- if isinstance(cmd_param.type, Choice): +- # Choices don't support descriptions. +- results =3D [ +- (c, None) for c in cmd_param.type.choices if str(c).startswit= h(incomplete) +- ] +- elif cmd_param.autocompletion is not None: +- dynamic_completions =3D cmd_param.autocompletion( +- ctx=3Dctx, args=3Dargs, incomplete=3Dincomplete +- ) +- results =3D [ +- c if isinstance(c, tuple) else (c, None) for c in dynamic_com= pletions +- ] +- return results +- +- +-def get_visible_commands_starting_with(ctx, starts_with): +- """ +- :param ctx: context associated with the parsed command +- :starts_with: string that visible commands must start with. +- :return: all visible (not hidden) commands that start with starts_wit= h. +- """ +- for c in ctx.command.list_commands(ctx): +- if c.startswith(starts_with): +- command =3D ctx.command.get_command(ctx, c) +- if not command.hidden: +- yield command +- +- +-def add_subcommand_completions(ctx, incomplete, completions_out): +- # Add subcommand completions. +- if isinstance(ctx.command, MultiCommand): +- completions_out.extend( +- [ +- (c.name, c.get_short_help_str()) +- for c in get_visible_commands_starting_with(ctx, incomple= te) +- ] +- ) +- +- # Walk up the context list and add any other completion +- # possibilities from chained commands +- while ctx.parent is not None: +- ctx =3D ctx.parent +- if isinstance(ctx.command, MultiCommand) and ctx.command.chain: +- remaining_commands =3D [ +- c +- for c in get_visible_commands_starting_with(ctx, incomple= te) +- if c.name not in ctx.protected_args +- ] +- completions_out.extend( +- [(c.name, c.get_short_help_str()) for c in remaining_comm= ands] +- ) +- +- +-def get_choices(cli, prog_name, args, incomplete): +- """ +- :param cli: command definition +- :param prog_name: the program that is running +- :param args: full list of args +- :param incomplete: the incomplete text to autocomplete +- :return: all the possible completions for the incomplete +- """ +- all_args =3D copy.deepcopy(args) +- +- ctx =3D resolve_ctx(cli, prog_name, args) +- if ctx is None: +- return [] +- +- has_double_dash =3D "--" in all_args +- +- # In newer versions of bash long opts with '=3D's are partitioned, but +- # it's easier to parse without the '=3D' +- if start_of_option(incomplete) and WORDBREAK in incomplete: +- partition_incomplete =3D incomplete.partition(WORDBREAK) +- all_args.append(partition_incomplete[0]) +- incomplete =3D partition_incomplete[2] +- elif incomplete =3D=3D WORDBREAK: +- incomplete =3D "" +- +- completions =3D [] +- if not has_double_dash and start_of_option(incomplete): +- # completions for partial options +- for param in ctx.command.params: +- if isinstance(param, Option) and not param.hidden: +- param_opts =3D [ +- param_opt +- for param_opt in param.opts + param.secondary_opts +- if param_opt not in all_args or param.multiple +- ] +- completions.extend( +- [(o, param.help) for o in param_opts if o.startswith(= incomplete)] +- ) +- return completions +- # completion for option values from user supplied values +- for param in ctx.command.params: +- if is_incomplete_option(all_args, param): +- return get_user_autocompletions(ctx, all_args, incomplete, pa= ram) +- # completion for argument values from user supplied values +- for param in ctx.command.params: +- if is_incomplete_argument(ctx.params, param): +- return get_user_autocompletions(ctx, all_args, incomplete, pa= ram) +- +- add_subcommand_completions(ctx, incomplete, completions) +- # Sort before returning so that proper ordering can be enforced in cu= stom types. +- return sorted(completions) +- +- +-def do_complete(cli, prog_name, include_descriptions): +- cwords =3D split_arg_string(os.environ["COMP_WORDS"]) +- cword =3D int(os.environ["COMP_CWORD"]) +- args =3D cwords[1:cword] +- try: +- incomplete =3D cwords[cword] +- except IndexError: +- incomplete =3D "" +- +- for item in get_choices(cli, prog_name, args, incomplete): +- echo(item[0]) +- if include_descriptions: +- # ZSH has trouble dealing with empty array parameters when +- # returned from commands, use '_' to indicate no description +- # is present. +- echo(item[1] if item[1] else "_") +- +- return True +- +- +-def do_complete_fish(cli, prog_name): +- cwords =3D split_arg_string(os.environ["COMP_WORDS"]) +- incomplete =3D os.environ["COMP_CWORD"] +- args =3D cwords[1:] +- +- for item in get_choices(cli, prog_name, args, incomplete): +- if item[1]: +- echo(f"{item[0]}\t{item[1]}") +- else: +- echo(item[0]) +- +- return True +- +- +-def bashcomplete(cli, prog_name, complete_var, complete_instr): +- if "_" in complete_instr: +- command, shell =3D complete_instr.split("_", 1) +- else: +- command =3D complete_instr +- shell =3D "bash" +- +- if command =3D=3D "source": +- echo(get_completion_script(prog_name, complete_var, shell)) +- return True +- elif command =3D=3D "complete": +- if shell =3D=3D "fish": +- return do_complete_fish(cli, prog_name) +- elif shell in {"bash", "zsh"}: +- return do_complete(cli, prog_name, shell =3D=3D "zsh") +- +- return False +diff --git a/dynaconf/vendor_src/click/_compat.py b/dynaconf/vendor_src/cl= ick/_compat.py +deleted file mode 100644 +index 85568ca..0000000 +--- a/dynaconf/vendor_src/click/_compat.py ++++ /dev/null +@@ -1,611 +0,0 @@ +-import codecs +-import io +-import os +-import re +-import sys +-from weakref import WeakKeyDictionary +- +-CYGWIN =3D sys.platform.startswith("cygwin") +-MSYS2 =3D sys.platform.startswith("win") and ("GCC" in sys.version) +-# Determine local App Engine environment, per Google's own suggestion +-APP_ENGINE =3D "APPENGINE_RUNTIME" in os.environ and "Development/" in os= .environ.get( +- "SERVER_SOFTWARE", "" +-) +-WIN =3D sys.platform.startswith("win") and not APP_ENGINE and not MSYS2 +-DEFAULT_COLUMNS =3D 80 +-auto_wrap_for_ansi =3D None +-colorama =3D None +-get_winterm_size =3D None +-_ansi_re =3D re.compile(r"\033\[[;?0-9]*[a-zA-Z]") +- +- +-def get_filesystem_encoding(): +- return sys.getfilesystemencoding() or sys.getdefaultencoding() +- +- +-def _make_text_stream( +- stream, encoding, errors, force_readable=3DFalse, force_writable=3DFa= lse +-): +- if encoding is None: +- encoding =3D get_best_encoding(stream) +- if errors is None: +- errors =3D "replace" +- return _NonClosingTextIOWrapper( +- stream, +- encoding, +- errors, +- line_buffering=3DTrue, +- force_readable=3Dforce_readable, +- force_writable=3Dforce_writable, +- ) +- +- +-def is_ascii_encoding(encoding): +- """Checks if a given encoding is ascii.""" +- try: +- return codecs.lookup(encoding).name =3D=3D "ascii" +- except LookupError: +- return False +- +- +-def get_best_encoding(stream): +- """Returns the default stream encoding if not found.""" +- rv =3D getattr(stream, "encoding", None) or sys.getdefaultencoding() +- if is_ascii_encoding(rv): +- return "utf-8" +- return rv +- +- +-class _NonClosingTextIOWrapper(io.TextIOWrapper): +- def __init__( +- self, +- stream, +- encoding, +- errors, +- force_readable=3DFalse, +- force_writable=3DFalse, +- **extra, +- ): +- self._stream =3D stream =3D _FixupStream(stream, force_readable, = force_writable) +- super().__init__(stream, encoding, errors, **extra) +- +- def __del__(self): +- try: +- self.detach() +- except Exception: +- pass +- +- def isatty(self): +- # https://bitbucket.org/pypy/pypy/issue/1803 +- return self._stream.isatty() +- +- +-class _FixupStream: +- """The new io interface needs more from streams than streams +- traditionally implement. As such, this fix-up code is necessary in +- some circumstances. +- +- The forcing of readable and writable flags are there because some too= ls +- put badly patched objects on sys (one such offender are certain versi= on +- of jupyter notebook). +- """ +- +- def __init__(self, stream, force_readable=3DFalse, force_writable=3DF= alse): +- self._stream =3D stream +- self._force_readable =3D force_readable +- self._force_writable =3D force_writable +- +- def __getattr__(self, name): +- return getattr(self._stream, name) +- +- def read1(self, size): +- f =3D getattr(self._stream, "read1", None) +- if f is not None: +- return f(size) +- +- return self._stream.read(size) +- +- def readable(self): +- if self._force_readable: +- return True +- x =3D getattr(self._stream, "readable", None) +- if x is not None: +- return x() +- try: +- self._stream.read(0) +- except Exception: +- return False +- return True +- +- def writable(self): +- if self._force_writable: +- return True +- x =3D getattr(self._stream, "writable", None) +- if x is not None: +- return x() +- try: +- self._stream.write("") +- except Exception: +- try: +- self._stream.write(b"") +- except Exception: +- return False +- return True +- +- def seekable(self): +- x =3D getattr(self._stream, "seekable", None) +- if x is not None: +- return x() +- try: +- self._stream.seek(self._stream.tell()) +- except Exception: +- return False +- return True +- +- +-def is_bytes(x): +- return isinstance(x, (bytes, memoryview, bytearray)) +- +- +-def _is_binary_reader(stream, default=3DFalse): +- try: +- return isinstance(stream.read(0), bytes) +- except Exception: +- return default +- # This happens in some cases where the stream was already +- # closed. In this case, we assume the default. +- +- +-def _is_binary_writer(stream, default=3DFalse): +- try: +- stream.write(b"") +- except Exception: +- try: +- stream.write("") +- return False +- except Exception: +- pass +- return default +- return True +- +- +-def _find_binary_reader(stream): +- # We need to figure out if the given stream is already binary. +- # This can happen because the official docs recommend detaching +- # the streams to get binary streams. Some code might do this, so +- # we need to deal with this case explicitly. +- if _is_binary_reader(stream, False): +- return stream +- +- buf =3D getattr(stream, "buffer", None) +- +- # Same situation here; this time we assume that the buffer is +- # actually binary in case it's closed. +- if buf is not None and _is_binary_reader(buf, True): +- return buf +- +- +-def _find_binary_writer(stream): +- # We need to figure out if the given stream is already binary. +- # This can happen because the official docs recommend detaching +- # the streams to get binary streams. Some code might do this, so +- # we need to deal with this case explicitly. +- if _is_binary_writer(stream, False): +- return stream +- +- buf =3D getattr(stream, "buffer", None) +- +- # Same situation here; this time we assume that the buffer is +- # actually binary in case it's closed. +- if buf is not None and _is_binary_writer(buf, True): +- return buf +- +- +-def _stream_is_misconfigured(stream): +- """A stream is misconfigured if its encoding is ASCII.""" +- # If the stream does not have an encoding set, we assume it's set +- # to ASCII. This appears to happen in certain unittest +- # environments. It's not quite clear what the correct behavior is +- # but this at least will force Click to recover somehow. +- return is_ascii_encoding(getattr(stream, "encoding", None) or "ascii") +- +- +-def _is_compat_stream_attr(stream, attr, value): +- """A stream attribute is compatible if it is equal to the +- desired value or the desired value is unset and the attribute +- has a value. +- """ +- stream_value =3D getattr(stream, attr, None) +- return stream_value =3D=3D value or (value is None and stream_value i= s not None) +- +- +-def _is_compatible_text_stream(stream, encoding, errors): +- """Check if a stream's encoding and errors attributes are +- compatible with the desired values. +- """ +- return _is_compat_stream_attr( +- stream, "encoding", encoding +- ) and _is_compat_stream_attr(stream, "errors", errors) +- +- +-def _force_correct_text_stream( +- text_stream, +- encoding, +- errors, +- is_binary, +- find_binary, +- force_readable=3DFalse, +- force_writable=3DFalse, +-): +- if is_binary(text_stream, False): +- binary_reader =3D text_stream +- else: +- # If the stream looks compatible, and won't default to a +- # misconfigured ascii encoding, return it as-is. +- if _is_compatible_text_stream(text_stream, encoding, errors) and = not ( +- encoding is None and _stream_is_misconfigured(text_stream) +- ): +- return text_stream +- +- # Otherwise, get the underlying binary reader. +- binary_reader =3D find_binary(text_stream) +- +- # If that's not possible, silently use the original reader +- # and get mojibake instead of exceptions. +- if binary_reader is None: +- return text_stream +- +- # Default errors to replace instead of strict in order to get +- # something that works. +- if errors is None: +- errors =3D "replace" +- +- # Wrap the binary stream in a text stream with the correct +- # encoding parameters. +- return _make_text_stream( +- binary_reader, +- encoding, +- errors, +- force_readable=3Dforce_readable, +- force_writable=3Dforce_writable, +- ) +- +- +-def _force_correct_text_reader(text_reader, encoding, errors, force_reada= ble=3DFalse): +- return _force_correct_text_stream( +- text_reader, +- encoding, +- errors, +- _is_binary_reader, +- _find_binary_reader, +- force_readable=3Dforce_readable, +- ) +- +- +-def _force_correct_text_writer(text_writer, encoding, errors, force_writa= ble=3DFalse): +- return _force_correct_text_stream( +- text_writer, +- encoding, +- errors, +- _is_binary_writer, +- _find_binary_writer, +- force_writable=3Dforce_writable, +- ) +- +- +-def get_binary_stdin(): +- reader =3D _find_binary_reader(sys.stdin) +- if reader is None: +- raise RuntimeError("Was not able to determine binary stream for s= ys.stdin.") +- return reader +- +- +-def get_binary_stdout(): +- writer =3D _find_binary_writer(sys.stdout) +- if writer is None: +- raise RuntimeError("Was not able to determine binary stream for s= ys.stdout.") +- return writer +- +- +-def get_binary_stderr(): +- writer =3D _find_binary_writer(sys.stderr) +- if writer is None: +- raise RuntimeError("Was not able to determine binary stream for s= ys.stderr.") +- return writer +- +- +-def get_text_stdin(encoding=3DNone, errors=3DNone): +- rv =3D _get_windows_console_stream(sys.stdin, encoding, errors) +- if rv is not None: +- return rv +- return _force_correct_text_reader(sys.stdin, encoding, errors, force_= readable=3DTrue) +- +- +-def get_text_stdout(encoding=3DNone, errors=3DNone): +- rv =3D _get_windows_console_stream(sys.stdout, encoding, errors) +- if rv is not None: +- return rv +- return _force_correct_text_writer(sys.stdout, encoding, errors, force= _writable=3DTrue) +- +- +-def get_text_stderr(encoding=3DNone, errors=3DNone): +- rv =3D _get_windows_console_stream(sys.stderr, encoding, errors) +- if rv is not None: +- return rv +- return _force_correct_text_writer(sys.stderr, encoding, errors, force= _writable=3DTrue) +- +- +-def filename_to_ui(value): +- if isinstance(value, bytes): +- value =3D value.decode(get_filesystem_encoding(), "replace") +- else: +- value =3D value.encode("utf-8", "surrogateescape").decode("utf-8"= , "replace") +- return value +- +- +-def get_strerror(e, default=3DNone): +- if hasattr(e, "strerror"): +- msg =3D e.strerror +- else: +- if default is not None: +- msg =3D default +- else: +- msg =3D str(e) +- if isinstance(msg, bytes): +- msg =3D msg.decode("utf-8", "replace") +- return msg +- +- +-def _wrap_io_open(file, mode, encoding, errors): +- """Handles not passing ``encoding`` and ``errors`` in binary mode.""" +- if "b" in mode: +- return open(file, mode) +- +- return open(file, mode, encoding=3Dencoding, errors=3Derrors) +- +- +-def open_stream(filename, mode=3D"r", encoding=3DNone, errors=3D"strict",= atomic=3DFalse): +- binary =3D "b" in mode +- +- # Standard streams first. These are simple because they don't need +- # special handling for the atomic flag. It's entirely ignored. +- if filename =3D=3D "-": +- if any(m in mode for m in ["w", "a", "x"]): +- if binary: +- return get_binary_stdout(), False +- return get_text_stdout(encoding=3Dencoding, errors=3Derrors),= False +- if binary: +- return get_binary_stdin(), False +- return get_text_stdin(encoding=3Dencoding, errors=3Derrors), False +- +- # Non-atomic writes directly go out through the regular open function= s. +- if not atomic: +- return _wrap_io_open(filename, mode, encoding, errors), True +- +- # Some usability stuff for atomic writes +- if "a" in mode: +- raise ValueError( +- "Appending to an existing file is not supported, because that" +- " would involve an expensive `copy`-operation to a temporary" +- " file. Open the file in normal `w`-mode and copy explicitly" +- " if that's what you're after." +- ) +- if "x" in mode: +- raise ValueError("Use the `overwrite`-parameter instead.") +- if "w" not in mode: +- raise ValueError("Atomic writes only make sense with `w`-mode.") +- +- # Atomic writes are more complicated. They work by opening a file +- # as a proxy in the same folder and then using the fdopen +- # functionality to wrap it in a Python file. Then we wrap it in an +- # atomic file that moves the file over on close. +- import errno +- import random +- +- try: +- perm =3D os.stat(filename).st_mode +- except OSError: +- perm =3D None +- +- flags =3D os.O_RDWR | os.O_CREAT | os.O_EXCL +- +- if binary: +- flags |=3D getattr(os, "O_BINARY", 0) +- +- while True: +- tmp_filename =3D os.path.join( +- os.path.dirname(filename), +- f".__atomic-write{random.randrange(1 << 32):08x}", +- ) +- try: +- fd =3D os.open(tmp_filename, flags, 0o666 if perm is None els= e perm) +- break +- except OSError as e: +- if e.errno =3D=3D errno.EEXIST or ( +- os.name =3D=3D "nt" +- and e.errno =3D=3D errno.EACCES +- and os.path.isdir(e.filename) +- and os.access(e.filename, os.W_OK) +- ): +- continue +- raise +- +- if perm is not None: +- os.chmod(tmp_filename, perm) # in case perm includes bits in uma= sk +- +- f =3D _wrap_io_open(fd, mode, encoding, errors) +- return _AtomicFile(f, tmp_filename, os.path.realpath(filename)), True +- +- +-class _AtomicFile: +- def __init__(self, f, tmp_filename, real_filename): +- self._f =3D f +- self._tmp_filename =3D tmp_filename +- self._real_filename =3D real_filename +- self.closed =3D False +- +- @property +- def name(self): +- return self._real_filename +- +- def close(self, delete=3DFalse): +- if self.closed: +- return +- self._f.close() +- os.replace(self._tmp_filename, self._real_filename) +- self.closed =3D True +- +- def __getattr__(self, name): +- return getattr(self._f, name) +- +- def __enter__(self): +- return self +- +- def __exit__(self, exc_type, exc_value, tb): +- self.close(delete=3Dexc_type is not None) +- +- def __repr__(self): +- return repr(self._f) +- +- +-def strip_ansi(value): +- return _ansi_re.sub("", value) +- +- +-def _is_jupyter_kernel_output(stream): +- if WIN: +- # TODO: Couldn't test on Windows, should't try to support until +- # someone tests the details wrt colorama. +- return +- +- while isinstance(stream, (_FixupStream, _NonClosingTextIOWrapper)): +- stream =3D stream._stream +- +- return stream.__class__.__module__.startswith("ipykernel.") +- +- +-def should_strip_ansi(stream=3DNone, color=3DNone): +- if color is None: +- if stream is None: +- stream =3D sys.stdin +- return not isatty(stream) and not _is_jupyter_kernel_output(strea= m) +- return not color +- +- +-# If we're on Windows, we provide transparent integration through +-# colorama. This will make ANSI colors through the echo function +-# work automatically. +-if WIN: +- # Windows has a smaller terminal +- DEFAULT_COLUMNS =3D 79 +- +- from ._winconsole import _get_windows_console_stream +- +- def _get_argv_encoding(): +- import locale +- +- return locale.getpreferredencoding() +- +- try: +- import colorama +- except ImportError: +- pass +- else: +- _ansi_stream_wrappers =3D WeakKeyDictionary() +- +- def auto_wrap_for_ansi(stream, color=3DNone): +- """This function wraps a stream so that calls through colorama +- are issued to the win32 console API to recolor on demand. It +- also ensures to reset the colors if a write call is interrupt= ed +- to not destroy the console afterwards. +- """ +- try: +- cached =3D _ansi_stream_wrappers.get(stream) +- except Exception: +- cached =3D None +- if cached is not None: +- return cached +- strip =3D should_strip_ansi(stream, color) +- ansi_wrapper =3D colorama.AnsiToWin32(stream, strip=3Dstrip) +- rv =3D ansi_wrapper.stream +- _write =3D rv.write +- +- def _safe_write(s): +- try: +- return _write(s) +- except BaseException: +- ansi_wrapper.reset_all() +- raise +- +- rv.write =3D _safe_write +- try: +- _ansi_stream_wrappers[stream] =3D rv +- except Exception: +- pass +- return rv +- +- def get_winterm_size(): +- win =3D colorama.win32.GetConsoleScreenBufferInfo( +- colorama.win32.STDOUT +- ).srWindow +- return win.Right - win.Left, win.Bottom - win.Top +- +- +-else: +- +- def _get_argv_encoding(): +- return getattr(sys.stdin, "encoding", None) or get_filesystem_enc= oding() +- +- def _get_windows_console_stream(f, encoding, errors): +- return None +- +- +-def term_len(x): +- return len(strip_ansi(x)) +- +- +-def isatty(stream): +- try: +- return stream.isatty() +- except Exception: +- return False +- +- +-def _make_cached_stream_func(src_func, wrapper_func): +- cache =3D WeakKeyDictionary() +- +- def func(): +- stream =3D src_func() +- try: +- rv =3D cache.get(stream) +- except Exception: +- rv =3D None +- if rv is not None: +- return rv +- rv =3D wrapper_func() +- try: +- stream =3D src_func() # In case wrapper_func() modified the = stream +- cache[stream] =3D rv +- except Exception: +- pass +- return rv +- +- return func +- +- +-_default_text_stdin =3D _make_cached_stream_func(lambda: sys.stdin, get_t= ext_stdin) +-_default_text_stdout =3D _make_cached_stream_func(lambda: sys.stdout, get= _text_stdout) +-_default_text_stderr =3D _make_cached_stream_func(lambda: sys.stderr, get= _text_stderr) +- +- +-binary_streams =3D { +- "stdin": get_binary_stdin, +- "stdout": get_binary_stdout, +- "stderr": get_binary_stderr, +-} +- +-text_streams =3D { +- "stdin": get_text_stdin, +- "stdout": get_text_stdout, +- "stderr": get_text_stderr, +-} +diff --git a/dynaconf/vendor_src/click/_termui_impl.py b/dynaconf/vendor_s= rc/click/_termui_impl.py +deleted file mode 100644 +index 7837250..0000000 +--- a/dynaconf/vendor_src/click/_termui_impl.py ++++ /dev/null +@@ -1,667 +0,0 @@ +-""" +-This module contains implementations for the termui module. To keep the +-import time of Click down, some infrequently used functionality is +-placed in this module and only imported as needed. +-""" +-import contextlib +-import math +-import os +-import sys +-import time +- +-from ._compat import _default_text_stdout +-from ._compat import CYGWIN +-from ._compat import get_best_encoding +-from ._compat import isatty +-from ._compat import open_stream +-from ._compat import strip_ansi +-from ._compat import term_len +-from ._compat import WIN +-from .exceptions import ClickException +-from .utils import echo +- +-if os.name =3D=3D "nt": +- BEFORE_BAR =3D "\r" +- AFTER_BAR =3D "\n" +-else: +- BEFORE_BAR =3D "\r\033[?25l" +- AFTER_BAR =3D "\033[?25h\n" +- +- +-def _length_hint(obj): +- """Returns the length hint of an object.""" +- try: +- return len(obj) +- except (AttributeError, TypeError): +- try: +- get_hint =3D type(obj).__length_hint__ +- except AttributeError: +- return None +- try: +- hint =3D get_hint(obj) +- except TypeError: +- return None +- if hint is NotImplemented or not isinstance(hint, int) or hint < = 0: +- return None +- return hint +- +- +-class ProgressBar: +- def __init__( +- self, +- iterable, +- length=3DNone, +- fill_char=3D"#", +- empty_char=3D" ", +- bar_template=3D"%(bar)s", +- info_sep=3D" ", +- show_eta=3DTrue, +- show_percent=3DNone, +- show_pos=3DFalse, +- item_show_func=3DNone, +- label=3DNone, +- file=3DNone, +- color=3DNone, +- width=3D30, +- ): +- self.fill_char =3D fill_char +- self.empty_char =3D empty_char +- self.bar_template =3D bar_template +- self.info_sep =3D info_sep +- self.show_eta =3D show_eta +- self.show_percent =3D show_percent +- self.show_pos =3D show_pos +- self.item_show_func =3D item_show_func +- self.label =3D label or "" +- if file is None: +- file =3D _default_text_stdout() +- self.file =3D file +- self.color =3D color +- self.width =3D width +- self.autowidth =3D width =3D=3D 0 +- +- if length is None: +- length =3D _length_hint(iterable) +- if iterable is None: +- if length is None: +- raise TypeError("iterable or length is required") +- iterable =3D range(length) +- self.iter =3D iter(iterable) +- self.length =3D length +- self.length_known =3D length is not None +- self.pos =3D 0 +- self.avg =3D [] +- self.start =3D self.last_eta =3D time.time() +- self.eta_known =3D False +- self.finished =3D False +- self.max_width =3D None +- self.entered =3D False +- self.current_item =3D None +- self.is_hidden =3D not isatty(self.file) +- self._last_line =3D None +- self.short_limit =3D 0.5 +- +- def __enter__(self): +- self.entered =3D True +- self.render_progress() +- return self +- +- def __exit__(self, exc_type, exc_value, tb): +- self.render_finish() +- +- def __iter__(self): +- if not self.entered: +- raise RuntimeError("You need to use progress bars in a with b= lock.") +- self.render_progress() +- return self.generator() +- +- def __next__(self): +- # Iteration is defined in terms of a generator function, +- # returned by iter(self); use that to define next(). This works +- # because `self.iter` is an iterable consumed by that generator, +- # so it is re-entry safe. Calling `next(self.generator())` +- # twice works and does "what you want". +- return next(iter(self)) +- +- def is_fast(self): +- return time.time() - self.start <=3D self.short_limit +- +- def render_finish(self): +- if self.is_hidden or self.is_fast(): +- return +- self.file.write(AFTER_BAR) +- self.file.flush() +- +- @property +- def pct(self): +- if self.finished: +- return 1.0 +- return min(self.pos / (float(self.length) or 1), 1.0) +- +- @property +- def time_per_iteration(self): +- if not self.avg: +- return 0.0 +- return sum(self.avg) / float(len(self.avg)) +- +- @property +- def eta(self): +- if self.length_known and not self.finished: +- return self.time_per_iteration * (self.length - self.pos) +- return 0.0 +- +- def format_eta(self): +- if self.eta_known: +- t =3D int(self.eta) +- seconds =3D t % 60 +- t //=3D 60 +- minutes =3D t % 60 +- t //=3D 60 +- hours =3D t % 24 +- t //=3D 24 +- if t > 0: +- return f"{t}d {hours:02}:{minutes:02}:{seconds:02}" +- else: +- return f"{hours:02}:{minutes:02}:{seconds:02}" +- return "" +- +- def format_pos(self): +- pos =3D str(self.pos) +- if self.length_known: +- pos +=3D f"/{self.length}" +- return pos +- +- def format_pct(self): +- return f"{int(self.pct * 100): 4}%"[1:] +- +- def format_bar(self): +- if self.length_known: +- bar_length =3D int(self.pct * self.width) +- bar =3D self.fill_char * bar_length +- bar +=3D self.empty_char * (self.width - bar_length) +- elif self.finished: +- bar =3D self.fill_char * self.width +- else: +- bar =3D list(self.empty_char * (self.width or 1)) +- if self.time_per_iteration !=3D 0: +- bar[ +- int( +- (math.cos(self.pos * self.time_per_iteration) / 2= .0 + 0.5) +- * self.width +- ) +- ] =3D self.fill_char +- bar =3D "".join(bar) +- return bar +- +- def format_progress_line(self): +- show_percent =3D self.show_percent +- +- info_bits =3D [] +- if self.length_known and show_percent is None: +- show_percent =3D not self.show_pos +- +- if self.show_pos: +- info_bits.append(self.format_pos()) +- if show_percent: +- info_bits.append(self.format_pct()) +- if self.show_eta and self.eta_known and not self.finished: +- info_bits.append(self.format_eta()) +- if self.item_show_func is not None: +- item_info =3D self.item_show_func(self.current_item) +- if item_info is not None: +- info_bits.append(item_info) +- +- return ( +- self.bar_template +- % { +- "label": self.label, +- "bar": self.format_bar(), +- "info": self.info_sep.join(info_bits), +- } +- ).rstrip() +- +- def render_progress(self): +- from .termui import get_terminal_size +- +- if self.is_hidden: +- return +- +- buf =3D [] +- # Update width in case the terminal has been resized +- if self.autowidth: +- old_width =3D self.width +- self.width =3D 0 +- clutter_length =3D term_len(self.format_progress_line()) +- new_width =3D max(0, get_terminal_size()[0] - clutter_length) +- if new_width < old_width: +- buf.append(BEFORE_BAR) +- buf.append(" " * self.max_width) +- self.max_width =3D new_width +- self.width =3D new_width +- +- clear_width =3D self.width +- if self.max_width is not None: +- clear_width =3D self.max_width +- +- buf.append(BEFORE_BAR) +- line =3D self.format_progress_line() +- line_len =3D term_len(line) +- if self.max_width is None or self.max_width < line_len: +- self.max_width =3D line_len +- +- buf.append(line) +- buf.append(" " * (clear_width - line_len)) +- line =3D "".join(buf) +- # Render the line only if it changed. +- +- if line !=3D self._last_line and not self.is_fast(): +- self._last_line =3D line +- echo(line, file=3Dself.file, color=3Dself.color, nl=3DFalse) +- self.file.flush() +- +- def make_step(self, n_steps): +- self.pos +=3D n_steps +- if self.length_known and self.pos >=3D self.length: +- self.finished =3D True +- +- if (time.time() - self.last_eta) < 1.0: +- return +- +- self.last_eta =3D time.time() +- +- # self.avg is a rolling list of length <=3D 7 of steps where step= s are +- # defined as time elapsed divided by the total progress through +- # self.length. +- if self.pos: +- step =3D (time.time() - self.start) / self.pos +- else: +- step =3D time.time() - self.start +- +- self.avg =3D self.avg[-6:] + [step] +- +- self.eta_known =3D self.length_known +- +- def update(self, n_steps, current_item=3DNone): +- """Update the progress bar by advancing a specified number of +- steps, and optionally set the ``current_item`` for this new +- position. +- +- :param n_steps: Number of steps to advance. +- :param current_item: Optional item to set as ``current_item`` +- for the updated position. +- +- .. versionadded:: 8.0 +- Added the ``current_item`` optional parameter. +- """ +- self.make_step(n_steps) +- if current_item is not None: +- self.current_item =3D current_item +- self.render_progress() +- +- def finish(self): +- self.eta_known =3D 0 +- self.current_item =3D None +- self.finished =3D True +- +- def generator(self): +- """Return a generator which yields the items added to the bar +- during construction, and updates the progress bar *after* the +- yielded block returns. +- """ +- # WARNING: the iterator interface for `ProgressBar` relies on +- # this and only works because this is a simple generator which +- # doesn't create or manage additional state. If this function +- # changes, the impact should be evaluated both against +- # `iter(bar)` and `next(bar)`. `next()` in particular may call +- # `self.generator()` repeatedly, and this must remain safe in +- # order for that interface to work. +- if not self.entered: +- raise RuntimeError("You need to use progress bars in a with b= lock.") +- +- if self.is_hidden: +- yield from self.iter +- else: +- for rv in self.iter: +- self.current_item =3D rv +- yield rv +- self.update(1) +- self.finish() +- self.render_progress() +- +- +-def pager(generator, color=3DNone): +- """Decide what method to use for paging through text.""" +- stdout =3D _default_text_stdout() +- if not isatty(sys.stdin) or not isatty(stdout): +- return _nullpager(stdout, generator, color) +- pager_cmd =3D (os.environ.get("PAGER", None) or "").strip() +- if pager_cmd: +- if WIN: +- return _tempfilepager(generator, pager_cmd, color) +- return _pipepager(generator, pager_cmd, color) +- if os.environ.get("TERM") in ("dumb", "emacs"): +- return _nullpager(stdout, generator, color) +- if WIN or sys.platform.startswith("os2"): +- return _tempfilepager(generator, "more <", color) +- if hasattr(os, "system") and os.system("(less) 2>/dev/null") =3D=3D 0: +- return _pipepager(generator, "less", color) +- +- import tempfile +- +- fd, filename =3D tempfile.mkstemp() +- os.close(fd) +- try: +- if hasattr(os, "system") and os.system(f'more "{filename}"') =3D= =3D 0: +- return _pipepager(generator, "more", color) +- return _nullpager(stdout, generator, color) +- finally: +- os.unlink(filename) +- +- +-def _pipepager(generator, cmd, color): +- """Page through text by feeding it to another program. Invoking a +- pager through this might support colors. +- """ +- import subprocess +- +- env =3D dict(os.environ) +- +- # If we're piping to less we might support colors under the +- # condition that +- cmd_detail =3D cmd.rsplit("/", 1)[-1].split() +- if color is None and cmd_detail[0] =3D=3D "less": +- less_flags =3D f"{os.environ.get('LESS', '')}{' '.join(cmd_detail= [1:])}" +- if not less_flags: +- env["LESS"] =3D "-R" +- color =3D True +- elif "r" in less_flags or "R" in less_flags: +- color =3D True +- +- c =3D subprocess.Popen(cmd, shell=3DTrue, stdin=3Dsubprocess.PIPE, en= v=3Denv) +- encoding =3D get_best_encoding(c.stdin) +- try: +- for text in generator: +- if not color: +- text =3D strip_ansi(text) +- +- c.stdin.write(text.encode(encoding, "replace")) +- except (OSError, KeyboardInterrupt): +- pass +- else: +- c.stdin.close() +- +- # Less doesn't respect ^C, but catches it for its own UI purposes (ab= orting +- # search or other commands inside less). +- # +- # That means when the user hits ^C, the parent process (click) termin= ates, +- # but less is still alive, paging the output and messing up the termi= nal. +- # +- # If the user wants to make the pager exit on ^C, they should set +- # `LESS=3D'-K'`. It's not our decision to make. +- while True: +- try: +- c.wait() +- except KeyboardInterrupt: +- pass +- else: +- break +- +- +-def _tempfilepager(generator, cmd, color): +- """Page through text by invoking a program on a temporary file.""" +- import tempfile +- +- filename =3D tempfile.mktemp() +- # TODO: This never terminates if the passed generator never terminate= s. +- text =3D "".join(generator) +- if not color: +- text =3D strip_ansi(text) +- encoding =3D get_best_encoding(sys.stdout) +- with open_stream(filename, "wb")[0] as f: +- f.write(text.encode(encoding)) +- try: +- os.system(f'{cmd} "{filename}"') +- finally: +- os.unlink(filename) +- +- +-def _nullpager(stream, generator, color): +- """Simply print unformatted text. This is the ultimate fallback.""" +- for text in generator: +- if not color: +- text =3D strip_ansi(text) +- stream.write(text) +- +- +-class Editor: +- def __init__(self, editor=3DNone, env=3DNone, require_save=3DTrue, ex= tension=3D".txt"): +- self.editor =3D editor +- self.env =3D env +- self.require_save =3D require_save +- self.extension =3D extension +- +- def get_editor(self): +- if self.editor is not None: +- return self.editor +- for key in "VISUAL", "EDITOR": +- rv =3D os.environ.get(key) +- if rv: +- return rv +- if WIN: +- return "notepad" +- for editor in "sensible-editor", "vim", "nano": +- if os.system(f"which {editor} >/dev/null 2>&1") =3D=3D 0: +- return editor +- return "vi" +- +- def edit_file(self, filename): +- import subprocess +- +- editor =3D self.get_editor() +- if self.env: +- environ =3D os.environ.copy() +- environ.update(self.env) +- else: +- environ =3D None +- try: +- c =3D subprocess.Popen(f'{editor} "{filename}"', env=3Denviro= n, shell=3DTrue) +- exit_code =3D c.wait() +- if exit_code !=3D 0: +- raise ClickException(f"{editor}: Editing failed!") +- except OSError as e: +- raise ClickException(f"{editor}: Editing failed: {e}") +- +- def edit(self, text): +- import tempfile +- +- text =3D text or "" +- binary_data =3D type(text) in [bytes, bytearray] +- +- if not binary_data and text and not text.endswith("\n"): +- text +=3D "\n" +- +- fd, name =3D tempfile.mkstemp(prefix=3D"editor-", suffix=3Dself.e= xtension) +- try: +- if not binary_data: +- if WIN: +- encoding =3D "utf-8-sig" +- text =3D text.replace("\n", "\r\n") +- else: +- encoding =3D "utf-8" +- text =3D text.encode(encoding) +- +- f =3D os.fdopen(fd, "wb") +- f.write(text) +- f.close() +- timestamp =3D os.path.getmtime(name) +- +- self.edit_file(name) +- +- if self.require_save and os.path.getmtime(name) =3D=3D timest= amp: +- return None +- +- f =3D open(name, "rb") +- try: +- rv =3D f.read() +- finally: +- f.close() +- if binary_data: +- return rv +- else: +- return rv.decode("utf-8-sig").replace("\r\n", "\n") +- finally: +- os.unlink(name) +- +- +-def open_url(url, wait=3DFalse, locate=3DFalse): +- import subprocess +- +- def _unquote_file(url): +- import urllib +- +- if url.startswith("file://"): +- url =3D urllib.unquote(url[7:]) +- return url +- +- if sys.platform =3D=3D "darwin": +- args =3D ["open"] +- if wait: +- args.append("-W") +- if locate: +- args.append("-R") +- args.append(_unquote_file(url)) +- null =3D open("/dev/null", "w") +- try: +- return subprocess.Popen(args, stderr=3Dnull).wait() +- finally: +- null.close() +- elif WIN: +- if locate: +- url =3D _unquote_file(url.replace('"', "")) +- args =3D f'explorer /select,"{url}"' +- else: +- url =3D url.replace('"', "") +- wait =3D "/WAIT" if wait else "" +- args =3D f'start {wait} "" "{url}"' +- return os.system(args) +- elif CYGWIN: +- if locate: +- url =3D os.path.dirname(_unquote_file(url).replace('"', "")) +- args =3D f'cygstart "{url}"' +- else: +- url =3D url.replace('"', "") +- wait =3D "-w" if wait else "" +- args =3D f'cygstart {wait} "{url}"' +- return os.system(args) +- +- try: +- if locate: +- url =3D os.path.dirname(_unquote_file(url)) or "." +- else: +- url =3D _unquote_file(url) +- c =3D subprocess.Popen(["xdg-open", url]) +- if wait: +- return c.wait() +- return 0 +- except OSError: +- if url.startswith(("http://", "https://")) and not locate and not= wait: +- import webbrowser +- +- webbrowser.open(url) +- return 0 +- return 1 +- +- +-def _translate_ch_to_exc(ch): +- if ch =3D=3D "\x03": +- raise KeyboardInterrupt() +- if ch =3D=3D "\x04" and not WIN: # Unix-like, Ctrl+D +- raise EOFError() +- if ch =3D=3D "\x1a" and WIN: # Windows, Ctrl+Z +- raise EOFError() +- +- +-if WIN: +- import msvcrt +- +- @contextlib.contextmanager +- def raw_terminal(): +- yield +- +- def getchar(echo): +- # The function `getch` will return a bytes object corresponding to +- # the pressed character. Since Windows 10 build 1803, it will also +- # return \x00 when called a second time after pressing a regular = key. +- # +- # `getwch` does not share this probably-bugged behavior. Moreover= , it +- # returns a Unicode object by default, which is what we want. +- # +- # Either of these functions will return \x00 or \xe0 to indicate +- # a special key, and you need to call the same function again to = get +- # the "rest" of the code. The fun part is that \u00e0 is +- # "latin small letter a with grave", so if you type that on a Fre= nch +- # keyboard, you _also_ get a \xe0. +- # E.g., consider the Up arrow. This returns \xe0 and then \x48. T= he +- # resulting Unicode string reads as "a with grave" + "capital H". +- # This is indistinguishable from when the user actually types +- # "a with grave" and then "capital H". +- # +- # When \xe0 is returned, we assume it's part of a special-key seq= uence +- # and call `getwch` again, but that means that when the user types +- # the \u00e0 character, `getchar` doesn't return until a second +- # character is typed. +- # The alternative is returning immediately, but that would mess up +- # cross-platform handling of arrow keys and others that start with +- # \xe0. Another option is using `getch`, but then we can't reliab= ly +- # read non-ASCII characters, because return values of `getch` are +- # limited to the current 8-bit codepage. +- # +- # Anyway, Click doesn't claim to do this Right(tm), and using `ge= twch` +- # is doing the right thing in more situations than with `getch`. +- if echo: +- func =3D msvcrt.getwche +- else: +- func =3D msvcrt.getwch +- +- rv =3D func() +- if rv in ("\x00", "\xe0"): +- # \x00 and \xe0 are control characters that indicate special = key, +- # see above. +- rv +=3D func() +- _translate_ch_to_exc(rv) +- return rv +- +- +-else: +- import tty +- import termios +- +- @contextlib.contextmanager +- def raw_terminal(): +- if not isatty(sys.stdin): +- f =3D open("/dev/tty") +- fd =3D f.fileno() +- else: +- fd =3D sys.stdin.fileno() +- f =3D None +- try: +- old_settings =3D termios.tcgetattr(fd) +- try: +- tty.setraw(fd) +- yield fd +- finally: +- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) +- sys.stdout.flush() +- if f is not None: +- f.close() +- except termios.error: +- pass +- +- def getchar(echo): +- with raw_terminal() as fd: +- ch =3D os.read(fd, 32) +- ch =3D ch.decode(get_best_encoding(sys.stdin), "replace") +- if echo and isatty(sys.stdout): +- sys.stdout.write(ch) +- _translate_ch_to_exc(ch) +- return ch +diff --git a/dynaconf/vendor_src/click/_textwrap.py b/dynaconf/vendor_src/= click/_textwrap.py +deleted file mode 100644 +index 7a052b7..0000000 +--- a/dynaconf/vendor_src/click/_textwrap.py ++++ /dev/null +@@ -1,37 +0,0 @@ +-import textwrap +-from contextlib import contextmanager +- +- +-class TextWrapper(textwrap.TextWrapper): +- def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width= ): +- space_left =3D max(width - cur_len, 1) +- +- if self.break_long_words: +- last =3D reversed_chunks[-1] +- cut =3D last[:space_left] +- res =3D last[space_left:] +- cur_line.append(cut) +- reversed_chunks[-1] =3D res +- elif not cur_line: +- cur_line.append(reversed_chunks.pop()) +- +- @contextmanager +- def extra_indent(self, indent): +- old_initial_indent =3D self.initial_indent +- old_subsequent_indent =3D self.subsequent_indent +- self.initial_indent +=3D indent +- self.subsequent_indent +=3D indent +- try: +- yield +- finally: +- self.initial_indent =3D old_initial_indent +- self.subsequent_indent =3D old_subsequent_indent +- +- def indent_only(self, text): +- rv =3D [] +- for idx, line in enumerate(text.splitlines()): +- indent =3D self.initial_indent +- if idx > 0: +- indent =3D self.subsequent_indent +- rv.append(f"{indent}{line}") +- return "\n".join(rv) +diff --git a/dynaconf/vendor_src/click/_unicodefun.py b/dynaconf/vendor_sr= c/click/_unicodefun.py +deleted file mode 100644 +index 53ec9d2..0000000 +--- a/dynaconf/vendor_src/click/_unicodefun.py ++++ /dev/null +@@ -1,82 +0,0 @@ +-import codecs +-import os +- +- +-def _verify_python_env(): +- """Ensures that the environment is good for Unicode.""" +- try: +- import locale +- +- fs_enc =3D codecs.lookup(locale.getpreferredencoding()).name +- except Exception: +- fs_enc =3D "ascii" +- if fs_enc !=3D "ascii": +- return +- +- extra =3D "" +- if os.name =3D=3D "posix": +- import subprocess +- +- try: +- rv =3D subprocess.Popen( +- ["locale", "-a"], stdout=3Dsubprocess.PIPE, stderr=3Dsubp= rocess.PIPE +- ).communicate()[0] +- except OSError: +- rv =3D b"" +- good_locales =3D set() +- has_c_utf8 =3D False +- +- # Make sure we're operating on text here. +- if isinstance(rv, bytes): +- rv =3D rv.decode("ascii", "replace") +- +- for line in rv.splitlines(): +- locale =3D line.strip() +- if locale.lower().endswith((".utf-8", ".utf8")): +- good_locales.add(locale) +- if locale.lower() in ("c.utf8", "c.utf-8"): +- has_c_utf8 =3D True +- +- extra +=3D "\n\n" +- if not good_locales: +- extra +=3D ( +- "Additional information: on this system no suitable" +- " UTF-8 locales were discovered. This most likely" +- " requires resolving by reconfiguring the locale" +- " system." +- ) +- elif has_c_utf8: +- extra +=3D ( +- "This system supports the C.UTF-8 locale which is" +- " recommended. You might be able to resolve your issue" +- " by exporting the following environment variables:\n\n" +- " export LC_ALL=3DC.UTF-8\n" +- " export LANG=3DC.UTF-8" +- ) +- else: +- extra +=3D ( +- "This system lists some UTF-8 supporting locales that" +- " you can pick from. The following suitable locales" +- f" were discovered: {', '.join(sorted(good_locales))}" +- ) +- +- bad_locale =3D None +- for locale in os.environ.get("LC_ALL"), os.environ.get("LANG"): +- if locale and locale.lower().endswith((".utf-8", ".utf8")): +- bad_locale =3D locale +- if locale is not None: +- break +- if bad_locale is not None: +- extra +=3D ( +- "\n\nClick discovered that you exported a UTF-8 locale" +- " but the locale system could not pick up from it" +- " because it does not exist. The exported locale is" +- f" {bad_locale!r} but it is not supported" +- ) +- +- raise RuntimeError( +- "Click will abort further execution because Python was" +- " configured to use ASCII as encoding for the environment." +- " Consult https://click.palletsprojects.com/unicode-support/" +- f" for mitigation steps.{extra}" +- ) +diff --git a/dynaconf/vendor_src/click/_winconsole.py b/dynaconf/vendor_sr= c/click/_winconsole.py +deleted file mode 100644 +index 923fdba..0000000 +--- a/dynaconf/vendor_src/click/_winconsole.py ++++ /dev/null +@@ -1,308 +0,0 @@ +-# This module is based on the excellent work by Adam Barto=C5=A1 who +-# provided a lot of what went into the implementation here in +-# the discussion to issue1602 in the Python bug tracker. +-# +-# There are some general differences in regards to how this works +-# compared to the original patches as we do not need to patch +-# the entire interpreter but just work in our little world of +-# echo and prompt. +-import ctypes +-import io +-import time +-from ctypes import byref +-from ctypes import c_char +-from ctypes import c_char_p +-from ctypes import c_int +-from ctypes import c_ssize_t +-from ctypes import c_ulong +-from ctypes import c_void_p +-from ctypes import POINTER +-from ctypes import py_object +-from ctypes import windll +-from ctypes import WINFUNCTYPE +-from ctypes.wintypes import DWORD +-from ctypes.wintypes import HANDLE +-from ctypes.wintypes import LPCWSTR +-from ctypes.wintypes import LPWSTR +- +-import msvcrt +- +-from ._compat import _NonClosingTextIOWrapper +- +-try: +- from ctypes import pythonapi +-except ImportError: +- pythonapi =3D None +-else: +- PyObject_GetBuffer =3D pythonapi.PyObject_GetBuffer +- PyBuffer_Release =3D pythonapi.PyBuffer_Release +- +- +-c_ssize_p =3D POINTER(c_ssize_t) +- +-kernel32 =3D windll.kernel32 +-GetStdHandle =3D kernel32.GetStdHandle +-ReadConsoleW =3D kernel32.ReadConsoleW +-WriteConsoleW =3D kernel32.WriteConsoleW +-GetConsoleMode =3D kernel32.GetConsoleMode +-GetLastError =3D kernel32.GetLastError +-GetCommandLineW =3D WINFUNCTYPE(LPWSTR)(("GetCommandLineW", windll.kernel= 32)) +-CommandLineToArgvW =3D WINFUNCTYPE(POINTER(LPWSTR), LPCWSTR, POINTER(c_in= t))( +- ("CommandLineToArgvW", windll.shell32) +-) +-LocalFree =3D WINFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)( +- ("LocalFree", windll.kernel32) +-) +- +- +-STDIN_HANDLE =3D GetStdHandle(-10) +-STDOUT_HANDLE =3D GetStdHandle(-11) +-STDERR_HANDLE =3D GetStdHandle(-12) +- +- +-PyBUF_SIMPLE =3D 0 +-PyBUF_WRITABLE =3D 1 +- +-ERROR_SUCCESS =3D 0 +-ERROR_NOT_ENOUGH_MEMORY =3D 8 +-ERROR_OPERATION_ABORTED =3D 995 +- +-STDIN_FILENO =3D 0 +-STDOUT_FILENO =3D 1 +-STDERR_FILENO =3D 2 +- +-EOF =3D b"\x1a" +-MAX_BYTES_WRITTEN =3D 32767 +- +- +-class Py_buffer(ctypes.Structure): +- _fields_ =3D [ +- ("buf", c_void_p), +- ("obj", py_object), +- ("len", c_ssize_t), +- ("itemsize", c_ssize_t), +- ("readonly", c_int), +- ("ndim", c_int), +- ("format", c_char_p), +- ("shape", c_ssize_p), +- ("strides", c_ssize_p), +- ("suboffsets", c_ssize_p), +- ("internal", c_void_p), +- ] +- +- +-# On PyPy we cannot get buffers so our ability to operate here is +-# severely limited. +-if pythonapi is None: +- get_buffer =3D None +-else: +- +- def get_buffer(obj, writable=3DFalse): +- buf =3D Py_buffer() +- flags =3D PyBUF_WRITABLE if writable else PyBUF_SIMPLE +- PyObject_GetBuffer(py_object(obj), byref(buf), flags) +- try: +- buffer_type =3D c_char * buf.len +- return buffer_type.from_address(buf.buf) +- finally: +- PyBuffer_Release(byref(buf)) +- +- +-class _WindowsConsoleRawIOBase(io.RawIOBase): +- def __init__(self, handle): +- self.handle =3D handle +- +- def isatty(self): +- io.RawIOBase.isatty(self) +- return True +- +- +-class _WindowsConsoleReader(_WindowsConsoleRawIOBase): +- def readable(self): +- return True +- +- def readinto(self, b): +- bytes_to_be_read =3D len(b) +- if not bytes_to_be_read: +- return 0 +- elif bytes_to_be_read % 2: +- raise ValueError( +- "cannot read odd number of bytes from UTF-16-LE encoded c= onsole" +- ) +- +- buffer =3D get_buffer(b, writable=3DTrue) +- code_units_to_be_read =3D bytes_to_be_read // 2 +- code_units_read =3D c_ulong() +- +- rv =3D ReadConsoleW( +- HANDLE(self.handle), +- buffer, +- code_units_to_be_read, +- byref(code_units_read), +- None, +- ) +- if GetLastError() =3D=3D ERROR_OPERATION_ABORTED: +- # wait for KeyboardInterrupt +- time.sleep(0.1) +- if not rv: +- raise OSError(f"Windows error: {GetLastError()}") +- +- if buffer[0] =3D=3D EOF: +- return 0 +- return 2 * code_units_read.value +- +- +-class _WindowsConsoleWriter(_WindowsConsoleRawIOBase): +- def writable(self): +- return True +- +- @staticmethod +- def _get_error_message(errno): +- if errno =3D=3D ERROR_SUCCESS: +- return "ERROR_SUCCESS" +- elif errno =3D=3D ERROR_NOT_ENOUGH_MEMORY: +- return "ERROR_NOT_ENOUGH_MEMORY" +- return f"Windows error {errno}" +- +- def write(self, b): +- bytes_to_be_written =3D len(b) +- buf =3D get_buffer(b) +- code_units_to_be_written =3D min(bytes_to_be_written, MAX_BYTES_W= RITTEN) // 2 +- code_units_written =3D c_ulong() +- +- WriteConsoleW( +- HANDLE(self.handle), +- buf, +- code_units_to_be_written, +- byref(code_units_written), +- None, +- ) +- bytes_written =3D 2 * code_units_written.value +- +- if bytes_written =3D=3D 0 and bytes_to_be_written > 0: +- raise OSError(self._get_error_message(GetLastError())) +- return bytes_written +- +- +-class ConsoleStream: +- def __init__(self, text_stream, byte_stream): +- self._text_stream =3D text_stream +- self.buffer =3D byte_stream +- +- @property +- def name(self): +- return self.buffer.name +- +- def write(self, x): +- if isinstance(x, str): +- return self._text_stream.write(x) +- try: +- self.flush() +- except Exception: +- pass +- return self.buffer.write(x) +- +- def writelines(self, lines): +- for line in lines: +- self.write(line) +- +- def __getattr__(self, name): +- return getattr(self._text_stream, name) +- +- def isatty(self): +- return self.buffer.isatty() +- +- def __repr__(self): +- return f"" +- +- +-class WindowsChunkedWriter: +- """ +- Wraps a stream (such as stdout), acting as a transparent proxy for all +- attribute access apart from method 'write()' which we wrap to write in +- limited chunks due to a Windows limitation on binary console streams. +- """ +- +- def __init__(self, wrapped): +- # double-underscore everything to prevent clashes with names of +- # attributes on the wrapped stream object. +- self.__wrapped =3D wrapped +- +- def __getattr__(self, name): +- return getattr(self.__wrapped, name) +- +- def write(self, text): +- total_to_write =3D len(text) +- written =3D 0 +- +- while written < total_to_write: +- to_write =3D min(total_to_write - written, MAX_BYTES_WRITTEN) +- self.__wrapped.write(text[written : written + to_write]) +- written +=3D to_write +- +- +-def _get_text_stdin(buffer_stream): +- text_stream =3D _NonClosingTextIOWrapper( +- io.BufferedReader(_WindowsConsoleReader(STDIN_HANDLE)), +- "utf-16-le", +- "strict", +- line_buffering=3DTrue, +- ) +- return ConsoleStream(text_stream, buffer_stream) +- +- +-def _get_text_stdout(buffer_stream): +- text_stream =3D _NonClosingTextIOWrapper( +- io.BufferedWriter(_WindowsConsoleWriter(STDOUT_HANDLE)), +- "utf-16-le", +- "strict", +- line_buffering=3DTrue, +- ) +- return ConsoleStream(text_stream, buffer_stream) +- +- +-def _get_text_stderr(buffer_stream): +- text_stream =3D _NonClosingTextIOWrapper( +- io.BufferedWriter(_WindowsConsoleWriter(STDERR_HANDLE)), +- "utf-16-le", +- "strict", +- line_buffering=3DTrue, +- ) +- return ConsoleStream(text_stream, buffer_stream) +- +- +-_stream_factories =3D { +- 0: _get_text_stdin, +- 1: _get_text_stdout, +- 2: _get_text_stderr, +-} +- +- +-def _is_console(f): +- if not hasattr(f, "fileno"): +- return False +- +- try: +- fileno =3D f.fileno() +- except OSError: +- return False +- +- handle =3D msvcrt.get_osfhandle(fileno) +- return bool(GetConsoleMode(handle, byref(DWORD()))) +- +- +-def _get_windows_console_stream(f, encoding, errors): +- if ( +- get_buffer is not None +- and encoding in {"utf-16-le", None} +- and errors in {"strict", None} +- and _is_console(f) +- ): +- func =3D _stream_factories.get(f.fileno()) +- if func is not None: +- f =3D getattr(f, "buffer", None) +- +- if f is None: +- return None +- +- return func(f) +diff --git a/dynaconf/vendor_src/click/core.py b/dynaconf/vendor_src/click= /core.py +deleted file mode 100644 +index b7124df..0000000 +--- a/dynaconf/vendor_src/click/core.py ++++ /dev/null +@@ -1,2070 +0,0 @@ +-import errno +-import inspect +-import os +-import sys +-from contextlib import contextmanager +-from functools import update_wrapper +-from itertools import repeat +- +-from ._unicodefun import _verify_python_env +-from .exceptions import Abort +-from .exceptions import BadParameter +-from .exceptions import ClickException +-from .exceptions import Exit +-from .exceptions import MissingParameter +-from .exceptions import UsageError +-from .formatting import HelpFormatter +-from .formatting import join_options +-from .globals import pop_context +-from .globals import push_context +-from .parser import OptionParser +-from .parser import split_opt +-from .termui import confirm +-from .termui import prompt +-from .termui import style +-from .types import BOOL +-from .types import convert_type +-from .types import IntRange +-from .utils import echo +-from .utils import make_default_short_help +-from .utils import make_str +-from .utils import PacifyFlushWrapper +- +-_missing =3D object() +- +-SUBCOMMAND_METAVAR =3D "COMMAND [ARGS]..." +-SUBCOMMANDS_METAVAR =3D "COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]..." +- +-DEPRECATED_HELP_NOTICE =3D " (DEPRECATED)" +-DEPRECATED_INVOKE_NOTICE =3D "DeprecationWarning: The command {name} is d= eprecated." +- +- +-def _maybe_show_deprecated_notice(cmd): +- if cmd.deprecated: +- echo(style(DEPRECATED_INVOKE_NOTICE.format(name=3Dcmd.name), fg= =3D"red"), err=3DTrue) +- +- +-def fast_exit(code): +- """Exit without garbage collection, this speeds up exit by about 10ms= for +- things like bash completion. +- """ +- sys.stdout.flush() +- sys.stderr.flush() +- os._exit(code) +- +- +-def _bashcomplete(cmd, prog_name, complete_var=3DNone): +- """Internal handler for the bash completion support.""" +- if complete_var is None: +- complete_var =3D f"_{prog_name}_COMPLETE".replace("-", "_").upper= () +- complete_instr =3D os.environ.get(complete_var) +- if not complete_instr: +- return +- +- from ._bashcomplete import bashcomplete +- +- if bashcomplete(cmd, prog_name, complete_var, complete_instr): +- fast_exit(1) +- +- +-def _check_multicommand(base_command, cmd_name, cmd, register=3DFalse): +- if not base_command.chain or not isinstance(cmd, MultiCommand): +- return +- if register: +- hint =3D ( +- "It is not possible to add multi commands as children to" +- " another multi command that is in chain mode." +- ) +- else: +- hint =3D ( +- "Found a multi command as subcommand to a multi command" +- " that is in chain mode. This is not supported." +- ) +- raise RuntimeError( +- f"{hint}. Command {base_command.name!r} is set to chain and" +- f" {cmd_name!r} was added as a subcommand but it in itself is a" +- f" multi command. ({cmd_name!r} is a {type(cmd).__name__}" +- f" within a chained {type(base_command).__name__} named" +- f" {base_command.name!r})." +- ) +- +- +-def batch(iterable, batch_size): +- return list(zip(*repeat(iter(iterable), batch_size))) +- +- +-@contextmanager +-def augment_usage_errors(ctx, param=3DNone): +- """Context manager that attaches extra information to exceptions.""" +- try: +- yield +- except BadParameter as e: +- if e.ctx is None: +- e.ctx =3D ctx +- if param is not None and e.param is None: +- e.param =3D param +- raise +- except UsageError as e: +- if e.ctx is None: +- e.ctx =3D ctx +- raise +- +- +-def iter_params_for_processing(invocation_order, declaration_order): +- """Given a sequence of parameters in the order as should be considered +- for processing and an iterable of parameters that exist, this returns +- a list in the correct order as they should be processed. +- """ +- +- def sort_key(item): +- try: +- idx =3D invocation_order.index(item) +- except ValueError: +- idx =3D float("inf") +- return (not item.is_eager, idx) +- +- return sorted(declaration_order, key=3Dsort_key) +- +- +-class ParameterSource: +- """This is an enum that indicates the source of a command line parame= ter. +- +- The enum has one of the following values: COMMANDLINE, +- ENVIRONMENT, DEFAULT, DEFAULT_MAP. The DEFAULT indicates that the +- default value in the decorator was used. This class should be +- converted to an enum when Python 2 support is dropped. +- """ +- +- COMMANDLINE =3D "COMMANDLINE" +- ENVIRONMENT =3D "ENVIRONMENT" +- DEFAULT =3D "DEFAULT" +- DEFAULT_MAP =3D "DEFAULT_MAP" +- +- VALUES =3D {COMMANDLINE, ENVIRONMENT, DEFAULT, DEFAULT_MAP} +- +- @classmethod +- def validate(cls, value): +- """Validate that the specified value is a valid enum. +- +- This method will raise a ValueError if the value is +- not a valid enum. +- +- :param value: the string value to verify +- """ +- if value not in cls.VALUES: +- raise ValueError( +- f"Invalid ParameterSource value: {value!r}. Valid" +- f" values are: {','.join(cls.VALUES)}" +- ) +- +- +-class Context: +- """The context is a special internal object that holds state relevant +- for the script execution at every single level. It's normally invisi= ble +- to commands unless they opt-in to getting access to it. +- +- The context is useful as it can pass internal objects around and can +- control special execution features such as reading data from +- environment variables. +- +- A context can be used as context manager in which case it will call +- :meth:`close` on teardown. +- +- .. versionadded:: 2.0 +- Added the `resilient_parsing`, `help_option_names`, +- `token_normalize_func` parameters. +- +- .. versionadded:: 3.0 +- Added the `allow_extra_args` and `allow_interspersed_args` +- parameters. +- +- .. versionadded:: 4.0 +- Added the `color`, `ignore_unknown_options`, and +- `max_content_width` parameters. +- +- .. versionadded:: 7.1 +- Added the `show_default` parameter. +- +- :param command: the command class for this context. +- :param parent: the parent context. +- :param info_name: the info name for this invocation. Generally this +- is the most descriptive name for the script or +- command. For the toplevel script it is usually +- the name of the script, for commands below it it's +- the name of the script. +- :param obj: an arbitrary object of user data. +- :param auto_envvar_prefix: the prefix to use for automatic environment +- variables. If this is `None` then reading +- from environment variables is disabled. T= his +- does not affect manually set environment +- variables which are always read. +- :param default_map: a dictionary (like object) with default values +- for parameters. +- :param terminal_width: the width of the terminal. The default is +- inherit from parent context. If no context +- defines the terminal width then auto +- detection will be applied. +- :param max_content_width: the maximum width for content rendered by +- Click (this currently only affects help +- pages). This defaults to 80 characters if +- not overridden. In other words: even if the +- terminal is larger than that, Click will not +- format things wider than 80 characters by +- default. In addition to that, formatters m= ight +- add some safety mapping on the right. +- :param resilient_parsing: if this flag is enabled then Click will +- parse without any interactivity or callback +- invocation. Default values will also be +- ignored. This is useful for implementing +- things such as completion support. +- :param allow_extra_args: if this is set to `True` then extra arguments +- at the end will not raise an error and will = be +- kept on the context. The default is to inhe= rit +- from the command. +- :param allow_interspersed_args: if this is set to `False` then options +- and arguments cannot be mixed. The +- default is to inherit from the comman= d. +- :param ignore_unknown_options: instructs click to ignore options it d= oes +- not know and keeps them for later +- processing. +- :param help_option_names: optionally a list of strings that define how +- the default help parameter is named. The +- default is ``['--help']``. +- :param token_normalize_func: an optional function that is used to +- normalize tokens (options, choices, +- etc.). This for instance can be used to +- implement case insensitive behavior. +- :param color: controls if the terminal supports ANSI colors or not. = The +- default is autodetection. This is only needed if ANSI +- codes are used in texts that Click prints which is by +- default not the case. This for instance would affect +- help output. +- :param show_default: if True, shows defaults for all options. +- Even if an option is later created with show_default= =3DFalse, +- this command-level setting overrides it. +- """ +- +- def __init__( +- self, +- command, +- parent=3DNone, +- info_name=3DNone, +- obj=3DNone, +- auto_envvar_prefix=3DNone, +- default_map=3DNone, +- terminal_width=3DNone, +- max_content_width=3DNone, +- resilient_parsing=3DFalse, +- allow_extra_args=3DNone, +- allow_interspersed_args=3DNone, +- ignore_unknown_options=3DNone, +- help_option_names=3DNone, +- token_normalize_func=3DNone, +- color=3DNone, +- show_default=3DNone, +- ): +- #: the parent context or `None` if none exists. +- self.parent =3D parent +- #: the :class:`Command` for this context. +- self.command =3D command +- #: the descriptive information name +- self.info_name =3D info_name +- #: the parsed parameters except if the value is hidden in which +- #: case it's not remembered. +- self.params =3D {} +- #: the leftover arguments. +- self.args =3D [] +- #: protected arguments. These are arguments that are prepended +- #: to `args` when certain parsing scenarios are encountered but +- #: must be never propagated to another arguments. This is used +- #: to implement nested parsing. +- self.protected_args =3D [] +- if obj is None and parent is not None: +- obj =3D parent.obj +- #: the user object stored. +- self.obj =3D obj +- self._meta =3D getattr(parent, "meta", {}) +- +- #: A dictionary (-like object) with defaults for parameters. +- if ( +- default_map is None +- and parent is not None +- and parent.default_map is not None +- ): +- default_map =3D parent.default_map.get(info_name) +- self.default_map =3D default_map +- +- #: This flag indicates if a subcommand is going to be executed. A +- #: group callback can use this information to figure out if it's +- #: being executed directly or because the execution flow passes +- #: onwards to a subcommand. By default it's None, but it can be +- #: the name of the subcommand to execute. +- #: +- #: If chaining is enabled this will be set to ``'*'`` in case +- #: any commands are executed. It is however not possible to +- #: figure out which ones. If you require this knowledge you +- #: should use a :func:`resultcallback`. +- self.invoked_subcommand =3D None +- +- if terminal_width is None and parent is not None: +- terminal_width =3D parent.terminal_width +- #: The width of the terminal (None is autodetection). +- self.terminal_width =3D terminal_width +- +- if max_content_width is None and parent is not None: +- max_content_width =3D parent.max_content_width +- #: The maximum width of formatted content (None implies a sensible +- #: default which is 80 for most things). +- self.max_content_width =3D max_content_width +- +- if allow_extra_args is None: +- allow_extra_args =3D command.allow_extra_args +- #: Indicates if the context allows extra args or if it should +- #: fail on parsing. +- #: +- #: .. versionadded:: 3.0 +- self.allow_extra_args =3D allow_extra_args +- +- if allow_interspersed_args is None: +- allow_interspersed_args =3D command.allow_interspersed_args +- #: Indicates if the context allows mixing of arguments and +- #: options or not. +- #: +- #: .. versionadded:: 3.0 +- self.allow_interspersed_args =3D allow_interspersed_args +- +- if ignore_unknown_options is None: +- ignore_unknown_options =3D command.ignore_unknown_options +- #: Instructs click to ignore options that a command does not +- #: understand and will store it on the context for later +- #: processing. This is primarily useful for situations where you +- #: want to call into external programs. Generally this pattern is +- #: strongly discouraged because it's not possibly to losslessly +- #: forward all arguments. +- #: +- #: .. versionadded:: 4.0 +- self.ignore_unknown_options =3D ignore_unknown_options +- +- if help_option_names is None: +- if parent is not None: +- help_option_names =3D parent.help_option_names +- else: +- help_option_names =3D ["--help"] +- +- #: The names for the help options. +- self.help_option_names =3D help_option_names +- +- if token_normalize_func is None and parent is not None: +- token_normalize_func =3D parent.token_normalize_func +- +- #: An optional normalization function for tokens. This is +- #: options, choices, commands etc. +- self.token_normalize_func =3D token_normalize_func +- +- #: Indicates if resilient parsing is enabled. In that case Click +- #: will do its best to not cause any failures and default values +- #: will be ignored. Useful for completion. +- self.resilient_parsing =3D resilient_parsing +- +- # If there is no envvar prefix yet, but the parent has one and +- # the command on this level has a name, we can expand the envvar +- # prefix automatically. +- if auto_envvar_prefix is None: +- if ( +- parent is not None +- and parent.auto_envvar_prefix is not None +- and self.info_name is not None +- ): +- auto_envvar_prefix =3D ( +- f"{parent.auto_envvar_prefix}_{self.info_name.upper()= }" +- ) +- else: +- auto_envvar_prefix =3D auto_envvar_prefix.upper() +- if auto_envvar_prefix is not None: +- auto_envvar_prefix =3D auto_envvar_prefix.replace("-", "_") +- self.auto_envvar_prefix =3D auto_envvar_prefix +- +- if color is None and parent is not None: +- color =3D parent.color +- +- #: Controls if styling output is wanted or not. +- self.color =3D color +- +- self.show_default =3D show_default +- +- self._close_callbacks =3D [] +- self._depth =3D 0 +- self._source_by_paramname =3D {} +- +- def __enter__(self): +- self._depth +=3D 1 +- push_context(self) +- return self +- +- def __exit__(self, exc_type, exc_value, tb): +- self._depth -=3D 1 +- if self._depth =3D=3D 0: +- self.close() +- pop_context() +- +- @contextmanager +- def scope(self, cleanup=3DTrue): +- """This helper method can be used with the context object to prom= ote +- it to the current thread local (see :func:`get_current_context`). +- The default behavior of this is to invoke the cleanup functions w= hich +- can be disabled by setting `cleanup` to `False`. The cleanup +- functions are typically used for things such as closing file hand= les. +- +- If the cleanup is intended the context object can also be directly +- used as a context manager. +- +- Example usage:: +- +- with ctx.scope(): +- assert get_current_context() is ctx +- +- This is equivalent:: +- +- with ctx: +- assert get_current_context() is ctx +- +- .. versionadded:: 5.0 +- +- :param cleanup: controls if the cleanup functions should be run or +- not. The default is to run these functions. In +- some situations the context only wants to be +- temporarily pushed in which case this can be disa= bled. +- Nested pushes automatically defer the cleanup. +- """ +- if not cleanup: +- self._depth +=3D 1 +- try: +- with self as rv: +- yield rv +- finally: +- if not cleanup: +- self._depth -=3D 1 +- +- @property +- def meta(self): +- """This is a dictionary which is shared with all the contexts +- that are nested. It exists so that click utilities can store some +- state here if they need to. It is however the responsibility of +- that code to manage this dictionary well. +- +- The keys are supposed to be unique dotted strings. For instance +- module paths are a good choice for it. What is stored in there is +- irrelevant for the operation of click. However what is important= is +- that code that places data here adheres to the general semantics = of +- the system. +- +- Example usage:: +- +- LANG_KEY =3D f'{__name__}.lang' +- +- def set_language(value): +- ctx =3D get_current_context() +- ctx.meta[LANG_KEY] =3D value +- +- def get_language(): +- return get_current_context().meta.get(LANG_KEY, 'en_US') +- +- .. versionadded:: 5.0 +- """ +- return self._meta +- +- def make_formatter(self): +- """Creates the formatter for the help and usage output.""" +- return HelpFormatter( +- width=3Dself.terminal_width, max_width=3Dself.max_content_wid= th +- ) +- +- def call_on_close(self, f): +- """This decorator remembers a function as callback that should be +- executed when the context tears down. This is most useful to bind +- resource handling to the script execution. For instance, file ob= jects +- opened by the :class:`File` type will register their close callba= cks +- here. +- +- :param f: the function to execute on teardown. +- """ +- self._close_callbacks.append(f) +- return f +- +- def close(self): +- """Invokes all close callbacks.""" +- for cb in self._close_callbacks: +- cb() +- self._close_callbacks =3D [] +- +- @property +- def command_path(self): +- """The computed command path. This is used for the ``usage`` +- information on the help page. It's automatically created by +- combining the info names of the chain of contexts to the root. +- """ +- rv =3D "" +- if self.info_name is not None: +- rv =3D self.info_name +- if self.parent is not None: +- rv =3D f"{self.parent.command_path} {rv}" +- return rv.lstrip() +- +- def find_root(self): +- """Finds the outermost context.""" +- node =3D self +- while node.parent is not None: +- node =3D node.parent +- return node +- +- def find_object(self, object_type): +- """Finds the closest object of a given type.""" +- node =3D self +- while node is not None: +- if isinstance(node.obj, object_type): +- return node.obj +- node =3D node.parent +- +- def ensure_object(self, object_type): +- """Like :meth:`find_object` but sets the innermost object to a +- new instance of `object_type` if it does not exist. +- """ +- rv =3D self.find_object(object_type) +- if rv is None: +- self.obj =3D rv =3D object_type() +- return rv +- +- def lookup_default(self, name): +- """Looks up the default for a parameter name. This by default +- looks into the :attr:`default_map` if available. +- """ +- if self.default_map is not None: +- rv =3D self.default_map.get(name) +- if callable(rv): +- rv =3D rv() +- return rv +- +- def fail(self, message): +- """Aborts the execution of the program with a specific error +- message. +- +- :param message: the error message to fail with. +- """ +- raise UsageError(message, self) +- +- def abort(self): +- """Aborts the script.""" +- raise Abort() +- +- def exit(self, code=3D0): +- """Exits the application with a given exit code.""" +- raise Exit(code) +- +- def get_usage(self): +- """Helper method to get formatted usage string for the current +- context and command. +- """ +- return self.command.get_usage(self) +- +- def get_help(self): +- """Helper method to get formatted help page for the current +- context and command. +- """ +- return self.command.get_help(self) +- +- def invoke(*args, **kwargs): # noqa: B902 +- """Invokes a command callback in exactly the way it expects. The= re +- are two ways to invoke this method: +- +- 1. the first argument can be a callback and all other arguments = and +- keyword arguments are forwarded directly to the function. +- 2. the first argument is a click command object. In that case a= ll +- arguments are forwarded as well but proper click parameters +- (options and click arguments) must be keyword arguments and C= lick +- will fill in defaults. +- +- Note that before Click 3.2 keyword arguments were not properly fi= lled +- in against the intention of this code and no context was created.= For +- more information about this change and why it was done in a bugfix +- release see :ref:`upgrade-to-3.2`. +- """ +- self, callback =3D args[:2] +- ctx =3D self +- +- # It's also possible to invoke another command which might or +- # might not have a callback. In that case we also fill +- # in defaults and make a new context for this command. +- if isinstance(callback, Command): +- other_cmd =3D callback +- callback =3D other_cmd.callback +- ctx =3D Context(other_cmd, info_name=3Dother_cmd.name, parent= =3Dself) +- if callback is None: +- raise TypeError( +- "The given command does not have a callback that can = be invoked." +- ) +- +- for param in other_cmd.params: +- if param.name not in kwargs and param.expose_value: +- kwargs[param.name] =3D param.get_default(ctx) +- +- args =3D args[2:] +- with augment_usage_errors(self): +- with ctx: +- return callback(*args, **kwargs) +- +- def forward(*args, **kwargs): # noqa: B902 +- """Similar to :meth:`invoke` but fills in default keyword +- arguments from the current context if the other command expects +- it. This cannot invoke callbacks directly, only other commands. +- """ +- self, cmd =3D args[:2] +- +- # It's also possible to invoke another command which might or +- # might not have a callback. +- if not isinstance(cmd, Command): +- raise TypeError("Callback is not a command.") +- +- for param in self.params: +- if param not in kwargs: +- kwargs[param] =3D self.params[param] +- +- return self.invoke(cmd, **kwargs) +- +- def set_parameter_source(self, name, source): +- """Set the source of a parameter. +- +- This indicates the location from which the value of the +- parameter was obtained. +- +- :param name: the name of the command line parameter +- :param source: the source of the command line parameter, which +- should be a valid ParameterSource value +- """ +- ParameterSource.validate(source) +- self._source_by_paramname[name] =3D source +- +- def get_parameter_source(self, name): +- """Get the source of a parameter. +- +- This indicates the location from which the value of the +- parameter was obtained. This can be useful for determining +- when a user specified an option on the command line that is +- the same as the default. In that case, the source would be +- ParameterSource.COMMANDLINE, even though the value of the +- parameter was equivalent to the default. +- +- :param name: the name of the command line parameter +- :returns: the source +- :rtype: ParameterSource +- """ +- return self._source_by_paramname[name] +- +- +-class BaseCommand: +- """The base command implements the minimal API contract of commands. +- Most code will never use this as it does not implement a lot of useful +- functionality but it can act as the direct subclass of alternative +- parsing methods that do not depend on the Click parser. +- +- For instance, this can be used to bridge Click and other systems like +- argparse or docopt. +- +- Because base commands do not implement a lot of the API that other +- parts of Click take for granted, they are not supported for all +- operations. For instance, they cannot be used with the decorators +- usually and they have no built-in callback system. +- +- .. versionchanged:: 2.0 +- Added the `context_settings` parameter. +- +- :param name: the name of the command to use unless a group overrides = it. +- :param context_settings: an optional dictionary with defaults that are +- passed to the context object. +- """ +- +- #: the default for the :attr:`Context.allow_extra_args` flag. +- allow_extra_args =3D False +- #: the default for the :attr:`Context.allow_interspersed_args` flag. +- allow_interspersed_args =3D True +- #: the default for the :attr:`Context.ignore_unknown_options` flag. +- ignore_unknown_options =3D False +- +- def __init__(self, name, context_settings=3DNone): +- #: the name the command thinks it has. Upon registering a command +- #: on a :class:`Group` the group will default the command name +- #: with this information. You should instead use the +- #: :class:`Context`\'s :attr:`~Context.info_name` attribute. +- self.name =3D name +- if context_settings is None: +- context_settings =3D {} +- #: an optional dictionary with defaults passed to the context. +- self.context_settings =3D context_settings +- +- def __repr__(self): +- return f"<{self.__class__.__name__} {self.name}>" +- +- def get_usage(self, ctx): +- raise NotImplementedError("Base commands cannot get usage") +- +- def get_help(self, ctx): +- raise NotImplementedError("Base commands cannot get help") +- +- def make_context(self, info_name, args, parent=3DNone, **extra): +- """This function when given an info name and arguments will kick +- off the parsing and create a new :class:`Context`. It does not +- invoke the actual command callback though. +- +- :param info_name: the info name for this invokation. Generally t= his +- is the most descriptive name for the script or +- command. For the toplevel script it's usually +- the name of the script, for commands below it i= t's +- the name of the script. +- :param args: the arguments to parse as list of strings. +- :param parent: the parent context if available. +- :param extra: extra keyword arguments forwarded to the context +- constructor. +- """ +- for key, value in self.context_settings.items(): +- if key not in extra: +- extra[key] =3D value +- ctx =3D Context(self, info_name=3Dinfo_name, parent=3Dparent, **e= xtra) +- with ctx.scope(cleanup=3DFalse): +- self.parse_args(ctx, args) +- return ctx +- +- def parse_args(self, ctx, args): +- """Given a context and a list of arguments this creates the parser +- and parses the arguments, then modifies the context as necessary. +- This is automatically invoked by :meth:`make_context`. +- """ +- raise NotImplementedError("Base commands do not know how to parse= arguments.") +- +- def invoke(self, ctx): +- """Given a context, this invokes the command. The default +- implementation is raising a not implemented error. +- """ +- raise NotImplementedError("Base commands are not invokable by def= ault") +- +- def main( +- self, +- args=3DNone, +- prog_name=3DNone, +- complete_var=3DNone, +- standalone_mode=3DTrue, +- **extra, +- ): +- """This is the way to invoke a script with all the bells and +- whistles as a command line application. This will always termina= te +- the application after a call. If this is not wanted, ``SystemExi= t`` +- needs to be caught. +- +- This method is also available by directly calling the instance of +- a :class:`Command`. +- +- .. versionadded:: 3.0 +- Added the `standalone_mode` flag to control the standalone mod= e. +- +- :param args: the arguments that should be used for parsing. If n= ot +- provided, ``sys.argv[1:]`` is used. +- :param prog_name: the program name that should be used. By defau= lt +- the program name is constructed by taking the f= ile +- name from ``sys.argv[0]``. +- :param complete_var: the environment variable that controls the +- bash completion support. The default is +- ``"__COMPLETE"`` with prog_name in +- uppercase. +- :param standalone_mode: the default behavior is to invoke the scr= ipt +- in standalone mode. Click will then +- handle exceptions and convert them into +- error messages and the function will never +- return but shut down the interpreter. If +- this is set to `False` they will be +- propagated to the caller and the return +- value of this function is the return value +- of :meth:`invoke`. +- :param extra: extra keyword arguments are forwarded to the context +- constructor. See :class:`Context` for more informa= tion. +- """ +- # Verify that the environment is configured correctly, or reject +- # further execution to avoid a broken script. +- _verify_python_env() +- +- if args is None: +- args =3D sys.argv[1:] +- else: +- args =3D list(args) +- +- if prog_name is None: +- prog_name =3D make_str( +- os.path.basename(sys.argv[0] if sys.argv else __file__) +- ) +- +- # Hook for the Bash completion. This only activates if the Bash +- # completion is actually enabled, otherwise this is quite a fast +- # noop. +- _bashcomplete(self, prog_name, complete_var) +- +- try: +- try: +- with self.make_context(prog_name, args, **extra) as ctx: +- rv =3D self.invoke(ctx) +- if not standalone_mode: +- return rv +- # it's not safe to `ctx.exit(rv)` here! +- # note that `rv` may actually contain data like "1" w= hich +- # has obvious effects +- # more subtle case: `rv=3D[None, None]` can come out = of +- # chained commands which all returned `None` -- so it= 's not +- # even always obvious that `rv` indicates success/fai= lure +- # by its truthiness/falsiness +- ctx.exit() +- except (EOFError, KeyboardInterrupt): +- echo(file=3Dsys.stderr) +- raise Abort() +- except ClickException as e: +- if not standalone_mode: +- raise +- e.show() +- sys.exit(e.exit_code) +- except OSError as e: +- if e.errno =3D=3D errno.EPIPE: +- sys.stdout =3D PacifyFlushWrapper(sys.stdout) +- sys.stderr =3D PacifyFlushWrapper(sys.stderr) +- sys.exit(1) +- else: +- raise +- except Exit as e: +- if standalone_mode: +- sys.exit(e.exit_code) +- else: +- # in non-standalone mode, return the exit code +- # note that this is only reached if `self.invoke` above r= aises +- # an Exit explicitly -- thus bypassing the check there wh= ich +- # would return its result +- # the results of non-standalone execution may therefore be +- # somewhat ambiguous: if there are codepaths which lead to +- # `ctx.exit(1)` and to `return 1`, the caller won't be ab= le to +- # tell the difference between the two +- return e.exit_code +- except Abort: +- if not standalone_mode: +- raise +- echo("Aborted!", file=3Dsys.stderr) +- sys.exit(1) +- +- def __call__(self, *args, **kwargs): +- """Alias for :meth:`main`.""" +- return self.main(*args, **kwargs) +- +- +-class Command(BaseCommand): +- """Commands are the basic building block of command line interfaces in +- Click. A basic command handles command line parsing and might dispat= ch +- more parsing to commands nested below it. +- +- .. versionchanged:: 2.0 +- Added the `context_settings` parameter. +- .. versionchanged:: 8.0 +- Added repr showing the command name +- .. versionchanged:: 7.1 +- Added the `no_args_is_help` parameter. +- +- :param name: the name of the command to use unless a group overrides = it. +- :param context_settings: an optional dictionary with defaults that are +- passed to the context object. +- :param callback: the callback to invoke. This is optional. +- :param params: the parameters to register with this command. This can +- be either :class:`Option` or :class:`Argument` objects. +- :param help: the help string to use for this command. +- :param epilog: like the help string but it's printed at the end of the +- help page after everything else. +- :param short_help: the short help to use for this command. This is +- shown on the command listing of the parent command. +- :param add_help_option: by default each command registers a ``--help`` +- option. This can be disabled by this paramet= er. +- :param no_args_is_help: this controls what happens if no arguments are +- provided. This option is disabled by default. +- If enabled this will add ``--help`` as argume= nt +- if no arguments are passed +- :param hidden: hide this command from help outputs. +- +- :param deprecated: issues a message indicating that +- the command is deprecated. +- """ +- +- def __init__( +- self, +- name, +- context_settings=3DNone, +- callback=3DNone, +- params=3DNone, +- help=3DNone, +- epilog=3DNone, +- short_help=3DNone, +- options_metavar=3D"[OPTIONS]", +- add_help_option=3DTrue, +- no_args_is_help=3DFalse, +- hidden=3DFalse, +- deprecated=3DFalse, +- ): +- BaseCommand.__init__(self, name, context_settings) +- #: the callback to execute when the command fires. This might be +- #: `None` in which case nothing happens. +- self.callback =3D callback +- #: the list of parameters for this command in the order they +- #: should show up in the help page and execute. Eager parameters +- #: will automatically be handled before non eager ones. +- self.params =3D params or [] +- # if a form feed (page break) is found in the help text, truncate= help +- # text to the content preceding the first form feed +- if help and "\f" in help: +- help =3D help.split("\f", 1)[0] +- self.help =3D help +- self.epilog =3D epilog +- self.options_metavar =3D options_metavar +- self.short_help =3D short_help +- self.add_help_option =3D add_help_option +- self.no_args_is_help =3D no_args_is_help +- self.hidden =3D hidden +- self.deprecated =3D deprecated +- +- def __repr__(self): +- return f"<{self.__class__.__name__} {self.name}>" +- +- def get_usage(self, ctx): +- """Formats the usage line into a string and returns it. +- +- Calls :meth:`format_usage` internally. +- """ +- formatter =3D ctx.make_formatter() +- self.format_usage(ctx, formatter) +- return formatter.getvalue().rstrip("\n") +- +- def get_params(self, ctx): +- rv =3D self.params +- help_option =3D self.get_help_option(ctx) +- if help_option is not None: +- rv =3D rv + [help_option] +- return rv +- +- def format_usage(self, ctx, formatter): +- """Writes the usage line into the formatter. +- +- This is a low-level method called by :meth:`get_usage`. +- """ +- pieces =3D self.collect_usage_pieces(ctx) +- formatter.write_usage(ctx.command_path, " ".join(pieces)) +- +- def collect_usage_pieces(self, ctx): +- """Returns all the pieces that go into the usage line and returns +- it as a list of strings. +- """ +- rv =3D [self.options_metavar] +- for param in self.get_params(ctx): +- rv.extend(param.get_usage_pieces(ctx)) +- return rv +- +- def get_help_option_names(self, ctx): +- """Returns the names for the help option.""" +- all_names =3D set(ctx.help_option_names) +- for param in self.params: +- all_names.difference_update(param.opts) +- all_names.difference_update(param.secondary_opts) +- return all_names +- +- def get_help_option(self, ctx): +- """Returns the help option object.""" +- help_options =3D self.get_help_option_names(ctx) +- if not help_options or not self.add_help_option: +- return +- +- def show_help(ctx, param, value): +- if value and not ctx.resilient_parsing: +- echo(ctx.get_help(), color=3Dctx.color) +- ctx.exit() +- +- return Option( +- help_options, +- is_flag=3DTrue, +- is_eager=3DTrue, +- expose_value=3DFalse, +- callback=3Dshow_help, +- help=3D"Show this message and exit.", +- ) +- +- def make_parser(self, ctx): +- """Creates the underlying option parser for this command.""" +- parser =3D OptionParser(ctx) +- for param in self.get_params(ctx): +- param.add_to_parser(parser, ctx) +- return parser +- +- def get_help(self, ctx): +- """Formats the help into a string and returns it. +- +- Calls :meth:`format_help` internally. +- """ +- formatter =3D ctx.make_formatter() +- self.format_help(ctx, formatter) +- return formatter.getvalue().rstrip("\n") +- +- def get_short_help_str(self, limit=3D45): +- """Gets short help for the command or makes it by shortening the +- long help string. +- """ +- return ( +- self.short_help +- or self.help +- and make_default_short_help(self.help, limit) +- or "" +- ) +- +- def format_help(self, ctx, formatter): +- """Writes the help into the formatter if it exists. +- +- This is a low-level method called by :meth:`get_help`. +- +- This calls the following methods: +- +- - :meth:`format_usage` +- - :meth:`format_help_text` +- - :meth:`format_options` +- - :meth:`format_epilog` +- """ +- self.format_usage(ctx, formatter) +- self.format_help_text(ctx, formatter) +- self.format_options(ctx, formatter) +- self.format_epilog(ctx, formatter) +- +- def format_help_text(self, ctx, formatter): +- """Writes the help text to the formatter if it exists.""" +- if self.help: +- formatter.write_paragraph() +- with formatter.indentation(): +- help_text =3D self.help +- if self.deprecated: +- help_text +=3D DEPRECATED_HELP_NOTICE +- formatter.write_text(help_text) +- elif self.deprecated: +- formatter.write_paragraph() +- with formatter.indentation(): +- formatter.write_text(DEPRECATED_HELP_NOTICE) +- +- def format_options(self, ctx, formatter): +- """Writes all the options into the formatter if they exist.""" +- opts =3D [] +- for param in self.get_params(ctx): +- rv =3D param.get_help_record(ctx) +- if rv is not None: +- opts.append(rv) +- +- if opts: +- with formatter.section("Options"): +- formatter.write_dl(opts) +- +- def format_epilog(self, ctx, formatter): +- """Writes the epilog into the formatter if it exists.""" +- if self.epilog: +- formatter.write_paragraph() +- with formatter.indentation(): +- formatter.write_text(self.epilog) +- +- def parse_args(self, ctx, args): +- if not args and self.no_args_is_help and not ctx.resilient_parsin= g: +- echo(ctx.get_help(), color=3Dctx.color) +- ctx.exit() +- +- parser =3D self.make_parser(ctx) +- opts, args, param_order =3D parser.parse_args(args=3Dargs) +- +- for param in iter_params_for_processing(param_order, self.get_par= ams(ctx)): +- value, args =3D param.handle_parse_result(ctx, opts, args) +- +- if args and not ctx.allow_extra_args and not ctx.resilient_parsin= g: +- ctx.fail( +- "Got unexpected extra" +- f" argument{'s' if len(args) !=3D 1 else ''}" +- f" ({' '.join(map(make_str, args))})" +- ) +- +- ctx.args =3D args +- return args +- +- def invoke(self, ctx): +- """Given a context, this invokes the attached callback (if it exi= sts) +- in the right way. +- """ +- _maybe_show_deprecated_notice(self) +- if self.callback is not None: +- return ctx.invoke(self.callback, **ctx.params) +- +- +-class MultiCommand(Command): +- """A multi command is the basic implementation of a command that +- dispatches to subcommands. The most common version is the +- :class:`Group`. +- +- :param invoke_without_command: this controls how the multi command it= self +- is invoked. By default it's only invo= ked +- if a subcommand is provided. +- :param no_args_is_help: this controls what happens if no arguments are +- provided. This option is enabled by default = if +- `invoke_without_command` is disabled or disab= led +- if it's enabled. If enabled this will add +- ``--help`` as argument if no arguments are +- passed. +- :param subcommand_metavar: the string that is used in the documentati= on +- to indicate the subcommand place. +- :param chain: if this is set to `True` chaining of multiple subcomman= ds +- is enabled. This restricts the form of commands in that +- they cannot have optional arguments but it allows +- multiple commands to be chained together. +- :param result_callback: the result callback to attach to this multi +- command. +- """ +- +- allow_extra_args =3D True +- allow_interspersed_args =3D False +- +- def __init__( +- self, +- name=3DNone, +- invoke_without_command=3DFalse, +- no_args_is_help=3DNone, +- subcommand_metavar=3DNone, +- chain=3DFalse, +- result_callback=3DNone, +- **attrs, +- ): +- Command.__init__(self, name, **attrs) +- if no_args_is_help is None: +- no_args_is_help =3D not invoke_without_command +- self.no_args_is_help =3D no_args_is_help +- self.invoke_without_command =3D invoke_without_command +- if subcommand_metavar is None: +- if chain: +- subcommand_metavar =3D SUBCOMMANDS_METAVAR +- else: +- subcommand_metavar =3D SUBCOMMAND_METAVAR +- self.subcommand_metavar =3D subcommand_metavar +- self.chain =3D chain +- #: The result callback that is stored. This can be set or +- #: overridden with the :func:`resultcallback` decorator. +- self.result_callback =3D result_callback +- +- if self.chain: +- for param in self.params: +- if isinstance(param, Argument) and not param.required: +- raise RuntimeError( +- "Multi commands in chain mode cannot have" +- " optional arguments." +- ) +- +- def collect_usage_pieces(self, ctx): +- rv =3D Command.collect_usage_pieces(self, ctx) +- rv.append(self.subcommand_metavar) +- return rv +- +- def format_options(self, ctx, formatter): +- Command.format_options(self, ctx, formatter) +- self.format_commands(ctx, formatter) +- +- def resultcallback(self, replace=3DFalse): +- """Adds a result callback to the chain command. By default if a +- result callback is already registered this will chain them but +- this can be disabled with the `replace` parameter. The result +- callback is invoked with the return value of the subcommand +- (or the list of return values from all subcommands if chaining +- is enabled) as well as the parameters as they would be passed +- to the main callback. +- +- Example:: +- +- @click.group() +- @click.option('-i', '--input', default=3D23) +- def cli(input): +- return 42 +- +- @cli.resultcallback() +- def process_result(result, input): +- return result + input +- +- .. versionadded:: 3.0 +- +- :param replace: if set to `True` an already existing result +- callback will be removed. +- """ +- +- def decorator(f): +- old_callback =3D self.result_callback +- if old_callback is None or replace: +- self.result_callback =3D f +- return f +- +- def function(__value, *args, **kwargs): +- return f(old_callback(__value, *args, **kwargs), *args, *= *kwargs) +- +- self.result_callback =3D rv =3D update_wrapper(function, f) +- return rv +- +- return decorator +- +- def format_commands(self, ctx, formatter): +- """Extra format methods for multi methods that adds all the comma= nds +- after the options. +- """ +- commands =3D [] +- for subcommand in self.list_commands(ctx): +- cmd =3D self.get_command(ctx, subcommand) +- # What is this, the tool lied about a command. Ignore it +- if cmd is None: +- continue +- if cmd.hidden: +- continue +- +- commands.append((subcommand, cmd)) +- +- # allow for 3 times the default spacing +- if len(commands): +- limit =3D formatter.width - 6 - max(len(cmd[0]) for cmd in co= mmands) +- +- rows =3D [] +- for subcommand, cmd in commands: +- help =3D cmd.get_short_help_str(limit) +- rows.append((subcommand, help)) +- +- if rows: +- with formatter.section("Commands"): +- formatter.write_dl(rows) +- +- def parse_args(self, ctx, args): +- if not args and self.no_args_is_help and not ctx.resilient_parsin= g: +- echo(ctx.get_help(), color=3Dctx.color) +- ctx.exit() +- +- rest =3D Command.parse_args(self, ctx, args) +- if self.chain: +- ctx.protected_args =3D rest +- ctx.args =3D [] +- elif rest: +- ctx.protected_args, ctx.args =3D rest[:1], rest[1:] +- +- return ctx.args +- +- def invoke(self, ctx): +- def _process_result(value): +- if self.result_callback is not None: +- value =3D ctx.invoke(self.result_callback, value, **ctx.p= arams) +- return value +- +- if not ctx.protected_args: +- # If we are invoked without command the chain flag controls +- # how this happens. If we are not in chain mode, the return +- # value here is the return value of the command. +- # If however we are in chain mode, the return value is the +- # return value of the result processor invoked with an empty +- # list (which means that no subcommand actually was executed). +- if self.invoke_without_command: +- if not self.chain: +- return Command.invoke(self, ctx) +- with ctx: +- Command.invoke(self, ctx) +- return _process_result([]) +- ctx.fail("Missing command.") +- +- # Fetch args back out +- args =3D ctx.protected_args + ctx.args +- ctx.args =3D [] +- ctx.protected_args =3D [] +- +- # If we're not in chain mode, we only allow the invocation of a +- # single command but we also inform the current context about the +- # name of the command to invoke. +- if not self.chain: +- # Make sure the context is entered so we do not clean up +- # resources until the result processor has worked. +- with ctx: +- cmd_name, cmd, args =3D self.resolve_command(ctx, args) +- ctx.invoked_subcommand =3D cmd_name +- Command.invoke(self, ctx) +- sub_ctx =3D cmd.make_context(cmd_name, args, parent=3Dctx) +- with sub_ctx: +- return _process_result(sub_ctx.command.invoke(sub_ctx= )) +- +- # In chain mode we create the contexts step by step, but after the +- # base command has been invoked. Because at that point we do not +- # know the subcommands yet, the invoked subcommand attribute is +- # set to ``*`` to inform the command that subcommands are executed +- # but nothing else. +- with ctx: +- ctx.invoked_subcommand =3D "*" if args else None +- Command.invoke(self, ctx) +- +- # Otherwise we make every single context and invoke them in a +- # chain. In that case the return value to the result process= or +- # is the list of all invoked subcommand's results. +- contexts =3D [] +- while args: +- cmd_name, cmd, args =3D self.resolve_command(ctx, args) +- sub_ctx =3D cmd.make_context( +- cmd_name, +- args, +- parent=3Dctx, +- allow_extra_args=3DTrue, +- allow_interspersed_args=3DFalse, +- ) +- contexts.append(sub_ctx) +- args, sub_ctx.args =3D sub_ctx.args, [] +- +- rv =3D [] +- for sub_ctx in contexts: +- with sub_ctx: +- rv.append(sub_ctx.command.invoke(sub_ctx)) +- return _process_result(rv) +- +- def resolve_command(self, ctx, args): +- cmd_name =3D make_str(args[0]) +- original_cmd_name =3D cmd_name +- +- # Get the command +- cmd =3D self.get_command(ctx, cmd_name) +- +- # If we can't find the command but there is a normalization +- # function available, we try with that one. +- if cmd is None and ctx.token_normalize_func is not None: +- cmd_name =3D ctx.token_normalize_func(cmd_name) +- cmd =3D self.get_command(ctx, cmd_name) +- +- # If we don't find the command we want to show an error message +- # to the user that it was not provided. However, there is +- # something else we should do: if the first argument looks like +- # an option we want to kick off parsing again for arguments to +- # resolve things like --help which now should go to the main +- # place. +- if cmd is None and not ctx.resilient_parsing: +- if split_opt(cmd_name)[0]: +- self.parse_args(ctx, ctx.args) +- ctx.fail(f"No such command '{original_cmd_name}'.") +- +- return cmd_name, cmd, args[1:] +- +- def get_command(self, ctx, cmd_name): +- """Given a context and a command name, this returns a +- :class:`Command` object if it exists or returns `None`. +- """ +- raise NotImplementedError() +- +- def list_commands(self, ctx): +- """Returns a list of subcommand names in the order they should +- appear. +- """ +- return [] +- +- +-class Group(MultiCommand): +- """A group allows a command to have subcommands attached. This is the +- most common way to implement nesting in Click. +- +- :param commands: a dictionary of commands. +- """ +- +- def __init__(self, name=3DNone, commands=3DNone, **attrs): +- MultiCommand.__init__(self, name, **attrs) +- #: the registered subcommands by their exported names. +- self.commands =3D commands or {} +- +- def add_command(self, cmd, name=3DNone): +- """Registers another :class:`Command` with this group. If the na= me +- is not provided, the name of the command is used. +- """ +- name =3D name or cmd.name +- if name is None: +- raise TypeError("Command has no name.") +- _check_multicommand(self, name, cmd, register=3DTrue) +- self.commands[name] =3D cmd +- +- def command(self, *args, **kwargs): +- """A shortcut decorator for declaring and attaching a command to +- the group. This takes the same arguments as :func:`command` but +- immediately registers the created command with this instance by +- calling into :meth:`add_command`. +- """ +- from .decorators import command +- +- def decorator(f): +- cmd =3D command(*args, **kwargs)(f) +- self.add_command(cmd) +- return cmd +- +- return decorator +- +- def group(self, *args, **kwargs): +- """A shortcut decorator for declaring and attaching a group to +- the group. This takes the same arguments as :func:`group` but +- immediately registers the created command with this instance by +- calling into :meth:`add_command`. +- """ +- from .decorators import group +- +- def decorator(f): +- cmd =3D group(*args, **kwargs)(f) +- self.add_command(cmd) +- return cmd +- +- return decorator +- +- def get_command(self, ctx, cmd_name): +- return self.commands.get(cmd_name) +- +- def list_commands(self, ctx): +- return sorted(self.commands) +- +- +-class CommandCollection(MultiCommand): +- """A command collection is a multi command that merges multiple multi +- commands together into one. This is a straightforward implementation +- that accepts a list of different multi commands as sources and +- provides all the commands for each of them. +- """ +- +- def __init__(self, name=3DNone, sources=3DNone, **attrs): +- MultiCommand.__init__(self, name, **attrs) +- #: The list of registered multi commands. +- self.sources =3D sources or [] +- +- def add_source(self, multi_cmd): +- """Adds a new multi command to the chain dispatcher.""" +- self.sources.append(multi_cmd) +- +- def get_command(self, ctx, cmd_name): +- for source in self.sources: +- rv =3D source.get_command(ctx, cmd_name) +- if rv is not None: +- if self.chain: +- _check_multicommand(self, cmd_name, rv) +- return rv +- +- def list_commands(self, ctx): +- rv =3D set() +- for source in self.sources: +- rv.update(source.list_commands(ctx)) +- return sorted(rv) +- +- +-class Parameter: +- r"""A parameter to a command comes in two versions: they are either +- :class:`Option`\s or :class:`Argument`\s. Other subclasses are curre= ntly +- not supported by design as some of the internals for parsing are +- intentionally not finalized. +- +- Some settings are supported by both options and arguments. +- +- :param param_decls: the parameter declarations for this option or +- argument. This is a list of flags or argument +- names. +- :param type: the type that should be used. Either a :class:`ParamTyp= e` +- or a Python type. The later is converted into the former +- automatically if supported. +- :param required: controls if this is optional or not. +- :param default: the default value if omitted. This can also be a cal= lable, +- in which case it's invoked when the default is needed +- without any arguments. +- :param callback: a callback that should be executed after the paramet= er +- was matched. This is called as ``fn(ctx, param, +- value)`` and needs to return the value. +- :param nargs: the number of arguments to match. If not ``1`` the ret= urn +- value is a tuple instead of single value. The default = for +- nargs is ``1`` (except if the type is a tuple, then it's +- the arity of the tuple). If ``nargs=3D-1``, all remaini= ng +- parameters are collected. +- :param metavar: how the value is represented in the help page. +- :param expose_value: if this is `True` then the value is passed onwar= ds +- to the command callback and stored on the contex= t, +- otherwise it's skipped. +- :param is_eager: eager values are processed before non eager ones. T= his +- should not be set for arguments or it will inverse t= he +- order of processing. +- :param envvar: a string or list of strings that are environment varia= bles +- that should be checked. +- +- .. versionchanged:: 7.1 +- Empty environment variables are ignored rather than taking the +- empty string value. This makes it possible for scripts to clear +- variables if they can't unset them. +- +- .. versionchanged:: 2.0 +- Changed signature for parameter callback to also be passed the +- parameter. The old callback format will still work, but it will +- raise a warning to give you a chance to migrate the code easier. +- """ +- param_type_name =3D "parameter" +- +- def __init__( +- self, +- param_decls=3DNone, +- type=3DNone, +- required=3DFalse, +- default=3DNone, +- callback=3DNone, +- nargs=3DNone, +- metavar=3DNone, +- expose_value=3DTrue, +- is_eager=3DFalse, +- envvar=3DNone, +- autocompletion=3DNone, +- ): +- self.name, self.opts, self.secondary_opts =3D self._parse_decls( +- param_decls or (), expose_value +- ) +- +- self.type =3D convert_type(type, default) +- +- # Default nargs to what the type tells us if we have that +- # information available. +- if nargs is None: +- if self.type.is_composite: +- nargs =3D self.type.arity +- else: +- nargs =3D 1 +- +- self.required =3D required +- self.callback =3D callback +- self.nargs =3D nargs +- self.multiple =3D False +- self.expose_value =3D expose_value +- self.default =3D default +- self.is_eager =3D is_eager +- self.metavar =3D metavar +- self.envvar =3D envvar +- self.autocompletion =3D autocompletion +- +- def __repr__(self): +- return f"<{self.__class__.__name__} {self.name}>" +- +- @property +- def human_readable_name(self): +- """Returns the human readable name of this parameter. This is the +- same as the name for options, but the metavar for arguments. +- """ +- return self.name +- +- def make_metavar(self): +- if self.metavar is not None: +- return self.metavar +- metavar =3D self.type.get_metavar(self) +- if metavar is None: +- metavar =3D self.type.name.upper() +- if self.nargs !=3D 1: +- metavar +=3D "..." +- return metavar +- +- def get_default(self, ctx): +- """Given a context variable this calculates the default value.""" +- # Otherwise go with the regular default. +- if callable(self.default): +- rv =3D self.default() +- else: +- rv =3D self.default +- return self.type_cast_value(ctx, rv) +- +- def add_to_parser(self, parser, ctx): +- pass +- +- def consume_value(self, ctx, opts): +- value =3D opts.get(self.name) +- source =3D ParameterSource.COMMANDLINE +- if value is None: +- value =3D self.value_from_envvar(ctx) +- source =3D ParameterSource.ENVIRONMENT +- if value is None: +- value =3D ctx.lookup_default(self.name) +- source =3D ParameterSource.DEFAULT_MAP +- if value is not None: +- ctx.set_parameter_source(self.name, source) +- return value +- +- def type_cast_value(self, ctx, value): +- """Given a value this runs it properly through the type system. +- This automatically handles things like `nargs` and `multiple` as +- well as composite types. +- """ +- if self.type.is_composite: +- if self.nargs <=3D 1: +- raise TypeError( +- "Attempted to invoke composite type but nargs has" +- f" been set to {self.nargs}. This is not supported;" +- " nargs needs to be set to a fixed value > 1." +- ) +- if self.multiple: +- return tuple(self.type(x or (), self, ctx) for x in value= or ()) +- return self.type(value or (), self, ctx) +- +- def _convert(value, level): +- if level =3D=3D 0: +- return self.type(value, self, ctx) +- return tuple(_convert(x, level - 1) for x in value or ()) +- +- return _convert(value, (self.nargs !=3D 1) + bool(self.multiple)) +- +- def process_value(self, ctx, value): +- """Given a value and context this runs the logic to convert the +- value as necessary. +- """ +- # If the value we were given is None we do nothing. This way +- # code that calls this can easily figure out if something was +- # not provided. Otherwise it would be converted into an empty +- # tuple for multiple invocations which is inconvenient. +- if value is not None: +- return self.type_cast_value(ctx, value) +- +- def value_is_missing(self, value): +- if value is None: +- return True +- if (self.nargs !=3D 1 or self.multiple) and value =3D=3D (): +- return True +- return False +- +- def full_process_value(self, ctx, value): +- value =3D self.process_value(ctx, value) +- +- if value is None and not ctx.resilient_parsing: +- value =3D self.get_default(ctx) +- if value is not None: +- ctx.set_parameter_source(self.name, ParameterSource.DEFAU= LT) +- +- if self.required and self.value_is_missing(value): +- raise MissingParameter(ctx=3Dctx, param=3Dself) +- +- return value +- +- def resolve_envvar_value(self, ctx): +- if self.envvar is None: +- return +- if isinstance(self.envvar, (tuple, list)): +- for envvar in self.envvar: +- rv =3D os.environ.get(envvar) +- if rv is not None: +- return rv +- else: +- rv =3D os.environ.get(self.envvar) +- +- if rv !=3D "": +- return rv +- +- def value_from_envvar(self, ctx): +- rv =3D self.resolve_envvar_value(ctx) +- if rv is not None and self.nargs !=3D 1: +- rv =3D self.type.split_envvar_value(rv) +- return rv +- +- def handle_parse_result(self, ctx, opts, args): +- with augment_usage_errors(ctx, param=3Dself): +- value =3D self.consume_value(ctx, opts) +- try: +- value =3D self.full_process_value(ctx, value) +- except Exception: +- if not ctx.resilient_parsing: +- raise +- value =3D None +- if self.callback is not None: +- try: +- value =3D self.callback(ctx, self, value) +- except Exception: +- if not ctx.resilient_parsing: +- raise +- +- if self.expose_value: +- ctx.params[self.name] =3D value +- return value, args +- +- def get_help_record(self, ctx): +- pass +- +- def get_usage_pieces(self, ctx): +- return [] +- +- def get_error_hint(self, ctx): +- """Get a stringified version of the param for use in error messag= es to +- indicate which param caused the error. +- """ +- hint_list =3D self.opts or [self.human_readable_name] +- return " / ".join(repr(x) for x in hint_list) +- +- +-class Option(Parameter): +- """Options are usually optional values on the command line and +- have some extra features that arguments don't have. +- +- All other parameters are passed onwards to the parameter constructor. +- +- :param show_default: controls if the default value should be shown on= the +- help page. Normally, defaults are not shown. If = this +- value is a string, it shows the string instead o= f the +- value. This is particularly useful for dynamic o= ptions. +- :param show_envvar: controls if an environment variable should be sho= wn on +- the help page. Normally, environment variables +- are not shown. +- :param prompt: if set to `True` or a non empty string then the user w= ill be +- prompted for input. If set to `True` the prompt will = be the +- option name capitalized. +- :param confirmation_prompt: if set then the value will need to be con= firmed +- if it was prompted for. +- :param hide_input: if this is `True` then the input on the prompt wil= l be +- hidden from the user. This is useful for password +- input. +- :param is_flag: forces this option to act as a flag. The default is +- auto detection. +- :param flag_value: which value should be used for this flag if it's +- enabled. This is set to a boolean automatically if +- the option string contains a slash to mark two opt= ions. +- :param multiple: if this is set to `True` then the argument is accept= ed +- multiple times and recorded. This is similar to ``n= args`` +- in how it works but supports arbitrary number of +- arguments. +- :param count: this flag makes an option increment an integer. +- :param allow_from_autoenv: if this is enabled then the value of this +- parameter will be pulled from an environme= nt +- variable in case a prefix is defined on the +- context. +- :param help: the help string. +- :param hidden: hide this option from help outputs. +- """ +- +- param_type_name =3D "option" +- +- def __init__( +- self, +- param_decls=3DNone, +- show_default=3DFalse, +- prompt=3DFalse, +- confirmation_prompt=3DFalse, +- hide_input=3DFalse, +- is_flag=3DNone, +- flag_value=3DNone, +- multiple=3DFalse, +- count=3DFalse, +- allow_from_autoenv=3DTrue, +- type=3DNone, +- help=3DNone, +- hidden=3DFalse, +- show_choices=3DTrue, +- show_envvar=3DFalse, +- **attrs, +- ): +- default_is_missing =3D attrs.get("default", _missing) is _missing +- Parameter.__init__(self, param_decls, type=3Dtype, **attrs) +- +- if prompt is True: +- prompt_text =3D self.name.replace("_", " ").capitalize() +- elif prompt is False: +- prompt_text =3D None +- else: +- prompt_text =3D prompt +- self.prompt =3D prompt_text +- self.confirmation_prompt =3D confirmation_prompt +- self.hide_input =3D hide_input +- self.hidden =3D hidden +- +- # Flags +- if is_flag is None: +- if flag_value is not None: +- is_flag =3D True +- else: +- is_flag =3D bool(self.secondary_opts) +- if is_flag and default_is_missing: +- self.default =3D False +- if flag_value is None: +- flag_value =3D not self.default +- self.is_flag =3D is_flag +- self.flag_value =3D flag_value +- if self.is_flag and isinstance(self.flag_value, bool) and type in= [None, bool]: +- self.type =3D BOOL +- self.is_bool_flag =3D True +- else: +- self.is_bool_flag =3D False +- +- # Counting +- self.count =3D count +- if count: +- if type is None: +- self.type =3D IntRange(min=3D0) +- if default_is_missing: +- self.default =3D 0 +- +- self.multiple =3D multiple +- self.allow_from_autoenv =3D allow_from_autoenv +- self.help =3D help +- self.show_default =3D show_default +- self.show_choices =3D show_choices +- self.show_envvar =3D show_envvar +- +- # Sanity check for stuff we don't support +- if __debug__: +- if self.nargs < 0: +- raise TypeError("Options cannot have nargs < 0") +- if self.prompt and self.is_flag and not self.is_bool_flag: +- raise TypeError("Cannot prompt for flags that are not boo= ls.") +- if not self.is_bool_flag and self.secondary_opts: +- raise TypeError("Got secondary option for non boolean fla= g.") +- if self.is_bool_flag and self.hide_input and self.prompt is n= ot None: +- raise TypeError("Hidden input does not work with boolean = flag prompts.") +- if self.count: +- if self.multiple: +- raise TypeError( +- "Options cannot be multiple and count at the same= time." +- ) +- elif self.is_flag: +- raise TypeError( +- "Options cannot be count and flags at the same ti= me." +- ) +- +- def _parse_decls(self, decls, expose_value): +- opts =3D [] +- secondary_opts =3D [] +- name =3D None +- possible_names =3D [] +- +- for decl in decls: +- if decl.isidentifier(): +- if name is not None: +- raise TypeError("Name defined twice") +- name =3D decl +- else: +- split_char =3D ";" if decl[:1] =3D=3D "/" else "/" +- if split_char in decl: +- first, second =3D decl.split(split_char, 1) +- first =3D first.rstrip() +- if first: +- possible_names.append(split_opt(first)) +- opts.append(first) +- second =3D second.lstrip() +- if second: +- secondary_opts.append(second.lstrip()) +- else: +- possible_names.append(split_opt(decl)) +- opts.append(decl) +- +- if name is None and possible_names: +- possible_names.sort(key=3Dlambda x: -len(x[0])) # group long= options first +- name =3D possible_names[0][1].replace("-", "_").lower() +- if not name.isidentifier(): +- name =3D None +- +- if name is None: +- if not expose_value: +- return None, opts, secondary_opts +- raise TypeError("Could not determine name for option") +- +- if not opts and not secondary_opts: +- raise TypeError( +- f"No options defined but a name was passed ({name})." +- " Did you mean to declare an argument instead of an" +- " option?" +- ) +- +- return name, opts, secondary_opts +- +- def add_to_parser(self, parser, ctx): +- kwargs =3D { +- "dest": self.name, +- "nargs": self.nargs, +- "obj": self, +- } +- +- if self.multiple: +- action =3D "append" +- elif self.count: +- action =3D "count" +- else: +- action =3D "store" +- +- if self.is_flag: +- kwargs.pop("nargs", None) +- action_const =3D f"{action}_const" +- if self.is_bool_flag and self.secondary_opts: +- parser.add_option(self.opts, action=3Daction_const, const= =3DTrue, **kwargs) +- parser.add_option( +- self.secondary_opts, action=3Daction_const, const=3DF= alse, **kwargs +- ) +- else: +- parser.add_option( +- self.opts, action=3Daction_const, const=3Dself.flag_v= alue, **kwargs +- ) +- else: +- kwargs["action"] =3D action +- parser.add_option(self.opts, **kwargs) +- +- def get_help_record(self, ctx): +- if self.hidden: +- return +- any_prefix_is_slash =3D [] +- +- def _write_opts(opts): +- rv, any_slashes =3D join_options(opts) +- if any_slashes: +- any_prefix_is_slash[:] =3D [True] +- if not self.is_flag and not self.count: +- rv +=3D f" {self.make_metavar()}" +- return rv +- +- rv =3D [_write_opts(self.opts)] +- if self.secondary_opts: +- rv.append(_write_opts(self.secondary_opts)) +- +- help =3D self.help or "" +- extra =3D [] +- if self.show_envvar: +- envvar =3D self.envvar +- if envvar is None: +- if self.allow_from_autoenv and ctx.auto_envvar_prefix is = not None: +- envvar =3D f"{ctx.auto_envvar_prefix}_{self.name.uppe= r()}" +- if envvar is not None: +- var_str =3D ( +- ", ".join(str(d) for d in envvar) +- if isinstance(envvar, (list, tuple)) +- else envvar +- ) +- extra.append(f"env var: {var_str}") +- if self.default is not None and (self.show_default or ctx.show_de= fault): +- if isinstance(self.show_default, str): +- default_string =3D f"({self.show_default})" +- elif isinstance(self.default, (list, tuple)): +- default_string =3D ", ".join(str(d) for d in self.default) +- elif inspect.isfunction(self.default): +- default_string =3D "(dynamic)" +- else: +- default_string =3D self.default +- extra.append(f"default: {default_string}") +- +- if self.required: +- extra.append("required") +- if extra: +- extra_str =3D ";".join(extra) +- help =3D f"{help} [{extra_str}]" if help else f"[{extra_str}= ]" +- +- return ("; " if any_prefix_is_slash else " / ").join(rv), help +- +- def get_default(self, ctx): +- # If we're a non boolean flag our default is more complex because +- # we need to look at all flags in the same group to figure out +- # if we're the the default one in which case we return the flag +- # value as default. +- if self.is_flag and not self.is_bool_flag: +- for param in ctx.command.params: +- if param.name =3D=3D self.name and param.default: +- return param.flag_value +- return None +- return Parameter.get_default(self, ctx) +- +- def prompt_for_value(self, ctx): +- """This is an alternative flow that can be activated in the full +- value processing if a value does not exist. It will prompt the +- user until a valid value exists and then returns the processed +- value as result. +- """ +- # Calculate the default before prompting anything to be stable. +- default =3D self.get_default(ctx) +- +- # If this is a prompt for a flag we need to handle this +- # differently. +- if self.is_bool_flag: +- return confirm(self.prompt, default) +- +- return prompt( +- self.prompt, +- default=3Ddefault, +- type=3Dself.type, +- hide_input=3Dself.hide_input, +- show_choices=3Dself.show_choices, +- confirmation_prompt=3Dself.confirmation_prompt, +- value_proc=3Dlambda x: self.process_value(ctx, x), +- ) +- +- def resolve_envvar_value(self, ctx): +- rv =3D Parameter.resolve_envvar_value(self, ctx) +- if rv is not None: +- return rv +- if self.allow_from_autoenv and ctx.auto_envvar_prefix is not None: +- envvar =3D f"{ctx.auto_envvar_prefix}_{self.name.upper()}" +- return os.environ.get(envvar) +- +- def value_from_envvar(self, ctx): +- rv =3D self.resolve_envvar_value(ctx) +- if rv is None: +- return None +- value_depth =3D (self.nargs !=3D 1) + bool(self.multiple) +- if value_depth > 0 and rv is not None: +- rv =3D self.type.split_envvar_value(rv) +- if self.multiple and self.nargs !=3D 1: +- rv =3D batch(rv, self.nargs) +- return rv +- +- def full_process_value(self, ctx, value): +- if value is None and self.prompt is not None and not ctx.resilien= t_parsing: +- return self.prompt_for_value(ctx) +- return Parameter.full_process_value(self, ctx, value) +- +- +-class Argument(Parameter): +- """Arguments are positional parameters to a command. They generally +- provide fewer features than options but can have infinite ``nargs`` +- and are required by default. +- +- All parameters are passed onwards to the parameter constructor. +- """ +- +- param_type_name =3D "argument" +- +- def __init__(self, param_decls, required=3DNone, **attrs): +- if required is None: +- if attrs.get("default") is not None: +- required =3D False +- else: +- required =3D attrs.get("nargs", 1) > 0 +- Parameter.__init__(self, param_decls, required=3Drequired, **attr= s) +- if self.default is not None and self.nargs < 0: +- raise TypeError( +- "nargs=3D-1 in combination with a default value is not su= pported." +- ) +- +- @property +- def human_readable_name(self): +- if self.metavar is not None: +- return self.metavar +- return self.name.upper() +- +- def make_metavar(self): +- if self.metavar is not None: +- return self.metavar +- var =3D self.type.get_metavar(self) +- if not var: +- var =3D self.name.upper() +- if not self.required: +- var =3D f"[{var}]" +- if self.nargs !=3D 1: +- var +=3D "..." +- return var +- +- def _parse_decls(self, decls, expose_value): +- if not decls: +- if not expose_value: +- return None, [], [] +- raise TypeError("Could not determine name for argument") +- if len(decls) =3D=3D 1: +- name =3D arg =3D decls[0] +- name =3D name.replace("-", "_").lower() +- else: +- raise TypeError( +- "Arguments take exactly one parameter declaration, got" +- f" {len(decls)}." +- ) +- return name, [arg], [] +- +- def get_usage_pieces(self, ctx): +- return [self.make_metavar()] +- +- def get_error_hint(self, ctx): +- return repr(self.make_metavar()) +- +- def add_to_parser(self, parser, ctx): +- parser.add_argument(dest=3Dself.name, nargs=3Dself.nargs, obj=3Ds= elf) +diff --git a/dynaconf/vendor_src/click/decorators.py b/dynaconf/vendor_src= /click/decorators.py +deleted file mode 100644 +index 3013305..0000000 +--- a/dynaconf/vendor_src/click/decorators.py ++++ /dev/null +@@ -1,331 +0,0 @@ +-import inspect +-import sys +-from functools import update_wrapper +- +-from .core import Argument +-from .core import Command +-from .core import Group +-from .core import Option +-from .globals import get_current_context +-from .utils import echo +- +- +-def pass_context(f): +- """Marks a callback as wanting to receive the current context +- object as first argument. +- """ +- +- def new_func(*args, **kwargs): +- return f(get_current_context(), *args, **kwargs) +- +- return update_wrapper(new_func, f) +- +- +-def pass_obj(f): +- """Similar to :func:`pass_context`, but only pass the object on the +- context onwards (:attr:`Context.obj`). This is useful if that object +- represents the state of a nested system. +- """ +- +- def new_func(*args, **kwargs): +- return f(get_current_context().obj, *args, **kwargs) +- +- return update_wrapper(new_func, f) +- +- +-def make_pass_decorator(object_type, ensure=3DFalse): +- """Given an object type this creates a decorator that will work +- similar to :func:`pass_obj` but instead of passing the object of the +- current context, it will find the innermost context of type +- :func:`object_type`. +- +- This generates a decorator that works roughly like this:: +- +- from functools import update_wrapper +- +- def decorator(f): +- @pass_context +- def new_func(ctx, *args, **kwargs): +- obj =3D ctx.find_object(object_type) +- return ctx.invoke(f, obj, *args, **kwargs) +- return update_wrapper(new_func, f) +- return decorator +- +- :param object_type: the type of the object to pass. +- :param ensure: if set to `True`, a new object will be created and +- remembered on the context if it's not there yet. +- """ +- +- def decorator(f): +- def new_func(*args, **kwargs): +- ctx =3D get_current_context() +- if ensure: +- obj =3D ctx.ensure_object(object_type) +- else: +- obj =3D ctx.find_object(object_type) +- if obj is None: +- raise RuntimeError( +- "Managed to invoke callback without a context" +- f" object of type {object_type.__name__!r}" +- " existing." +- ) +- return ctx.invoke(f, obj, *args, **kwargs) +- +- return update_wrapper(new_func, f) +- +- return decorator +- +- +-def _make_command(f, name, attrs, cls): +- if isinstance(f, Command): +- raise TypeError("Attempted to convert a callback into a command t= wice.") +- try: +- params =3D f.__click_params__ +- params.reverse() +- del f.__click_params__ +- except AttributeError: +- params =3D [] +- help =3D attrs.get("help") +- if help is None: +- help =3D inspect.getdoc(f) +- if isinstance(help, bytes): +- help =3D help.decode("utf-8") +- else: +- help =3D inspect.cleandoc(help) +- attrs["help"] =3D help +- return cls( +- name=3Dname or f.__name__.lower().replace("_", "-"), +- callback=3Df, +- params=3Dparams, +- **attrs, +- ) +- +- +-def command(name=3DNone, cls=3DNone, **attrs): +- r"""Creates a new :class:`Command` and uses the decorated function as +- callback. This will also automatically attach all decorated +- :func:`option`\s and :func:`argument`\s as parameters to the command. +- +- The name of the command defaults to the name of the function with +- underscores replaced by dashes. If you want to change that, you can +- pass the intended name as the first argument. +- +- All keyword arguments are forwarded to the underlying command class. +- +- Once decorated the function turns into a :class:`Command` instance +- that can be invoked as a command line utility or be attached to a +- command :class:`Group`. +- +- :param name: the name of the command. This defaults to the function +- name with underscores replaced by dashes. +- :param cls: the command class to instantiate. This defaults to +- :class:`Command`. +- """ +- if cls is None: +- cls =3D Command +- +- def decorator(f): +- cmd =3D _make_command(f, name, attrs, cls) +- cmd.__doc__ =3D f.__doc__ +- return cmd +- +- return decorator +- +- +-def group(name=3DNone, **attrs): +- """Creates a new :class:`Group` with a function as callback. This +- works otherwise the same as :func:`command` just that the `cls` +- parameter is set to :class:`Group`. +- """ +- attrs.setdefault("cls", Group) +- return command(name, **attrs) +- +- +-def _param_memo(f, param): +- if isinstance(f, Command): +- f.params.append(param) +- else: +- if not hasattr(f, "__click_params__"): +- f.__click_params__ =3D [] +- f.__click_params__.append(param) +- +- +-def argument(*param_decls, **attrs): +- """Attaches an argument to the command. All positional arguments are +- passed as parameter declarations to :class:`Argument`; all keyword +- arguments are forwarded unchanged (except ``cls``). +- This is equivalent to creating an :class:`Argument` instance manually +- and attaching it to the :attr:`Command.params` list. +- +- :param cls: the argument class to instantiate. This defaults to +- :class:`Argument`. +- """ +- +- def decorator(f): +- ArgumentClass =3D attrs.pop("cls", Argument) +- _param_memo(f, ArgumentClass(param_decls, **attrs)) +- return f +- +- return decorator +- +- +-def option(*param_decls, **attrs): +- """Attaches an option to the command. All positional arguments are +- passed as parameter declarations to :class:`Option`; all keyword +- arguments are forwarded unchanged (except ``cls``). +- This is equivalent to creating an :class:`Option` instance manually +- and attaching it to the :attr:`Command.params` list. +- +- :param cls: the option class to instantiate. This defaults to +- :class:`Option`. +- """ +- +- def decorator(f): +- # Issue 926, copy attrs, so pre-defined options can re-use the sa= me cls=3D +- option_attrs =3D attrs.copy() +- +- if "help" in option_attrs: +- option_attrs["help"] =3D inspect.cleandoc(option_attrs["help"= ]) +- OptionClass =3D option_attrs.pop("cls", Option) +- _param_memo(f, OptionClass(param_decls, **option_attrs)) +- return f +- +- return decorator +- +- +-def confirmation_option(*param_decls, **attrs): +- """Shortcut for confirmation prompts that can be ignored by passing +- ``--yes`` as parameter. +- +- This is equivalent to decorating a function with :func:`option` with +- the following parameters:: +- +- def callback(ctx, param, value): +- if not value: +- ctx.abort() +- +- @click.command() +- @click.option('--yes', is_flag=3DTrue, callback=3Dcallback, +- expose_value=3DFalse, prompt=3D'Do you want to cont= inue?') +- def dropdb(): +- pass +- """ +- +- def decorator(f): +- def callback(ctx, param, value): +- if not value: +- ctx.abort() +- +- attrs.setdefault("is_flag", True) +- attrs.setdefault("callback", callback) +- attrs.setdefault("expose_value", False) +- attrs.setdefault("prompt", "Do you want to continue?") +- attrs.setdefault("help", "Confirm the action without prompting.") +- return option(*(param_decls or ("--yes",)), **attrs)(f) +- +- return decorator +- +- +-def password_option(*param_decls, **attrs): +- """Shortcut for password prompts. +- +- This is equivalent to decorating a function with :func:`option` with +- the following parameters:: +- +- @click.command() +- @click.option('--password', prompt=3DTrue, confirmation_prompt=3D= True, +- hide_input=3DTrue) +- def changeadmin(password): +- pass +- """ +- +- def decorator(f): +- attrs.setdefault("prompt", True) +- attrs.setdefault("confirmation_prompt", True) +- attrs.setdefault("hide_input", True) +- return option(*(param_decls or ("--password",)), **attrs)(f) +- +- return decorator +- +- +-def version_option(version=3DNone, *param_decls, **attrs): +- """Adds a ``--version`` option which immediately ends the program +- printing out the version number. This is implemented as an eager +- option that prints the version and exits the program in the callback. +- +- :param version: the version number to show. If not provided Click +- attempts an auto discovery via setuptools. +- :param prog_name: the name of the program (defaults to autodetection) +- :param message: custom message to show instead of the default +- (``'%(prog)s, version %(version)s'``) +- :param others: everything else is forwarded to :func:`option`. +- """ +- if version is None: +- if hasattr(sys, "_getframe"): +- module =3D sys._getframe(1).f_globals.get("__name__") +- else: +- module =3D "" +- +- def decorator(f): +- prog_name =3D attrs.pop("prog_name", None) +- message =3D attrs.pop("message", "%(prog)s, version %(version)s") +- +- def callback(ctx, param, value): +- if not value or ctx.resilient_parsing: +- return +- prog =3D prog_name +- if prog is None: +- prog =3D ctx.find_root().info_name +- ver =3D version +- if ver is None: +- try: +- import pkg_resources +- except ImportError: +- pass +- else: +- for dist in pkg_resources.working_set: +- scripts =3D dist.get_entry_map().get("console_scr= ipts") or {} +- for entry_point in scripts.values(): +- if entry_point.module_name =3D=3D module: +- ver =3D dist.version +- break +- if ver is None: +- raise RuntimeError("Could not determine version") +- echo(message % {"prog": prog, "version": ver}, color=3Dctx.co= lor) +- ctx.exit() +- +- attrs.setdefault("is_flag", True) +- attrs.setdefault("expose_value", False) +- attrs.setdefault("is_eager", True) +- attrs.setdefault("help", "Show the version and exit.") +- attrs["callback"] =3D callback +- return option(*(param_decls or ("--version",)), **attrs)(f) +- +- return decorator +- +- +-def help_option(*param_decls, **attrs): +- """Adds a ``--help`` option which immediately ends the program +- printing out the help page. This is usually unnecessary to add as +- this is added by default to all commands unless suppressed. +- +- Like :func:`version_option`, this is implemented as eager option that +- prints in the callback and exits. +- +- All arguments are forwarded to :func:`option`. +- """ +- +- def decorator(f): +- def callback(ctx, param, value): +- if value and not ctx.resilient_parsing: +- echo(ctx.get_help(), color=3Dctx.color) +- ctx.exit() +- +- attrs.setdefault("is_flag", True) +- attrs.setdefault("expose_value", False) +- attrs.setdefault("help", "Show this message and exit.") +- attrs.setdefault("is_eager", True) +- attrs["callback"] =3D callback +- return option(*(param_decls or ("--help",)), **attrs)(f) +- +- return decorator +diff --git a/dynaconf/vendor_src/click/exceptions.py b/dynaconf/vendor_src= /click/exceptions.py +deleted file mode 100644 +index 25b02bb..0000000 +--- a/dynaconf/vendor_src/click/exceptions.py ++++ /dev/null +@@ -1,233 +0,0 @@ +-from ._compat import filename_to_ui +-from ._compat import get_text_stderr +-from .utils import echo +- +- +-def _join_param_hints(param_hint): +- if isinstance(param_hint, (tuple, list)): +- return " / ".join(repr(x) for x in param_hint) +- return param_hint +- +- +-class ClickException(Exception): +- """An exception that Click can handle and show to the user.""" +- +- #: The exit code for this exception. +- exit_code =3D 1 +- +- def __init__(self, message): +- super().__init__(message) +- self.message =3D message +- +- def format_message(self): +- return self.message +- +- def __str__(self): +- return self.message +- +- def show(self, file=3DNone): +- if file is None: +- file =3D get_text_stderr() +- echo(f"Error: {self.format_message()}", file=3Dfile) +- +- +-class UsageError(ClickException): +- """An internal exception that signals a usage error. This typically +- aborts any further handling. +- +- :param message: the error message to display. +- :param ctx: optionally the context that caused this error. Click will +- fill in the context automatically in some situations. +- """ +- +- exit_code =3D 2 +- +- def __init__(self, message, ctx=3DNone): +- ClickException.__init__(self, message) +- self.ctx =3D ctx +- self.cmd =3D self.ctx.command if self.ctx else None +- +- def show(self, file=3DNone): +- if file is None: +- file =3D get_text_stderr() +- color =3D None +- hint =3D "" +- if self.cmd is not None and self.cmd.get_help_option(self.ctx) is= not None: +- hint =3D ( +- f"Try '{self.ctx.command_path}" +- f" {self.ctx.help_option_names[0]}' for help.\n" +- ) +- if self.ctx is not None: +- color =3D self.ctx.color +- echo(f"{self.ctx.get_usage()}\n{hint}", file=3Dfile, color=3D= color) +- echo(f"Error: {self.format_message()}", file=3Dfile, color=3Dcolo= r) +- +- +-class BadParameter(UsageError): +- """An exception that formats out a standardized error message for a +- bad parameter. This is useful when thrown from a callback or type as +- Click will attach contextual information to it (for instance, which +- parameter it is). +- +- .. versionadded:: 2.0 +- +- :param param: the parameter object that caused this error. This can +- be left out, and Click will attach this info itself +- if possible. +- :param param_hint: a string that shows up as parameter name. This +- can be used as alternative to `param` in cases +- where custom validation should happen. If it is +- a string it's used as such, if it's a list then +- each item is quoted and separated. +- """ +- +- def __init__(self, message, ctx=3DNone, param=3DNone, param_hint=3DNo= ne): +- UsageError.__init__(self, message, ctx) +- self.param =3D param +- self.param_hint =3D param_hint +- +- def format_message(self): +- if self.param_hint is not None: +- param_hint =3D self.param_hint +- elif self.param is not None: +- param_hint =3D self.param.get_error_hint(self.ctx) +- else: +- return f"Invalid value: {self.message}" +- param_hint =3D _join_param_hints(param_hint) +- +- return f"Invalid value for {param_hint}: {self.message}" +- +- +-class MissingParameter(BadParameter): +- """Raised if click required an option or argument but it was not +- provided when invoking the script. +- +- .. versionadded:: 4.0 +- +- :param param_type: a string that indicates the type of the parameter. +- The default is to inherit the parameter type from +- the given `param`. Valid values are ``'parameter'= ``, +- ``'option'`` or ``'argument'``. +- """ +- +- def __init__( +- self, message=3DNone, ctx=3DNone, param=3DNone, param_hint=3DNone= , param_type=3DNone +- ): +- BadParameter.__init__(self, message, ctx, param, param_hint) +- self.param_type =3D param_type +- +- def format_message(self): +- if self.param_hint is not None: +- param_hint =3D self.param_hint +- elif self.param is not None: +- param_hint =3D self.param.get_error_hint(self.ctx) +- else: +- param_hint =3D None +- param_hint =3D _join_param_hints(param_hint) +- +- param_type =3D self.param_type +- if param_type is None and self.param is not None: +- param_type =3D self.param.param_type_name +- +- msg =3D self.message +- if self.param is not None: +- msg_extra =3D self.param.type.get_missing_message(self.param) +- if msg_extra: +- if msg: +- msg +=3D f". {msg_extra}" +- else: +- msg =3D msg_extra +- +- hint_str =3D f" {param_hint}" if param_hint else "" +- return f"Missing {param_type}{hint_str}.{' ' if msg else ''}{msg = or ''}" +- +- def __str__(self): +- if self.message is None: +- param_name =3D self.param.name if self.param else None +- return f"missing parameter: {param_name}" +- else: +- return self.message +- +- +-class NoSuchOption(UsageError): +- """Raised if click attempted to handle an option that does not +- exist. +- +- .. versionadded:: 4.0 +- """ +- +- def __init__(self, option_name, message=3DNone, possibilities=3DNone,= ctx=3DNone): +- if message is None: +- message =3D f"no such option: {option_name}" +- UsageError.__init__(self, message, ctx) +- self.option_name =3D option_name +- self.possibilities =3D possibilities +- +- def format_message(self): +- bits =3D [self.message] +- if self.possibilities: +- if len(self.possibilities) =3D=3D 1: +- bits.append(f"Did you mean {self.possibilities[0]}?") +- else: +- possibilities =3D sorted(self.possibilities) +- bits.append(f"(Possible options: {', '.join(possibilities= )})") +- return " ".join(bits) +- +- +-class BadOptionUsage(UsageError): +- """Raised if an option is generally supplied but the use of the option +- was incorrect. This is for instance raised if the number of arguments +- for an option is not correct. +- +- .. versionadded:: 4.0 +- +- :param option_name: the name of the option being used incorrectly. +- """ +- +- def __init__(self, option_name, message, ctx=3DNone): +- UsageError.__init__(self, message, ctx) +- self.option_name =3D option_name +- +- +-class BadArgumentUsage(UsageError): +- """Raised if an argument is generally supplied but the use of the arg= ument +- was incorrect. This is for instance raised if the number of values +- for an argument is not correct. +- +- .. versionadded:: 6.0 +- """ +- +- def __init__(self, message, ctx=3DNone): +- UsageError.__init__(self, message, ctx) +- +- +-class FileError(ClickException): +- """Raised if a file cannot be opened.""" +- +- def __init__(self, filename, hint=3DNone): +- ui_filename =3D filename_to_ui(filename) +- if hint is None: +- hint =3D "unknown error" +- ClickException.__init__(self, hint) +- self.ui_filename =3D ui_filename +- self.filename =3D filename +- +- def format_message(self): +- return f"Could not open file {self.ui_filename}: {self.message}" +- +- +-class Abort(RuntimeError): +- """An internal signalling exception that signals Click to abort.""" +- +- +-class Exit(RuntimeError): +- """An exception that indicates that the application should exit with = some +- status code. +- +- :param code: the status code to exit with. +- """ +- +- __slots__ =3D ("exit_code",) +- +- def __init__(self, code=3D0): +- self.exit_code =3D code +diff --git a/dynaconf/vendor_src/click/formatting.py b/dynaconf/vendor_src= /click/formatting.py +deleted file mode 100644 +index a298c2e..0000000 +--- a/dynaconf/vendor_src/click/formatting.py ++++ /dev/null +@@ -1,279 +0,0 @@ +-from contextlib import contextmanager +- +-from ._compat import term_len +-from .parser import split_opt +-from .termui import get_terminal_size +- +-# Can force a width. This is used by the test system +-FORCED_WIDTH =3D None +- +- +-def measure_table(rows): +- widths =3D {} +- for row in rows: +- for idx, col in enumerate(row): +- widths[idx] =3D max(widths.get(idx, 0), term_len(col)) +- return tuple(y for x, y in sorted(widths.items())) +- +- +-def iter_rows(rows, col_count): +- for row in rows: +- row =3D tuple(row) +- yield row + ("",) * (col_count - len(row)) +- +- +-def wrap_text( +- text, width=3D78, initial_indent=3D"", subsequent_indent=3D"", preser= ve_paragraphs=3DFalse +-): +- """A helper function that intelligently wraps text. By default, it +- assumes that it operates on a single paragraph of text but if the +- `preserve_paragraphs` parameter is provided it will intelligently +- handle paragraphs (defined by two empty lines). +- +- If paragraphs are handled, a paragraph can be prefixed with an empty +- line containing the ``\\b`` character (``\\x08``) to indicate that +- no rewrapping should happen in that block. +- +- :param text: the text that should be rewrapped. +- :param width: the maximum width for the text. +- :param initial_indent: the initial indent that should be placed on the +- first line as a string. +- :param subsequent_indent: the indent string that should be placed on +- each consecutive line. +- :param preserve_paragraphs: if this flag is set then the wrapping will +- intelligently handle paragraphs. +- """ +- from ._textwrap import TextWrapper +- +- text =3D text.expandtabs() +- wrapper =3D TextWrapper( +- width, +- initial_indent=3Dinitial_indent, +- subsequent_indent=3Dsubsequent_indent, +- replace_whitespace=3DFalse, +- ) +- if not preserve_paragraphs: +- return wrapper.fill(text) +- +- p =3D [] +- buf =3D [] +- indent =3D None +- +- def _flush_par(): +- if not buf: +- return +- if buf[0].strip() =3D=3D "\b": +- p.append((indent or 0, True, "\n".join(buf[1:]))) +- else: +- p.append((indent or 0, False, " ".join(buf))) +- del buf[:] +- +- for line in text.splitlines(): +- if not line: +- _flush_par() +- indent =3D None +- else: +- if indent is None: +- orig_len =3D term_len(line) +- line =3D line.lstrip() +- indent =3D orig_len - term_len(line) +- buf.append(line) +- _flush_par() +- +- rv =3D [] +- for indent, raw, text in p: +- with wrapper.extra_indent(" " * indent): +- if raw: +- rv.append(wrapper.indent_only(text)) +- else: +- rv.append(wrapper.fill(text)) +- +- return "\n\n".join(rv) +- +- +-class HelpFormatter: +- """This class helps with formatting text-based help pages. It's +- usually just needed for very special internal cases, but it's also +- exposed so that developers can write their own fancy outputs. +- +- At present, it always writes into memory. +- +- :param indent_increment: the additional increment for each level. +- :param width: the width for the text. This defaults to the terminal +- width clamped to a maximum of 78. +- """ +- +- def __init__(self, indent_increment=3D2, width=3DNone, max_width=3DNo= ne): +- self.indent_increment =3D indent_increment +- if max_width is None: +- max_width =3D 80 +- if width is None: +- width =3D FORCED_WIDTH +- if width is None: +- width =3D max(min(get_terminal_size()[0], max_width) - 2,= 50) +- self.width =3D width +- self.current_indent =3D 0 +- self.buffer =3D [] +- +- def write(self, string): +- """Writes a unicode string into the internal buffer.""" +- self.buffer.append(string) +- +- def indent(self): +- """Increases the indentation.""" +- self.current_indent +=3D self.indent_increment +- +- def dedent(self): +- """Decreases the indentation.""" +- self.current_indent -=3D self.indent_increment +- +- def write_usage(self, prog, args=3D"", prefix=3D"Usage: "): +- """Writes a usage line into the buffer. +- +- :param prog: the program name. +- :param args: whitespace separated list of arguments. +- :param prefix: the prefix for the first line. +- """ +- usage_prefix =3D f"{prefix:>{self.current_indent}}{prog} " +- text_width =3D self.width - self.current_indent +- +- if text_width >=3D (term_len(usage_prefix) + 20): +- # The arguments will fit to the right of the prefix. +- indent =3D " " * term_len(usage_prefix) +- self.write( +- wrap_text( +- args, +- text_width, +- initial_indent=3Dusage_prefix, +- subsequent_indent=3Dindent, +- ) +- ) +- else: +- # The prefix is too long, put the arguments on the next line. +- self.write(usage_prefix) +- self.write("\n") +- indent =3D " " * (max(self.current_indent, term_len(prefix)) = + 4) +- self.write( +- wrap_text( +- args, text_width, initial_indent=3Dindent, subsequent= _indent=3Dindent +- ) +- ) +- +- self.write("\n") +- +- def write_heading(self, heading): +- """Writes a heading into the buffer.""" +- self.write(f"{'':>{self.current_indent}}{heading}:\n") +- +- def write_paragraph(self): +- """Writes a paragraph into the buffer.""" +- if self.buffer: +- self.write("\n") +- +- def write_text(self, text): +- """Writes re-indented text into the buffer. This rewraps and +- preserves paragraphs. +- """ +- text_width =3D max(self.width - self.current_indent, 11) +- indent =3D " " * self.current_indent +- self.write( +- wrap_text( +- text, +- text_width, +- initial_indent=3Dindent, +- subsequent_indent=3Dindent, +- preserve_paragraphs=3DTrue, +- ) +- ) +- self.write("\n") +- +- def write_dl(self, rows, col_max=3D30, col_spacing=3D2): +- """Writes a definition list into the buffer. This is how options +- and commands are usually formatted. +- +- :param rows: a list of two item tuples for the terms and values. +- :param col_max: the maximum width of the first column. +- :param col_spacing: the number of spaces between the first and +- second column. +- """ +- rows =3D list(rows) +- widths =3D measure_table(rows) +- if len(widths) !=3D 2: +- raise TypeError("Expected two columns for definition list") +- +- first_col =3D min(widths[0], col_max) + col_spacing +- +- for first, second in iter_rows(rows, len(widths)): +- self.write(f"{'':>{self.current_indent}}{first}") +- if not second: +- self.write("\n") +- continue +- if term_len(first) <=3D first_col - col_spacing: +- self.write(" " * (first_col - term_len(first))) +- else: +- self.write("\n") +- self.write(" " * (first_col + self.current_indent)) +- +- text_width =3D max(self.width - first_col - 2, 10) +- wrapped_text =3D wrap_text(second, text_width, preserve_parag= raphs=3DTrue) +- lines =3D wrapped_text.splitlines() +- +- if lines: +- self.write(f"{lines[0]}\n") +- +- for line in lines[1:]: +- self.write(f"{'':>{first_col + self.current_indent}}{= line}\n") +- +- if len(lines) > 1: +- # separate long help from next option +- self.write("\n") +- else: +- self.write("\n") +- +- @contextmanager +- def section(self, name): +- """Helpful context manager that writes a paragraph, a heading, +- and the indents. +- +- :param name: the section name that is written as heading. +- """ +- self.write_paragraph() +- self.write_heading(name) +- self.indent() +- try: +- yield +- finally: +- self.dedent() +- +- @contextmanager +- def indentation(self): +- """A context manager that increases the indentation.""" +- self.indent() +- try: +- yield +- finally: +- self.dedent() +- +- def getvalue(self): +- """Returns the buffer contents.""" +- return "".join(self.buffer) +- +- +-def join_options(options): +- """Given a list of option strings this joins them in the most appropr= iate +- way and returns them in the form ``(formatted_string, +- any_prefix_is_slash)`` where the second item in the tuple is a flag t= hat +- indicates if any of the option prefixes was a slash. +- """ +- rv =3D [] +- any_prefix_is_slash =3D False +- for opt in options: +- prefix =3D split_opt(opt)[0] +- if prefix =3D=3D "/": +- any_prefix_is_slash =3D True +- rv.append((len(prefix), opt)) +- +- rv.sort(key=3Dlambda x: x[0]) +- +- rv =3D ", ".join(x[1] for x in rv) +- return rv, any_prefix_is_slash +diff --git a/dynaconf/vendor_src/click/globals.py b/dynaconf/vendor_src/cl= ick/globals.py +deleted file mode 100644 +index 1649f9a..0000000 +--- a/dynaconf/vendor_src/click/globals.py ++++ /dev/null +@@ -1,47 +0,0 @@ +-from threading import local +- +-_local =3D local() +- +- +-def get_current_context(silent=3DFalse): +- """Returns the current click context. This can be used as a way to +- access the current context object from anywhere. This is a more impl= icit +- alternative to the :func:`pass_context` decorator. This function is +- primarily useful for helpers such as :func:`echo` which might be +- interested in changing its behavior based on the current context. +- +- To push the current context, :meth:`Context.scope` can be used. +- +- .. versionadded:: 5.0 +- +- :param silent: if set to `True` the return value is `None` if no cont= ext +- is available. The default behavior is to raise a +- :exc:`RuntimeError`. +- """ +- try: +- return _local.stack[-1] +- except (AttributeError, IndexError): +- if not silent: +- raise RuntimeError("There is no active click context.") +- +- +-def push_context(ctx): +- """Pushes a new context to the current stack.""" +- _local.__dict__.setdefault("stack", []).append(ctx) +- +- +-def pop_context(): +- """Removes the top level from the stack.""" +- _local.stack.pop() +- +- +-def resolve_color_default(color=3DNone): +- """"Internal helper to get the default value of the color flag. If a +- value is passed it's returned unchanged, otherwise it's looked up from +- the current context. +- """ +- if color is not None: +- return color +- ctx =3D get_current_context(silent=3DTrue) +- if ctx is not None: +- return ctx.color +diff --git a/dynaconf/vendor_src/click/parser.py b/dynaconf/vendor_src/cli= ck/parser.py +deleted file mode 100644 +index 158abb0..0000000 +--- a/dynaconf/vendor_src/click/parser.py ++++ /dev/null +@@ -1,431 +0,0 @@ +-""" +-This module started out as largely a copy paste from the stdlib's +-optparse module with the features removed that we do not need from +-optparse because we implement them in Click on a higher level (for +-instance type handling, help formatting and a lot more). +- +-The plan is to remove more and more from here over time. +- +-The reason this is a different module and not optparse from the stdlib +-is that there are differences in 2.x and 3.x about the error messages +-generated and optparse in the stdlib uses gettext for no good reason +-and might cause us issues. +- +-Click uses parts of optparse written by Gregory P. Ward and maintained +-by the Python Software Foundation. This is limited to code in parser.py. +- +-Copyright 2001-2006 Gregory P. Ward. All rights reserved. +-Copyright 2002-2006 Python Software Foundation. All rights reserved. +-""" +-# This code uses parts of optparse written by Gregory P. Ward and +-# maintained by the Python Software Foundation. +-# Copyright 2001-2006 Gregory P. Ward +-# Copyright 2002-2006 Python Software Foundation +-import re +-from collections import deque +- +-from .exceptions import BadArgumentUsage +-from .exceptions import BadOptionUsage +-from .exceptions import NoSuchOption +-from .exceptions import UsageError +- +- +-def _unpack_args(args, nargs_spec): +- """Given an iterable of arguments and an iterable of nargs specificat= ions, +- it returns a tuple with all the unpacked arguments at the first index +- and all remaining arguments as the second. +- +- The nargs specification is the number of arguments that should be con= sumed +- or `-1` to indicate that this position should eat up all the remainde= rs. +- +- Missing items are filled with `None`. +- """ +- args =3D deque(args) +- nargs_spec =3D deque(nargs_spec) +- rv =3D [] +- spos =3D None +- +- def _fetch(c): +- try: +- if spos is None: +- return c.popleft() +- else: +- return c.pop() +- except IndexError: +- return None +- +- while nargs_spec: +- nargs =3D _fetch(nargs_spec) +- if nargs =3D=3D 1: +- rv.append(_fetch(args)) +- elif nargs > 1: +- x =3D [_fetch(args) for _ in range(nargs)] +- # If we're reversed, we're pulling in the arguments in revers= e, +- # so we need to turn them around. +- if spos is not None: +- x.reverse() +- rv.append(tuple(x)) +- elif nargs < 0: +- if spos is not None: +- raise TypeError("Cannot have two nargs < 0") +- spos =3D len(rv) +- rv.append(None) +- +- # spos is the position of the wildcard (star). If it's not `None`, +- # we fill it with the remainder. +- if spos is not None: +- rv[spos] =3D tuple(args) +- args =3D [] +- rv[spos + 1 :] =3D reversed(rv[spos + 1 :]) +- +- return tuple(rv), list(args) +- +- +-def _error_opt_args(nargs, opt): +- if nargs =3D=3D 1: +- raise BadOptionUsage(opt, f"{opt} option requires an argument") +- raise BadOptionUsage(opt, f"{opt} option requires {nargs} arguments") +- +- +-def split_opt(opt): +- first =3D opt[:1] +- if first.isalnum(): +- return "", opt +- if opt[1:2] =3D=3D first: +- return opt[:2], opt[2:] +- return first, opt[1:] +- +- +-def normalize_opt(opt, ctx): +- if ctx is None or ctx.token_normalize_func is None: +- return opt +- prefix, opt =3D split_opt(opt) +- return f"{prefix}{ctx.token_normalize_func(opt)}" +- +- +-def split_arg_string(string): +- """Given an argument string this attempts to split it into small part= s.""" +- rv =3D [] +- for match in re.finditer( +- r"('([^'\\]*(?:\\.[^'\\]*)*)'|\"([^\"\\]*(?:\\.[^\"\\]*)*)\"|\S+)= \s*", +- string, +- re.S, +- ): +- arg =3D match.group().strip() +- if arg[:1] =3D=3D arg[-1:] and arg[:1] in "\"'": +- arg =3D arg[1:-1].encode("ascii", "backslashreplace").decode(= "unicode-escape") +- try: +- arg =3D type(string)(arg) +- except UnicodeError: +- pass +- rv.append(arg) +- return rv +- +- +-class Option: +- def __init__(self, opts, dest, action=3DNone, nargs=3D1, const=3DNone= , obj=3DNone): +- self._short_opts =3D [] +- self._long_opts =3D [] +- self.prefixes =3D set() +- +- for opt in opts: +- prefix, value =3D split_opt(opt) +- if not prefix: +- raise ValueError(f"Invalid start character for option ({o= pt})") +- self.prefixes.add(prefix[0]) +- if len(prefix) =3D=3D 1 and len(value) =3D=3D 1: +- self._short_opts.append(opt) +- else: +- self._long_opts.append(opt) +- self.prefixes.add(prefix) +- +- if action is None: +- action =3D "store" +- +- self.dest =3D dest +- self.action =3D action +- self.nargs =3D nargs +- self.const =3D const +- self.obj =3D obj +- +- @property +- def takes_value(self): +- return self.action in ("store", "append") +- +- def process(self, value, state): +- if self.action =3D=3D "store": +- state.opts[self.dest] =3D value +- elif self.action =3D=3D "store_const": +- state.opts[self.dest] =3D self.const +- elif self.action =3D=3D "append": +- state.opts.setdefault(self.dest, []).append(value) +- elif self.action =3D=3D "append_const": +- state.opts.setdefault(self.dest, []).append(self.const) +- elif self.action =3D=3D "count": +- state.opts[self.dest] =3D state.opts.get(self.dest, 0) + 1 +- else: +- raise ValueError(f"unknown action '{self.action}'") +- state.order.append(self.obj) +- +- +-class Argument: +- def __init__(self, dest, nargs=3D1, obj=3DNone): +- self.dest =3D dest +- self.nargs =3D nargs +- self.obj =3D obj +- +- def process(self, value, state): +- if self.nargs > 1: +- holes =3D sum(1 for x in value if x is None) +- if holes =3D=3D len(value): +- value =3D None +- elif holes !=3D 0: +- raise BadArgumentUsage( +- f"argument {self.dest} takes {self.nargs} values" +- ) +- state.opts[self.dest] =3D value +- state.order.append(self.obj) +- +- +-class ParsingState: +- def __init__(self, rargs): +- self.opts =3D {} +- self.largs =3D [] +- self.rargs =3D rargs +- self.order =3D [] +- +- +-class OptionParser: +- """The option parser is an internal class that is ultimately used to +- parse options and arguments. It's modelled after optparse and brings +- a similar but vastly simplified API. It should generally not be used +- directly as the high level Click classes wrap it for you. +- +- It's not nearly as extensible as optparse or argparse as it does not +- implement features that are implemented on a higher level (such as +- types or defaults). +- +- :param ctx: optionally the :class:`~click.Context` where this parser +- should go with. +- """ +- +- def __init__(self, ctx=3DNone): +- #: The :class:`~click.Context` for this parser. This might be +- #: `None` for some advanced use cases. +- self.ctx =3D ctx +- #: This controls how the parser deals with interspersed arguments. +- #: If this is set to `False`, the parser will stop on the first +- #: non-option. Click uses this to implement nested subcommands +- #: safely. +- self.allow_interspersed_args =3D True +- #: This tells the parser how to deal with unknown options. By +- #: default it will error out (which is sensible), but there is a +- #: second mode where it will ignore it and continue processing +- #: after shifting all the unknown options into the resulting args. +- self.ignore_unknown_options =3D False +- if ctx is not None: +- self.allow_interspersed_args =3D ctx.allow_interspersed_args +- self.ignore_unknown_options =3D ctx.ignore_unknown_options +- self._short_opt =3D {} +- self._long_opt =3D {} +- self._opt_prefixes =3D {"-", "--"} +- self._args =3D [] +- +- def add_option(self, opts, dest, action=3DNone, nargs=3D1, const=3DNo= ne, obj=3DNone): +- """Adds a new option named `dest` to the parser. The destination +- is not inferred (unlike with optparse) and needs to be explicitly +- provided. Action can be any of ``store``, ``store_const``, +- ``append``, ``appnd_const`` or ``count``. +- +- The `obj` can be used to identify the option in the order list +- that is returned from the parser. +- """ +- if obj is None: +- obj =3D dest +- opts =3D [normalize_opt(opt, self.ctx) for opt in opts] +- option =3D Option(opts, dest, action=3Daction, nargs=3Dnargs, con= st=3Dconst, obj=3Dobj) +- self._opt_prefixes.update(option.prefixes) +- for opt in option._short_opts: +- self._short_opt[opt] =3D option +- for opt in option._long_opts: +- self._long_opt[opt] =3D option +- +- def add_argument(self, dest, nargs=3D1, obj=3DNone): +- """Adds a positional argument named `dest` to the parser. +- +- The `obj` can be used to identify the option in the order list +- that is returned from the parser. +- """ +- if obj is None: +- obj =3D dest +- self._args.append(Argument(dest=3Ddest, nargs=3Dnargs, obj=3Dobj)) +- +- def parse_args(self, args): +- """Parses positional arguments and returns ``(values, args, order= )`` +- for the parsed options and arguments as well as the leftover +- arguments if there are any. The order is a list of objects as th= ey +- appear on the command line. If arguments appear multiple times t= hey +- will be memorized multiple times as well. +- """ +- state =3D ParsingState(args) +- try: +- self._process_args_for_options(state) +- self._process_args_for_args(state) +- except UsageError: +- if self.ctx is None or not self.ctx.resilient_parsing: +- raise +- return state.opts, state.largs, state.order +- +- def _process_args_for_args(self, state): +- pargs, args =3D _unpack_args( +- state.largs + state.rargs, [x.nargs for x in self._args] +- ) +- +- for idx, arg in enumerate(self._args): +- arg.process(pargs[idx], state) +- +- state.largs =3D args +- state.rargs =3D [] +- +- def _process_args_for_options(self, state): +- while state.rargs: +- arg =3D state.rargs.pop(0) +- arglen =3D len(arg) +- # Double dashes always handled explicitly regardless of what +- # prefixes are valid. +- if arg =3D=3D "--": +- return +- elif arg[:1] in self._opt_prefixes and arglen > 1: +- self._process_opts(arg, state) +- elif self.allow_interspersed_args: +- state.largs.append(arg) +- else: +- state.rargs.insert(0, arg) +- return +- +- # Say this is the original argument list: +- # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)] +- # ^ +- # (we are about to process arg(i)). +- # +- # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of +- # [arg0, ..., arg(i-1)] (any options and their arguments will have +- # been removed from largs). +- # +- # The while loop will usually consume 1 or more arguments per pas= s. +- # If it consumes 1 (eg. arg is an option that takes no arguments), +- # then after _process_arg() is done the situation is: +- # +- # largs =3D subset of [arg0, ..., arg(i)] +- # rargs =3D [arg(i+1), ..., arg(N-1)] +- # +- # If allow_interspersed_args is false, largs will always be +- # *empty* -- still a subset of [arg0, ..., arg(i-1)], but +- # not a very interesting subset! +- +- def _match_long_opt(self, opt, explicit_value, state): +- if opt not in self._long_opt: +- possibilities =3D [word for word in self._long_opt if word.st= artswith(opt)] +- raise NoSuchOption(opt, possibilities=3Dpossibilities, ctx=3D= self.ctx) +- +- option =3D self._long_opt[opt] +- if option.takes_value: +- # At this point it's safe to modify rargs by injecting the +- # explicit value, because no exception is raised in this +- # branch. This means that the inserted value will be fully +- # consumed. +- if explicit_value is not None: +- state.rargs.insert(0, explicit_value) +- +- nargs =3D option.nargs +- if len(state.rargs) < nargs: +- _error_opt_args(nargs, opt) +- elif nargs =3D=3D 1: +- value =3D state.rargs.pop(0) +- else: +- value =3D tuple(state.rargs[:nargs]) +- del state.rargs[:nargs] +- +- elif explicit_value is not None: +- raise BadOptionUsage(opt, f"{opt} option does not take a valu= e") +- +- else: +- value =3D None +- +- option.process(value, state) +- +- def _match_short_opt(self, arg, state): +- stop =3D False +- i =3D 1 +- prefix =3D arg[0] +- unknown_options =3D [] +- +- for ch in arg[1:]: +- opt =3D normalize_opt(f"{prefix}{ch}", self.ctx) +- option =3D self._short_opt.get(opt) +- i +=3D 1 +- +- if not option: +- if self.ignore_unknown_options: +- unknown_options.append(ch) +- continue +- raise NoSuchOption(opt, ctx=3Dself.ctx) +- if option.takes_value: +- # Any characters left in arg? Pretend they're the +- # next arg, and stop consuming characters of arg. +- if i < len(arg): +- state.rargs.insert(0, arg[i:]) +- stop =3D True +- +- nargs =3D option.nargs +- if len(state.rargs) < nargs: +- _error_opt_args(nargs, opt) +- elif nargs =3D=3D 1: +- value =3D state.rargs.pop(0) +- else: +- value =3D tuple(state.rargs[:nargs]) +- del state.rargs[:nargs] +- +- else: +- value =3D None +- +- option.process(value, state) +- +- if stop: +- break +- +- # If we got any unknown options we re-combinate the string of the +- # remaining options and re-attach the prefix, then report that +- # to the state as new larg. This way there is basic combinatorics +- # that can be achieved while still ignoring unknown arguments. +- if self.ignore_unknown_options and unknown_options: +- state.largs.append(f"{prefix}{''.join(unknown_options)}") +- +- def _process_opts(self, arg, state): +- explicit_value =3D None +- # Long option handling happens in two parts. The first part is +- # supporting explicitly attached values. In any case, we will try +- # to long match the option first. +- if "=3D" in arg: +- long_opt, explicit_value =3D arg.split("=3D", 1) +- else: +- long_opt =3D arg +- norm_long_opt =3D normalize_opt(long_opt, self.ctx) +- +- # At this point we will match the (assumed) long option through +- # the long option matching code. Note that this allows options +- # like "-foo" to be matched as long options. +- try: +- self._match_long_opt(norm_long_opt, explicit_value, state) +- except NoSuchOption: +- # At this point the long option matching failed, and we need +- # to try with short options. However there is a special rule +- # which says, that if we have a two character options prefix +- # (applies to "--foo" for instance), we do not dispatch to the +- # short option code and will instead raise the no option +- # error. +- if arg[:2] not in self._opt_prefixes: +- return self._match_short_opt(arg, state) +- if not self.ignore_unknown_options: +- raise +- state.largs.append(arg) +diff --git a/dynaconf/vendor_src/click/termui.py b/dynaconf/vendor_src/cli= ck/termui.py +deleted file mode 100644 +index a1bdf2a..0000000 +--- a/dynaconf/vendor_src/click/termui.py ++++ /dev/null +@@ -1,688 +0,0 @@ +-import inspect +-import io +-import itertools +-import os +-import struct +-import sys +- +-from ._compat import DEFAULT_COLUMNS +-from ._compat import get_winterm_size +-from ._compat import isatty +-from ._compat import strip_ansi +-from ._compat import WIN +-from .exceptions import Abort +-from .exceptions import UsageError +-from .globals import resolve_color_default +-from .types import Choice +-from .types import convert_type +-from .types import Path +-from .utils import echo +-from .utils import LazyFile +- +-# The prompt functions to use. The doc tools currently override these +-# functions to customize how they work. +-visible_prompt_func =3D input +- +-_ansi_colors =3D { +- "black": 30, +- "red": 31, +- "green": 32, +- "yellow": 33, +- "blue": 34, +- "magenta": 35, +- "cyan": 36, +- "white": 37, +- "reset": 39, +- "bright_black": 90, +- "bright_red": 91, +- "bright_green": 92, +- "bright_yellow": 93, +- "bright_blue": 94, +- "bright_magenta": 95, +- "bright_cyan": 96, +- "bright_white": 97, +-} +-_ansi_reset_all =3D "\033[0m" +- +- +-def hidden_prompt_func(prompt): +- import getpass +- +- return getpass.getpass(prompt) +- +- +-def _build_prompt( +- text, suffix, show_default=3DFalse, default=3DNone, show_choices=3DTr= ue, type=3DNone +-): +- prompt =3D text +- if type is not None and show_choices and isinstance(type, Choice): +- prompt +=3D f" ({', '.join(map(str, type.choices))})" +- if default is not None and show_default: +- prompt =3D f"{prompt} [{_format_default(default)}]" +- return f"{prompt}{suffix}" +- +- +-def _format_default(default): +- if isinstance(default, (io.IOBase, LazyFile)) and hasattr(default, "n= ame"): +- return default.name +- +- return default +- +- +-def prompt( +- text, +- default=3DNone, +- hide_input=3DFalse, +- confirmation_prompt=3DFalse, +- type=3DNone, +- value_proc=3DNone, +- prompt_suffix=3D": ", +- show_default=3DTrue, +- err=3DFalse, +- show_choices=3DTrue, +-): +- """Prompts a user for input. This is a convenience function that can +- be used to prompt a user for input later. +- +- If the user aborts the input by sending a interrupt signal, this +- function will catch it and raise a :exc:`Abort` exception. +- +- .. versionadded:: 7.0 +- Added the show_choices parameter. +- +- .. versionadded:: 6.0 +- Added unicode support for cmd.exe on Windows. +- +- .. versionadded:: 4.0 +- Added the `err` parameter. +- +- :param text: the text to show for the prompt. +- :param default: the default value to use if no input happens. If this +- is not given it will prompt until it's aborted. +- :param hide_input: if this is set to true then the input value will +- be hidden. +- :param confirmation_prompt: asks for confirmation for the value. +- :param type: the type to use to check the value against. +- :param value_proc: if this parameter is provided it's a function that +- is invoked instead of the type conversion to +- convert a value. +- :param prompt_suffix: a suffix that should be added to the prompt. +- :param show_default: shows or hides the default value in the prompt. +- :param err: if set to true the file defaults to ``stderr`` instead of +- ``stdout``, the same as with echo. +- :param show_choices: Show or hide choices if the passed type is a Cho= ice. +- For example if type is a Choice of either day or= week, +- show_choices is true and text is "Group by" then= the +- prompt will be "Group by (day, week): ". +- """ +- result =3D None +- +- def prompt_func(text): +- f =3D hidden_prompt_func if hide_input else visible_prompt_func +- try: +- # Write the prompt separately so that we get nice +- # coloring through colorama on Windows +- echo(text, nl=3DFalse, err=3Derr) +- return f("") +- except (KeyboardInterrupt, EOFError): +- # getpass doesn't print a newline if the user aborts input wi= th ^C. +- # Allegedly this behavior is inherited from getpass(3). +- # A doc bug has been filed at https://bugs.python.org/issue24= 711 +- if hide_input: +- echo(None, err=3Derr) +- raise Abort() +- +- if value_proc is None: +- value_proc =3D convert_type(type, default) +- +- prompt =3D _build_prompt( +- text, prompt_suffix, show_default, default, show_choices, type +- ) +- +- while 1: +- while 1: +- value =3D prompt_func(prompt) +- if value: +- break +- elif default is not None: +- if isinstance(value_proc, Path): +- # validate Path default value(exists, dir_okay etc.) +- value =3D default +- break +- return default +- try: +- result =3D value_proc(value) +- except UsageError as e: +- echo(f"Error: {e.message}", err=3Derr) # noqa: B306 +- continue +- if not confirmation_prompt: +- return result +- while 1: +- value2 =3D prompt_func("Repeat for confirmation: ") +- if value2: +- break +- if value =3D=3D value2: +- return result +- echo("Error: the two entered values do not match", err=3Derr) +- +- +-def confirm( +- text, default=3DFalse, abort=3DFalse, prompt_suffix=3D": ", show_defa= ult=3DTrue, err=3DFalse +-): +- """Prompts for confirmation (yes/no question). +- +- If the user aborts the input by sending a interrupt signal this +- function will catch it and raise a :exc:`Abort` exception. +- +- .. versionadded:: 4.0 +- Added the `err` parameter. +- +- :param text: the question to ask. +- :param default: the default for the prompt. +- :param abort: if this is set to `True` a negative answer aborts the +- exception by raising :exc:`Abort`. +- :param prompt_suffix: a suffix that should be added to the prompt. +- :param show_default: shows or hides the default value in the prompt. +- :param err: if set to true the file defaults to ``stderr`` instead of +- ``stdout``, the same as with echo. +- """ +- prompt =3D _build_prompt( +- text, prompt_suffix, show_default, "Y/n" if default else "y/N" +- ) +- while 1: +- try: +- # Write the prompt separately so that we get nice +- # coloring through colorama on Windows +- echo(prompt, nl=3DFalse, err=3Derr) +- value =3D visible_prompt_func("").lower().strip() +- except (KeyboardInterrupt, EOFError): +- raise Abort() +- if value in ("y", "yes"): +- rv =3D True +- elif value in ("n", "no"): +- rv =3D False +- elif value =3D=3D "": +- rv =3D default +- else: +- echo("Error: invalid input", err=3Derr) +- continue +- break +- if abort and not rv: +- raise Abort() +- return rv +- +- +-def get_terminal_size(): +- """Returns the current size of the terminal as tuple in the form +- ``(width, height)`` in columns and rows. +- """ +- import shutil +- +- if hasattr(shutil, "get_terminal_size"): +- return shutil.get_terminal_size() +- +- # We provide a sensible default for get_winterm_size() when being inv= oked +- # inside a subprocess. Without this, it would not provide a useful in= put. +- if get_winterm_size is not None: +- size =3D get_winterm_size() +- if size =3D=3D (0, 0): +- return (79, 24) +- else: +- return size +- +- def ioctl_gwinsz(fd): +- try: +- import fcntl +- import termios +- +- cr =3D struct.unpack("hh", fcntl.ioctl(fd, termios.TIOCGWINSZ= , "1234")) +- except Exception: +- return +- return cr +- +- cr =3D ioctl_gwinsz(0) or ioctl_gwinsz(1) or ioctl_gwinsz(2) +- if not cr: +- try: +- fd =3D os.open(os.ctermid(), os.O_RDONLY) +- try: +- cr =3D ioctl_gwinsz(fd) +- finally: +- os.close(fd) +- except Exception: +- pass +- if not cr or not cr[0] or not cr[1]: +- cr =3D (os.environ.get("LINES", 25), os.environ.get("COLUMNS", DE= FAULT_COLUMNS)) +- return int(cr[1]), int(cr[0]) +- +- +-def echo_via_pager(text_or_generator, color=3DNone): +- """This function takes a text and shows it via an environment specific +- pager on stdout. +- +- .. versionchanged:: 3.0 +- Added the `color` flag. +- +- :param text_or_generator: the text to page, or alternatively, a +- generator emitting the text to page. +- :param color: controls if the pager supports ANSI colors or not. The +- default is autodetection. +- """ +- color =3D resolve_color_default(color) +- +- if inspect.isgeneratorfunction(text_or_generator): +- i =3D text_or_generator() +- elif isinstance(text_or_generator, str): +- i =3D [text_or_generator] +- else: +- i =3D iter(text_or_generator) +- +- # convert every element of i to a text type if necessary +- text_generator =3D (el if isinstance(el, str) else str(el) for el in = i) +- +- from ._termui_impl import pager +- +- return pager(itertools.chain(text_generator, "\n"), color) +- +- +-def progressbar( +- iterable=3DNone, +- length=3DNone, +- label=3DNone, +- show_eta=3DTrue, +- show_percent=3DNone, +- show_pos=3DFalse, +- item_show_func=3DNone, +- fill_char=3D"#", +- empty_char=3D"-", +- bar_template=3D"%(label)s [%(bar)s] %(info)s", +- info_sep=3D" ", +- width=3D36, +- file=3DNone, +- color=3DNone, +-): +- """This function creates an iterable context manager that can be used +- to iterate over something while showing a progress bar. It will +- either iterate over the `iterable` or `length` items (that are counted +- up). While iteration happens, this function will print a rendered +- progress bar to the given `file` (defaults to stdout) and will attempt +- to calculate remaining time and more. By default, this progress bar +- will not be rendered if the file is not a terminal. +- +- The context manager creates the progress bar. When the context +- manager is entered the progress bar is already created. With every +- iteration over the progress bar, the iterable passed to the bar is +- advanced and the bar is updated. When the context manager exits, +- a newline is printed and the progress bar is finalized on screen. +- +- Note: The progress bar is currently designed for use cases where the +- total progress can be expected to take at least several seconds. +- Because of this, the ProgressBar class object won't display +- progress that is considered too fast, and progress where the time +- between steps is less than a second. +- +- No printing must happen or the progress bar will be unintentionally +- destroyed. +- +- Example usage:: +- +- with progressbar(items) as bar: +- for item in bar: +- do_something_with(item) +- +- Alternatively, if no iterable is specified, one can manually update t= he +- progress bar through the `update()` method instead of directly +- iterating over the progress bar. The update method accepts the number +- of steps to increment the bar with:: +- +- with progressbar(length=3Dchunks.total_bytes) as bar: +- for chunk in chunks: +- process_chunk(chunk) +- bar.update(chunks.bytes) +- +- The ``update()`` method also takes an optional value specifying the +- ``current_item`` at the new position. This is useful when used +- together with ``item_show_func`` to customize the output for each +- manual step:: +- +- with click.progressbar( +- length=3Dtotal_size, +- label=3D'Unzipping archive', +- item_show_func=3Dlambda a: a.filename +- ) as bar: +- for archive in zip_file: +- archive.extract() +- bar.update(archive.size, archive) +- +- .. versionadded:: 2.0 +- +- .. versionadded:: 4.0 +- Added the `color` parameter. Added a `update` method to the +- progressbar object. +- +- :param iterable: an iterable to iterate over. If not provided the le= ngth +- is required. +- :param length: the number of items to iterate over. By default the +- progressbar will attempt to ask the iterator about its +- length, which might or might not work. If an iterable= is +- also provided this parameter can be used to override t= he +- length. If an iterable is not provided the progress b= ar +- will iterate over a range of that length. +- :param label: the label to show next to the progress bar. +- :param show_eta: enables or disables the estimated time display. Thi= s is +- automatically disabled if the length cannot be +- determined. +- :param show_percent: enables or disables the percentage display. The +- default is `True` if the iterable has a length or +- `False` if not. +- :param show_pos: enables or disables the absolute position display. = The +- default is `False`. +- :param item_show_func: a function called with the current item which +- can return a string to show the current item +- next to the progress bar. Note that the curre= nt +- item can be `None`! +- :param fill_char: the character to use to show the filled part of the +- progress bar. +- :param empty_char: the character to use to show the non-filled part of +- the progress bar. +- :param bar_template: the format string to use as template for the bar. +- The parameters in it are ``label`` for the label, +- ``bar`` for the progress bar and ``info`` for the +- info section. +- :param info_sep: the separator between multiple info items (eta etc.) +- :param width: the width of the progress bar in characters, 0 means fu= ll +- terminal width +- :param file: the file to write to. If this is not a terminal then +- only the label is printed. +- :param color: controls if the terminal supports ANSI colors or not. = The +- default is autodetection. This is only needed if ANSI +- codes are included anywhere in the progress bar output +- which is not the case by default. +- """ +- from ._termui_impl import ProgressBar +- +- color =3D resolve_color_default(color) +- return ProgressBar( +- iterable=3Diterable, +- length=3Dlength, +- show_eta=3Dshow_eta, +- show_percent=3Dshow_percent, +- show_pos=3Dshow_pos, +- item_show_func=3Ditem_show_func, +- fill_char=3Dfill_char, +- empty_char=3Dempty_char, +- bar_template=3Dbar_template, +- info_sep=3Dinfo_sep, +- file=3Dfile, +- label=3Dlabel, +- width=3Dwidth, +- color=3Dcolor, +- ) +- +- +-def clear(): +- """Clears the terminal screen. This will have the effect of clearing +- the whole visible space of the terminal and moving the cursor to the +- top left. This does not do anything if not connected to a terminal. +- +- .. versionadded:: 2.0 +- """ +- if not isatty(sys.stdout): +- return +- # If we're on Windows and we don't have colorama available, then we +- # clear the screen by shelling out. Otherwise we can use an escape +- # sequence. +- if WIN: +- os.system("cls") +- else: +- sys.stdout.write("\033[2J\033[1;1H") +- +- +-def style( +- text, +- fg=3DNone, +- bg=3DNone, +- bold=3DNone, +- dim=3DNone, +- underline=3DNone, +- blink=3DNone, +- reverse=3DNone, +- reset=3DTrue, +-): +- """Styles a text with ANSI styles and returns the new string. By +- default the styling is self contained which means that at the end +- of the string a reset code is issued. This can be prevented by +- passing ``reset=3DFalse``. +- +- Examples:: +- +- click.echo(click.style('Hello World!', fg=3D'green')) +- click.echo(click.style('ATTENTION!', blink=3DTrue)) +- click.echo(click.style('Some things', reverse=3DTrue, fg=3D'cyan'= )) +- +- Supported color names: +- +- * ``black`` (might be a gray) +- * ``red`` +- * ``green`` +- * ``yellow`` (might be an orange) +- * ``blue`` +- * ``magenta`` +- * ``cyan`` +- * ``white`` (might be light gray) +- * ``bright_black`` +- * ``bright_red`` +- * ``bright_green`` +- * ``bright_yellow`` +- * ``bright_blue`` +- * ``bright_magenta`` +- * ``bright_cyan`` +- * ``bright_white`` +- * ``reset`` (reset the color code only) +- +- .. versionadded:: 2.0 +- +- .. versionadded:: 7.0 +- Added support for bright colors. +- +- :param text: the string to style with ansi codes. +- :param fg: if provided this will become the foreground color. +- :param bg: if provided this will become the background color. +- :param bold: if provided this will enable or disable bold mode. +- :param dim: if provided this will enable or disable dim mode. This is +- badly supported. +- :param underline: if provided this will enable or disable underline. +- :param blink: if provided this will enable or disable blinking. +- :param reverse: if provided this will enable or disable inverse +- rendering (foreground becomes background and the +- other way round). +- :param reset: by default a reset-all code is added at the end of the +- string which means that styles do not carry over. This +- can be disabled to compose styles. +- """ +- bits =3D [] +- if fg: +- try: +- bits.append(f"\033[{_ansi_colors[fg]}m") +- except KeyError: +- raise TypeError(f"Unknown color {fg!r}") +- if bg: +- try: +- bits.append(f"\033[{_ansi_colors[bg] + 10}m") +- except KeyError: +- raise TypeError(f"Unknown color {bg!r}") +- if bold is not None: +- bits.append(f"\033[{1 if bold else 22}m") +- if dim is not None: +- bits.append(f"\033[{2 if dim else 22}m") +- if underline is not None: +- bits.append(f"\033[{4 if underline else 24}m") +- if blink is not None: +- bits.append(f"\033[{5 if blink else 25}m") +- if reverse is not None: +- bits.append(f"\033[{7 if reverse else 27}m") +- bits.append(text) +- if reset: +- bits.append(_ansi_reset_all) +- return "".join(bits) +- +- +-def unstyle(text): +- """Removes ANSI styling information from a string. Usually it's not +- necessary to use this function as Click's echo function will +- automatically remove styling if necessary. +- +- .. versionadded:: 2.0 +- +- :param text: the text to remove style information from. +- """ +- return strip_ansi(text) +- +- +-def secho(message=3DNone, file=3DNone, nl=3DTrue, err=3DFalse, color=3DNo= ne, **styles): +- """This function combines :func:`echo` and :func:`style` into one +- call. As such the following two calls are the same:: +- +- click.secho('Hello World!', fg=3D'green') +- click.echo(click.style('Hello World!', fg=3D'green')) +- +- All keyword arguments are forwarded to the underlying functions +- depending on which one they go with. +- +- .. versionadded:: 2.0 +- """ +- if message is not None: +- message =3D style(message, **styles) +- return echo(message, file=3Dfile, nl=3Dnl, err=3Derr, color=3Dcolor) +- +- +-def edit( +- text=3DNone, editor=3DNone, env=3DNone, require_save=3DTrue, extensio= n=3D".txt", filename=3DNone +-): +- r"""Edits the given text in the defined editor. If an editor is given +- (should be the full path to the executable but the regular operating +- system search path is used for finding the executable) it overrides +- the detected editor. Optionally, some environment variables can be +- used. If the editor is closed without changes, `None` is returned. = In +- case a file is edited directly the return value is always `None` and +- `require_save` and `extension` are ignored. +- +- If the editor cannot be opened a :exc:`UsageError` is raised. +- +- Note for Windows: to simplify cross-platform usage, the newlines are +- automatically converted from POSIX to Windows and vice versa. As suc= h, +- the message here will have ``\n`` as newline markers. +- +- :param text: the text to edit. +- :param editor: optionally the editor to use. Defaults to automatic +- detection. +- :param env: environment variables to forward to the editor. +- :param require_save: if this is true, then not saving in the editor +- will make the return value become `None`. +- :param extension: the extension to tell the editor about. This defau= lts +- to `.txt` but changing this might change syntax +- highlighting. +- :param filename: if provided it will edit this file instead of the +- provided text contents. It will not use a temporary +- file as an indirection in that case. +- """ +- from ._termui_impl import Editor +- +- editor =3D Editor( +- editor=3Deditor, env=3Denv, require_save=3Drequire_save, extensio= n=3Dextension +- ) +- if filename is None: +- return editor.edit(text) +- editor.edit_file(filename) +- +- +-def launch(url, wait=3DFalse, locate=3DFalse): +- """This function launches the given URL (or filename) in the default +- viewer application for this file type. If this is an executable, it +- might launch the executable in a new session. The return value is +- the exit code of the launched application. Usually, ``0`` indicates +- success. +- +- Examples:: +- +- click.launch('https://click.palletsprojects.com/') +- click.launch('/my/downloaded/file', locate=3DTrue) +- +- .. versionadded:: 2.0 +- +- :param url: URL or filename of the thing to launch. +- :param wait: waits for the program to stop. +- :param locate: if this is set to `True` then instead of launching the +- application associated with the URL it will attempt to +- launch a file manager with the file located. This +- might have weird effects if the URL does not point to +- the filesystem. +- """ +- from ._termui_impl import open_url +- +- return open_url(url, wait=3Dwait, locate=3Dlocate) +- +- +-# If this is provided, getchar() calls into this instead. This is used +-# for unittesting purposes. +-_getchar =3D None +- +- +-def getchar(echo=3DFalse): +- """Fetches a single character from the terminal and returns it. This +- will always return a unicode character and under certain rare +- circumstances this might return more than one character. The +- situations which more than one character is returned is when for +- whatever reason multiple characters end up in the terminal buffer or +- standard input was not actually a terminal. +- +- Note that this will always read from the terminal, even if something +- is piped into the standard input. +- +- Note for Windows: in rare cases when typing non-ASCII characters, this +- function might wait for a second character and then return both at on= ce. +- This is because certain Unicode characters look like special-key mark= ers. +- +- .. versionadded:: 2.0 +- +- :param echo: if set to `True`, the character read will also show up on +- the terminal. The default is to not show it. +- """ +- f =3D _getchar +- if f is None: +- from ._termui_impl import getchar as f +- return f(echo) +- +- +-def raw_terminal(): +- from ._termui_impl import raw_terminal as f +- +- return f() +- +- +-def pause(info=3D"Press any key to continue ...", err=3DFalse): +- """This command stops execution and waits for the user to press any +- key to continue. This is similar to the Windows batch "pause" +- command. If the program is not run through a terminal, this command +- will instead do nothing. +- +- .. versionadded:: 2.0 +- +- .. versionadded:: 4.0 +- Added the `err` parameter. +- +- :param info: the info string to print before pausing. +- :param err: if set to message goes to ``stderr`` instead of +- ``stdout``, the same as with echo. +- """ +- if not isatty(sys.stdin) or not isatty(sys.stdout): +- return +- try: +- if info: +- echo(info, nl=3DFalse, err=3Derr) +- try: +- getchar() +- except (KeyboardInterrupt, EOFError): +- pass +- finally: +- if info: +- echo(err=3Derr) +diff --git a/dynaconf/vendor_src/click/testing.py b/dynaconf/vendor_src/cl= ick/testing.py +deleted file mode 100644 +index fd6bf61..0000000 +--- a/dynaconf/vendor_src/click/testing.py ++++ /dev/null +@@ -1,362 +0,0 @@ +-import contextlib +-import io +-import os +-import shlex +-import shutil +-import sys +-import tempfile +- +-from . import formatting +-from . import termui +-from . import utils +-from ._compat import _find_binary_reader +- +- +-class EchoingStdin: +- def __init__(self, input, output): +- self._input =3D input +- self._output =3D output +- +- def __getattr__(self, x): +- return getattr(self._input, x) +- +- def _echo(self, rv): +- self._output.write(rv) +- return rv +- +- def read(self, n=3D-1): +- return self._echo(self._input.read(n)) +- +- def readline(self, n=3D-1): +- return self._echo(self._input.readline(n)) +- +- def readlines(self): +- return [self._echo(x) for x in self._input.readlines()] +- +- def __iter__(self): +- return iter(self._echo(x) for x in self._input) +- +- def __repr__(self): +- return repr(self._input) +- +- +-def make_input_stream(input, charset): +- # Is already an input stream. +- if hasattr(input, "read"): +- rv =3D _find_binary_reader(input) +- +- if rv is not None: +- return rv +- +- raise TypeError("Could not find binary reader for input stream.") +- +- if input is None: +- input =3D b"" +- elif not isinstance(input, bytes): +- input =3D input.encode(charset) +- +- return io.BytesIO(input) +- +- +-class Result: +- """Holds the captured result of an invoked CLI script.""" +- +- def __init__( +- self, runner, stdout_bytes, stderr_bytes, exit_code, exception, e= xc_info=3DNone +- ): +- #: The runner that created the result +- self.runner =3D runner +- #: The standard output as bytes. +- self.stdout_bytes =3D stdout_bytes +- #: The standard error as bytes, or None if not available +- self.stderr_bytes =3D stderr_bytes +- #: The exit code as integer. +- self.exit_code =3D exit_code +- #: The exception that happened if one did. +- self.exception =3D exception +- #: The traceback +- self.exc_info =3D exc_info +- +- @property +- def output(self): +- """The (standard) output as unicode string.""" +- return self.stdout +- +- @property +- def stdout(self): +- """The standard output as unicode string.""" +- return self.stdout_bytes.decode(self.runner.charset, "replace").r= eplace( +- "\r\n", "\n" +- ) +- +- @property +- def stderr(self): +- """The standard error as unicode string.""" +- if self.stderr_bytes is None: +- raise ValueError("stderr not separately captured") +- return self.stderr_bytes.decode(self.runner.charset, "replace").r= eplace( +- "\r\n", "\n" +- ) +- +- def __repr__(self): +- exc_str =3D repr(self.exception) if self.exception else "okay" +- return f"<{type(self).__name__} {exc_str}>" +- +- +-class CliRunner: +- """The CLI runner provides functionality to invoke a Click command li= ne +- script for unittesting purposes in a isolated environment. This only +- works in single-threaded systems without any concurrency as it change= s the +- global interpreter state. +- +- :param charset: the character set for the input and output data. +- :param env: a dictionary with environment variables for overriding. +- :param echo_stdin: if this is set to `True`, then reading from stdin = writes +- to stdout. This is useful for showing examples in +- some circumstances. Note that regular prompts +- will automatically echo the input. +- :param mix_stderr: if this is set to `False`, then stdout and stderr = are +- preserved as independent streams. This is useful = for +- Unix-philosophy apps that have predictable stdout = and +- noisy stderr, such that each may be measured +- independently +- """ +- +- def __init__(self, charset=3D"utf-8", env=3DNone, echo_stdin=3DFalse,= mix_stderr=3DTrue): +- self.charset =3D charset +- self.env =3D env or {} +- self.echo_stdin =3D echo_stdin +- self.mix_stderr =3D mix_stderr +- +- def get_default_prog_name(self, cli): +- """Given a command object it will return the default program name +- for it. The default is the `name` attribute or ``"root"`` if not +- set. +- """ +- return cli.name or "root" +- +- def make_env(self, overrides=3DNone): +- """Returns the environment overrides for invoking a script.""" +- rv =3D dict(self.env) +- if overrides: +- rv.update(overrides) +- return rv +- +- @contextlib.contextmanager +- def isolation(self, input=3DNone, env=3DNone, color=3DFalse): +- """A context manager that sets up the isolation for invoking of a +- command line tool. This sets up stdin with the given input data +- and `os.environ` with the overrides from the given dictionary. +- This also rebinds some internals in Click to be mocked (like the +- prompt functionality). +- +- This is automatically done in the :meth:`invoke` method. +- +- .. versionadded:: 4.0 +- The ``color`` parameter was added. +- +- :param input: the input stream to put into sys.stdin. +- :param env: the environment overrides as dictionary. +- :param color: whether the output should contain color codes. The +- application can still override this explicitly. +- """ +- input =3D make_input_stream(input, self.charset) +- +- old_stdin =3D sys.stdin +- old_stdout =3D sys.stdout +- old_stderr =3D sys.stderr +- old_forced_width =3D formatting.FORCED_WIDTH +- formatting.FORCED_WIDTH =3D 80 +- +- env =3D self.make_env(env) +- +- bytes_output =3D io.BytesIO() +- +- if self.echo_stdin: +- input =3D EchoingStdin(input, bytes_output) +- +- input =3D io.TextIOWrapper(input, encoding=3Dself.charset) +- sys.stdout =3D io.TextIOWrapper(bytes_output, encoding=3Dself.cha= rset) +- +- if not self.mix_stderr: +- bytes_error =3D io.BytesIO() +- sys.stderr =3D io.TextIOWrapper(bytes_error, encoding=3Dself.= charset) +- +- if self.mix_stderr: +- sys.stderr =3D sys.stdout +- +- sys.stdin =3D input +- +- def visible_input(prompt=3DNone): +- sys.stdout.write(prompt or "") +- val =3D input.readline().rstrip("\r\n") +- sys.stdout.write(f"{val}\n") +- sys.stdout.flush() +- return val +- +- def hidden_input(prompt=3DNone): +- sys.stdout.write(f"{prompt or ''}\n") +- sys.stdout.flush() +- return input.readline().rstrip("\r\n") +- +- def _getchar(echo): +- char =3D sys.stdin.read(1) +- if echo: +- sys.stdout.write(char) +- sys.stdout.flush() +- return char +- +- default_color =3D color +- +- def should_strip_ansi(stream=3DNone, color=3DNone): +- if color is None: +- return not default_color +- return not color +- +- old_visible_prompt_func =3D termui.visible_prompt_func +- old_hidden_prompt_func =3D termui.hidden_prompt_func +- old__getchar_func =3D termui._getchar +- old_should_strip_ansi =3D utils.should_strip_ansi +- termui.visible_prompt_func =3D visible_input +- termui.hidden_prompt_func =3D hidden_input +- termui._getchar =3D _getchar +- utils.should_strip_ansi =3D should_strip_ansi +- +- old_env =3D {} +- try: +- for key, value in env.items(): +- old_env[key] =3D os.environ.get(key) +- if value is None: +- try: +- del os.environ[key] +- except Exception: +- pass +- else: +- os.environ[key] =3D value +- yield (bytes_output, not self.mix_stderr and bytes_error) +- finally: +- for key, value in old_env.items(): +- if value is None: +- try: +- del os.environ[key] +- except Exception: +- pass +- else: +- os.environ[key] =3D value +- sys.stdout =3D old_stdout +- sys.stderr =3D old_stderr +- sys.stdin =3D old_stdin +- termui.visible_prompt_func =3D old_visible_prompt_func +- termui.hidden_prompt_func =3D old_hidden_prompt_func +- termui._getchar =3D old__getchar_func +- utils.should_strip_ansi =3D old_should_strip_ansi +- formatting.FORCED_WIDTH =3D old_forced_width +- +- def invoke( +- self, +- cli, +- args=3DNone, +- input=3DNone, +- env=3DNone, +- catch_exceptions=3DTrue, +- color=3DFalse, +- **extra, +- ): +- """Invokes a command in an isolated environment. The arguments a= re +- forwarded directly to the command line script, the `extra` keyword +- arguments are passed to the :meth:`~clickpkg.Command.main` functi= on of +- the command. +- +- This returns a :class:`Result` object. +- +- .. versionadded:: 3.0 +- The ``catch_exceptions`` parameter was added. +- +- .. versionchanged:: 3.0 +- The result object now has an `exc_info` attribute with the +- traceback if available. +- +- .. versionadded:: 4.0 +- The ``color`` parameter was added. +- +- :param cli: the command to invoke +- :param args: the arguments to invoke. It may be given as an itera= ble +- or a string. When given as string it will be interpr= eted +- as a Unix shell command. More details at +- :func:`shlex.split`. +- :param input: the input data for `sys.stdin`. +- :param env: the environment overrides. +- :param catch_exceptions: Whether to catch any other exceptions th= an +- ``SystemExit``. +- :param extra: the keyword arguments to pass to :meth:`main`. +- :param color: whether the output should contain color codes. The +- application can still override this explicitly. +- """ +- exc_info =3D None +- with self.isolation(input=3Dinput, env=3Denv, color=3Dcolor) as o= utstreams: +- exception =3D None +- exit_code =3D 0 +- +- if isinstance(args, str): +- args =3D shlex.split(args) +- +- try: +- prog_name =3D extra.pop("prog_name") +- except KeyError: +- prog_name =3D self.get_default_prog_name(cli) +- +- try: +- cli.main(args=3Dargs or (), prog_name=3Dprog_name, **extr= a) +- except SystemExit as e: +- exc_info =3D sys.exc_info() +- exit_code =3D e.code +- if exit_code is None: +- exit_code =3D 0 +- +- if exit_code !=3D 0: +- exception =3D e +- +- if not isinstance(exit_code, int): +- sys.stdout.write(str(exit_code)) +- sys.stdout.write("\n") +- exit_code =3D 1 +- +- except Exception as e: +- if not catch_exceptions: +- raise +- exception =3D e +- exit_code =3D 1 +- exc_info =3D sys.exc_info() +- finally: +- sys.stdout.flush() +- stdout =3D outstreams[0].getvalue() +- if self.mix_stderr: +- stderr =3D None +- else: +- stderr =3D outstreams[1].getvalue() +- +- return Result( +- runner=3Dself, +- stdout_bytes=3Dstdout, +- stderr_bytes=3Dstderr, +- exit_code=3Dexit_code, +- exception=3Dexception, +- exc_info=3Dexc_info, +- ) +- +- @contextlib.contextmanager +- def isolated_filesystem(self): +- """A context manager that creates a temporary folder and changes +- the current working directory to it for isolated filesystem tests. +- """ +- cwd =3D os.getcwd() +- t =3D tempfile.mkdtemp() +- os.chdir(t) +- try: +- yield t +- finally: +- os.chdir(cwd) +- try: +- shutil.rmtree(t) +- except OSError: # noqa: B014 +- pass +diff --git a/dynaconf/vendor_src/click/types.py b/dynaconf/vendor_src/clic= k/types.py +deleted file mode 100644 +index 93cf701..0000000 +--- a/dynaconf/vendor_src/click/types.py ++++ /dev/null +@@ -1,726 +0,0 @@ +-import os +-import stat +-from datetime import datetime +- +-from ._compat import _get_argv_encoding +-from ._compat import filename_to_ui +-from ._compat import get_filesystem_encoding +-from ._compat import get_strerror +-from ._compat import open_stream +-from .exceptions import BadParameter +-from .utils import LazyFile +-from .utils import safecall +- +- +-class ParamType: +- """Helper for converting values through types. The following is +- necessary for a valid type: +- +- * it needs a name +- * it needs to pass through None unchanged +- * it needs to convert from a string +- * it needs to convert its result type through unchanged +- (eg: needs to be idempotent) +- * it needs to be able to deal with param and context being `None`. +- This can be the case when the object is used with prompt +- inputs. +- """ +- +- is_composite =3D False +- +- #: the descriptive name of this type +- name =3D None +- +- #: if a list of this type is expected and the value is pulled from a +- #: string environment variable, this is what splits it up. `None` +- #: means any whitespace. For all parameters the general rule is that +- #: whitespace splits them up. The exception are paths and files which +- #: are split by ``os.path.pathsep`` by default (":" on Unix and ";" on +- #: Windows). +- envvar_list_splitter =3D None +- +- def __call__(self, value, param=3DNone, ctx=3DNone): +- if value is not None: +- return self.convert(value, param, ctx) +- +- def get_metavar(self, param): +- """Returns the metavar default for this param if it provides one.= """ +- +- def get_missing_message(self, param): +- """Optionally might return extra information about a missing +- parameter. +- +- .. versionadded:: 2.0 +- """ +- +- def convert(self, value, param, ctx): +- """Converts the value. This is not invoked for values that are +- `None` (the missing value). +- """ +- return value +- +- def split_envvar_value(self, rv): +- """Given a value from an environment variable this splits it up +- into small chunks depending on the defined envvar list splitter. +- +- If the splitter is set to `None`, which means that whitespace spl= its, +- then leading and trailing whitespace is ignored. Otherwise, lead= ing +- and trailing splitters usually lead to empty items being included. +- """ +- return (rv or "").split(self.envvar_list_splitter) +- +- def fail(self, message, param=3DNone, ctx=3DNone): +- """Helper method to fail with an invalid value message.""" +- raise BadParameter(message, ctx=3Dctx, param=3Dparam) +- +- +-class CompositeParamType(ParamType): +- is_composite =3D True +- +- @property +- def arity(self): +- raise NotImplementedError() +- +- +-class FuncParamType(ParamType): +- def __init__(self, func): +- self.name =3D func.__name__ +- self.func =3D func +- +- def convert(self, value, param, ctx): +- try: +- return self.func(value) +- except ValueError: +- try: +- value =3D str(value) +- except UnicodeError: +- value =3D value.decode("utf-8", "replace") +- +- self.fail(value, param, ctx) +- +- +-class UnprocessedParamType(ParamType): +- name =3D "text" +- +- def convert(self, value, param, ctx): +- return value +- +- def __repr__(self): +- return "UNPROCESSED" +- +- +-class StringParamType(ParamType): +- name =3D "text" +- +- def convert(self, value, param, ctx): +- if isinstance(value, bytes): +- enc =3D _get_argv_encoding() +- try: +- value =3D value.decode(enc) +- except UnicodeError: +- fs_enc =3D get_filesystem_encoding() +- if fs_enc !=3D enc: +- try: +- value =3D value.decode(fs_enc) +- except UnicodeError: +- value =3D value.decode("utf-8", "replace") +- else: +- value =3D value.decode("utf-8", "replace") +- return value +- return value +- +- def __repr__(self): +- return "STRING" +- +- +-class Choice(ParamType): +- """The choice type allows a value to be checked against a fixed set +- of supported values. All of these values have to be strings. +- +- You should only pass a list or tuple of choices. Other iterables +- (like generators) may lead to surprising results. +- +- The resulting value will always be one of the originally passed choic= es +- regardless of ``case_sensitive`` or any ``ctx.token_normalize_func`` +- being specified. +- +- See :ref:`choice-opts` for an example. +- +- :param case_sensitive: Set to false to make choices case +- insensitive. Defaults to true. +- """ +- +- name =3D "choice" +- +- def __init__(self, choices, case_sensitive=3DTrue): +- self.choices =3D choices +- self.case_sensitive =3D case_sensitive +- +- def get_metavar(self, param): +- return f"[{'|'.join(self.choices)}]" +- +- def get_missing_message(self, param): +- choice_str =3D ",\n\t".join(self.choices) +- return f"Choose from:\n\t{choice_str}" +- +- def convert(self, value, param, ctx): +- # Match through normalization and case sensitivity +- # first do token_normalize_func, then lowercase +- # preserve original `value` to produce an accurate message in +- # `self.fail` +- normed_value =3D value +- normed_choices =3D {choice: choice for choice in self.choices} +- +- if ctx is not None and ctx.token_normalize_func is not None: +- normed_value =3D ctx.token_normalize_func(value) +- normed_choices =3D { +- ctx.token_normalize_func(normed_choice): original +- for normed_choice, original in normed_choices.items() +- } +- +- if not self.case_sensitive: +- normed_value =3D normed_value.casefold() +- normed_choices =3D { +- normed_choice.casefold(): original +- for normed_choice, original in normed_choices.items() +- } +- +- if normed_value in normed_choices: +- return normed_choices[normed_value] +- +- self.fail( +- f"invalid choice: {value}. (choose from {', '.join(self.choic= es)})", +- param, +- ctx, +- ) +- +- def __repr__(self): +- return f"Choice({list(self.choices)})" +- +- +-class DateTime(ParamType): +- """The DateTime type converts date strings into `datetime` objects. +- +- The format strings which are checked are configurable, but default to= some +- common (non-timezone aware) ISO 8601 formats. +- +- When specifying *DateTime* formats, you should only pass a list or a = tuple. +- Other iterables, like generators, may lead to surprising results. +- +- The format strings are processed using ``datetime.strptime``, and this +- consequently defines the format strings which are allowed. +- +- Parsing is tried using each format, in order, and the first format wh= ich +- parses successfully is used. +- +- :param formats: A list or tuple of date format strings, in the order = in +- which they should be tried. Defaults to +- ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``, +- ``'%Y-%m-%d %H:%M:%S'``. +- """ +- +- name =3D "datetime" +- +- def __init__(self, formats=3DNone): +- self.formats =3D formats or ["%Y-%m-%d", "%Y-%m-%dT%H:%M:%S", "%Y= -%m-%d %H:%M:%S"] +- +- def get_metavar(self, param): +- return f"[{'|'.join(self.formats)}]" +- +- def _try_to_convert_date(self, value, format): +- try: +- return datetime.strptime(value, format) +- except ValueError: +- return None +- +- def convert(self, value, param, ctx): +- # Exact match +- for format in self.formats: +- dtime =3D self._try_to_convert_date(value, format) +- if dtime: +- return dtime +- +- self.fail( +- f"invalid datetime format: {value}. (choose from {', '.join(s= elf.formats)})" +- ) +- +- def __repr__(self): +- return "DateTime" +- +- +-class IntParamType(ParamType): +- name =3D "integer" +- +- def convert(self, value, param, ctx): +- try: +- return int(value) +- except ValueError: +- self.fail(f"{value} is not a valid integer", param, ctx) +- +- def __repr__(self): +- return "INT" +- +- +-class IntRange(IntParamType): +- """A parameter that works similar to :data:`click.INT` but restricts +- the value to fit into a range. The default behavior is to fail if the +- value falls outside the range, but it can also be silently clamped +- between the two edges. +- +- See :ref:`ranges` for an example. +- """ +- +- name =3D "integer range" +- +- def __init__(self, min=3DNone, max=3DNone, clamp=3DFalse): +- self.min =3D min +- self.max =3D max +- self.clamp =3D clamp +- +- def convert(self, value, param, ctx): +- rv =3D IntParamType.convert(self, value, param, ctx) +- if self.clamp: +- if self.min is not None and rv < self.min: +- return self.min +- if self.max is not None and rv > self.max: +- return self.max +- if ( +- self.min is not None +- and rv < self.min +- or self.max is not None +- and rv > self.max +- ): +- if self.min is None: +- self.fail( +- f"{rv} is bigger than the maximum valid value {self.m= ax}.", +- param, +- ctx, +- ) +- elif self.max is None: +- self.fail( +- f"{rv} is smaller than the minimum valid value {self.= min}.", +- param, +- ctx, +- ) +- else: +- self.fail( +- f"{rv} is not in the valid range of {self.min} to {se= lf.max}.", +- param, +- ctx, +- ) +- return rv +- +- def __repr__(self): +- return f"IntRange({self.min}, {self.max})" +- +- +-class FloatParamType(ParamType): +- name =3D "float" +- +- def convert(self, value, param, ctx): +- try: +- return float(value) +- except ValueError: +- self.fail(f"{value} is not a valid floating point value", par= am, ctx) +- +- def __repr__(self): +- return "FLOAT" +- +- +-class FloatRange(FloatParamType): +- """A parameter that works similar to :data:`click.FLOAT` but restricts +- the value to fit into a range. The default behavior is to fail if the +- value falls outside the range, but it can also be silently clamped +- between the two edges. +- +- See :ref:`ranges` for an example. +- """ +- +- name =3D "float range" +- +- def __init__(self, min=3DNone, max=3DNone, clamp=3DFalse): +- self.min =3D min +- self.max =3D max +- self.clamp =3D clamp +- +- def convert(self, value, param, ctx): +- rv =3D FloatParamType.convert(self, value, param, ctx) +- if self.clamp: +- if self.min is not None and rv < self.min: +- return self.min +- if self.max is not None and rv > self.max: +- return self.max +- if ( +- self.min is not None +- and rv < self.min +- or self.max is not None +- and rv > self.max +- ): +- if self.min is None: +- self.fail( +- f"{rv} is bigger than the maximum valid value {self.m= ax}.", +- param, +- ctx, +- ) +- elif self.max is None: +- self.fail( +- f"{rv} is smaller than the minimum valid value {self.= min}.", +- param, +- ctx, +- ) +- else: +- self.fail( +- f"{rv} is not in the valid range of {self.min} to {se= lf.max}.", +- param, +- ctx, +- ) +- return rv +- +- def __repr__(self): +- return f"FloatRange({self.min}, {self.max})" +- +- +-class BoolParamType(ParamType): +- name =3D "boolean" +- +- def convert(self, value, param, ctx): +- if isinstance(value, bool): +- return bool(value) +- value =3D value.lower() +- if value in ("true", "t", "1", "yes", "y"): +- return True +- elif value in ("false", "f", "0", "no", "n"): +- return False +- self.fail(f"{value} is not a valid boolean", param, ctx) +- +- def __repr__(self): +- return "BOOL" +- +- +-class UUIDParameterType(ParamType): +- name =3D "uuid" +- +- def convert(self, value, param, ctx): +- import uuid +- +- try: +- return uuid.UUID(value) +- except ValueError: +- self.fail(f"{value} is not a valid UUID value", param, ctx) +- +- def __repr__(self): +- return "UUID" +- +- +-class File(ParamType): +- """Declares a parameter to be a file for reading or writing. The file +- is automatically closed once the context tears down (after the command +- finished working). +- +- Files can be opened for reading or writing. The special value ``-`` +- indicates stdin or stdout depending on the mode. +- +- By default, the file is opened for reading text data, but it can also= be +- opened in binary mode or for writing. The encoding parameter can be = used +- to force a specific encoding. +- +- The `lazy` flag controls if the file should be opened immediately or = upon +- first IO. The default is to be non-lazy for standard input and output +- streams as well as files opened for reading, `lazy` otherwise. When o= pening a +- file lazily for reading, it is still opened temporarily for validatio= n, but +- will not be held open until first IO. lazy is mainly useful when open= ing +- for writing to avoid creating the file until it is needed. +- +- Starting with Click 2.0, files can also be opened atomically in which +- case all writes go into a separate file in the same folder and upon +- completion the file will be moved over to the original location. This +- is useful if a file regularly read by other users is modified. +- +- See :ref:`file-args` for more information. +- """ +- +- name =3D "filename" +- envvar_list_splitter =3D os.path.pathsep +- +- def __init__( +- self, mode=3D"r", encoding=3DNone, errors=3D"strict", lazy=3DNone= , atomic=3DFalse +- ): +- self.mode =3D mode +- self.encoding =3D encoding +- self.errors =3D errors +- self.lazy =3D lazy +- self.atomic =3D atomic +- +- def resolve_lazy_flag(self, value): +- if self.lazy is not None: +- return self.lazy +- if value =3D=3D "-": +- return False +- elif "w" in self.mode: +- return True +- return False +- +- def convert(self, value, param, ctx): +- try: +- if hasattr(value, "read") or hasattr(value, "write"): +- return value +- +- lazy =3D self.resolve_lazy_flag(value) +- +- if lazy: +- f =3D LazyFile( +- value, self.mode, self.encoding, self.errors, atomic= =3Dself.atomic +- ) +- if ctx is not None: +- ctx.call_on_close(f.close_intelligently) +- return f +- +- f, should_close =3D open_stream( +- value, self.mode, self.encoding, self.errors, atomic=3Dse= lf.atomic +- ) +- # If a context is provided, we automatically close the file +- # at the end of the context execution (or flush out). If a +- # context does not exist, it's the caller's responsibility to +- # properly close the file. This for instance happens when the +- # type is used with prompts. +- if ctx is not None: +- if should_close: +- ctx.call_on_close(safecall(f.close)) +- else: +- ctx.call_on_close(safecall(f.flush)) +- return f +- except OSError as e: # noqa: B014 +- self.fail( +- f"Could not open file: {filename_to_ui(value)}: {get_stre= rror(e)}", +- param, +- ctx, +- ) +- +- +-class Path(ParamType): +- """The path type is similar to the :class:`File` type but it performs +- different checks. First of all, instead of returning an open file +- handle it returns just the filename. Secondly, it can perform various +- basic checks about what the file or directory should be. +- +- .. versionchanged:: 6.0 +- `allow_dash` was added. +- +- :param exists: if set to true, the file or directory needs to exist f= or +- this value to be valid. If this is not required and a +- file does indeed not exist, then all further checks are +- silently skipped. +- :param file_okay: controls if a file is a possible value. +- :param dir_okay: controls if a directory is a possible value. +- :param writable: if true, a writable check is performed. +- :param readable: if true, a readable check is performed. +- :param resolve_path: if this is true, then the path is fully resolved +- before the value is passed onwards. This means +- that it's absolute and symlinks are resolved. It +- will not expand a tilde-prefix, as this is +- supposed to be done by the shell only. +- :param allow_dash: If this is set to `True`, a single dash to indicate +- standard streams is permitted. +- :param path_type: optionally a string type that should be used to +- represent the path. The default is `None` which +- means the return value will be either bytes or +- unicode depending on what makes most sense given the +- input data Click deals with. +- """ +- +- envvar_list_splitter =3D os.path.pathsep +- +- def __init__( +- self, +- exists=3DFalse, +- file_okay=3DTrue, +- dir_okay=3DTrue, +- writable=3DFalse, +- readable=3DTrue, +- resolve_path=3DFalse, +- allow_dash=3DFalse, +- path_type=3DNone, +- ): +- self.exists =3D exists +- self.file_okay =3D file_okay +- self.dir_okay =3D dir_okay +- self.writable =3D writable +- self.readable =3D readable +- self.resolve_path =3D resolve_path +- self.allow_dash =3D allow_dash +- self.type =3D path_type +- +- if self.file_okay and not self.dir_okay: +- self.name =3D "file" +- self.path_type =3D "File" +- elif self.dir_okay and not self.file_okay: +- self.name =3D "directory" +- self.path_type =3D "Directory" +- else: +- self.name =3D "path" +- self.path_type =3D "Path" +- +- def coerce_path_result(self, rv): +- if self.type is not None and not isinstance(rv, self.type): +- if self.type is str: +- rv =3D rv.decode(get_filesystem_encoding()) +- else: +- rv =3D rv.encode(get_filesystem_encoding()) +- return rv +- +- def convert(self, value, param, ctx): +- rv =3D value +- +- is_dash =3D self.file_okay and self.allow_dash and rv in (b"-", "= -") +- +- if not is_dash: +- if self.resolve_path: +- rv =3D os.path.realpath(rv) +- +- try: +- st =3D os.stat(rv) +- except OSError: +- if not self.exists: +- return self.coerce_path_result(rv) +- self.fail( +- f"{self.path_type} {filename_to_ui(value)!r} does not= exist.", +- param, +- ctx, +- ) +- +- if not self.file_okay and stat.S_ISREG(st.st_mode): +- self.fail( +- f"{self.path_type} {filename_to_ui(value)!r} is a fil= e.", +- param, +- ctx, +- ) +- if not self.dir_okay and stat.S_ISDIR(st.st_mode): +- self.fail( +- f"{self.path_type} {filename_to_ui(value)!r} is a dir= ectory.", +- param, +- ctx, +- ) +- if self.writable and not os.access(value, os.W_OK): +- self.fail( +- f"{self.path_type} {filename_to_ui(value)!r} is not w= ritable.", +- param, +- ctx, +- ) +- if self.readable and not os.access(value, os.R_OK): +- self.fail( +- f"{self.path_type} {filename_to_ui(value)!r} is not r= eadable.", +- param, +- ctx, +- ) +- +- return self.coerce_path_result(rv) +- +- +-class Tuple(CompositeParamType): +- """The default behavior of Click is to apply a type on a value direct= ly. +- This works well in most cases, except for when `nargs` is set to a fi= xed +- count and different types should be used for different items. In this +- case the :class:`Tuple` type can be used. This type can only be used +- if `nargs` is set to a fixed number. +- +- For more information see :ref:`tuple-type`. +- +- This can be selected by using a Python tuple literal as a type. +- +- :param types: a list of types that should be used for the tuple items. +- """ +- +- def __init__(self, types): +- self.types =3D [convert_type(ty) for ty in types] +- +- @property +- def name(self): +- return f"<{' '.join(ty.name for ty in self.types)}>" +- +- @property +- def arity(self): +- return len(self.types) +- +- def convert(self, value, param, ctx): +- if len(value) !=3D len(self.types): +- raise TypeError( +- "It would appear that nargs is set to conflict with the" +- " composite type arity." +- ) +- return tuple(ty(x, param, ctx) for ty, x in zip(self.types, value= )) +- +- +-def convert_type(ty, default=3DNone): +- """Converts a callable or python type into the most appropriate +- param type. +- """ +- guessed_type =3D False +- if ty is None and default is not None: +- if isinstance(default, tuple): +- ty =3D tuple(map(type, default)) +- else: +- ty =3D type(default) +- guessed_type =3D True +- +- if isinstance(ty, tuple): +- return Tuple(ty) +- if isinstance(ty, ParamType): +- return ty +- if ty is str or ty is None: +- return STRING +- if ty is int: +- return INT +- # Booleans are only okay if not guessed. This is done because for +- # flags the default value is actually a bit of a lie in that it +- # indicates which of the flags is the one we want. See get_default() +- # for more information. +- if ty is bool and not guessed_type: +- return BOOL +- if ty is float: +- return FLOAT +- if guessed_type: +- return STRING +- +- # Catch a common mistake +- if __debug__: +- try: +- if issubclass(ty, ParamType): +- raise AssertionError( +- f"Attempted to use an uninstantiated parameter type (= {ty})." +- ) +- except TypeError: +- pass +- return FuncParamType(ty) +- +- +-#: A dummy parameter type that just does nothing. From a user's +-#: perspective this appears to just be the same as `STRING` but +-#: internally no string conversion takes place if the input was bytes. +-#: This is usually useful when working with file paths as they can +-#: appear in bytes and unicode. +-#: +-#: For path related uses the :class:`Path` type is a better choice but +-#: there are situations where an unprocessed type is useful which is why +-#: it is is provided. +-#: +-#: .. versionadded:: 4.0 +-UNPROCESSED =3D UnprocessedParamType() +- +-#: A unicode string parameter type which is the implicit default. This +-#: can also be selected by using ``str`` as type. +-STRING =3D StringParamType() +- +-#: An integer parameter. This can also be selected by using ``int`` as +-#: type. +-INT =3D IntParamType() +- +-#: A floating point value parameter. This can also be selected by using +-#: ``float`` as type. +-FLOAT =3D FloatParamType() +- +-#: A boolean parameter. This is the default for boolean flags. This can +-#: also be selected by using ``bool`` as a type. +-BOOL =3D BoolParamType() +- +-#: A UUID parameter. +-UUID =3D UUIDParameterType() +diff --git a/dynaconf/vendor_src/click/utils.py b/dynaconf/vendor_src/clic= k/utils.py +deleted file mode 100644 +index bd9dd8e..0000000 +--- a/dynaconf/vendor_src/click/utils.py ++++ /dev/null +@@ -1,440 +0,0 @@ +-import os +-import sys +- +-from ._compat import _default_text_stderr +-from ._compat import _default_text_stdout +-from ._compat import _find_binary_writer +-from ._compat import auto_wrap_for_ansi +-from ._compat import binary_streams +-from ._compat import filename_to_ui +-from ._compat import get_filesystem_encoding +-from ._compat import get_strerror +-from ._compat import is_bytes +-from ._compat import open_stream +-from ._compat import should_strip_ansi +-from ._compat import strip_ansi +-from ._compat import text_streams +-from ._compat import WIN +-from .globals import resolve_color_default +- +- +-echo_native_types =3D (str, bytes, bytearray) +- +- +-def _posixify(name): +- return "-".join(name.split()).lower() +- +- +-def safecall(func): +- """Wraps a function so that it swallows exceptions.""" +- +- def wrapper(*args, **kwargs): +- try: +- return func(*args, **kwargs) +- except Exception: +- pass +- +- return wrapper +- +- +-def make_str(value): +- """Converts a value into a valid string.""" +- if isinstance(value, bytes): +- try: +- return value.decode(get_filesystem_encoding()) +- except UnicodeError: +- return value.decode("utf-8", "replace") +- return str(value) +- +- +-def make_default_short_help(help, max_length=3D45): +- """Return a condensed version of help string.""" +- words =3D help.split() +- total_length =3D 0 +- result =3D [] +- done =3D False +- +- for word in words: +- if word[-1:] =3D=3D ".": +- done =3D True +- new_length =3D 1 + len(word) if result else len(word) +- if total_length + new_length > max_length: +- result.append("...") +- done =3D True +- else: +- if result: +- result.append(" ") +- result.append(word) +- if done: +- break +- total_length +=3D new_length +- +- return "".join(result) +- +- +-class LazyFile: +- """A lazy file works like a regular file but it does not fully open +- the file but it does perform some basic checks early to see if the +- filename parameter does make sense. This is useful for safely opening +- files for writing. +- """ +- +- def __init__( +- self, filename, mode=3D"r", encoding=3DNone, errors=3D"strict", a= tomic=3DFalse +- ): +- self.name =3D filename +- self.mode =3D mode +- self.encoding =3D encoding +- self.errors =3D errors +- self.atomic =3D atomic +- +- if filename =3D=3D "-": +- self._f, self.should_close =3D open_stream(filename, mode, en= coding, errors) +- else: +- if "r" in mode: +- # Open and close the file in case we're opening it for +- # reading so that we can catch at least some errors in +- # some cases early. +- open(filename, mode).close() +- self._f =3D None +- self.should_close =3D True +- +- def __getattr__(self, name): +- return getattr(self.open(), name) +- +- def __repr__(self): +- if self._f is not None: +- return repr(self._f) +- return f"" +- +- def open(self): +- """Opens the file if it's not yet open. This call might fail with +- a :exc:`FileError`. Not handling this error will produce an error +- that Click shows. +- """ +- if self._f is not None: +- return self._f +- try: +- rv, self.should_close =3D open_stream( +- self.name, self.mode, self.encoding, self.errors, atomic= =3Dself.atomic +- ) +- except OSError as e: # noqa: E402 +- from .exceptions import FileError +- +- raise FileError(self.name, hint=3Dget_strerror(e)) +- self._f =3D rv +- return rv +- +- def close(self): +- """Closes the underlying file, no matter what.""" +- if self._f is not None: +- self._f.close() +- +- def close_intelligently(self): +- """This function only closes the file if it was opened by the lazy +- file wrapper. For instance this will never close stdin. +- """ +- if self.should_close: +- self.close() +- +- def __enter__(self): +- return self +- +- def __exit__(self, exc_type, exc_value, tb): +- self.close_intelligently() +- +- def __iter__(self): +- self.open() +- return iter(self._f) +- +- +-class KeepOpenFile: +- def __init__(self, file): +- self._file =3D file +- +- def __getattr__(self, name): +- return getattr(self._file, name) +- +- def __enter__(self): +- return self +- +- def __exit__(self, exc_type, exc_value, tb): +- pass +- +- def __repr__(self): +- return repr(self._file) +- +- def __iter__(self): +- return iter(self._file) +- +- +-def echo(message=3DNone, file=3DNone, nl=3DTrue, err=3DFalse, color=3DNon= e): +- """Prints a message plus a newline to the given file or stdout. On +- first sight, this looks like the print function, but it has improved +- support for handling Unicode and binary data that does not fail no +- matter how badly configured the system is. +- +- Primarily it means that you can print binary data as well as Unicode +- data on both 2.x and 3.x to the given file in the most appropriate way +- possible. This is a very carefree function in that it will try its +- best to not fail. As of Click 6.0 this includes support for unicode +- output on the Windows console. +- +- In addition to that, if `colorama`_ is installed, the echo function w= ill +- also support clever handling of ANSI codes. Essentially it will then +- do the following: +- +- - add transparent handling of ANSI color codes on Windows. +- - hide ANSI codes automatically if the destination file is not a +- terminal. +- +- .. _colorama: https://pypi.org/project/colorama/ +- +- .. versionchanged:: 6.0 +- As of Click 6.0 the echo function will properly support unicode +- output on the windows console. Not that click does not modify +- the interpreter in any way which means that `sys.stdout` or the +- print statement or function will still not provide unicode support. +- +- .. versionchanged:: 2.0 +- Starting with version 2.0 of Click, the echo function will work +- with colorama if it's installed. +- +- .. versionadded:: 3.0 +- The `err` parameter was added. +- +- .. versionchanged:: 4.0 +- Added the `color` flag. +- +- :param message: the message to print +- :param file: the file to write to (defaults to ``stdout``) +- :param err: if set to true the file defaults to ``stderr`` instead of +- ``stdout``. This is faster and easier than calling +- :func:`get_text_stderr` yourself. +- :param nl: if set to `True` (the default) a newline is printed afterw= ards. +- :param color: controls if the terminal supports ANSI colors or not. = The +- default is autodetection. +- """ +- if file is None: +- if err: +- file =3D _default_text_stderr() +- else: +- file =3D _default_text_stdout() +- +- # Convert non bytes/text into the native string type. +- if message is not None and not isinstance(message, echo_native_types): +- message =3D str(message) +- +- if nl: +- message =3D message or "" +- if isinstance(message, str): +- message +=3D "\n" +- else: +- message +=3D b"\n" +- +- # If there is a message and the value looks like bytes, we manually +- # need to find the binary stream and write the message in there. +- # This is done separately so that most stream types will work as you +- # would expect. Eg: you can write to StringIO for other cases. +- if message and is_bytes(message): +- binary_file =3D _find_binary_writer(file) +- if binary_file is not None: +- file.flush() +- binary_file.write(message) +- binary_file.flush() +- return +- +- # ANSI-style support. If there is no message or we are dealing with +- # bytes nothing is happening. If we are connected to a file we want +- # to strip colors. If we are on windows we either wrap the stream +- # to strip the color or we use the colorama support to translate the +- # ansi codes to API calls. +- if message and not is_bytes(message): +- color =3D resolve_color_default(color) +- if should_strip_ansi(file, color): +- message =3D strip_ansi(message) +- elif WIN: +- if auto_wrap_for_ansi is not None: +- file =3D auto_wrap_for_ansi(file) +- elif not color: +- message =3D strip_ansi(message) +- +- if message: +- file.write(message) +- file.flush() +- +- +-def get_binary_stream(name): +- """Returns a system stream for byte processing. +- +- :param name: the name of the stream to open. Valid names are ``'stdi= n'``, +- ``'stdout'`` and ``'stderr'`` +- """ +- opener =3D binary_streams.get(name) +- if opener is None: +- raise TypeError(f"Unknown standard stream '{name}'") +- return opener() +- +- +-def get_text_stream(name, encoding=3DNone, errors=3D"strict"): +- """Returns a system stream for text processing. This usually returns +- a wrapped stream around a binary stream returned from +- :func:`get_binary_stream` but it also can take shortcuts for already +- correctly configured streams. +- +- :param name: the name of the stream to open. Valid names are ``'stdi= n'``, +- ``'stdout'`` and ``'stderr'`` +- :param encoding: overrides the detected default encoding. +- :param errors: overrides the default error mode. +- """ +- opener =3D text_streams.get(name) +- if opener is None: +- raise TypeError(f"Unknown standard stream '{name}'") +- return opener(encoding, errors) +- +- +-def open_file( +- filename, mode=3D"r", encoding=3DNone, errors=3D"strict", lazy=3DFals= e, atomic=3DFalse +-): +- """This is similar to how the :class:`File` works but for manual +- usage. Files are opened non lazy by default. This can open regular +- files as well as stdin/stdout if ``'-'`` is passed. +- +- If stdin/stdout is returned the stream is wrapped so that the context +- manager will not close the stream accidentally. This makes it possib= le +- to always use the function like this without having to worry to +- accidentally close a standard stream:: +- +- with open_file(filename) as f: +- ... +- +- .. versionadded:: 3.0 +- +- :param filename: the name of the file to open (or ``'-'`` for stdin/s= tdout). +- :param mode: the mode in which to open the file. +- :param encoding: the encoding to use. +- :param errors: the error handling for this file. +- :param lazy: can be flipped to true to open the file lazily. +- :param atomic: in atomic mode writes go into a temporary file and it's +- moved on close. +- """ +- if lazy: +- return LazyFile(filename, mode, encoding, errors, atomic=3Datomic) +- f, should_close =3D open_stream(filename, mode, encoding, errors, ato= mic=3Datomic) +- if not should_close: +- f =3D KeepOpenFile(f) +- return f +- +- +-def get_os_args(): +- """Returns the argument part of ``sys.argv``, removing the first +- value which is the name of the script. +- +- .. deprecated:: 8.0 +- Will be removed in 8.1. Access ``sys.argv[1:]`` directly +- instead. +- """ +- import warnings +- +- warnings.warn( +- "'get_os_args' is deprecated and will be removed in 8.1. Access" +- " 'sys.argv[1:]' directly instead.", +- DeprecationWarning, +- stacklevel=3D2, +- ) +- return sys.argv[1:] +- +- +-def format_filename(filename, shorten=3DFalse): +- """Formats a filename for user display. The main purpose of this +- function is to ensure that the filename can be displayed at all. This +- will decode the filename to unicode if necessary in a way that it will +- not fail. Optionally, it can shorten the filename to not include the +- full path to the filename. +- +- :param filename: formats a filename for UI display. This will also c= onvert +- the filename into unicode without failing. +- :param shorten: this optionally shortens the filename to strip of the +- path that leads up to it. +- """ +- if shorten: +- filename =3D os.path.basename(filename) +- return filename_to_ui(filename) +- +- +-def get_app_dir(app_name, roaming=3DTrue, force_posix=3DFalse): +- r"""Returns the config folder for the application. The default behav= ior +- is to return whatever is most appropriate for the operating system. +- +- To give you an idea, for an app called ``"Foo Bar"``, something like +- the following folders could be returned: +- +- Mac OS X: +- ``~/Library/Application Support/Foo Bar`` +- Mac OS X (POSIX): +- ``~/.foo-bar`` +- Unix: +- ``~/.config/foo-bar`` +- Unix (POSIX): +- ``~/.foo-bar`` +- Win XP (roaming): +- ``C:\Documents and Settings\\Local Settings\Application Data\= Foo Bar`` +- Win XP (not roaming): +- ``C:\Documents and Settings\\Application Data\Foo Bar`` +- Win 7 (roaming): +- ``C:\Users\\AppData\Roaming\Foo Bar`` +- Win 7 (not roaming): +- ``C:\Users\\AppData\Local\Foo Bar`` +- +- .. versionadded:: 2.0 +- +- :param app_name: the application name. This should be properly capit= alized +- and can contain whitespace. +- :param roaming: controls if the folder should be roaming or not on Wi= ndows. +- Has no affect otherwise. +- :param force_posix: if this is set to `True` then on any POSIX system= the +- folder will be stored in the home folder with a l= eading +- dot instead of the XDG config home or darwin's +- application support folder. +- """ +- if WIN: +- key =3D "APPDATA" if roaming else "LOCALAPPDATA" +- folder =3D os.environ.get(key) +- if folder is None: +- folder =3D os.path.expanduser("~") +- return os.path.join(folder, app_name) +- if force_posix: +- return os.path.join(os.path.expanduser(f"~/.{_posixify(app_name)}= ")) +- if sys.platform =3D=3D "darwin": +- return os.path.join( +- os.path.expanduser("~/Library/Application Support"), app_name +- ) +- return os.path.join( +- os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")= ), +- _posixify(app_name), +- ) +- +- +-class PacifyFlushWrapper: +- """This wrapper is used to catch and suppress BrokenPipeErrors result= ing +- from ``.flush()`` being called on broken pipe during the shutdown/fin= al-GC +- of the Python interpreter. Notably ``.flush()`` is always called on +- ``sys.stdout`` and ``sys.stderr``. So as to have minimal impact on any +- other cleanup code, and the case where the underlying file is not a b= roken +- pipe, all calls and attributes are proxied. +- """ +- +- def __init__(self, wrapped): +- self.wrapped =3D wrapped +- +- def flush(self): +- try: +- self.wrapped.flush() +- except OSError as e: +- import errno +- +- if e.errno !=3D errno.EPIPE: +- raise +- +- def __getattr__(self, attr): +- return getattr(self.wrapped, attr) +diff --git a/dynaconf/vendor_src/dotenv/README.md b/dynaconf/vendor_src/do= tenv/README.md +deleted file mode 100644 +index 94a816f..0000000 +--- a/dynaconf/vendor_src/dotenv/README.md ++++ /dev/null +@@ -1,6 +0,0 @@ +-## python-bodotenv +- +-Vendored dep taken from: https://github.com/theskumar/python-dotenv +-Licensed under BSD: https://github.com/theskumar/python-dotenv/blob/maste= r/LICENSE +- +-Current version: 0.13.0 +diff --git a/dynaconf/vendor_src/dotenv/__init__.py b/dynaconf/vendor_src/= dotenv/__init__.py +deleted file mode 100644 +index b88d9bc..0000000 +--- a/dynaconf/vendor_src/dotenv/__init__.py ++++ /dev/null +@@ -1,46 +0,0 @@ +-from .compat import IS_TYPE_CHECKING +-from .main import load_dotenv, get_key, set_key, unset_key, find_dotenv, = dotenv_values +- +-if IS_TYPE_CHECKING: +- from typing import Any, Optional +- +- +-def load_ipython_extension(ipython): +- # type: (Any) -> None +- from .ipython import load_ipython_extension +- load_ipython_extension(ipython) +- +- +-def get_cli_string(path=3DNone, action=3DNone, key=3DNone, value=3DNone, = quote=3DNone): +- # type: (Optional[str], Optional[str], Optional[str], Optional[str], = Optional[str]) -> str +- """Returns a string suitable for running as a shell script. +- +- Useful for converting a arguments passed to a fabric task +- to be passed to a `local` or `run` command. +- """ +- command =3D ['dotenv'] +- if quote: +- command.append('-q %s' % quote) +- if path: +- command.append('-f %s' % path) +- if action: +- command.append(action) +- if key: +- command.append(key) +- if value: +- if ' ' in value: +- command.append('"%s"' % value) +- else: +- command.append(value) +- +- return ' '.join(command).strip() +- +- +-__all__ =3D ['get_cli_string', +- 'load_dotenv', +- 'dotenv_values', +- 'get_key', +- 'set_key', +- 'unset_key', +- 'find_dotenv', +- 'load_ipython_extension'] +diff --git a/dynaconf/vendor_src/dotenv/cli.py b/dynaconf/vendor_src/doten= v/cli.py +deleted file mode 100644 +index 269b093..0000000 +--- a/dynaconf/vendor_src/dotenv/cli.py ++++ /dev/null +@@ -1,145 +0,0 @@ +-import os +-import sys +-from subprocess import Popen +- +-try: +- from dynaconf.vendor import click +-except ImportError: +- sys.stderr.write('It seems python-dotenv is not installed with cli op= tion. \n' +- 'Run pip install "python-dotenv[cli]" to fix this.') +- sys.exit(1) +- +-from .compat import IS_TYPE_CHECKING, to_env +-from .main import dotenv_values, get_key, set_key, unset_key +-from .version import __version__ +- +-if IS_TYPE_CHECKING: +- from typing import Any, List, Dict +- +- +-@click.group() +-@click.option('-f', '--file', default=3Dos.path.join(os.getcwd(), '.env'), +- type=3Dclick.Path(exists=3DTrue), +- help=3D"Location of the .env file, defaults to .env file in= current working directory.") +-@click.option('-q', '--quote', default=3D'always', +- type=3Dclick.Choice(['always', 'never', 'auto']), +- help=3D"Whether to quote or not the variable values. Defaul= t mode is always. This does not affect parsing.") +-@click.version_option(version=3D__version__) +-@click.pass_context +-def cli(ctx, file, quote): +- # type: (click.Context, Any, Any) -> None +- '''This script is used to set, get or unset values from a .env file.'= '' +- ctx.obj =3D {} +- ctx.obj['FILE'] =3D file +- ctx.obj['QUOTE'] =3D quote +- +- +-@cli.command() +-@click.pass_context +-def list(ctx): +- # type: (click.Context) -> None +- '''Display all the stored key/value.''' +- file =3D ctx.obj['FILE'] +- dotenv_as_dict =3D dotenv_values(file) +- for k, v in dotenv_as_dict.items(): +- click.echo('%s=3D%s' % (k, v)) +- +- +-@cli.command() +-@click.pass_context +-@click.argument('key', required=3DTrue) +-@click.argument('value', required=3DTrue) +-def set(ctx, key, value): +- # type: (click.Context, Any, Any) -> None +- '''Store the given key/value.''' +- file =3D ctx.obj['FILE'] +- quote =3D ctx.obj['QUOTE'] +- success, key, value =3D set_key(file, key, value, quote) +- if success: +- click.echo('%s=3D%s' % (key, value)) +- else: +- exit(1) +- +- +-@cli.command() +-@click.pass_context +-@click.argument('key', required=3DTrue) +-def get(ctx, key): +- # type: (click.Context, Any) -> None +- '''Retrieve the value for the given key.''' +- file =3D ctx.obj['FILE'] +- stored_value =3D get_key(file, key) +- if stored_value: +- click.echo('%s=3D%s' % (key, stored_value)) +- else: +- exit(1) +- +- +-@cli.command() +-@click.pass_context +-@click.argument('key', required=3DTrue) +-def unset(ctx, key): +- # type: (click.Context, Any) -> None +- '''Removes the given key.''' +- file =3D ctx.obj['FILE'] +- quote =3D ctx.obj['QUOTE'] +- success, key =3D unset_key(file, key, quote) +- if success: +- click.echo("Successfully removed %s" % key) +- else: +- exit(1) +- +- +-@cli.command(context_settings=3D{'ignore_unknown_options': True}) +-@click.pass_context +-@click.argument('commandline', nargs=3D-1, type=3Dclick.UNPROCESSED) +-def run(ctx, commandline): +- # type: (click.Context, List[str]) -> None +- """Run command with environment variables present.""" +- file =3D ctx.obj['FILE'] +- dotenv_as_dict =3D {to_env(k): to_env(v) for (k, v) in dotenv_values(= file).items() if v is not None} +- +- if not commandline: +- click.echo('No command given.') +- exit(1) +- ret =3D run_command(commandline, dotenv_as_dict) +- exit(ret) +- +- +-def run_command(command, env): +- # type: (List[str], Dict[str, str]) -> int +- """Run command in sub process. +- +- Runs the command in a sub process with the variables from `env` +- added in the current environment variables. +- +- Parameters +- ---------- +- command: List[str] +- The command and it's parameters +- env: Dict +- The additional environment variables +- +- Returns +- ------- +- int +- The return code of the command +- +- """ +- # copy the current environment variables and add the vales from +- # `env` +- cmd_env =3D os.environ.copy() +- cmd_env.update(env) +- +- p =3D Popen(command, +- universal_newlines=3DTrue, +- bufsize=3D0, +- shell=3DFalse, +- env=3Dcmd_env) +- _, _ =3D p.communicate() +- +- return p.returncode +- +- +-if __name__ =3D=3D "__main__": +- cli() +diff --git a/dynaconf/vendor_src/dotenv/compat.py b/dynaconf/vendor_src/do= tenv/compat.py +deleted file mode 100644 +index f8089bf..0000000 +--- a/dynaconf/vendor_src/dotenv/compat.py ++++ /dev/null +@@ -1,49 +0,0 @@ +-import sys +- +-PY2 =3D sys.version_info[0] =3D=3D 2 # type: bool +- +-if PY2: +- from StringIO import StringIO # noqa +-else: +- from io import StringIO # noqa +- +- +-def is_type_checking(): +- # type: () -> bool +- try: +- from typing import TYPE_CHECKING +- except ImportError: +- return False +- return TYPE_CHECKING +- +- +-IS_TYPE_CHECKING =3D is_type_checking() +- +- +-if IS_TYPE_CHECKING: +- from typing import Text +- +- +-def to_env(text): +- # type: (Text) -> str +- """ +- Encode a string the same way whether it comes from the environment or= a `.env` file. +- """ +- if PY2: +- return text.encode(sys.getfilesystemencoding() or "utf-8") +- else: +- return text +- +- +-def to_text(string): +- # type: (str) -> Text +- """ +- Make a string Unicode if it isn't already. +- +- This is useful for defining raw unicode strings because `ur"foo"` isn= 't valid in +- Python 3. +- """ +- if PY2: +- return string.decode("utf-8") +- else: +- return string +diff --git a/dynaconf/vendor_src/dotenv/ipython.py b/dynaconf/vendor_src/d= otenv/ipython.py +deleted file mode 100644 +index 7f1b13d..0000000 +--- a/dynaconf/vendor_src/dotenv/ipython.py ++++ /dev/null +@@ -1,41 +0,0 @@ +-from __future__ import print_function +- +-from IPython.core.magic import Magics, line_magic, magics_class # type: = ignore +-from IPython.core.magic_arguments import (argument, magic_arguments, # t= ype: ignore +- parse_argstring) # type: ignore +- +-from .main import find_dotenv, load_dotenv +- +- +-@magics_class +-class IPythonDotEnv(Magics): +- +- @magic_arguments() +- @argument( +- '-o', '--override', action=3D'store_true', +- help=3D"Indicate to override existing variables" +- ) +- @argument( +- '-v', '--verbose', action=3D'store_true', +- help=3D"Indicate function calls to be verbose" +- ) +- @argument('dotenv_path', nargs=3D'?', type=3Dstr, default=3D'.env', +- help=3D'Search in increasingly higher folders for the `dote= nv_path`') +- @line_magic +- def dotenv(self, line): +- args =3D parse_argstring(self.dotenv, line) +- # Locate the .env file +- dotenv_path =3D args.dotenv_path +- try: +- dotenv_path =3D find_dotenv(dotenv_path, True, True) +- except IOError: +- print("cannot find .env file") +- return +- +- # Load the .env file +- load_dotenv(dotenv_path, verbose=3Dargs.verbose, override=3Dargs.= override) +- +- +-def load_ipython_extension(ipython): +- """Register the %dotenv magic.""" +- ipython.register_magics(IPythonDotEnv) +diff --git a/dynaconf/vendor_src/dotenv/main.py b/dynaconf/vendor_src/dote= nv/main.py +deleted file mode 100644 +index c821ef7..0000000 +--- a/dynaconf/vendor_src/dotenv/main.py ++++ /dev/null +@@ -1,323 +0,0 @@ +-# -*- coding: utf-8 -*- +-from __future__ import absolute_import, print_function, unicode_literals +- +-import io +-import logging +-import os +-import re +-import shutil +-import sys +-import tempfile +-from collections import OrderedDict +-from contextlib import contextmanager +- +-from .compat import IS_TYPE_CHECKING, PY2, StringIO, to_env +-from .parser import Binding, parse_stream +- +-logger =3D logging.getLogger(__name__) +- +-if IS_TYPE_CHECKING: +- from typing import ( +- Dict, Iterator, Match, Optional, Pattern, Union, Text, IO, Tuple +- ) +- if sys.version_info >=3D (3, 6): +- _PathLike =3D os.PathLike +- else: +- _PathLike =3D Text +- +- if sys.version_info >=3D (3, 0): +- _StringIO =3D StringIO +- else: +- _StringIO =3D StringIO[Text] +- +-__posix_variable =3D re.compile( +- r""" +- \$\{ +- (?P[^\}:]*) +- (?::- +- (?P[^\}]*) +- )? +- \} +- """, +- re.VERBOSE, +-) # type: Pattern[Text] +- +- +-def with_warn_for_invalid_lines(mappings): +- # type: (Iterator[Binding]) -> Iterator[Binding] +- for mapping in mappings: +- if mapping.error: +- logger.warning( +- "Python-dotenv could not parse statement starting at line= %s", +- mapping.original.line, +- ) +- yield mapping +- +- +-class DotEnv(): +- +- def __init__(self, dotenv_path, verbose=3DFalse, encoding=3DNone, int= erpolate=3DTrue): +- # type: (Union[Text, _PathLike, _StringIO], bool, Union[None, Tex= t], bool) -> None +- self.dotenv_path =3D dotenv_path # type: Union[Text,_PathLike, _= StringIO] +- self._dict =3D None # type: Optional[Dict[Text, Optional[Text]]] +- self.verbose =3D verbose # type: bool +- self.encoding =3D encoding # type: Union[None, Text] +- self.interpolate =3D interpolate # type: bool +- +- @contextmanager +- def _get_stream(self): +- # type: () -> Iterator[IO[Text]] +- if isinstance(self.dotenv_path, StringIO): +- yield self.dotenv_path +- elif os.path.isfile(self.dotenv_path): +- with io.open(self.dotenv_path, encoding=3Dself.encoding) as s= tream: +- yield stream +- else: +- if self.verbose: +- logger.info("Python-dotenv could not find configuration f= ile %s.", self.dotenv_path or '.env') +- yield StringIO('') +- +- def dict(self): +- # type: () -> Dict[Text, Optional[Text]] +- """Return dotenv as dict""" +- if self._dict: +- return self._dict +- +- values =3D OrderedDict(self.parse()) +- self._dict =3D resolve_nested_variables(values) if self.interpola= te else values +- return self._dict +- +- def parse(self): +- # type: () -> Iterator[Tuple[Text, Optional[Text]]] +- with self._get_stream() as stream: +- for mapping in with_warn_for_invalid_lines(parse_stream(strea= m)): +- if mapping.key is not None: +- yield mapping.key, mapping.value +- +- def set_as_environment_variables(self, override=3DFalse): +- # type: (bool) -> bool +- """ +- Load the current dotenv as system environemt variable. +- """ +- for k, v in self.dict().items(): +- if k in os.environ and not override: +- continue +- if v is not None: +- os.environ[to_env(k)] =3D to_env(v) +- +- return True +- +- def get(self, key): +- # type: (Text) -> Optional[Text] +- """ +- """ +- data =3D self.dict() +- +- if key in data: +- return data[key] +- +- if self.verbose: +- logger.warning("Key %s not found in %s.", key, self.dotenv_pa= th) +- +- return None +- +- +-def get_key(dotenv_path, key_to_get): +- # type: (Union[Text, _PathLike], Text) -> Optional[Text] +- """ +- Gets the value of a given key from the given .env +- +- If the .env path given doesn't exist, fails +- """ +- return DotEnv(dotenv_path, verbose=3DTrue).get(key_to_get) +- +- +-@contextmanager +-def rewrite(path): +- # type: (_PathLike) -> Iterator[Tuple[IO[Text], IO[Text]]] +- try: +- with tempfile.NamedTemporaryFile(mode=3D"w+", delete=3DFalse) as = dest: +- with io.open(path) as source: +- yield (source, dest) # type: ignore +- except BaseException: +- if os.path.isfile(dest.name): +- os.unlink(dest.name) +- raise +- else: +- shutil.move(dest.name, path) +- +- +-def set_key(dotenv_path, key_to_set, value_to_set, quote_mode=3D"always"): +- # type: (_PathLike, Text, Text, Text) -> Tuple[Optional[bool], Text, = Text] +- """ +- Adds or Updates a key/value to the given .env +- +- If the .env path given doesn't exist, fails instead of risking creati= ng +- an orphan .env somewhere in the filesystem +- """ +- value_to_set =3D value_to_set.strip("'").strip('"') +- if not os.path.exists(dotenv_path): +- logger.warning("Can't write to %s - it doesn't exist.", dotenv_pa= th) +- return None, key_to_set, value_to_set +- +- if " " in value_to_set: +- quote_mode =3D "always" +- +- if quote_mode =3D=3D "always": +- value_out =3D '"{}"'.format(value_to_set.replace('"', '\\"')) +- else: +- value_out =3D value_to_set +- line_out =3D "{}=3D{}\n".format(key_to_set, value_out) +- +- with rewrite(dotenv_path) as (source, dest): +- replaced =3D False +- for mapping in with_warn_for_invalid_lines(parse_stream(source)): +- if mapping.key =3D=3D key_to_set: +- dest.write(line_out) +- replaced =3D True +- else: +- dest.write(mapping.original.string) +- if not replaced: +- dest.write(line_out) +- +- return True, key_to_set, value_to_set +- +- +-def unset_key(dotenv_path, key_to_unset, quote_mode=3D"always"): +- # type: (_PathLike, Text, Text) -> Tuple[Optional[bool], Text] +- """ +- Removes a given key from the given .env +- +- If the .env path given doesn't exist, fails +- If the given key doesn't exist in the .env, fails +- """ +- if not os.path.exists(dotenv_path): +- logger.warning("Can't delete from %s - it doesn't exist.", dotenv= _path) +- return None, key_to_unset +- +- removed =3D False +- with rewrite(dotenv_path) as (source, dest): +- for mapping in with_warn_for_invalid_lines(parse_stream(source)): +- if mapping.key =3D=3D key_to_unset: +- removed =3D True +- else: +- dest.write(mapping.original.string) +- +- if not removed: +- logger.warning("Key %s not removed from %s - key doesn't exist.",= key_to_unset, dotenv_path) +- return None, key_to_unset +- +- return removed, key_to_unset +- +- +-def resolve_nested_variables(values): +- # type: (Dict[Text, Optional[Text]]) -> Dict[Text, Optional[Text]] +- def _replacement(name, default): +- # type: (Text, Optional[Text]) -> Text +- """ +- get appropriate value for a variable name. +- first search in environ, if not found, +- then look into the dotenv variables +- """ +- default =3D default if default is not None else "" +- ret =3D os.getenv(name, new_values.get(name, default)) +- return ret # type: ignore +- +- def _re_sub_callback(match): +- # type: (Match[Text]) -> Text +- """ +- From a match object gets the variable name and returns +- the correct replacement +- """ +- matches =3D match.groupdict() +- return _replacement(name=3Dmatches["name"], default=3Dmatches["de= fault"]) # type: ignore +- +- new_values =3D {} +- +- for k, v in values.items(): +- new_values[k] =3D __posix_variable.sub(_re_sub_callback, v) if v = is not None else None +- +- return new_values +- +- +-def _walk_to_root(path): +- # type: (Text) -> Iterator[Text] +- """ +- Yield directories starting from the given directory up to the root +- """ +- if not os.path.exists(path): +- raise IOError('Starting path not found') +- +- if os.path.isfile(path): +- path =3D os.path.dirname(path) +- +- last_dir =3D None +- current_dir =3D os.path.abspath(path) +- while last_dir !=3D current_dir: +- yield current_dir +- parent_dir =3D os.path.abspath(os.path.join(current_dir, os.path.= pardir)) +- last_dir, current_dir =3D current_dir, parent_dir +- +- +-def find_dotenv(filename=3D'.env', raise_error_if_not_found=3DFalse, usec= wd=3DFalse): +- # type: (Text, bool, bool) -> Text +- """ +- Search in increasingly higher folders for the given file +- +- Returns path to the file if found, or an empty string otherwise +- """ +- +- def _is_interactive(): +- """ Decide whether this is running in a REPL or IPython notebook = """ +- main =3D __import__('__main__', None, None, fromlist=3D['__file__= ']) +- return not hasattr(main, '__file__') +- +- if usecwd or _is_interactive() or getattr(sys, 'frozen', False): +- # Should work without __file__, e.g. in REPL or IPython notebook. +- path =3D os.getcwd() +- else: +- # will work for .py files +- frame =3D sys._getframe() +- # find first frame that is outside of this file +- if PY2 and not __file__.endswith('.py'): +- # in Python2 __file__ extension could be .pyc or .pyo (this d= oesn't account +- # for edge case of Python compiled for non-standard extension) +- current_file =3D __file__.rsplit('.', 1)[0] + '.py' +- else: +- current_file =3D __file__ +- +- while frame.f_code.co_filename =3D=3D current_file: +- assert frame.f_back is not None +- frame =3D frame.f_back +- frame_filename =3D frame.f_code.co_filename +- path =3D os.path.dirname(os.path.abspath(frame_filename)) +- +- for dirname in _walk_to_root(path): +- check_path =3D os.path.join(dirname, filename) +- if os.path.isfile(check_path): +- return check_path +- +- if raise_error_if_not_found: +- raise IOError('File not found') +- +- return '' +- +- +-def load_dotenv(dotenv_path=3DNone, stream=3DNone, verbose=3DFalse, overr= ide=3DFalse, interpolate=3DTrue, **kwargs): +- # type: (Union[Text, _PathLike, None], Optional[_StringIO], bool, boo= l, bool, Union[None, Text]) -> bool +- """Parse a .env file and then load all the variables found as environ= ment variables. +- +- - *dotenv_path*: absolute or relative path to .env file. +- - *stream*: `StringIO` object with .env content. +- - *verbose*: whether to output the warnings related to missing .env f= ile etc. Defaults to `False`. +- - *override*: where to override the system environment variables with= the variables in `.env` file. +- Defaults to `False`. +- """ +- f =3D dotenv_path or stream or find_dotenv() +- return DotEnv(f, verbose=3Dverbose, interpolate=3Dinterpolate, **kwar= gs).set_as_environment_variables(override=3Doverride) +- +- +-def dotenv_values(dotenv_path=3DNone, stream=3DNone, verbose=3DFalse, int= erpolate=3DTrue, **kwargs): +- # type: (Union[Text, _PathLike, None], Optional[_StringIO], bool, boo= l, Union[None, Text]) -> Dict[Text, Optional[Text]] # noqa: E501 +- f =3D dotenv_path or stream or find_dotenv() +- return DotEnv(f, verbose=3Dverbose, interpolate=3Dinterpolate, **kwar= gs).dict() +diff --git a/dynaconf/vendor_src/dotenv/parser.py b/dynaconf/vendor_src/do= tenv/parser.py +deleted file mode 100644 +index 2c93cbd..0000000 +--- a/dynaconf/vendor_src/dotenv/parser.py ++++ /dev/null +@@ -1,237 +0,0 @@ +-import codecs +-import re +- +-from .compat import IS_TYPE_CHECKING, to_text +- +-if IS_TYPE_CHECKING: +- from typing import ( # noqa:F401 +- IO, Iterator, Match, NamedTuple, Optional, Pattern, Sequence, Tex= t, +- Tuple +- ) +- +- +-def make_regex(string, extra_flags=3D0): +- # type: (str, int) -> Pattern[Text] +- return re.compile(to_text(string), re.UNICODE | extra_flags) +- +- +-_newline =3D make_regex(r"(\r\n|\n|\r)") +-_multiline_whitespace =3D make_regex(r"\s*", extra_flags=3Dre.MULTILINE) +-_whitespace =3D make_regex(r"[^\S\r\n]*") +-_export =3D make_regex(r"(?:export[^\S\r\n]+)?") +-_single_quoted_key =3D make_regex(r"'([^']+)'") +-_unquoted_key =3D make_regex(r"([^=3D\#\s]+)") +-_equal_sign =3D make_regex(r"(=3D[^\S\r\n]*)") +-_single_quoted_value =3D make_regex(r"'((?:\\'|[^'])*)'") +-_double_quoted_value =3D make_regex(r'"((?:\\"|[^"])*)"') +-_unquoted_value_part =3D make_regex(r"([^ \r\n]*)") +-_comment =3D make_regex(r"(?:[^\S\r\n]*#[^\r\n]*)?") +-_end_of_line =3D make_regex(r"[^\S\r\n]*(?:\r\n|\n|\r|$)") +-_rest_of_line =3D make_regex(r"[^\r\n]*(?:\r|\n|\r\n)?") +-_double_quote_escapes =3D make_regex(r"\\[\\'\"abfnrtv]") +-_single_quote_escapes =3D make_regex(r"\\[\\']") +- +- +-try: +- # this is necessary because we only import these from typing +- # when we are type checking, and the linter is upset if we +- # re-import +- import typing +- +- Original =3D typing.NamedTuple( +- "Original", +- [ +- ("string", typing.Text), +- ("line", int), +- ], +- ) +- +- Binding =3D typing.NamedTuple( +- "Binding", +- [ +- ("key", typing.Optional[typing.Text]), +- ("value", typing.Optional[typing.Text]), +- ("original", Original), +- ("error", bool), +- ], +- ) +-except ImportError: +- from collections import namedtuple +- Original =3D namedtuple( # type: ignore +- "Original", +- [ +- "string", +- "line", +- ], +- ) +- Binding =3D namedtuple( # type: ignore +- "Binding", +- [ +- "key", +- "value", +- "original", +- "error", +- ], +- ) +- +- +-class Position: +- def __init__(self, chars, line): +- # type: (int, int) -> None +- self.chars =3D chars +- self.line =3D line +- +- @classmethod +- def start(cls): +- # type: () -> Position +- return cls(chars=3D0, line=3D1) +- +- def set(self, other): +- # type: (Position) -> None +- self.chars =3D other.chars +- self.line =3D other.line +- +- def advance(self, string): +- # type: (Text) -> None +- self.chars +=3D len(string) +- self.line +=3D len(re.findall(_newline, string)) +- +- +-class Error(Exception): +- pass +- +- +-class Reader: +- def __init__(self, stream): +- # type: (IO[Text]) -> None +- self.string =3D stream.read() +- self.position =3D Position.start() +- self.mark =3D Position.start() +- +- def has_next(self): +- # type: () -> bool +- return self.position.chars < len(self.string) +- +- def set_mark(self): +- # type: () -> None +- self.mark.set(self.position) +- +- def get_marked(self): +- # type: () -> Original +- return Original( +- string=3Dself.string[self.mark.chars:self.position.chars], +- line=3Dself.mark.line, +- ) +- +- def peek(self, count): +- # type: (int) -> Text +- return self.string[self.position.chars:self.position.chars + coun= t] +- +- def read(self, count): +- # type: (int) -> Text +- result =3D self.string[self.position.chars:self.position.chars + = count] +- if len(result) < count: +- raise Error("read: End of string") +- self.position.advance(result) +- return result +- +- def read_regex(self, regex): +- # type: (Pattern[Text]) -> Sequence[Text] +- match =3D regex.match(self.string, self.position.chars) +- if match is None: +- raise Error("read_regex: Pattern not found") +- self.position.advance(self.string[match.start():match.end()]) +- return match.groups() +- +- +-def decode_escapes(regex, string): +- # type: (Pattern[Text], Text) -> Text +- def decode_match(match): +- # type: (Match[Text]) -> Text +- return codecs.decode(match.group(0), 'unicode-escape') # type: i= gnore +- +- return regex.sub(decode_match, string) +- +- +-def parse_key(reader): +- # type: (Reader) -> Optional[Text] +- char =3D reader.peek(1) +- if char =3D=3D "#": +- return None +- elif char =3D=3D "'": +- (key,) =3D reader.read_regex(_single_quoted_key) +- else: +- (key,) =3D reader.read_regex(_unquoted_key) +- return key +- +- +-def parse_unquoted_value(reader): +- # type: (Reader) -> Text +- value =3D u"" +- while True: +- (part,) =3D reader.read_regex(_unquoted_value_part) +- value +=3D part +- after =3D reader.peek(2) +- if len(after) < 2 or after[0] in u"\r\n" or after[1] in u" #\r\n": +- return value +- value +=3D reader.read(2) +- +- +-def parse_value(reader): +- # type: (Reader) -> Text +- char =3D reader.peek(1) +- if char =3D=3D u"'": +- (value,) =3D reader.read_regex(_single_quoted_value) +- return decode_escapes(_single_quote_escapes, value) +- elif char =3D=3D u'"': +- (value,) =3D reader.read_regex(_double_quoted_value) +- return decode_escapes(_double_quote_escapes, value) +- elif char in (u"", u"\n", u"\r"): +- return u"" +- else: +- return parse_unquoted_value(reader) +- +- +-def parse_binding(reader): +- # type: (Reader) -> Binding +- reader.set_mark() +- try: +- reader.read_regex(_multiline_whitespace) +- if not reader.has_next(): +- return Binding( +- key=3DNone, +- value=3DNone, +- original=3Dreader.get_marked(), +- error=3DFalse, +- ) +- reader.read_regex(_export) +- key =3D parse_key(reader) +- reader.read_regex(_whitespace) +- if reader.peek(1) =3D=3D "=3D": +- reader.read_regex(_equal_sign) +- value =3D parse_value(reader) # type: Optional[Text] +- else: +- value =3D None +- reader.read_regex(_comment) +- reader.read_regex(_end_of_line) +- return Binding( +- key=3Dkey, +- value=3Dvalue, +- original=3Dreader.get_marked(), +- error=3DFalse, +- ) +- except Error: +- reader.read_regex(_rest_of_line) +- return Binding( +- key=3DNone, +- value=3DNone, +- original=3Dreader.get_marked(), +- error=3DTrue, +- ) +- +- +-def parse_stream(stream): +- # type: (IO[Text]) -> Iterator[Binding] +- reader =3D Reader(stream) +- while reader.has_next(): +- yield parse_binding(reader) +diff --git a/dynaconf/vendor_src/dotenv/py.typed b/dynaconf/vendor_src/dot= env/py.typed +deleted file mode 100644 +index 7632ecf..0000000 +--- a/dynaconf/vendor_src/dotenv/py.typed ++++ /dev/null +@@ -1 +0,0 @@ +-# Marker file for PEP 561 +diff --git a/dynaconf/vendor_src/dotenv/version.py b/dynaconf/vendor_src/d= otenv/version.py +deleted file mode 100644 +index f23a6b3..0000000 +--- a/dynaconf/vendor_src/dotenv/version.py ++++ /dev/null +@@ -1 +0,0 @@ +-__version__ =3D "0.13.0" +diff --git a/dynaconf/vendor_src/ruamel/__init__.py b/dynaconf/vendor_src/= ruamel/__init__.py +deleted file mode 100644 +index e69de29..0000000 +diff --git a/dynaconf/vendor_src/ruamel/yaml/CHANGES b/dynaconf/vendor_src= /ruamel/yaml/CHANGES +deleted file mode 100644 +index a70a8ef..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/CHANGES ++++ /dev/null +@@ -1,957 +0,0 @@ +-[0, 16, 10]: 2020-02-12 +- - (auto) updated image references in README to sourceforge +- +-[0, 16, 9]: 2020-02-11 +- - update CHANGES +- +-[0, 16, 8]: 2020-02-11 +- - update requirements so that ruamel.yaml.clib is installed for 3.8, +- as it has become available (via manylinux builds) +- +-[0, 16, 7]: 2020-01-30 +- - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) +- - fix error in dumping literal scalar in sequence with comments before = element +- (reported by `EJ Etherington `__) +- +-[0, 16, 6]: 2020-01-20 +- - fix empty string mapping key roundtripping with preservation of quote= s as `? ''` +- (reported via email by Tomer Aharoni). +- - fix incorrect state setting in class constructor (reported by `Dougla= s Raillard +- `_= _) +- - adjust deprecation warning test for Hashable, as that no longer warns= (reported +- by `Jason Montleon `__) +- +-[0, 16, 5]: 2019-08-18 +- - allow for ``YAML(typ=3D['unsafe', 'pytypes'])`` +- +-[0, 16, 4]: 2019-08-16 +- - fix output of TAG directives with # (reported by `Thomas Smith +- `_= _) +- +- +-[0, 16, 3]: 2019-08-15 +- - move setting of version based on YAML directive to scanner, allowing = to +- check for file version during TAG directive scanning +- +-[0, 16, 2]: 2019-08-15 +- - preserve YAML and TAG directives on roundtrip, correctly output # +- in URL for YAML 1.2 (both reported by `Thomas Smith +- `_= _) +- +-[0, 16, 1]: 2019-08-08 +- - Force the use of new version of ruamel.yaml.clib (reported by `Alex J= oz +- `_= _) +- - Allow '#' in tag URI as these are allowed in YAML 1.2 (reported by +- `Thomas Smith +- `_= _) +- +-[0, 16, 0]: 2019-07-25 +- - split of C source that generates .so file to ruamel.yaml.clib +- - duplicate keys are now an error when working with the old API as well +- +-[0, 15, 100]: 2019-07-17 +- - fixing issue with dumping deep-copied data from commented YAML, by +- providing both the memo parameter to __deepcopy__, and by allowing +- startmarks to be compared on their content (reported by `Theofilos +- Petsios +- `_= _) +- +-[0, 15, 99]: 2019-07-12 +- - add `py.typed` to distribution, based on a PR submitted by +- `Michael Crusoe +- `__ +- - merge PR 40 (also by Michael Crusoe) to more accurately specify +- repository in the README (also reported in a misunderstood issue +- some time ago) +- +-[0, 15, 98]: 2019-07-09 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.12, needed +- for Python 3.8.0b2 (reported by `John Vandenberg +- `_= _) +- +-[0, 15, 97]: 2019-06-06 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.10, needed for +- Python 3.8.0b1 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.9, needed for +- Python 3.8.0a4 (reported by `Anthony Sottile +- `_= _) +- +-[0, 15, 96]: 2019-05-16 +- - fix failure to indent comments on round-trip anchored block style +- scalars in block sequence (reported by `William Kimball +- `_= _) +- +-[0, 15, 95]: 2019-05-16 +- - fix failure to round-trip anchored scalars in block sequence +- (reported by `William Kimball +- `_= _) +- - wheel files for Python 3.4 no longer provided (`Python 3.4 EOL 2019-0= 3-18 +- `__) +- +-[0, 15, 94]: 2019-04-23 +- - fix missing line-break after end-of-file comments not ending in +- line-break (reported by `Philip Thompson +- `_= _) +- +-[0, 15, 93]: 2019-04-21 +- - fix failure to parse empty implicit flow mapping key +- - in YAML 1.1 plains scalars `y`, 'n', `Y`, and 'N' are now +- correctly recognised as booleans and such strings dumped quoted +- (reported by `Marcel Bollmann +- `_= _) +- +-[0, 15, 92]: 2019-04-16 +- - fix failure to parse empty implicit block mapping key (reported by=20 +- `Nolan W `__) +- +-[0, 15, 91]: 2019-04-05 +- - allowing duplicate keys would not work for merge keys (reported by ma= macdon on +- `StackOverflow `__=20 +- +-[0, 15, 90]: 2019-04-04 +- - fix issue with updating `CommentedMap` from list of tuples (reported = by=20 +- `Peter Henry `__) +- +-[0, 15, 89]: 2019-02-27 +- - fix for items with flow-mapping in block sequence output on single li= ne +- (reported by `Zahari Dim `__) +- - fix for safe dumping erroring in creation of representereror when dum= ping namedtuple +- (reported and solution by `Jaakko Kantoj=C3=A4rvi `__) +- +-[0, 15, 88]: 2019-02-12 +- - fix inclusing of python code from the subpackage data (containing ext= ra tests, +- reported by `Florian Apolloner `__) +- +-[0, 15, 87]: 2019-01-22 +- - fix problem with empty lists and the code to reinsert merge keys (rep= orted via email=20 +- by Zaloo) +- +-[0, 15, 86]: 2019-01-16 +- - reinsert merge key in its old position (reported by grumbler on +- `__) +- - fix for issue with non-ASCII anchor names (reported and fix +- provided by Dandaleon Flux via email) +- - fix for issue when parsing flow mapping value starting with colon (in= pure Python only) +- (reported by `FichteFoll `__) +- +-[0, 15, 85]: 2019-01-08 +- - the types used by `SafeConstructor` for mappings and sequences can +- now by set by assigning to `XXXConstructor.yaml_base_dict_type` +- (and `..._list_type`), preventing the need to copy two methods +- with 50+ lines that had `var =3D {}` hardcoded. (Implemented to +- help solve an feature request by `Anthony Sottile +- `__ in an easier way) +- +-[0, 15, 84]: 2019-01-07 +- - fix for `CommentedMap.copy()` not returning `CommentedMap`, let alone= copying comments etc. +- (reported by `Anthony Sottile `__) +- +-[0, 15, 83]: 2019-01-02 +- - fix for bug in roundtripping aliases used as key (reported via email = by Zaloo) +- +-[0, 15, 82]: 2018-12-28 +- - anchors and aliases on scalar int, float, string and bool are now pre= served. Anchors +- do not need a referring alias for these (reported by=20 +- `Alex Harvey `__) +- - anchors no longer lost on tagged objects when roundtripping (reported= by `Zaloo=20 +- `__) +- +-[0, 15, 81]: 2018-12-06 +- - fix issue saving methods of metaclass derived classes (reported and fi= x provided +- by `Douglas Raillard `__) +- +-[0, 15, 80]: 2018-11-26 +- - fix issue emitting BEL character when round-tripping invalid folded in= put +- (reported by Isaac on `StackOverflow `__) +-=20=20=20=20 +-[0, 15, 79]: 2018-11-21 +- - fix issue with anchors nested deeper than alias (reported by gaFF on +- `StackOverflow `__) +- +-[0, 15, 78]: 2018-11-15 +- - fix setup issue for 3.8 (reported by `Sidney Kuyateh=20 +- `__) +- +-[0, 15, 77]: 2018-11-09 +- - setting `yaml.sort_base_mapping_type_on_output =3D False`, will preve= nt +- explicit sorting by keys in the base representer of mappings. Roundtr= ip +- already did not do this. Usage only makes real sense for Python 3.6+ +- (feature request by `Sebastian Gerber `__). +- - implement Python version check in YAML metadata in ``_test/test_z_dat= a.py`` +- +-[0, 15, 76]: 2018-11-01 +- - fix issue with empty mapping and sequence loaded as flow-style +- (mapping reported by `Min RK `__, seque= nce +- by `Maged Ahmed `__) +- +-[0, 15, 75]: 2018-10-27 +- - fix issue with single '?' scalar (reported by `Terrance=20 +- `__) +- - fix issue with duplicate merge keys (prompted by `answering=20 +- `__ a=20 +- `StackOverflow question `__ +- by `math `__) +- +-[0, 15, 74]: 2018-10-17 +- - fix dropping of comment on rt before sequence item that is sequence i= tem +- (reported by `Thorsten Kampe `_= _) +- +-[0, 15, 73]: 2018-10-16 +- - fix irregular output on pre-comment in sequence within sequence (repo= rted +- by `Thorsten Kampe `__) +- - allow non-compact (i.e. next line) dumping sequence/mapping within se= quence. +- +-[0, 15, 72]: 2018-10-06 +- - fix regression on explicit 1.1 loading with the C based scanner/parser +- (reported by `Tomas Vavra `__) +- +-[0, 15, 71]: 2018-09-26 +- - fix regression where handcrafted CommentedMaps could not be initiated= (reported by=20 +- `Dan Helfman `__) +- - fix regression with non-root literal scalars that needed indent indic= ator +- (reported by `Clark Breyman `__) +- - tag:yaml.org,2002:python/object/apply now also uses __qualname__ on P= Y3 +- (reported by `Douglas RAILLARD `__) +- +-[0, 15, 70]: 2018-09-21 +- - reverted CommentedMap and CommentedSeq to subclass ordereddict resp. = list, +- reimplemented merge maps so that both ``dict(**commented_map_instance= )`` and JSON +- dumping works. This also allows checking with ``isinstance()`` on ``d= ict`` resp. ``list``. +- (Proposed by `Stuart Berg `__, wi= th feedback +- from `blhsing `__ on +- `StackOverflow `__) +- +-[0, 15, 69]: 2018-09-20 +- - fix issue with dump_all gobbling end-of-document comments on parsing +- (reported by `Pierre B. `__) +- +-[0, 15, 68]: 2018-09-20 +- - fix issue with parsabel, but incorrect output with nested flow-style = sequences +- (reported by `Dougal Seeley `__) +- - fix issue with loading Python objects that have __setstate__ and recu= rsion in parameters +- (reported by `Douglas RAILLARD `__) +- +-[0, 15, 67]: 2018-09-19 +- - fix issue with extra space inserted with non-root literal strings=20 +- (Issue reported and PR with fix provided by=20 +- `Naomi Seyfer `__.) +- +-[0, 15, 66]: 2018-09-07 +- - fix issue with fold indicating characters inserted in safe_load-ed fo= lded strings +- (reported by `Maximilian Hils `__). +- +-[0, 15, 65]: 2018-09-07 +- - fix issue #232 revert to throw ParserError for unexcpected ``]`` +- and ``}`` instead of IndexError. (Issue reported and PR with fix +- provided by `Naomi Seyfer `__.) +- - added ``key`` and ``reverse`` parameter (suggested by Jannik Klemm vi= a email) +- - indent root level literal scalars that have directive or document end= markers +- at the beginning of a line +- +-[0, 15, 64]: 2018-08-30 +- - support round-trip of tagged sequences: ``!Arg [a, {b: 1}]`` +- - single entry mappings in flow sequences now written by default withou= t quotes +- set ``yaml.brace_single_entry_mapping_in_flow_sequence=3DTrue`` to fo= rce +- getting ``[a, {b: 1}, {c: {d: 2}}]`` instead of the default ``[a, b: = 1, c: {d: 2}]`` +- - fix issue when roundtripping floats starting with a dot such as ``.5`` +- (reported by `Harrison Gregg `_= _) +- +-[0, 15, 63]: 2018-08-29 +- - small fix only necessary for Windows users that don't use wheels. +- +-[0, 15, 62]: 2018-08-29 +- - C based reader/scanner & emitter now allow setting of 1.2 as YAML ver= sion. +- ** The loading/dumping is still YAML 1.1 code**, so use the common su= bset of +- YAML 1.2 and 1.1 (reported by `Ge Yang `__) +- +-[0, 15, 61]: 2018-08-23 +- - support for round-tripping folded style scalars (initially requested= =20 +- by `Johnathan Viduchinsky `__) +- - update of C code +- - speed up of scanning (~30% depending on the input) +- +-[0, 15, 60]: 2018-08-18 +- - cleanup for mypy=20 +- - spurious print in library (reported by=20 +- `Lele Gaifax `__), now automatically che= cked=20 +- +-[0, 15, 59]: 2018-08-17 +- - issue with C based loader and leading zeros (reported by=20 +- `Tom Hamilton Stubber `__) +- +-[0, 15, 58]: 2018-08-17 +- - simple mappings can now be used as keys when round-tripping:: +- +- {a: 1, b: 2}: hello world +-=20=20=20=20=20=20 +- although using the obvious operations (del, popitem) on the key will +- fail, you can mutilate it by going through its attributes. If you loa= d the +- above YAML in `d`, then changing the value is cumbersome: +- +- d =3D {CommentedKeyMap([('a', 1), ('b', 2)]): "goodbye"} +- +- and changing the key even more so: +- +- d[CommentedKeyMap([('b', 1), ('a', 2)])] =3D d.pop( +- CommentedKeyMap([('a', 1), ('b', 2)])) +- +- (you can use a `dict` instead of a list of tuples (or ordereddict), b= ut that might result +- in a different order, of the keys of the key, in the output) +- - check integers to dump with 1.2 patterns instead of 1.1 (reported by= =20 +- `Lele Gaifax `__) +-=20=20 +- +-[0, 15, 57]: 2018-08-15 +- - Fix that CommentedSeq could no longer be used in adding or do a copy +- (reported by `Christopher Wright `__) +- +-[0, 15, 56]: 2018-08-15 +- - fix issue with ``python -O`` optimizing away code (reported, and deta= iled cause +- pinpointed, by `Alex Gr=C3=B6nholm = `__ +- +-[0, 15, 55]: 2018-08-14 +- +- - unmade ``CommentedSeq`` a subclass of ``list``. It is now +- indirectly a subclass of the standard +- ``collections.abc.MutableSequence`` (without .abc if you are +- still on Python2.7). If you do ``isinstance(yaml.load('[1, 2]'), +- list)``) anywhere in your code replace ``list`` with +- ``MutableSequence``. Directly, ``CommentedSeq`` is a subclass of +- the abstract baseclass ``ruamel.yaml.compat.MutableScliceableSequence= ``, +- with the result that *(extended) slicing is supported on=20 +- ``CommentedSeq``*. +- (reported by `Stuart Berg `__) +- - duplicate keys (or their values) with non-ascii now correctly +- report in Python2, instead of raising a Unicode error. +- (Reported by `Jonathan Pyle `__) +- +-[0, 15, 54]: 2018-08-13 +- +- - fix issue where a comment could pop-up twice in the output (reported = by=20 +- `Mike Kazantsev `__ and by=20 +- `Nate Peterson `__) +- - fix issue where JSON object (mapping) without spaces was not parsed +- properly (reported by `Marc Schmidt `__) +- - fix issue where comments after empty flow-style mappings were not emi= tted +- (reported by `Qinfench Chen `__) +- +-[0, 15, 53]: 2018-08-12 +- - fix issue with flow style mapping with comments gobbled newline (repo= rted +- by `Christopher Lambert `__) +- - fix issue where single '+' under YAML 1.2 was interpreted as +- integer, erroring out (reported by `Jethro Yu +- `__) +- +-[0, 15, 52]: 2018-08-09 +- - added `.copy()` mapping representation for round-tripping +- (``CommentedMap``) to fix incomplete copies of merged mappings +- (reported by `Will Richards +- `__)=20 +- - Also unmade that class a subclass of ordereddict to solve incorrect b= ehaviour +- for ``{**merged-mapping}`` and ``dict(**merged-mapping)`` (reported by +- `Filip Matzner `__) +- +-[0, 15, 51]: 2018-08-08 +- - Fix method name dumps (were not dotted) and loads (reported by `Dougl= as Raillard=20 +- `__) +- - Fix spurious trailing white-space caused when the comment start +- column was no longer reached and there was no actual EOL comment +- (e.g. following empty line) and doing substitutions, or when +- quotes around scalars got dropped. (reported by `Thomas Guillet +- `__) +- +-[0, 15, 50]: 2018-08-05 +- - Allow ``YAML()`` as a context manager for output, thereby making it m= uch easier +- to generate multi-documents in a stream.=20 +- - Fix issue with incorrect type information for `load()` and `dump()` (= reported=20 +- by `Jimbo Jim `__) +- +-[0, 15, 49]: 2018-08-05 +- - fix preservation of leading newlines in root level literal style scal= ar, +- and preserve comment after literal style indicator (``| # some comme= nt``) +- Both needed for round-tripping multi-doc streams in=20 +- `ryd `__. +- +-[0, 15, 48]: 2018-08-03 +- - housekeeping: ``oitnb`` for formatting, mypy 0.620 upgrade and confor= mity +- +-[0, 15, 47]: 2018-07-31 +- - fix broken 3.6 manylinux1 (result of an unclean ``build`` (reported b= y=20 +- `Roman Sichnyi `__) +- +- +-[0, 15, 46]: 2018-07-29 +- - fixed DeprecationWarning for importing from ``collections`` on 3.7 +- (issue 210, reported by `Reinoud Elhorst +- `__). It was `difficult to find +- why tox/pytest did not report +- `__ and as time +- consuming to actually `fix +- `__ the tests. +- +-[0, 15, 45]: 2018-07-26 +- - After adding failing test for ``YAML.load_all(Path())``, remove StopI= teration=20 +- (PR provided by `Zachary Buhman `__, +- also reported by `Steven Hiscocks = `__. +- +-[0, 15, 44]: 2018-07-14 +- - Correct loading plain scalars consisting of numerals only and +- starting with `0`, when not explicitly specifying YAML version +- 1.1. This also fixes the issue about dumping string `'019'` as +- plain scalars as reported by `Min RK +- `__, that prompted this chance. +- +-[0, 15, 43]: 2018-07-12 +- - merge PR33: Python2.7 on Windows is narrow, but has no +- ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by +- `Marcel Bargull `__) +- - ``register_class()`` now returns class (proposed by +- `Mike Nerone `__} +- +-[0, 15, 42]: 2018-07-01 +- - fix regression showing only on narrow Python 2.7 (py27mu) builds +- (with help from +- `Marcel Bargull `__ and +- `Colm O'Connor <>`__). +- - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as +- 3.4/3.5/3.6/3.7/pypy +- +-[0, 15, 41]: 2018-06-27 +- - add detection of C-compile failure (investigation prompted by=20 +- `StackOverlow `__ by=20 +- `Emmanuel Blot `__), +- which was removed while no longer dependent on ``libyaml``, C-extensi= ons +- compilation still needs a compiler though. +- +-[0, 15, 40]: 2018-06-18 +- - added links to landing places as suggested in issue 190 by +- `KostisA `__ +- - fixes issue #201: decoding unicode escaped tags on Python2, reported +- by `Dan Abolafia `__ +- +-[0, 15, 39]: 2018-06-16 +- - merge PR27 improving package startup time (and loading when regexp no= t=20 +- actually used), provided by=20 +- `Marcel Bargull `__ +- +-[0, 15, 38]: 2018-06-13 +- - fix for losing precision when roundtripping floats by +- `Rolf Wojtech `__ +- - fix for hardcoded dir separator not working for Windows by +- `Nuno Andr=C3=A9 `__ +- - typo fix by `Andrey Somov `__ +- +-[0, 15, 37]: 2018-03-21 +- - again trying to create installable files for 187 +- +-[0, 15, 36]: 2018-02-07 +- - fix issue 187, incompatibility of C extension with 3.7 (reported by +- Daniel Blanchard) +- +-[0, 15, 35]: 2017-12-03 +- - allow ``None`` as stream when specifying ``transform`` parameters to +- ``YAML.dump()``. +- This is useful if the transforming function doesn't return a meaningf= ul value +- (inspired by `StackOverflow `__ by +- `rsaw `__). +- +-[0, 15, 34]: 2017-09-17 +- - fix for issue 157: CDumper not dumping floats (reported by Jan Smitka) +- +-[0, 15, 33]: 2017-08-31 +- - support for "undefined" round-tripping tagged scalar objects (in addi= tion to +- tagged mapping object). Inspired by a use case presented by Matthew P= atton +- on `StackOverflow `__. +- - fix issue 148: replace cryptic error message when using !!timestamp w= ith an +- incorrectly formatted or non- scalar. Reported by FichteFoll. +- +-[0, 15, 32]: 2017-08-21 +- - allow setting ``yaml.default_flow_style =3D None`` (default: ``False`= `) for +- for ``typ=3D'rt'``. +- - fix for issue 149: multiplications on ``ScalarFloat`` now return ``fl= oat`` +- +-[0, 15, 31]: 2017-08-15 +- - fix Comment dumping +- +-[0, 15, 30]: 2017-08-14 +- - fix for issue with "compact JSON" not parsing: ``{"in":{},"out":{}}`` +- (reported on `StackOverflow `_ by +- `mjalkio `_ +- +-[0, 15, 29]: 2017-08-14 +- - fix issue #51: different indents for mappings and sequences (reported= by=20 +- Alex Harvey) +- - fix for flow sequence/mapping as element/value of block sequence with= =20 +- sequence-indent minus dash-offset not equal two. +- +-[0, 15, 28]: 2017-08-13 +- - fix issue #61: merge of merge cannot be __repr__-ed (reported by Tal = Liron) +- +-[0, 15, 27]: 2017-08-13 +- - fix issue 62, YAML 1.2 allows ``?`` and ``:`` in plain scalars if non= -ambigious +- (reported by nowox) +- - fix lists within lists which would make comments disappear +- +-[0, 15, 26]: 2017-08-10 +- - fix for disappearing comment after empty flow sequence (reported by +- oit-tzhimmash) +- +-[0, 15, 25]: 2017-08-09 +- - fix for problem with dumping (unloaded) floats (reported by eyenseo) +- +-[0, 15, 24]: 2017-08-09 +- - added ScalarFloat which supports roundtripping of 23.1, 23.100, +- 42.00E+56, 0.0, -0.0 etc. while keeping the format. Underscores in ma= ntissas +- are not preserved/supported (yet, is anybody using that?). +- - (finally) fixed longstanding issue 23 (reported by `Antony Sottile +- `_), now handling comment between bl= ock +- mapping key and value correctly +- - warn on YAML 1.1 float input that is incorrect (triggered by invalid = YAML +- provided by Cecil Curry) +- - allow setting of boolean representation (`false`, `true`) by using: +- ``yaml.boolean_representation =3D [u'False', u'True']`` +- +-[0, 15, 23]: 2017-08-01 +- - fix for round_tripping integers on 2.7.X > sys.maxint (reported by cc= atterina) +- +-[0, 15, 22]: 2017-07-28 +- - fix for round_tripping singe excl. mark tags doubling (reported and f= ix by Jan Brezina) +- +-[0, 15, 21]: 2017-07-25 +- - fix for writing unicode in new API, https://stackoverflow.com/a/45281= 922/1307905 +- +-[0, 15, 20]: 2017-07-23 +- - wheels for windows including C extensions +- +-[0, 15, 19]: 2017-07-13 +- - added object constructor for rt, decorator ``yaml_object`` to replace= YAMLObject. +- - fix for problem using load_all with Path() instance +- - fix for load_all in combination with zero indent block style literal +- (``pure=3DTrue`` only!) +- +-[0, 15, 18]: 2017-07-04 +- - missing ``pure`` attribute on ``YAML`` useful for implementing `!incl= ude` tag +- constructor for `including YAML files in a YAML file +- `_ +- - some documentation improvements +- - trigger of doc build on new revision +- +-[0, 15, 17]: 2017-07-03 +- - support for Unicode supplementary Plane **output** with allow_unicode +- (input was already supported, triggered by +- `this `_ Stack Overflow= Q&A) +- +-[0, 15, 16]: 2017-07-01 +- - minor typing issues (reported and fix provided by +- `Manvendra Singh `_) +- - small doc improvements +- +-[0, 15, 15]: 2017-06-27 +- - fix for issue 135, typ=3D'safe' not dumping in Python 2.7 +- (reported by Andrzej Ostrowski `_) +- +-[0, 15, 14]: 2017-06-25 +- - setup.py: change ModuleNotFoundError to ImportError (reported and fix= by Asley Drake) +- +-[0, 15, 13]: 2017-06-24 +- - suppress duplicate key warning on mappings with merge keys (reported = by +- Cameron Sweeney) +- +-[0, 15, 12]: 2017-06-24 +- - remove fatal dependency of setup.py on wheel package (reported by +- Cameron Sweeney) +- +-[0, 15, 11]: 2017-06-24 +- - fix for issue 130, regression in nested merge keys (reported by +- `David Fee `_) +- +-[0, 15, 10]: 2017-06-23 +- - top level PreservedScalarString not indented if not explicitly asked = to +- - remove Makefile (not very useful anyway) +- - some mypy additions +- +-[0, 15, 9]: 2017-06-16 +- - fix for issue 127: tagged scalars were always quoted and seperated +- by a newline when in a block sequence (reported and largely fixed by +- `Tommy Wang `_) +- +-[0, 15, 8]: 2017-06-15 +- - allow plug-in install via ``install ruamel.yaml[jinja2]`` +- +-[0, 15, 7]: 2017-06-14 +- - add plug-in mechanism for load/dump pre resp. post-processing +- +-[0, 15, 6]: 2017-06-10 +- - a set() with duplicate elements now throws error in rt loading +- - support for toplevel column zero literal/folded scalar in explicit do= cuments +- +-[0, 15, 5]: 2017-06-08 +- - repeat `load()` on a single `YAML()` instance would fail. +- +-(0, 15, 4) 2017-06-08: | +- - `transform` parameter on dump that expects a function taking a +- string and returning a string. This allows transformation of the outp= ut +- before it is written to stream. +- - some updates to the docs +- +-(0, 15, 3) 2017-06-07: +- - No longer try to compile C extensions on Windows. Compilation can be = forced by setting +- the environment variable `RUAMEL_FORCE_EXT_BUILD` to some value +- before starting the `pip install`. +- +-(0, 15, 2) 2017-06-07: +- - update to conform to mypy 0.511:mypy --strict +- +-(0, 15, 1) 2017-06-07: +- - Any `duplicate keys `_ +- in mappings generate an error (in the old API this change generates a= warning until 0.16) +- - dependecy on ruamel.ordereddict for 2.7 now via extras_require +- +-(0, 15, 0) 2017-06-04: +- - it is now allowed to pass in a ``pathlib.Path`` as "stream" parameter= to all +- load/dump functions +- - passing in a non-supported object (e.g. a string) as "stream" will re= sult in a +- much more meaningful YAMLStreamError. +- - assigning a normal string value to an existing CommentedMap key or Co= mmentedSeq +- element will result in a value cast to the previous value's type if p= ossible. +- +-(0, 14, 12) 2017-05-14: +- - fix for issue 119, deepcopy not returning subclasses (reported and PR= by +- Constantine Evans ) +- +-(0, 14, 11) 2017-05-01: +- - fix for issue 103 allowing implicit documents after document end mark= er line (``...``) +- in YAML 1.2 +- +-(0, 14, 10) 2017-04-26: +- - fix problem with emitting using cyaml +- +-(0, 14, 9) 2017-04-22: +- - remove dependency on ``typing`` while still supporting ``mypy`` +- (http://stackoverflow.com/a/43516781/1307905) +- - fix unclarity in doc that stated 2.6 is supported (reported by feetdu= st) +- +-(0, 14, 8) 2017-04-19: +- - fix Text not available on 3.5.0 and 3.5.1, now proactively setting ve= rsion guards +- on all files (reported by `Jo=C3=A3o Paulo Magalh=C3=A3es `_) +- +-(0, 14, 7) 2017-04-18: +- - round trip of integers (decimal, octal, hex, binary) now preserve +- leading zero(s) padding and underscores. Underscores are presumed +- to be at regular distances (i.e. ``0o12_345_67`` dumps back as +- ``0o1_23_45_67`` as the space from the last digit to the +- underscore before that is the determining factor). +- +-(0, 14, 6) 2017-04-14: +- - binary, octal and hex integers are now preserved by default. This +- was a known deficiency. Working on this was prompted by the issue rep= ort (112) +- from devnoname120, as well as the additional experience with `.replac= e()` +- on `scalarstring` classes. +- - fix issues 114 cannot install on Buildozer (reported by mixmastamyk). +- Setting env. var ``RUAMEL_NO_PIP_INSTALL_CHECK`` will suppress ``pip`= `-check. +- +-(0, 14, 5) 2017-04-04: +- - fix issue 109 None not dumping correctly at top level (reported by An= drea Censi) +- - fix issue 110 .replace on Preserved/DoubleQuoted/SingleQuoted ScalarS= tring +- would give back "normal" string (reported by sandres23) +- +-(0, 14, 4) 2017-03-31: +- - fix readme +- +-(0, 14, 3) 2017-03-31: +- - fix for 0o52 not being a string in YAML 1.1 (reported on +- `StackOverflow Q&A 43138503>`_ by +- `Frank D `_ +- +-(0, 14, 2) 2017-03-23: +- - fix for old default pip on Ubuntu 14.04 (reported by S=C3=A9bastien M= accagnoni-Munch) +- +-(0.14.1) 2017-03-22: +- - fix Text not available on 3.5.0 and 3.5.1 (reported by Charles Boucha= rd-L=C3=A9gar=C3=A9) +- +-(0.14.0) 2017-03-21: +- - updates for mypy --strict +- - preparation for moving away from inheritance in Loader and Dumper, ca= lls from e.g. +- the Representer to the Serializer.serialize() are now done via the at= tribute +- .serializer.serialize(). Usage of .serialize() outside of Serializer = will be +- deprecated soon +- - some extra tests on main.py functions +- +-(0.13.14) 2017-02-12: +- - fix for issue 97, clipped block scalar followed by empty lines and co= mment +- would result in two CommentTokens of which the first was dropped. +- (reported by Colm O'Connor) +- +-(0.13.13) 2017-01-28: +- - fix for issue 96, prevent insertion of extra empty line if indented m= apping entries +- are separated by an empty line (reported by Derrick Sawyer) +- +-(0.13.11) 2017-01-23: +- - allow ':' in flow style scalars if not followed by space. Also don't +- quote such scalar as this is no longer necessary. +- - add python 3.6 manylinux wheel to PyPI +- +-(0.13.10) 2017-01-22: +- - fix for issue 93, insert spurious blank line before single line comme= nt +- between indented sequence elements (reported by Alex) +- +-(0.13.9) 2017-01-18: +- - fix for issue 92, wrong import name reported by the-corinthian +- +-(0.13.8) 2017-01-18: +- - fix for issue 91, when a compiler is unavailable reported by Maximili= an Hils +- - fix for deepcopy issue with TimeStamps not preserving 'T', reported on +- `StackOverflow Q&A `_ by +- `Quuxplusone `_ +- +-(0.13.7) 2016-12-27: +- - fix for issue 85, constructor.py importing unicode_literals caused my= py to fail +- on 2.7 (reported by Peter Amstutz) +- +-(0.13.6) 2016-12-27: +- - fix for issue 83, collections.OrderedDict not representable by SafeRe= presenter +- (reported by Frazer McLean) +- +-(0.13.5) 2016-12-25: +- - fix for issue 84, deepcopy not properly working (reported by Peter Am= stutz) +- +-(0.13.4) 2016-12-05: +- - another fix for issue 82, change to non-global resolver data broke im= plicit type +- specification +- +-(0.13.3) 2016-12-05: +- - fix for issue 82, deepcopy not working (reported by code monk) +- +-(0.13.2) 2016-11-28: +- - fix for comments after empty (null) values (reported by dsw2127 and = cokelaer) +- +-(0.13.1) 2016-11-22: +- - optimisations on memory usage when loading YAML from large files (py3= -50%, py2 -85%) +- +-(0.13.0) 2016-11-20: +- - if ``load()`` or ``load_all()`` is called with only a single argument +- (stream or string) +- a UnsafeLoaderWarning will be issued once. If appropriate you can sur= press this +- warning by filtering it. Explicitly supplying the ``Loader=3Druamel.y= aml.Loader`` +- argument, will also prevent it from being issued. You should however = consider +- using ``safe_load()``, ``safe_load_all()`` if your YAML input does no= t use tags. +- - allow adding comments before and after keys (based on +- `StackOveflow Q&A `_ by +- `msinn `_) +- +-(0.12.18) 2016-11-16: +- - another fix for numpy (re-reported independently by PaulG & Nathanial= Burdic) +- +-(0.12.17) 2016-11-15: +- - only the RoundTripLoader included the Resolver that supports YAML 1.2 +- now all loaders do (reported by mixmastamyk) +- +-(0.12.16) 2016-11-13: +- - allow dot char (and many others) in anchor name +- Fix issue 72 (reported by Shalon Wood) +- - | +- Slightly smarter behaviour dumping strings when no style is +- specified. Single string scalars that start with single quotes +- or have newlines now are dumped double quoted "'abc\nklm'" instead of +- +- '''abc +- +- klm''' +- +-(0.12.14) 2016-09-21: +- - preserve round-trip sequences that are mapping keys +- (prompted by stackoverflow question 39595807 from Nowox) +- +-(0.12.13) 2016-09-15: +- - Fix for issue #60 representation of CommentedMap with merge +- keys incorrect (reported by Tal Liron) +- +-(0.12.11) 2016-09-06: +- - Fix issue 58 endless loop in scanning tokens (reported by +- Christopher Lambert) +- +-(0.12.10) 2016-09-05: +- - Make previous fix depend on unicode char width (32 bit unicode support +- is a problem on MacOS reported by David Tagatac) +- +-(0.12.8) 2016-09-05: +- - To be ignored Unicode characters were not properly regex matched +- (no specific tests, PR by Haraguroicha Hsu) +- +-(0.12.7) 2016-09-03: +- - fixing issue 54 empty lines with spaces (reported by Alex Harvey) +- +-(0.12.6) 2016-09-03: +- - fixing issue 46 empty lines between top-level keys were gobbled (but +- not between sequence elements, nor between keys in netsted mappings +- (reported by Alex Harvey) +- +-(0.12.5) 2016-08-20: +- - fixing issue 45 preserving datetime formatting (submitted by altuin) +- Several formatting parameters are preserved with some normalisation: +- - preserve 'T', 't' is replaced by 'T', multiple spaces between date +- and time reduced to one. +- - optional space before timezone is removed +- - still using microseconds, but now rounded (.1234567 -> .123457) +- - Z/-5/+01:00 preserved +- +-(0.12.4) 2016-08-19: +- - Fix for issue 44: missing preserve_quotes keyword argument (reported +- by M. Crusoe) +- +-(0.12.3) 2016-08-17: +- - correct 'in' operation for merged CommentedMaps in round-trip mode +- (implementation inspired by J.Ngo, but original not working for merge= s) +- - iteration over round-trip loaded mappings, that contain merges. Also +- keys(), items(), values() (Py3/Py2) and iterkeys(), iteritems(), +- itervalues(), viewkeys(), viewitems(), viewvalues() (Py2) +- - reuse of anchor name now generates warning, not an error. Round-tripp= ing such +- anchors works correctly. This inherited PyYAML issue was brought to a= ttention +- by G. Coddut (and was long standing https://bugs.debian.org/cgi-bin/b= ugreport.cgi?bug=3D515634) +- suppressing the warning:: +- +- import warnings +- from ruamel.yaml.error import ReusedAnchorWarning +- warnings.simplefilter("ignore", ReusedAnchorWarning) +- +-(0.12.2) 2016-08-16: +- - minor improvements based on feedback from M. Crusoe +- https://bitbucket.org/ruamel/yaml/issues/42/ +- +-(0.12.0) 2016-08-16: +- - drop support for Python 2.6 +- - include initial Type information (inspired by M. Crusoe) +- +-(0.11.15) 2016-08-07: +- - Change to prevent FutureWarning in NumPy, as reported by tgehring +- ("comparison to None will result in an elementwise object comparison = in the future") +- +-(0.11.14) 2016-07-06: +- - fix preserve_quotes missing on original Loaders (as reported +- by Leynos, bitbucket issue 38) +- +-(0.11.13) 2016-07-06: +- - documentation only, automated linux wheels +- +-(0.11.12) 2016-07-06: +- - added support for roundtrip of single/double quoted scalars using: +- ruamel.yaml.round_trip_load(stream, preserve_quotes=3DTrue) +- +-(0.11.10) 2016-05-02: +- +-- added .insert(pos, key, value, comment=3DNone) to CommentedMap +- +-(0.11.10) 2016-04-19: +- +-- indent=3D2, block_seq_indent=3D2 works as expected +- +-(0.11.0) 2016-02-18: +- - RoundTripLoader loads 1.2 by default (no sexagesimals, 012 octals nor +- yes/no/on/off booleans +- +-(0.10.11) 2015-09-17: +-- Fix issue 13: dependency on libyaml to be installed for yaml.h +- +-(0.10.10) 2015-09-15: +-- Python 3.5 tested with tox +-- pypy full test (old PyYAML tests failed on too many open file handles) +- +-(0.10.6-0.10.9) 2015-09-14: +-- Fix for issue 9 +-- Fix for issue 11: double dump losing comments +-- Include libyaml code +-- move code from 'py' subdir for proper namespace packaging. +- +-(0.10.5) 2015-08-25: +-- preservation of newlines after block scalars. Contributed by Sam Thursf= ield. +- +-(0.10) 2015-06-22: +-- preservation of hand crafted anchor names ( not of the form "idNNN") +-- preservation of map merges ( <<< ) +- +-(0.9) 2015-04-18: +-- collections read in by the RoundTripLoader now have a ``lc`` property +- that can be quired for line and column ( ``lc.line`` resp. ``lc.col``) +- +-(0.8) 2015-04-15: +-- bug fix for non-roundtrip save of ordereddict +-- adding/replacing end of line comments on block style mappings/sequences +- +-(0.7.2) 2015-03-29: +-- support for end-of-line comments on flow style sequences and mappings +- +-(0.7.1) 2015-03-27: +-- RoundTrip capability of flow style sequences ( 'a: b, c, d' ) +- +-(0.7) 2015-03-26: +-- tests (currently failing) for inline sequece and non-standard spacing b= etween +- block sequence dash and scalar (Anthony Sottile) +-- initial possibility (on list, i.e. CommentedSeq) to set the flow format +- explicitly +-- RoundTrip capability of flow style sequences ( 'a: b, c, d' ) +- +-(0.6.1) 2015-03-15: +-- setup.py changed so ruamel.ordereddict no longer is a dependency +- if not on CPython 2.x (used to test only for 2.x, which breaks pypy 2.5= .0 +- reported by Anthony Sottile) +- +-(0.6) 2015-03-11: +-- basic support for scalars with preserved newlines +-- html option for yaml command +-- check if yaml C library is available before trying to compile C extensi= on +-- include unreleased change in PyYAML dd 20141128 +- +-(0.5) 2015-01-14: +-- move configobj -> YAML generator to own module +-- added dependency on ruamel.base (based on feedback from Sess +- +- +-(0.4) 20141125: +-- move comment classes in own module comments +-- fix omap pre comment +-- make !!omap and !!set take parameters. There are still some restriction= s: +- - no comments before the !!tag +-- extra tests +- +-(0.3) 20141124: +-- fix value comment occuring as on previous line (looking like eol commen= t) +-- INI conversion in yaml + tests +-- (hidden) test in yaml for debugging with auto command +-- fix for missing comment in middel of simple map + test +- +-(0.2) 20141123: +-- add ext/_yaml.c etc to the source tree +-- tests for yaml to work on 2.6/3.3/3.4 +-- change install so that you can include ruamel.yaml instead of ruamel.ya= ml.py +-- add "yaml" utility with initial subcommands (test rt, from json) +- +-(0.1) 20141122: +-- merge py2 and py3 code bases +-- remove support for 2.5/3.0/3.1/3.2 (this merge relies on u"" as +- available in 3.3 and . imports not available in 2.5) +-- tox.ini for 2.7/3.4/2.6/3.3 +-- remove lib3/ and tests/lib3 directories and content +-- commit +-- correct --verbose for test application +-- DATA=3Dchanged to be relative to __file__ of code +-- DATA using os.sep +-- remove os.path from imports as os is already imported +-- have test_yaml.py exit with value 0 on success, 1 on failures, 2 on +- error +-- added support for octal integers starting with '0o' +- keep support for 01234 as well as 0o1234 +-- commit +-- added test_roundtrip_data: +- requirest a .data file and .roundtrip (empty), yaml_load .data +- and compare dump against original. +-- fix grammar as per David Pursehouse: +- https://bitbucket.org/xi/pyyaml/pull-request/5/fix-grammar-in-error-mes= sages/diff +-- http://www.json.org/ extra escaped char \/ +- add .skip-ext as libyaml is not updated +-- David Fraser: Extract a method to represent keys in mappings, so that +- a subclass can choose not to quote them, used in repesent_mapping +- https://bitbucket.org/davidfraser/pyyaml/ +-- add CommentToken and percolate through parser and composer and construc= tor +-- add Comments to wrapped mapping and sequence constructs (not to scalars) +-- generate YAML with comments +-- initial README +diff --git a/dynaconf/vendor_src/ruamel/yaml/LICENSE b/dynaconf/vendor_src= /ruamel/yaml/LICENSE +deleted file mode 100644 +index 5b863d3..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/LICENSE ++++ /dev/null +@@ -1,21 +0,0 @@ +- The MIT License (MIT) +- +- Copyright (c) 2014-2020 Anthon van der Neut, Ruamel bvba +- +- Permission is hereby granted, free of charge, to any person obtaining a = copy +- of this software and associated documentation files (the "Software"), to= deal +- in the Software without restriction, including without limitation the ri= ghts +- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- copies of the Software, and to permit persons to whom the Software is +- furnished to do so, subject to the following conditions: +- +- The above copyright notice and this permission notice shall be included = in +- all copies or substantial portions of the Software. +- +- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR +- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL = THE +- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING = FROM, +- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I= N THE +- SOFTWARE. +diff --git a/dynaconf/vendor_src/ruamel/yaml/MANIFEST.in b/dynaconf/vendor= _src/ruamel/yaml/MANIFEST.in +deleted file mode 100644 +index 1aa7798..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/MANIFEST.in ++++ /dev/null +@@ -1,3 +0,0 @@ +-include README.rst LICENSE CHANGES setup.py +-prune ext* +-prune clib* +diff --git a/dynaconf/vendor_src/ruamel/yaml/PKG-INFO b/dynaconf/vendor_sr= c/ruamel/yaml/PKG-INFO +deleted file mode 100644 +index b0ce985..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/PKG-INFO ++++ /dev/null +@@ -1,782 +0,0 @@ +-Metadata-Version: 2.1 +-Name: ruamel.yaml +-Version: 0.16.10 +-Summary: ruamel.yaml is a YAML parser/emitter that supports roundtrip pre= servation of comments, seq/map flow style, and map key order +-Home-page: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree +-Author: Anthon van der Neut +-Author-email: a.van.der.neut@ruamel.eu +-License: MIT license +-Description:=20 +- ruamel.yaml +- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +-=20=20=20=20=20=20=20=20 +- ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. +-=20=20=20=20=20=20=20=20 +- :version: 0.16.10 +- :updated: 2020-02-12 +- :documentation: http://yaml.readthedocs.io +- :repository: https://bitbucket.org/ruamel/yaml +- :pypi: https://pypi.org/project/ruamel.yaml/ +-=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- Starting with version 0.15.0 the way YAML files are loaded and du= mped +- is changing. See the API doc for details. Currently existing +- functionality will throw a warning before being changed/removed. +- **For production systems you should pin the version being used wi= th +- ``ruamel.yaml<=3D0.15``**. There might be bug fixes in the 0.14 s= eries, +- but new functionality is likely only to be available via the new = API. +-=20=20=20=20=20=20=20=20 +- If your package uses ``ruamel.yaml`` and is not listed on PyPI, d= rop +- me an email, preferably with some information on how you use the +- package (or a link to bitbucket/github) and I'll keep you informed +- when the status of the API is stable enough to make the transitio= n. +-=20=20=20=20=20=20=20=20 +- * `Overview = `_ +- * `Installing `_ +- * `Basic Usage `_ +- * `Details `_ +- * `Examples `_ +- * `API `_ +- * `Differences with PyYAML `_ +-=20=20=20=20=20=20=20=20 +- .. image:: https://readthedocs.org/projects/yaml/badge/?version= =3Dstable +- :target: https://yaml.readthedocs.org/en/stable +-=20=20=20=20=20=20=20=20 +- .. image:: https://bestpractices.coreinfrastructure.org/projects/= 1128/badge +- :target: https://bestpractices.coreinfrastructure.org/projects= /1128 +-=20=20=20=20=20=20=20=20 +- .. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/= tree/_doc/_static/license.svg?format=3Draw +- :target: https://opensource.org/licenses/MIT +-=20=20=20=20=20=20=20=20 +- .. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/= tree/_doc/_static/pypi.svg?format=3Draw +- :target: https://pypi.org/project/ruamel.yaml/ +-=20=20=20=20=20=20=20=20 +- .. image:: https://sourceforge.net/p/oitnb/code/ci/default/tree/_= doc/_static/oitnb.svg?format=3Draw +- :target: https://pypi.org/project/oitnb/ +-=20=20=20=20=20=20=20=20 +- .. image:: http://www.mypy-lang.org/static/mypy_badge.svg +- :target: http://mypy-lang.org/ +-=20=20=20=20=20=20=20=20 +- ChangeLog +- =3D=3D=3D=3D=3D=3D=3D=3D=3D +-=20=20=20=20=20=20=20=20 +- .. should insert NEXT: at the beginning of line for next key (wit= h empty line) +-=20=20=20=20=20=20=20=20 +- 0.16.10 (2020-02-12): +- - (auto) updated image references in README to sourceforge +-=20=20=20=20=20=20=20=20 +- 0.16.9 (2020-02-11): +- - update CHANGES +-=20=20=20=20=20=20=20=20 +- 0.16.8 (2020-02-11): +- - update requirements so that ruamel.yaml.clib is installed for= 3.8, +- as it has become available (via manylinux builds) +-=20=20=20=20=20=20=20=20 +- 0.16.7 (2020-01-30): +- - fix typchecking issue on TaggedScalar (reported by Jens Niels= en) +- - fix error in dumping literal scalar in sequence with comments= before element +- (reported by `EJ Etherington `__) +-=20=20=20=20=20=20=20=20 +- 0.16.6 (2020-01-20): +- - fix empty string mapping key roundtripping with preservation = of quotes as `? ''` +- (reported via email by Tomer Aharoni). +- - fix incorrect state setting in class constructor (reported by= `Douglas Raillard +- `__) +- - adjust deprecation warning test for Hashable, as that no long= er warns (reported +- by `Jason Montleon `__) +-=20=20=20=20=20=20=20=20 +- 0.16.5 (2019-08-18): +- - allow for ``YAML(typ=3D['unsafe', 'pytypes'])`` +-=20=20=20=20=20=20=20=20 +- 0.16.4 (2019-08-16): +- - fix output of TAG directives with # (reported by `Thomas Smith +- `__) +-=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- 0.16.3 (2019-08-15): +- - split construct_object +- - change stuff back to keep mypy happy +- - move setting of version based on YAML directive to scanner, a= llowing to +- check for file version during TAG directive scanning +-=20=20=20=20=20=20=20=20 +- 0.16.2 (2019-08-15): +- - preserve YAML and TAG directives on roundtrip, correctly outp= ut # +- in URL for YAML 1.2 (both reported by `Thomas Smith +- `__) +-=20=20=20=20=20=20=20=20 +- 0.16.1 (2019-08-08): +- - Force the use of new version of ruamel.yaml.clib (reported by= `Alex Joz +- `__) +- - Allow '#' in tag URI as these are allowed in YAML 1.2 (report= ed by +- `Thomas Smith +- `__) +-=20=20=20=20=20=20=20=20 +- 0.16.0 (2019-07-25): +- - split of C source that generates .so file to ruamel.yaml.clib +- - duplicate keys are now an error when working with the old API= as well +-=20=20=20=20=20=20=20=20 +- 0.15.100 (2019-07-17): +- - fixing issue with dumping deep-copied data from commented YAM= L, by +- providing both the memo parameter to __deepcopy__, and by all= owing +- startmarks to be compared on their content (reported by `Theo= filos +- Petsios +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.99 (2019-07-12): +- - add `py.typed` to distribution, based on a PR submitted by +- `Michael Crusoe +- `__ +- - merge PR 40 (also by Michael Crusoe) to more accurately speci= fy +- repository in the README (also reported in a misunderstood is= sue +- some time ago) +-=20=20=20=20=20=20=20=20 +- 0.15.98 (2019-07-09): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.12, ne= eded +- for Python 3.8.0b2 (reported by `John Vandenberg +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.97 (2019-06-06): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.10, ne= eded for +- Python 3.8.0b1 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.9, nee= ded for +- Python 3.8.0a4 (reported by `Anthony Sottile +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.96 (2019-05-16): +- - fix failure to indent comments on round-trip anchored block s= tyle +- scalars in block sequence (reported by `William Kimball +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.95 (2019-05-16): +- - fix failure to round-trip anchored scalars in block sequence +- (reported by `William Kimball +- `__) +- - wheel files for Python 3.4 no longer provided (`Python 3.4 EO= L 2019-03-18 +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.94 (2019-04-23): +- - fix missing line-break after end-of-file comments not ending = in +- line-break (reported by `Philip Thompson +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.93 (2019-04-21): +- - fix failure to parse empty implicit flow mapping key +- - in YAML 1.1 plains scalars `y`, 'n', `Y`, and 'N' are now +- correctly recognised as booleans and such strings dumped quot= ed +- (reported by `Marcel Bollmann +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.92 (2019-04-16): +- - fix failure to parse empty implicit block mapping key (report= ed by=20 +- `Nolan W `__) +-=20=20=20=20=20=20=20=20 +- 0.15.91 (2019-04-05): +- - allowing duplicate keys would not work for merge keys (report= ed by mamacdon on +- `StackOverflow `__=20 +-=20=20=20=20=20=20=20=20 +- 0.15.90 (2019-04-04): +- - fix issue with updating `CommentedMap` from list of tuples (r= eported by=20 +- `Peter Henry `__) +-=20=20=20=20=20=20=20=20 +- 0.15.89 (2019-02-27): +- - fix for items with flow-mapping in block sequence output on s= ingle line +- (reported by `Zahari Dim `= __) +- - fix for safe dumping erroring in creation of representereror = when dumping namedtuple +- (reported and solution by `Jaakko Kantoj=C3=A4rvi `__) +-=20=20=20=20=20=20=20=20 +- 0.15.88 (2019-02-12): +- - fix inclusing of python code from the subpackage data (contai= ning extra tests, +- reported by `Florian Apolloner `__) +-=20=20=20=20=20=20=20=20 +- 0.15.87 (2019-01-22): +- - fix problem with empty lists and the code to reinsert merge k= eys (reported via email=20 +- by Zaloo) +-=20=20=20=20=20=20=20=20 +- 0.15.86 (2019-01-16): +- - reinsert merge key in its old position (reported by grumbler = on +- `StackOverflow = `__) +- - fix for issue with non-ASCII anchor names (reported and fix +- provided by Dandaleon Flux via email) +- - fix for issue when parsing flow mapping value starting with c= olon (in pure Python only) +- (reported by `FichteFoll `= __) +-=20=20=20=20=20=20=20=20 +- 0.15.85 (2019-01-08): +- - the types used by ``SafeConstructor`` for mappings and sequen= ces can +- now by set by assigning to ``XXXConstructor.yaml_base_dict_ty= pe`` +- (and ``..._list_type``), preventing the need to copy two meth= ods +- with 50+ lines that had ``var =3D {}`` hardcoded. (Implement= ed to +- help solve an feature request by `Anthony Sottile +- `__ in an easier way) +-=20=20=20=20=20=20=20=20 +- 0.15.84 (2019-01-07): +- - fix for ``CommentedMap.copy()`` not returning ``CommentedMap`= `, let alone copying comments etc. +- (reported by `Anthony Sottile `__) +-=20=20=20=20=20=20=20=20 +- 0.15.83 (2019-01-02): +- - fix for bug in roundtripping aliases used as key (reported vi= a email by Zaloo) +-=20=20=20=20=20=20=20=20 +- 0.15.82 (2018-12-28): +- - anchors and aliases on scalar int, float, string and bool are= now preserved. Anchors +- do not need a referring alias for these (reported by=20 +- `Alex Harvey `__) +- - anchors no longer lost on tagged objects when roundtripping (= reported by `Zaloo=20 +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.81 (2018-12-06): +- - fix issue dumping methods of metaclass derived classes (repor= ted and fix provided +- by `Douglas Raillard = `__) +-=20=20=20=20=20=20=20=20 +- 0.15.80 (2018-11-26): +- - fix issue emitting BEL character when round-tripping invalid = folded input +- (reported by Isaac on `StackOverflow `__) +-=20=20=20=20=20=20=20=20=20=20=20=20 +- 0.15.79 (2018-11-21): +- - fix issue with anchors nested deeper than alias (reported by = gaFF on +- `StackOverflow = `__) +-=20=20=20=20=20=20=20=20 +- 0.15.78 (2018-11-15): +- - fix setup issue for 3.8 (reported by `Sidney Kuyateh=20 +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.77 (2018-11-09): +- - setting `yaml.sort_base_mapping_type_on_output =3D False`, wi= ll prevent +- explicit sorting by keys in the base representer of mappings.= Roundtrip +- already did not do this. Usage only makes real sense for Pyth= on 3.6+ +- (feature request by `Sebastian Gerber `__). +- - implement Python version check in YAML metadata in ``_test/te= st_z_data.py`` +-=20=20=20=20=20=20=20=20 +- 0.15.76 (2018-11-01): +- - fix issue with empty mapping and sequence loaded as flow-style +- (mapping reported by `Min RK `_= _, sequence +- by `Maged Ahmed `__) +-=20=20=20=20=20=20=20=20 +- 0.15.75 (2018-10-27): +- - fix issue with single '?' scalar (reported by `Terrance=20 +- `__) +- - fix issue with duplicate merge keys (prompted by `answering=20 +- `__ a=20 +- `StackOverflow question `__ +- by `math `__) +-=20=20=20=20=20=20=20=20 +- 0.15.74 (2018-10-17): +- - fix dropping of comment on rt before sequence item that is se= quence item +- (reported by `Thorsten Kampe `__) +-=20=20=20=20=20=20=20=20 +- 0.15.73 (2018-10-16): +- - fix irregular output on pre-comment in sequence within sequen= ce (reported +- by `Thorsten Kampe `__) +- - allow non-compact (i.e. next line) dumping sequence/mapping w= ithin sequence. +-=20=20=20=20=20=20=20=20 +- 0.15.72 (2018-10-06): +- - fix regression on explicit 1.1 loading with the C based scann= er/parser +- (reported by `Tomas Vavra `__) +-=20=20=20=20=20=20=20=20 +- 0.15.71 (2018-09-26): +- - some of the tests now live in YAML files in the=20 +- `yaml.data `__ reposi= tory.=20 +- ``_test/test_z_data.py`` processes these. +- - fix regression where handcrafted CommentedMaps could not be i= nitiated (reported by=20 +- `Dan Helfman `__) +- - fix regression with non-root literal scalars that needed inde= nt indicator +- (reported by `Clark Breyman `__) +- - tag:yaml.org,2002:python/object/apply now also uses __qualnam= e__ on PY3 +- (reported by `Douglas RAILLARD `__) +- - issue with self-referring object creation +- (reported and fix by `Douglas RAILLARD `__) +-=20=20=20=20=20=20=20=20 +- 0.15.70 (2018-09-21): +- - reverted CommentedMap and CommentedSeq to subclass ordereddic= t resp. list, +- reimplemented merge maps so that both ``dict(**commented_map_= instance)`` and JSON +- dumping works. This also allows checking with ``isinstance()`= ` on ``dict`` resp. ``list``. +- (Proposed by `Stuart Berg `__, with feedback +- from `blhsing `__ on +- `StackOverflow = `__) +-=20=20=20=20=20=20=20=20 +- 0.15.69 (2018-09-20): +- - fix issue with dump_all gobbling end-of-document comments on = parsing +- (reported by `Pierre B. `__) +-=20=20=20=20=20=20=20=20 +- 0.15.68 (2018-09-20): +- - fix issue with parsabel, but incorrect output with nested flo= w-style sequences +- (reported by `Dougal Seeley `= __) +- - fix issue with loading Python objects that have __setstate__ = and recursion in parameters +- (reported by `Douglas RAILLARD `__) +-=20=20=20=20=20=20=20=20 +- 0.15.67 (2018-09-19): +- - fix issue with extra space inserted with non-root literal str= ings=20 +- (Issue reported and PR with fix provided by=20 +- `Naomi Seyfer `__.) +-=20=20=20=20=20=20=20=20 +- 0.15.66 (2018-09-07): +- - fix issue with fold indicating characters inserted in safe_lo= ad-ed folded strings +- (reported by `Maximilian Hils `= __). +-=20=20=20=20=20=20=20=20 +- 0.15.65 (2018-09-07): +- - fix issue #232 revert to throw ParserError for unexcpected ``= ]`` +- and ``}`` instead of IndexError. (Issue reported and PR with = fix +- provided by `Naomi Seyfer `__= .) +- - added ``key`` and ``reverse`` parameter (suggested by Jannik = Klemm via email) +- - indent root level literal scalars that have directive or docu= ment end markers +- at the beginning of a line +-=20=20=20=20=20=20=20=20 +- 0.15.64 (2018-08-30): +- - support round-trip of tagged sequences: ``!Arg [a, {b: 1}]`` +- - single entry mappings in flow sequences now written by defaul= t without braces, +- set ``yaml.brace_single_entry_mapping_in_flow_sequence=3DTrue= `` to force +- getting ``[a, {b: 1}, {c: {d: 2}}]`` instead of the default `= `[a, b: 1, c: {d: 2}]`` +- - fix issue when roundtripping floats starting with a dot such = as ``.5`` +- (reported by `Harrison Gregg `__) +-=20=20=20=20=20=20=20=20 +- 0.15.63 (2018-08-29): +- - small fix only necessary for Windows users that don't use whe= els. +-=20=20=20=20=20=20=20=20 +- 0.15.62 (2018-08-29): +- - C based reader/scanner & emitter now allow setting of 1.2 as = YAML version. +- ** The loading/dumping is still YAML 1.1 code**, so use the c= ommon subset of +- YAML 1.2 and 1.1 (reported by `Ge Yang `__) +-=20=20=20=20=20=20=20=20 +- 0.15.61 (2018-08-23): +- - support for round-tripping folded style scalars (initially re= quested=20 +- by `Johnathan Viduchinsky `__) +- - update of C code +- - speed up of scanning (~30% depending on the input) +-=20=20=20=20=20=20=20=20 +- 0.15.60 (2018-08-18): +- - again allow single entry map in flow sequence context (report= ed by=20 +- `Lee Goolsbee `__) +- - cleanup for mypy=20 +- - spurious print in library (reported by=20 +- `Lele Gaifax `__), now automatic= ally checked=20 +-=20=20=20=20=20=20=20=20 +- 0.15.59 (2018-08-17): +- - issue with C based loader and leading zeros (reported by=20 +- `Tom Hamilton Stubber `__) +-=20=20=20=20=20=20=20=20 +- 0.15.58 (2018-08-17): +- - simple mappings can now be used as keys when round-tripping:: +-=20=20=20=20=20=20=20=20 +- {a: 1, b: 2}: hello world +-=20=20=20=20=20=20=20=20=20=20=20=20=20=20 +- although using the obvious operations (del, popitem) on the k= ey will +- fail, you can mutilate it by going through its attributes. If= you load the +- above YAML in `d`, then changing the value is cumbersome: +-=20=20=20=20=20=20=20=20 +- d =3D {CommentedKeyMap([('a', 1), ('b', 2)]): "goodbye"} +-=20=20=20=20=20=20=20=20 +- and changing the key even more so: +-=20=20=20=20=20=20=20=20 +- d[CommentedKeyMap([('b', 1), ('a', 2)])] =3D d.pop( +- CommentedKeyMap([('a', 1), ('b', 2)])) +-=20=20=20=20=20=20=20=20 +- (you can use a `dict` instead of a list of tuples (or ordered= dict), but that might result +- in a different order, of the keys of the key, in the output) +- - check integers to dump with 1.2 patterns instead of 1.1 (repo= rted by=20 +- `Lele Gaifax `__) +-=20=20=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- 0.15.57 (2018-08-15): +- - Fix that CommentedSeq could no longer be used in adding or do= a sort +- (reported by `Christopher Wright `__) +-=20=20=20=20=20=20=20=20 +- 0.15.56 (2018-08-15): +- - fix issue with ``python -O`` optimizing away code (reported, = and detailed cause +- pinpointed, by `Alex Gr=C3=B6nholm `__) +-=20=20=20=20=20=20=20=20 +- 0.15.55 (2018-08-14): +- - unmade ``CommentedSeq`` a subclass of ``list``. It is now +- indirectly a subclass of the standard +- ``collections.abc.MutableSequence`` (without .abc if you are +- still on Python2.7). If you do ``isinstance(yaml.load('[1, 2]= '), +- list)``) anywhere in your code replace ``list`` with +- ``MutableSequence``. Directly, ``CommentedSeq`` is a subclas= s of +- the abstract baseclass ``ruamel.yaml.compat.MutableScliceable= Sequence``, +- with the result that *(extended) slicing is supported on=20 +- ``CommentedSeq``*. +- (reported by `Stuart Berg `__) +- - duplicate keys (or their values) with non-ascii now correctly +- report in Python2, instead of raising a Unicode error. +- (Reported by `Jonathan Pyle `__) +-=20=20=20=20=20=20=20=20 +- 0.15.54 (2018-08-13): +- - fix issue where a comment could pop-up twice in the output (r= eported by=20 +- `Mike Kazantsev `__ and by=20 +- `Nate Peterson `__) +- - fix issue where JSON object (mapping) without spaces was not = parsed +- properly (reported by `Marc Schmidt `__) +- - fix issue where comments after empty flow-style mappings were= not emitted +- (reported by `Qinfench Chen `__) +-=20=20=20=20=20=20=20=20 +- 0.15.53 (2018-08-12): +- - fix issue with flow style mapping with comments gobbled newli= ne (reported +- by `Christopher Lambert `__) +- - fix issue where single '+' under YAML 1.2 was interpreted as +- integer, erroring out (reported by `Jethro Yu +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.52 (2018-08-09): +- - added `.copy()` mapping representation for round-tripping +- (``CommentedMap``) to fix incomplete copies of merged mappings +- (reported by `Will Richards +- `__)=20 +- - Also unmade that class a subclass of ordereddict to solve inc= orrect behaviour +- for ``{**merged-mapping}`` and ``dict(**merged-mapping)`` (re= ported independently by +- `Tim Olsson `__ and=20 +- `Filip Matzner `__) +-=20=20=20=20=20=20=20=20 +- 0.15.51 (2018-08-08): +- - Fix method name dumps (were not dotted) and loads (reported b= y `Douglas Raillard=20 +- `__) +- - Fix spurious trailing white-space caused when the comment sta= rt +- column was no longer reached and there was no actual EOL comm= ent +- (e.g. following empty line) and doing substitutions, or when +- quotes around scalars got dropped. (reported by `Thomas Guil= let +- `__) +-=20=20=20=20=20=20=20=20 +- 0.15.50 (2018-08-05): +- - Allow ``YAML()`` as a context manager for output, thereby mak= ing it much easier +- to generate multi-documents in a stream.=20 +- - Fix issue with incorrect type information for `load()` and `d= ump()` (reported=20 +- by `Jimbo Jim `__) +-=20=20=20=20=20=20=20=20 +- 0.15.49 (2018-08-05): +- - fix preservation of leading newlines in root level literal st= yle scalar, +- and preserve comment after literal style indicator (``| # so= me comment``) +- Both needed for round-tripping multi-doc streams in=20 +- `ryd `__. +-=20=20=20=20=20=20=20=20 +- 0.15.48 (2018-08-03): +- - housekeeping: ``oitnb`` for formatting, mypy 0.620 upgrade an= d conformity +-=20=20=20=20=20=20=20=20 +- 0.15.47 (2018-07-31): +- - fix broken 3.6 manylinux1, the result of an unclean ``build``= (reported by=20 +- `Roman Sichnyi `__) +-=20=20=20=20=20=20=20=20 +-=20=20=20=20=20=20=20=20 +- 0.15.46 (2018-07-29): +- - fixed DeprecationWarning for importing from ``collections`` o= n 3.7 +- (issue 210, reported by `Reinoud Elhorst +- `__). It was `difficult to f= ind +- why tox/pytest did not report +- `__ and as time +- consuming to actually `fix +- `__ the tests. +-=20=20=20=20=20=20=20=20 +- 0.15.45 (2018-07-26): +- - After adding failing test for ``YAML.load_all(Path())``, remo= ve StopIteration=20 +- (PR provided by `Zachary Buhman `__, +- also reported by `Steven Hiscocks `__. +-=20=20=20=20=20=20=20=20 +- 0.15.44 (2018-07-14): +- - Correct loading plain scalars consisting of numerals only and +- starting with `0`, when not explicitly specifying YAML version +- 1.1. This also fixes the issue about dumping string `'019'` as +- plain scalars as reported by `Min RK +- `__, that prompted this chance. +-=20=20=20=20=20=20=20=20 +- 0.15.43 (2018-07-12): +- - merge PR33: Python2.7 on Windows is narrow, but has no +- ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provi= ded by +- `Marcel Bargull `__) +- - ``register_class()`` now returns class (proposed by +- `Mike Nerone `__} +-=20=20=20=20=20=20=20=20 +- 0.15.42 (2018-07-01): +- - fix regression showing only on narrow Python 2.7 (py27mu) bui= lds +- (with help from +- `Marcel Bargull `__ and +- `Colm O'Connor `__). +- - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well= as +- 3.4/3.5/3.6/3.7/pypy +-=20=20=20=20=20=20=20=20 +- 0.15.41 (2018-06-27): +- - add detection of C-compile failure (investigation prompted by +- `StackOverlow `= __ by +- `Emmanuel Blot `__), +- which was removed while no longer dependent on ``libyaml``, C= -extensions +- compilation still needs a compiler though. +-=20=20=20=20=20=20=20=20 +- 0.15.40 (2018-06-18): +- - added links to landing places as suggested in issue 190 by +- `KostisA `__ +- - fixes issue #201: decoding unicode escaped tags on Python2, r= eported +- by `Dan Abolafia `__ +-=20=20=20=20=20=20=20=20 +- 0.15.39 (2018-06-17): +- - merge PR27 improving package startup time (and loading when r= egexp not +- actually used), provided by +- `Marcel Bargull `__ +-=20=20=20=20=20=20=20=20 +- 0.15.38 (2018-06-13): +- - fix for losing precision when roundtripping floats by +- `Rolf Wojtech `__ +- - fix for hardcoded dir separator not working for Windows by +- `Nuno Andr=C3=A9 `__ +- - typo fix by `Andrey Somov `__ +-=20=20=20=20=20=20=20=20 +- 0.15.37 (2018-03-21): +- - again trying to create installable files for 187 +-=20=20=20=20=20=20=20=20 +- 0.15.36 (2018-02-07): +- - fix issue 187, incompatibility of C extension with 3.7 (repor= ted by +- Daniel Blanchard) +-=20=20=20=20=20=20=20=20 +- 0.15.35 (2017-12-03): +- - allow ``None`` as stream when specifying ``transform`` parame= ters to +- ``YAML.dump()``. +- This is useful if the transforming function doesn't return a = meaningful value +- (inspired by `StackOverflow `__ by +- `rsaw `__). +-=20=20=20=20=20=20=20=20 +- 0.15.34 (2017-09-17): +- - fix for issue 157: CDumper not dumping floats (reported by Ja= n Smitka) +-=20=20=20=20=20=20=20=20 +- 0.15.33 (2017-08-31): +- - support for "undefined" round-tripping tagged scalar objects = (in addition to +- tagged mapping object). Inspired by a use case presented by M= atthew Patton +- on `StackOverflow `__. +- - fix issue 148: replace cryptic error message when using !!tim= estamp with an +- incorrectly formatted or non- scalar. Reported by FichteFoll. +-=20=20=20=20=20=20=20=20 +- 0.15.32 (2017-08-21): +- - allow setting ``yaml.default_flow_style =3D None`` (default: = ``False``) for +- for ``typ=3D'rt'``. +- - fix for issue 149: multiplications on ``ScalarFloat`` now ret= urn ``float`` +- (reported by jan.brezina@tul.cz) +-=20=20=20=20=20=20=20=20 +- 0.15.31 (2017-08-15): +- - fix Comment dumping +-=20=20=20=20=20=20=20=20 +- 0.15.30 (2017-08-14): +- - fix for issue with "compact JSON" not parsing: ``{"in":{},"ou= t":{}}`` +- (reported on `StackOverflow `__ by +- `mjalkio `_ +-=20=20=20=20=20=20=20=20 +- 0.15.29 (2017-08-14): +- - fix issue #51: different indents for mappings and sequences (= reported by +- Alex Harvey) +- - fix for flow sequence/mapping as element/value of block seque= nce with +- sequence-indent minus dash-offset not equal two. +-=20=20=20=20=20=20=20=20 +- 0.15.28 (2017-08-13): +- - fix issue #61: merge of merge cannot be __repr__-ed (reported= by Tal Liron) +-=20=20=20=20=20=20=20=20 +- 0.15.27 (2017-08-13): +- - fix issue 62, YAML 1.2 allows ``?`` and ``:`` in plain scalar= s if non-ambigious +- (reported by nowox) +- - fix lists within lists which would make comments disappear +-=20=20=20=20=20=20=20=20 +- 0.15.26 (2017-08-10): +- - fix for disappearing comment after empty flow sequence (repor= ted by +- oit-tzhimmash) +-=20=20=20=20=20=20=20=20 +- 0.15.25 (2017-08-09): +- - fix for problem with dumping (unloaded) floats (reported by e= yenseo) +-=20=20=20=20=20=20=20=20 +- 0.15.24 (2017-08-09): +- - added ScalarFloat which supports roundtripping of 23.1, 23.10= 0, +- 42.00E+56, 0.0, -0.0 etc. while keeping the format. Underscor= es in mantissas +- are not preserved/supported (yet, is anybody using that?). +- - (finally) fixed longstanding issue 23 (reported by `Antony So= ttile +- `__), now handling comment b= etween block +- mapping key and value correctly +- - warn on YAML 1.1 float input that is incorrect (triggered by = invalid YAML +- provided by Cecil Curry) +- - allow setting of boolean representation (`false`, `true`) by = using: +- ``yaml.boolean_representation =3D [u'False', u'True']`` +-=20=20=20=20=20=20=20=20 +- 0.15.23 (2017-08-01): +- - fix for round_tripping integers on 2.7.X > sys.maxint (report= ed by ccatterina) +-=20=20=20=20=20=20=20=20 +- 0.15.22 (2017-07-28): +- - fix for round_tripping singe excl. mark tags doubling (report= ed and fix by Jan Brezina) +-=20=20=20=20=20=20=20=20 +- 0.15.21 (2017-07-25): +- - fix for writing unicode in new API, (reported on +- `StackOverflow = `__ +-=20=20=20=20=20=20=20=20 +- 0.15.20 (2017-07-23): +- - wheels for windows including C extensions +-=20=20=20=20=20=20=20=20 +- 0.15.19 (2017-07-13): +- - added object constructor for rt, decorator ``yaml_object`` to= replace YAMLObject. +- - fix for problem using load_all with Path() instance +- - fix for load_all in combination with zero indent block style = literal +- (``pure=3DTrue`` only!) +-=20=20=20=20=20=20=20=20 +- 0.15.18 (2017-07-04): +- - missing ``pure`` attribute on ``YAML`` useful for implementin= g `!include` tag +- constructor for `including YAML files in a YAML file +- `__ +- - some documentation improvements +- - trigger of doc build on new revision +-=20=20=20=20=20=20=20=20 +- 0.15.17 (2017-07-03): +- - support for Unicode supplementary Plane **output** +- (input was already supported, triggered by +- `this `__ Stack= Overflow Q&A) +-=20=20=20=20=20=20=20=20 +- 0.15.16 (2017-07-01): +- - minor typing issues (reported and fix provided by +- `Manvendra Singh `__ +- - small doc improvements +-=20=20=20=20=20=20=20=20 +- 0.15.15 (2017-06-27): +- - fix for issue 135, typ=3D'safe' not dumping in Python 2.7 +- (reported by Andrzej Ostrowski `__) +-=20=20=20=20=20=20=20=20 +- 0.15.14 (2017-06-25): +- - fix for issue 133, in setup.py: change ModuleNotFoundError to +- ImportError (reported and fix by +- `Asley Drake `__) +-=20=20=20=20=20=20=20=20 +- 0.15.13 (2017-06-24): +- - suppress duplicate key warning on mappings with merge keys (r= eported by +- Cameron Sweeney) +-=20=20=20=20=20=20=20=20 +- 0.15.12 (2017-06-24): +- - remove fatal dependency of setup.py on wheel package (reporte= d by +- Cameron Sweeney) +-=20=20=20=20=20=20=20=20 +- 0.15.11 (2017-06-24): +- - fix for issue 130, regression in nested merge keys (reported = by +- `David Fee `__) +-=20=20=20=20=20=20=20=20 +- 0.15.10 (2017-06-23): +- - top level PreservedScalarString not indented if not explicitl= y asked to +- - remove Makefile (not very useful anyway) +- - some mypy additions +-=20=20=20=20=20=20=20=20 +- 0.15.9 (2017-06-16): +- - fix for issue 127: tagged scalars were always quoted and sepe= rated +- by a newline when in a block sequence (reported and largely f= ixed by +- `Tommy Wang `__) +-=20=20=20=20=20=20=20=20 +- 0.15.8 (2017-06-15): +- - allow plug-in install via ``install ruamel.yaml[jinja2]`` +-=20=20=20=20=20=20=20=20 +- 0.15.7 (2017-06-14): +- - add plug-in mechanism for load/dump pre resp. post-processing +-=20=20=20=20=20=20=20=20 +- 0.15.6 (2017-06-10): +- - a set() with duplicate elements now throws error in rt loading +- - support for toplevel column zero literal/folded scalar in exp= licit documents +-=20=20=20=20=20=20=20=20 +- 0.15.5 (2017-06-08): +- - repeat `load()` on a single `YAML()` instance would fail. +-=20=20=20=20=20=20=20=20 +- 0.15.4 (2017-06-08): +- - `transform` parameter on dump that expects a function taking a +- string and returning a string. This allows transformation of = the output +- before it is written to stream. This forces creation of the c= omplete output in memory! +- - some updates to the docs +-=20=20=20=20=20=20=20=20 +- 0.15.3 (2017-06-07): +- - No longer try to compile C extensions on Windows. Compilation= can be forced by setting +- the environment variable `RUAMEL_FORCE_EXT_BUILD` to some val= ue +- before starting the `pip install`. +-=20=20=20=20=20=20=20=20 +- 0.15.2 (2017-06-07): +- - update to conform to mypy 0.511: mypy --strict +-=20=20=20=20=20=20=20=20 +- 0.15.1 (2017-06-07): +- - `duplicate keys `__ +- in mappings generate an error (in the old API this change gen= erates a warning until 0.16) +- - dependecy on ruamel.ordereddict for 2.7 now via extras_require +-=20=20=20=20=20=20=20=20 +- 0.15.0 (2017-06-04): +- - it is now allowed to pass in a ``pathlib.Path`` as "stream" p= arameter to all +- load/dump functions +- - passing in a non-supported object (e.g. a string) as "stream"= will result in a +- much more meaningful YAMLStreamError. +- - assigning a normal string value to an existing CommentedMap k= ey or CommentedSeq +- element will result in a value cast to the previous value's t= ype if possible. +- - added ``YAML`` class for new API +-=20=20=20=20=20=20=20=20 +- 0.14.12 (2017-05-14): +- - fix for issue 119, deepcopy not returning subclasses (reporte= d and PR by +- Constantine Evans ) +-=20=20=20=20=20=20=20=20 +- 0.14.11 (2017-05-01): +- - fix for issue 103 allowing implicit documents after document = end marker line (``...``) +- in YAML 1.2 +-=20=20=20=20=20=20=20=20 +- 0.14.10 (2017-04-26): +- - fix problem with emitting using cyaml +-=20=20=20=20=20=20=20=20 +- 0.14.9 (2017-04-22): +- - remove dependency on ``typing`` while still supporting ``mypy= `` +- (http://stackoverflow.com/a/43516781/1307905) +- - fix unclarity in doc that stated 2.6 is supported (reported b= y feetdust) +-=20=20=20=20=20=20=20=20 +- 0.14.8 (2017-04-19): +- - fix Text not available on 3.5.0 and 3.5.1, now proactively se= tting version guards +- on all files (reported by `Jo=C3=A3o Paulo Magalh=C3=A3es `__) +-=20=20=20=20=20=20=20=20 +- 0.14.7 (2017-04-18): +- - round trip of integers (decimal, octal, hex, binary) now pres= erve +- leading zero(s) padding and underscores. Underscores are pres= umed +- to be at regular distances (i.e. ``0o12_345_67`` dumps back as +- ``0o1_23_45_67`` as the space from the last digit to the +- underscore before that is the determining factor). +-=20=20=20=20=20=20=20=20 +- 0.14.6 (2017-04-14): +- - binary, octal and hex integers are now preserved by default. = This +- was a known deficiency. Working on this was prompted by the i= ssue report (112) +- from devnoname120, as well as the additional experience with = `.replace()` +- on `scalarstring` classes. +- - fix issues 114: cannot install on Buildozer (reported by mixm= astamyk). +- Setting env. var ``RUAMEL_NO_PIP_INSTALL_CHECK`` will suppres= s ``pip``-check. +-=20=20=20=20=20=20=20=20 +- 0.14.5 (2017-04-04): +- - fix issue 109: None not dumping correctly at top level (repor= ted by Andrea Censi) +- - fix issue 110: .replace on Preserved/DoubleQuoted/SingleQuote= d ScalarString +- would give back "normal" string (reported by sandres23) +-=20=20=20=20=20=20=20=20 +- 0.14.4 (2017-03-31): +- - fix readme +-=20=20=20=20=20=20=20=20 +- 0.14.3 (2017-03-31): +- - fix for 0o52 not being a string in YAML 1.1 (reported on +- `StackOverflow Q&A 43138503 `__ by +- `Frank D `__) +-=20=20=20=20=20=20=20=20 +- 0.14.2 (2017-03-23): +- - fix for old default pip on Ubuntu 14.04 (reported by S=C3=A9b= astien Maccagnoni-Munch) +-=20=20=20=20=20=20=20=20 +- 0.14.1 (2017-03-22): +- - fix Text not available on 3.5.0 and 3.5.1 (reported by Charle= s Bouchard-L=C3=A9gar=C3=A9) +-=20=20=20=20=20=20=20=20 +- 0.14.0 (2017-03-21): +- - updates for mypy --strict +- - preparation for moving away from inheritance in Loader and Du= mper, calls from e.g. +- the Representer to the Serializer.serialize() are now done vi= a the attribute +- .serializer.serialize(). Usage of .serialize() outside of Ser= ializer will be +- deprecated soon +- - some extra tests on main.py functions +-=20=20=20=20=20=20=20=20 +- ---- +-=20=20=20=20=20=20=20=20 +- For older changes see the file +- `CHANGES `_ +-=20=20=20=20=20=20=20=20 +-Keywords: yaml 1.2 parser round-trip preserve quotes order config +-Platform: UNKNOWN +-Classifier: Development Status :: 4 - Beta +-Classifier: Intended Audience :: Developers +-Classifier: License :: OSI Approved :: MIT License +-Classifier: Operating System :: OS Independent +-Classifier: Programming Language :: Python +-Classifier: Programming Language :: Python :: 2.7 +-Classifier: Programming Language :: Python :: 3.5 +-Classifier: Programming Language :: Python :: 3.6 +-Classifier: Programming Language :: Python :: 3.7 +-Classifier: Programming Language :: Python :: 3.8 +-Classifier: Programming Language :: Python :: Implementation :: CPython +-Classifier: Programming Language :: Python :: Implementation :: Jython +-Classifier: Programming Language :: Python :: Implementation :: PyPy +-Classifier: Topic :: Software Development :: Libraries :: Python Modules +-Classifier: Topic :: Text Processing :: Markup +-Classifier: Typing :: Typed +-Description-Content-Type: text/x-rst +-Provides-Extra: docs +-Provides-Extra: jinja2 +diff --git a/dynaconf/vendor_src/ruamel/yaml/README.rst b/dynaconf/vendor_= src/ruamel/yaml/README.rst +deleted file mode 100644 +index 2a99cb9..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/README.rst ++++ /dev/null +@@ -1,752 +0,0 @@ +- +-ruamel.yaml +-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +- +-``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. +- +-:version: 0.16.10 +-:updated: 2020-02-12 +-:documentation: http://yaml.readthedocs.io +-:repository: https://bitbucket.org/ruamel/yaml +-:pypi: https://pypi.org/project/ruamel.yaml/ +- +- +-Starting with version 0.15.0 the way YAML files are loaded and dumped +-is changing. See the API doc for details. Currently existing +-functionality will throw a warning before being changed/removed. +-**For production systems you should pin the version being used with +-``ruamel.yaml<=3D0.15``**. There might be bug fixes in the 0.14 series, +-but new functionality is likely only to be available via the new API. +- +-If your package uses ``ruamel.yaml`` and is not listed on PyPI, drop +-me an email, preferably with some information on how you use the +-package (or a link to bitbucket/github) and I'll keep you informed +-when the status of the API is stable enough to make the transition. +- +-* `Overview `_ +-* `Installing `_ +-* `Basic Usage `_ +-* `Details `_ +-* `Examples `_ +-* `API `_ +-* `Differences with PyYAML `_ +- +-.. image:: https://readthedocs.org/projects/yaml/badge/?version=3Dstable +- :target: https://yaml.readthedocs.org/en/stable +- +-.. image:: https://bestpractices.coreinfrastructure.org/projects/1128/bad= ge +- :target: https://bestpractices.coreinfrastructure.org/projects/1128 +- +-.. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/_do= c/_static/license.svg?format=3Draw +- :target: https://opensource.org/licenses/MIT +- +-.. image:: https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/_do= c/_static/pypi.svg?format=3Draw +- :target: https://pypi.org/project/ruamel.yaml/ +- +-.. image:: https://sourceforge.net/p/oitnb/code/ci/default/tree/_doc/_sta= tic/oitnb.svg?format=3Draw +- :target: https://pypi.org/project/oitnb/ +- +-.. image:: http://www.mypy-lang.org/static/mypy_badge.svg +- :target: http://mypy-lang.org/ +- +-ChangeLog +-=3D=3D=3D=3D=3D=3D=3D=3D=3D +- +-.. should insert NEXT: at the beginning of line for next key (with empty = line) +- +-0.16.10 (2020-02-12): +- - (auto) updated image references in README to sourceforge +- +-0.16.9 (2020-02-11): +- - update CHANGES +- +-0.16.8 (2020-02-11): +- - update requirements so that ruamel.yaml.clib is installed for 3.8, +- as it has become available (via manylinux builds) +- +-0.16.7 (2020-01-30): +- - fix typchecking issue on TaggedScalar (reported by Jens Nielsen) +- - fix error in dumping literal scalar in sequence with comments before = element +- (reported by `EJ Etherington `__) +- +-0.16.6 (2020-01-20): +- - fix empty string mapping key roundtripping with preservation of quote= s as `? ''` +- (reported via email by Tomer Aharoni). +- - fix incorrect state setting in class constructor (reported by `Dougla= s Raillard +- `_= _) +- - adjust deprecation warning test for Hashable, as that no longer warns= (reported +- by `Jason Montleon `__) +- +-0.16.5 (2019-08-18): +- - allow for ``YAML(typ=3D['unsafe', 'pytypes'])`` +- +-0.16.4 (2019-08-16): +- - fix output of TAG directives with # (reported by `Thomas Smith +- `_= _) +- +- +-0.16.3 (2019-08-15): +- - split construct_object +- - change stuff back to keep mypy happy +- - move setting of version based on YAML directive to scanner, allowing = to +- check for file version during TAG directive scanning +- +-0.16.2 (2019-08-15): +- - preserve YAML and TAG directives on roundtrip, correctly output # +- in URL for YAML 1.2 (both reported by `Thomas Smith +- `_= _) +- +-0.16.1 (2019-08-08): +- - Force the use of new version of ruamel.yaml.clib (reported by `Alex J= oz +- `_= _) +- - Allow '#' in tag URI as these are allowed in YAML 1.2 (reported by +- `Thomas Smith +- `_= _) +- +-0.16.0 (2019-07-25): +- - split of C source that generates .so file to ruamel.yaml.clib +- - duplicate keys are now an error when working with the old API as well +- +-0.15.100 (2019-07-17): +- - fixing issue with dumping deep-copied data from commented YAML, by +- providing both the memo parameter to __deepcopy__, and by allowing +- startmarks to be compared on their content (reported by `Theofilos +- Petsios +- `_= _) +- +-0.15.99 (2019-07-12): +- - add `py.typed` to distribution, based on a PR submitted by +- `Michael Crusoe +- `__ +- - merge PR 40 (also by Michael Crusoe) to more accurately specify +- repository in the README (also reported in a misunderstood issue +- some time ago) +- +-0.15.98 (2019-07-09): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.12, needed +- for Python 3.8.0b2 (reported by `John Vandenberg +- `_= _) +- +-0.15.97 (2019-06-06): +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.10, needed for +- Python 3.8.0b1 +- - regenerate ext/_ruamel_yaml.c with Cython version 0.29.9, needed for +- Python 3.8.0a4 (reported by `Anthony Sottile +- `_= _) +- +-0.15.96 (2019-05-16): +- - fix failure to indent comments on round-trip anchored block style +- scalars in block sequence (reported by `William Kimball +- `_= _) +- +-0.15.95 (2019-05-16): +- - fix failure to round-trip anchored scalars in block sequence +- (reported by `William Kimball +- `_= _) +- - wheel files for Python 3.4 no longer provided (`Python 3.4 EOL 2019-0= 3-18 +- `__) +- +-0.15.94 (2019-04-23): +- - fix missing line-break after end-of-file comments not ending in +- line-break (reported by `Philip Thompson +- `_= _) +- +-0.15.93 (2019-04-21): +- - fix failure to parse empty implicit flow mapping key +- - in YAML 1.1 plains scalars `y`, 'n', `Y`, and 'N' are now +- correctly recognised as booleans and such strings dumped quoted +- (reported by `Marcel Bollmann +- `_= _) +- +-0.15.92 (2019-04-16): +- - fix failure to parse empty implicit block mapping key (reported by=20 +- `Nolan W `__) +- +-0.15.91 (2019-04-05): +- - allowing duplicate keys would not work for merge keys (reported by ma= macdon on +- `StackOverflow `__=20 +- +-0.15.90 (2019-04-04): +- - fix issue with updating `CommentedMap` from list of tuples (reported = by=20 +- `Peter Henry `__) +- +-0.15.89 (2019-02-27): +- - fix for items with flow-mapping in block sequence output on single li= ne +- (reported by `Zahari Dim `__) +- - fix for safe dumping erroring in creation of representereror when dum= ping namedtuple +- (reported and solution by `Jaakko Kantoj=C3=A4rvi `__) +- +-0.15.88 (2019-02-12): +- - fix inclusing of python code from the subpackage data (containing ext= ra tests, +- reported by `Florian Apolloner `__) +- +-0.15.87 (2019-01-22): +- - fix problem with empty lists and the code to reinsert merge keys (rep= orted via email=20 +- by Zaloo) +- +-0.15.86 (2019-01-16): +- - reinsert merge key in its old position (reported by grumbler on +- `StackOverflow `__) +- - fix for issue with non-ASCII anchor names (reported and fix +- provided by Dandaleon Flux via email) +- - fix for issue when parsing flow mapping value starting with colon (in= pure Python only) +- (reported by `FichteFoll `__) +- +-0.15.85 (2019-01-08): +- - the types used by ``SafeConstructor`` for mappings and sequences can +- now by set by assigning to ``XXXConstructor.yaml_base_dict_type`` +- (and ``..._list_type``), preventing the need to copy two methods +- with 50+ lines that had ``var =3D {}`` hardcoded. (Implemented to +- help solve an feature request by `Anthony Sottile +- `__ in an easier way) +- +-0.15.84 (2019-01-07): +- - fix for ``CommentedMap.copy()`` not returning ``CommentedMap``, let a= lone copying comments etc. +- (reported by `Anthony Sottile `__) +- +-0.15.83 (2019-01-02): +- - fix for bug in roundtripping aliases used as key (reported via email = by Zaloo) +- +-0.15.82 (2018-12-28): +- - anchors and aliases on scalar int, float, string and bool are now pre= served. Anchors +- do not need a referring alias for these (reported by=20 +- `Alex Harvey `__) +- - anchors no longer lost on tagged objects when roundtripping (reported= by `Zaloo=20 +- `__) +- +-0.15.81 (2018-12-06): +- - fix issue dumping methods of metaclass derived classes (reported and = fix provided +- by `Douglas Raillard `__) +- +-0.15.80 (2018-11-26): +- - fix issue emitting BEL character when round-tripping invalid folded i= nput +- (reported by Isaac on `StackOverflow `__) +-=20=20=20=20 +-0.15.79 (2018-11-21): +- - fix issue with anchors nested deeper than alias (reported by gaFF on +- `StackOverflow `__) +- +-0.15.78 (2018-11-15): +- - fix setup issue for 3.8 (reported by `Sidney Kuyateh=20 +- `__) +- +-0.15.77 (2018-11-09): +- - setting `yaml.sort_base_mapping_type_on_output =3D False`, will preve= nt +- explicit sorting by keys in the base representer of mappings. Roundtr= ip +- already did not do this. Usage only makes real sense for Python 3.6+ +- (feature request by `Sebastian Gerber `__). +- - implement Python version check in YAML metadata in ``_test/test_z_dat= a.py`` +- +-0.15.76 (2018-11-01): +- - fix issue with empty mapping and sequence loaded as flow-style +- (mapping reported by `Min RK `__, seque= nce +- by `Maged Ahmed `__) +- +-0.15.75 (2018-10-27): +- - fix issue with single '?' scalar (reported by `Terrance=20 +- `__) +- - fix issue with duplicate merge keys (prompted by `answering=20 +- `__ a=20 +- `StackOverflow question `__ +- by `math `__) +- +-0.15.74 (2018-10-17): +- - fix dropping of comment on rt before sequence item that is sequence i= tem +- (reported by `Thorsten Kampe `_= _) +- +-0.15.73 (2018-10-16): +- - fix irregular output on pre-comment in sequence within sequence (repo= rted +- by `Thorsten Kampe `__) +- - allow non-compact (i.e. next line) dumping sequence/mapping within se= quence. +- +-0.15.72 (2018-10-06): +- - fix regression on explicit 1.1 loading with the C based scanner/parser +- (reported by `Tomas Vavra `__) +- +-0.15.71 (2018-09-26): +- - some of the tests now live in YAML files in the=20 +- `yaml.data `__ repository.=20 +- ``_test/test_z_data.py`` processes these. +- - fix regression where handcrafted CommentedMaps could not be initiated= (reported by=20 +- `Dan Helfman `__) +- - fix regression with non-root literal scalars that needed indent indic= ator +- (reported by `Clark Breyman `__) +- - tag:yaml.org,2002:python/object/apply now also uses __qualname__ on P= Y3 +- (reported by `Douglas RAILLARD `__) +- - issue with self-referring object creation +- (reported and fix by `Douglas RAILLARD `__) +- +-0.15.70 (2018-09-21): +- - reverted CommentedMap and CommentedSeq to subclass ordereddict resp. = list, +- reimplemented merge maps so that both ``dict(**commented_map_instance= )`` and JSON +- dumping works. This also allows checking with ``isinstance()`` on ``d= ict`` resp. ``list``. +- (Proposed by `Stuart Berg `__, wi= th feedback +- from `blhsing `__ on +- `StackOverflow `__) +- +-0.15.69 (2018-09-20): +- - fix issue with dump_all gobbling end-of-document comments on parsing +- (reported by `Pierre B. `__) +- +-0.15.68 (2018-09-20): +- - fix issue with parsabel, but incorrect output with nested flow-style = sequences +- (reported by `Dougal Seeley `__) +- - fix issue with loading Python objects that have __setstate__ and recu= rsion in parameters +- (reported by `Douglas RAILLARD `__) +- +-0.15.67 (2018-09-19): +- - fix issue with extra space inserted with non-root literal strings=20 +- (Issue reported and PR with fix provided by=20 +- `Naomi Seyfer `__.) +- +-0.15.66 (2018-09-07): +- - fix issue with fold indicating characters inserted in safe_load-ed fo= lded strings +- (reported by `Maximilian Hils `__). +- +-0.15.65 (2018-09-07): +- - fix issue #232 revert to throw ParserError for unexcpected ``]`` +- and ``}`` instead of IndexError. (Issue reported and PR with fix +- provided by `Naomi Seyfer `__.) +- - added ``key`` and ``reverse`` parameter (suggested by Jannik Klemm vi= a email) +- - indent root level literal scalars that have directive or document end= markers +- at the beginning of a line +- +-0.15.64 (2018-08-30): +- - support round-trip of tagged sequences: ``!Arg [a, {b: 1}]`` +- - single entry mappings in flow sequences now written by default withou= t braces, +- set ``yaml.brace_single_entry_mapping_in_flow_sequence=3DTrue`` to fo= rce +- getting ``[a, {b: 1}, {c: {d: 2}}]`` instead of the default ``[a, b: = 1, c: {d: 2}]`` +- - fix issue when roundtripping floats starting with a dot such as ``.5`` +- (reported by `Harrison Gregg `_= _) +- +-0.15.63 (2018-08-29): +- - small fix only necessary for Windows users that don't use wheels. +- +-0.15.62 (2018-08-29): +- - C based reader/scanner & emitter now allow setting of 1.2 as YAML ver= sion. +- ** The loading/dumping is still YAML 1.1 code**, so use the common su= bset of +- YAML 1.2 and 1.1 (reported by `Ge Yang `__) +- +-0.15.61 (2018-08-23): +- - support for round-tripping folded style scalars (initially requested= =20 +- by `Johnathan Viduchinsky `__) +- - update of C code +- - speed up of scanning (~30% depending on the input) +- +-0.15.60 (2018-08-18): +- - again allow single entry map in flow sequence context (reported by=20 +- `Lee Goolsbee `__) +- - cleanup for mypy=20 +- - spurious print in library (reported by=20 +- `Lele Gaifax `__), now automatically che= cked=20 +- +-0.15.59 (2018-08-17): +- - issue with C based loader and leading zeros (reported by=20 +- `Tom Hamilton Stubber `__) +- +-0.15.58 (2018-08-17): +- - simple mappings can now be used as keys when round-tripping:: +- +- {a: 1, b: 2}: hello world +-=20=20=20=20=20=20 +- although using the obvious operations (del, popitem) on the key will +- fail, you can mutilate it by going through its attributes. If you loa= d the +- above YAML in `d`, then changing the value is cumbersome: +- +- d =3D {CommentedKeyMap([('a', 1), ('b', 2)]): "goodbye"} +- +- and changing the key even more so: +- +- d[CommentedKeyMap([('b', 1), ('a', 2)])] =3D d.pop( +- CommentedKeyMap([('a', 1), ('b', 2)])) +- +- (you can use a `dict` instead of a list of tuples (or ordereddict), b= ut that might result +- in a different order, of the keys of the key, in the output) +- - check integers to dump with 1.2 patterns instead of 1.1 (reported by= =20 +- `Lele Gaifax `__) +-=20=20 +- +-0.15.57 (2018-08-15): +- - Fix that CommentedSeq could no longer be used in adding or do a sort +- (reported by `Christopher Wright `__) +- +-0.15.56 (2018-08-15): +- - fix issue with ``python -O`` optimizing away code (reported, and deta= iled cause +- pinpointed, by `Alex Gr=C3=B6nholm = `__) +- +-0.15.55 (2018-08-14): +- - unmade ``CommentedSeq`` a subclass of ``list``. It is now +- indirectly a subclass of the standard +- ``collections.abc.MutableSequence`` (without .abc if you are +- still on Python2.7). If you do ``isinstance(yaml.load('[1, 2]'), +- list)``) anywhere in your code replace ``list`` with +- ``MutableSequence``. Directly, ``CommentedSeq`` is a subclass of +- the abstract baseclass ``ruamel.yaml.compat.MutableScliceableSequence= ``, +- with the result that *(extended) slicing is supported on=20 +- ``CommentedSeq``*. +- (reported by `Stuart Berg `__) +- - duplicate keys (or their values) with non-ascii now correctly +- report in Python2, instead of raising a Unicode error. +- (Reported by `Jonathan Pyle `__) +- +-0.15.54 (2018-08-13): +- - fix issue where a comment could pop-up twice in the output (reported = by=20 +- `Mike Kazantsev `__ and by=20 +- `Nate Peterson `__) +- - fix issue where JSON object (mapping) without spaces was not parsed +- properly (reported by `Marc Schmidt `__) +- - fix issue where comments after empty flow-style mappings were not emi= tted +- (reported by `Qinfench Chen `__) +- +-0.15.53 (2018-08-12): +- - fix issue with flow style mapping with comments gobbled newline (repo= rted +- by `Christopher Lambert `__) +- - fix issue where single '+' under YAML 1.2 was interpreted as +- integer, erroring out (reported by `Jethro Yu +- `__) +- +-0.15.52 (2018-08-09): +- - added `.copy()` mapping representation for round-tripping +- (``CommentedMap``) to fix incomplete copies of merged mappings +- (reported by `Will Richards +- `__)=20 +- - Also unmade that class a subclass of ordereddict to solve incorrect b= ehaviour +- for ``{**merged-mapping}`` and ``dict(**merged-mapping)`` (reported i= ndependently by +- `Tim Olsson `__ and=20 +- `Filip Matzner `__) +- +-0.15.51 (2018-08-08): +- - Fix method name dumps (were not dotted) and loads (reported by `Dougl= as Raillard=20 +- `__) +- - Fix spurious trailing white-space caused when the comment start +- column was no longer reached and there was no actual EOL comment +- (e.g. following empty line) and doing substitutions, or when +- quotes around scalars got dropped. (reported by `Thomas Guillet +- `__) +- +-0.15.50 (2018-08-05): +- - Allow ``YAML()`` as a context manager for output, thereby making it m= uch easier +- to generate multi-documents in a stream.=20 +- - Fix issue with incorrect type information for `load()` and `dump()` (= reported=20 +- by `Jimbo Jim `__) +- +-0.15.49 (2018-08-05): +- - fix preservation of leading newlines in root level literal style scal= ar, +- and preserve comment after literal style indicator (``| # some comme= nt``) +- Both needed for round-tripping multi-doc streams in=20 +- `ryd `__. +- +-0.15.48 (2018-08-03): +- - housekeeping: ``oitnb`` for formatting, mypy 0.620 upgrade and confor= mity +- +-0.15.47 (2018-07-31): +- - fix broken 3.6 manylinux1, the result of an unclean ``build`` (report= ed by=20 +- `Roman Sichnyi `__) +- +- +-0.15.46 (2018-07-29): +- - fixed DeprecationWarning for importing from ``collections`` on 3.7 +- (issue 210, reported by `Reinoud Elhorst +- `__). It was `difficult to find +- why tox/pytest did not report +- `__ and as time +- consuming to actually `fix +- `__ the tests. +- +-0.15.45 (2018-07-26): +- - After adding failing test for ``YAML.load_all(Path())``, remove StopI= teration=20 +- (PR provided by `Zachary Buhman `__, +- also reported by `Steven Hiscocks = `__. +- +-0.15.44 (2018-07-14): +- - Correct loading plain scalars consisting of numerals only and +- starting with `0`, when not explicitly specifying YAML version +- 1.1. This also fixes the issue about dumping string `'019'` as +- plain scalars as reported by `Min RK +- `__, that prompted this chance. +- +-0.15.43 (2018-07-12): +- - merge PR33: Python2.7 on Windows is narrow, but has no +- ``sysconfig.get_config_var('Py_UNICODE_SIZE')``. (merge provided by +- `Marcel Bargull `__) +- - ``register_class()`` now returns class (proposed by +- `Mike Nerone `__} +- +-0.15.42 (2018-07-01): +- - fix regression showing only on narrow Python 2.7 (py27mu) builds +- (with help from +- `Marcel Bargull `__ and +- `Colm O'Connor `__). +- - run pre-commit ``tox`` on Python 2.7 wide and narrow, as well as +- 3.4/3.5/3.6/3.7/pypy +- +-0.15.41 (2018-06-27): +- - add detection of C-compile failure (investigation prompted by +- `StackOverlow `__ by +- `Emmanuel Blot `__), +- which was removed while no longer dependent on ``libyaml``, C-extensi= ons +- compilation still needs a compiler though. +- +-0.15.40 (2018-06-18): +- - added links to landing places as suggested in issue 190 by +- `KostisA `__ +- - fixes issue #201: decoding unicode escaped tags on Python2, reported +- by `Dan Abolafia `__ +- +-0.15.39 (2018-06-17): +- - merge PR27 improving package startup time (and loading when regexp not +- actually used), provided by +- `Marcel Bargull `__ +- +-0.15.38 (2018-06-13): +- - fix for losing precision when roundtripping floats by +- `Rolf Wojtech `__ +- - fix for hardcoded dir separator not working for Windows by +- `Nuno Andr=C3=A9 `__ +- - typo fix by `Andrey Somov `__ +- +-0.15.37 (2018-03-21): +- - again trying to create installable files for 187 +- +-0.15.36 (2018-02-07): +- - fix issue 187, incompatibility of C extension with 3.7 (reported by +- Daniel Blanchard) +- +-0.15.35 (2017-12-03): +- - allow ``None`` as stream when specifying ``transform`` parameters to +- ``YAML.dump()``. +- This is useful if the transforming function doesn't return a meaningf= ul value +- (inspired by `StackOverflow `__ by +- `rsaw `__). +- +-0.15.34 (2017-09-17): +- - fix for issue 157: CDumper not dumping floats (reported by Jan Smitka) +- +-0.15.33 (2017-08-31): +- - support for "undefined" round-tripping tagged scalar objects (in addi= tion to +- tagged mapping object). Inspired by a use case presented by Matthew P= atton +- on `StackOverflow `__. +- - fix issue 148: replace cryptic error message when using !!timestamp w= ith an +- incorrectly formatted or non- scalar. Reported by FichteFoll. +- +-0.15.32 (2017-08-21): +- - allow setting ``yaml.default_flow_style =3D None`` (default: ``False`= `) for +- for ``typ=3D'rt'``. +- - fix for issue 149: multiplications on ``ScalarFloat`` now return ``fl= oat`` +- (reported by jan.brezina@tul.cz) +- +-0.15.31 (2017-08-15): +- - fix Comment dumping +- +-0.15.30 (2017-08-14): +- - fix for issue with "compact JSON" not parsing: ``{"in":{},"out":{}}`` +- (reported on `StackOverflow `__ by +- `mjalkio `_ +- +-0.15.29 (2017-08-14): +- - fix issue #51: different indents for mappings and sequences (reported= by +- Alex Harvey) +- - fix for flow sequence/mapping as element/value of block sequence with +- sequence-indent minus dash-offset not equal two. +- +-0.15.28 (2017-08-13): +- - fix issue #61: merge of merge cannot be __repr__-ed (reported by Tal = Liron) +- +-0.15.27 (2017-08-13): +- - fix issue 62, YAML 1.2 allows ``?`` and ``:`` in plain scalars if non= -ambigious +- (reported by nowox) +- - fix lists within lists which would make comments disappear +- +-0.15.26 (2017-08-10): +- - fix for disappearing comment after empty flow sequence (reported by +- oit-tzhimmash) +- +-0.15.25 (2017-08-09): +- - fix for problem with dumping (unloaded) floats (reported by eyenseo) +- +-0.15.24 (2017-08-09): +- - added ScalarFloat which supports roundtripping of 23.1, 23.100, +- 42.00E+56, 0.0, -0.0 etc. while keeping the format. Underscores in ma= ntissas +- are not preserved/supported (yet, is anybody using that?). +- - (finally) fixed longstanding issue 23 (reported by `Antony Sottile +- `__), now handling comment between b= lock +- mapping key and value correctly +- - warn on YAML 1.1 float input that is incorrect (triggered by invalid = YAML +- provided by Cecil Curry) +- - allow setting of boolean representation (`false`, `true`) by using: +- ``yaml.boolean_representation =3D [u'False', u'True']`` +- +-0.15.23 (2017-08-01): +- - fix for round_tripping integers on 2.7.X > sys.maxint (reported by cc= atterina) +- +-0.15.22 (2017-07-28): +- - fix for round_tripping singe excl. mark tags doubling (reported and f= ix by Jan Brezina) +- +-0.15.21 (2017-07-25): +- - fix for writing unicode in new API, (reported on +- `StackOverflow `__ +- +-0.15.20 (2017-07-23): +- - wheels for windows including C extensions +- +-0.15.19 (2017-07-13): +- - added object constructor for rt, decorator ``yaml_object`` to replace= YAMLObject. +- - fix for problem using load_all with Path() instance +- - fix for load_all in combination with zero indent block style literal +- (``pure=3DTrue`` only!) +- +-0.15.18 (2017-07-04): +- - missing ``pure`` attribute on ``YAML`` useful for implementing `!incl= ude` tag +- constructor for `including YAML files in a YAML file +- `__ +- - some documentation improvements +- - trigger of doc build on new revision +- +-0.15.17 (2017-07-03): +- - support for Unicode supplementary Plane **output** +- (input was already supported, triggered by +- `this `__ Stack Overflo= w Q&A) +- +-0.15.16 (2017-07-01): +- - minor typing issues (reported and fix provided by +- `Manvendra Singh `__ +- - small doc improvements +- +-0.15.15 (2017-06-27): +- - fix for issue 135, typ=3D'safe' not dumping in Python 2.7 +- (reported by Andrzej Ostrowski `__) +- +-0.15.14 (2017-06-25): +- - fix for issue 133, in setup.py: change ModuleNotFoundError to +- ImportError (reported and fix by +- `Asley Drake `__) +- +-0.15.13 (2017-06-24): +- - suppress duplicate key warning on mappings with merge keys (reported = by +- Cameron Sweeney) +- +-0.15.12 (2017-06-24): +- - remove fatal dependency of setup.py on wheel package (reported by +- Cameron Sweeney) +- +-0.15.11 (2017-06-24): +- - fix for issue 130, regression in nested merge keys (reported by +- `David Fee `__) +- +-0.15.10 (2017-06-23): +- - top level PreservedScalarString not indented if not explicitly asked = to +- - remove Makefile (not very useful anyway) +- - some mypy additions +- +-0.15.9 (2017-06-16): +- - fix for issue 127: tagged scalars were always quoted and seperated +- by a newline when in a block sequence (reported and largely fixed by +- `Tommy Wang `__) +- +-0.15.8 (2017-06-15): +- - allow plug-in install via ``install ruamel.yaml[jinja2]`` +- +-0.15.7 (2017-06-14): +- - add plug-in mechanism for load/dump pre resp. post-processing +- +-0.15.6 (2017-06-10): +- - a set() with duplicate elements now throws error in rt loading +- - support for toplevel column zero literal/folded scalar in explicit do= cuments +- +-0.15.5 (2017-06-08): +- - repeat `load()` on a single `YAML()` instance would fail. +- +-0.15.4 (2017-06-08): +- - `transform` parameter on dump that expects a function taking a +- string and returning a string. This allows transformation of the outp= ut +- before it is written to stream. This forces creation of the complete = output in memory! +- - some updates to the docs +- +-0.15.3 (2017-06-07): +- - No longer try to compile C extensions on Windows. Compilation can be = forced by setting +- the environment variable `RUAMEL_FORCE_EXT_BUILD` to some value +- before starting the `pip install`. +- +-0.15.2 (2017-06-07): +- - update to conform to mypy 0.511: mypy --strict +- +-0.15.1 (2017-06-07): +- - `duplicate keys `__ +- in mappings generate an error (in the old API this change generates a= warning until 0.16) +- - dependecy on ruamel.ordereddict for 2.7 now via extras_require +- +-0.15.0 (2017-06-04): +- - it is now allowed to pass in a ``pathlib.Path`` as "stream" parameter= to all +- load/dump functions +- - passing in a non-supported object (e.g. a string) as "stream" will re= sult in a +- much more meaningful YAMLStreamError. +- - assigning a normal string value to an existing CommentedMap key or Co= mmentedSeq +- element will result in a value cast to the previous value's type if p= ossible. +- - added ``YAML`` class for new API +- +-0.14.12 (2017-05-14): +- - fix for issue 119, deepcopy not returning subclasses (reported and PR= by +- Constantine Evans ) +- +-0.14.11 (2017-05-01): +- - fix for issue 103 allowing implicit documents after document end mark= er line (``...``) +- in YAML 1.2 +- +-0.14.10 (2017-04-26): +- - fix problem with emitting using cyaml +- +-0.14.9 (2017-04-22): +- - remove dependency on ``typing`` while still supporting ``mypy`` +- (http://stackoverflow.com/a/43516781/1307905) +- - fix unclarity in doc that stated 2.6 is supported (reported by feetdu= st) +- +-0.14.8 (2017-04-19): +- - fix Text not available on 3.5.0 and 3.5.1, now proactively setting ve= rsion guards +- on all files (reported by `Jo=C3=A3o Paulo Magalh=C3=A3es `__) +- +-0.14.7 (2017-04-18): +- - round trip of integers (decimal, octal, hex, binary) now preserve +- leading zero(s) padding and underscores. Underscores are presumed +- to be at regular distances (i.e. ``0o12_345_67`` dumps back as +- ``0o1_23_45_67`` as the space from the last digit to the +- underscore before that is the determining factor). +- +-0.14.6 (2017-04-14): +- - binary, octal and hex integers are now preserved by default. This +- was a known deficiency. Working on this was prompted by the issue rep= ort (112) +- from devnoname120, as well as the additional experience with `.replac= e()` +- on `scalarstring` classes. +- - fix issues 114: cannot install on Buildozer (reported by mixmastamyk). +- Setting env. var ``RUAMEL_NO_PIP_INSTALL_CHECK`` will suppress ``pip`= `-check. +- +-0.14.5 (2017-04-04): +- - fix issue 109: None not dumping correctly at top level (reported by A= ndrea Censi) +- - fix issue 110: .replace on Preserved/DoubleQuoted/SingleQuoted Scalar= String +- would give back "normal" string (reported by sandres23) +- +-0.14.4 (2017-03-31): +- - fix readme +- +-0.14.3 (2017-03-31): +- - fix for 0o52 not being a string in YAML 1.1 (reported on +- `StackOverflow Q&A 43138503 `__ by +- `Frank D `__) +- +-0.14.2 (2017-03-23): +- - fix for old default pip on Ubuntu 14.04 (reported by S=C3=A9bastien M= accagnoni-Munch) +- +-0.14.1 (2017-03-22): +- - fix Text not available on 3.5.0 and 3.5.1 (reported by Charles Boucha= rd-L=C3=A9gar=C3=A9) +- +-0.14.0 (2017-03-21): +- - updates for mypy --strict +- - preparation for moving away from inheritance in Loader and Dumper, ca= lls from e.g. +- the Representer to the Serializer.serialize() are now done via the at= tribute +- .serializer.serialize(). Usage of .serialize() outside of Serializer = will be +- deprecated soon +- - some extra tests on main.py functions +- +----- +- +-For older changes see the file +-`CHANGES `_ +diff --git a/dynaconf/vendor_src/ruamel/yaml/__init__.py b/dynaconf/vendor= _src/ruamel/yaml/__init__.py +deleted file mode 100644 +index 8663a56..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/__init__.py ++++ /dev/null +@@ -1,60 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-if False: # MYPY +- from typing import Dict, Any # NOQA +- +-_package_data =3D dict( +- full_package_name=3D'ruamel.yaml', +- version_info=3D(0, 16, 10), +- __version__=3D'0.16.10', +- author=3D'Anthon van der Neut', +- author_email=3D'a.van.der.neut@ruamel.eu', +- description=3D'ruamel.yaml is a YAML parser/emitter that supports rou= ndtrip preservation of comments, seq/map flow style, and map key order', #= NOQA +- entry_points=3DNone, +- since=3D2014, +- extras_require=3D{':platform_python_implementation=3D=3D"CPython" and= python_version<=3D"2.7"': [ +- 'ruamel.ordereddict', +- ], ':platform_python_implementation=3D=3D"CPython" and python_ver= sion<"3.9"': [ +- 'ruamel.yaml.clib>=3D0.1.2', +- ], 'jinja2': ['ruamel.yaml.jinja2>=3D0.2'], 'docs': ['ryd']}, +- # NOQA +- # test=3D'#include "ext/yaml.h"\n\nint main(int argc, char* argv[])\n= {\nyaml_parser_t parser;\nparser =3D parser; /* prevent warning */\nreturn= 0;\n}\n', # NOQA +- classifiers=3D[ +- 'Programming Language :: Python :: 2.7', +- 'Programming Language :: Python :: 3.5', +- 'Programming Language :: Python :: 3.6', +- 'Programming Language :: Python :: 3.7', +- 'Programming Language :: Python :: 3.8', +- 'Programming Language :: Python :: Implementation :: CPython', +- 'Programming Language :: Python :: Implementation :: PyPy', +- 'Programming Language :: Python :: Implementation :: Jython', +- 'Topic :: Software Development :: Libraries :: Python Modules= ', +- 'Topic :: Text Processing :: Markup', +- 'Typing :: Typed', +- ], +- keywords=3D'yaml 1.2 parser round-trip preserve quotes order config', +- read_the_docs=3D'yaml', +- supported=3D[(2, 7), (3, 5)], # minimum +- tox=3Ddict( +- env=3D'*', # remove 'pn', no longer test narrow Python 2.7 for u= nicode patterns and PyPy +- deps=3D'ruamel.std.pathlib', +- fl8excl=3D'_test/lib', +- ), +- universal=3DTrue, +- rtfd=3D'yaml', +-) # type: Dict[Any, Any] +- +- +-version_info =3D _package_data['version_info'] +-__version__ =3D _package_data['__version__'] +- +-try: +- from .cyaml import * # NOQA +- +- __with_libyaml__ =3D True +-except (ImportError, ValueError): # for Jython +- __with_libyaml__ =3D False +- +-from dynaconf.vendor.ruamel.yaml.main import * # NOQA +diff --git a/dynaconf/vendor_src/ruamel/yaml/anchor.py b/dynaconf/vendor_s= rc/ruamel/yaml/anchor.py +deleted file mode 100644 +index aa649f5..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/anchor.py ++++ /dev/null +@@ -1,20 +0,0 @@ +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Union, Optional, Iterat= or # NOQA +- +-anchor_attrib =3D '_yaml_anchor' +- +- +-class Anchor(object): +- __slots__ =3D 'value', 'always_dump' +- attrib =3D anchor_attrib +- +- def __init__(self): +- # type: () -> None +- self.value =3D None +- self.always_dump =3D False +- +- def __repr__(self): +- # type: () -> Any +- ad =3D ', (always dump)' if self.always_dump else "" +- return 'Anchor({!r}{})'.format(self.value, ad) +diff --git a/dynaconf/vendor_src/ruamel/yaml/comments.py b/dynaconf/vendor= _src/ruamel/yaml/comments.py +deleted file mode 100644 +index 1ca210a..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/comments.py ++++ /dev/null +@@ -1,1149 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import, print_function +- +-""" +-stuff to deal with comments and formatting on dict/list/ordereddict/set +-these are not really related, formatting could be factored out as +-a separate base +-""" +- +-import sys +-import copy +- +- +-from .compat import ordereddict # type: ignore +-from .compat import PY2, string_types, MutableSliceableSequence +-from .scalarstring import ScalarString +-from .anchor import Anchor +- +-if PY2: +- from collections import MutableSet, Sized, Set, Mapping +-else: +- from collections.abc import MutableSet, Sized, Set, Mapping +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Union, Optional, Iterat= or # NOQA +- +-# fmt: off +-__all__ =3D ['CommentedSeq', 'CommentedKeySeq', +- 'CommentedMap', 'CommentedOrderedMap', +- 'CommentedSet', 'comment_attrib', 'merge_attrib'] +-# fmt: on +- +-comment_attrib =3D '_yaml_comment' +-format_attrib =3D '_yaml_format' +-line_col_attrib =3D '_yaml_line_col' +-merge_attrib =3D '_yaml_merge' +-tag_attrib =3D '_yaml_tag' +- +- +-class Comment(object): +- # sys.getsize tested the Comment objects, __slots__ makes them bigger +- # and adding self.end did not matter +- __slots__ =3D 'comment', '_items', '_end', '_start' +- attrib =3D comment_attrib +- +- def __init__(self): +- # type: () -> None +- self.comment =3D None # [post, [pre]] +- # map key (mapping/omap/dict) or index (sequence/list) to a list= of +- # dict: post_key, pre_key, post_value, pre_value +- # list: pre item, post item +- self._items =3D {} # type: Dict[Any, Any] +- # self._start =3D [] # should not put these on first item +- self._end =3D [] # type: List[Any] # end of document comments +- +- def __str__(self): +- # type: () -> str +- if bool(self._end): +- end =3D ',\n end=3D' + str(self._end) +- else: +- end =3D "" +- return 'Comment(comment=3D{0},\n items=3D{1}{2})'.format(self.co= mment, self._items, end) +- +- @property +- def items(self): +- # type: () -> Any +- return self._items +- +- @property +- def end(self): +- # type: () -> Any +- return self._end +- +- @end.setter +- def end(self, value): +- # type: (Any) -> None +- self._end =3D value +- +- @property +- def start(self): +- # type: () -> Any +- return self._start +- +- @start.setter +- def start(self, value): +- # type: (Any) -> None +- self._start =3D value +- +- +-# to distinguish key from None +-def NoComment(): +- # type: () -> None +- pass +- +- +-class Format(object): +- __slots__ =3D ('_flow_style',) +- attrib =3D format_attrib +- +- def __init__(self): +- # type: () -> None +- self._flow_style =3D None # type: Any +- +- def set_flow_style(self): +- # type: () -> None +- self._flow_style =3D True +- +- def set_block_style(self): +- # type: () -> None +- self._flow_style =3D False +- +- def flow_style(self, default=3DNone): +- # type: (Optional[Any]) -> Any +- """if default (the flow_style) is None, the flow style tacked on = to +- the object explicitly will be taken. If that is None as well the +- default flow style rules the format down the line, or the type +- of the constituent values (simple -> flow, map/list -> block)""" +- if self._flow_style is None: +- return default +- return self._flow_style +- +- +-class LineCol(object): +- attrib =3D line_col_attrib +- +- def __init__(self): +- # type: () -> None +- self.line =3D None +- self.col =3D None +- self.data =3D None # type: Optional[Dict[Any, Any]] +- +- def add_kv_line_col(self, key, data): +- # type: (Any, Any) -> None +- if self.data is None: +- self.data =3D {} +- self.data[key] =3D data +- +- def key(self, k): +- # type: (Any) -> Any +- return self._kv(k, 0, 1) +- +- def value(self, k): +- # type: (Any) -> Any +- return self._kv(k, 2, 3) +- +- def _kv(self, k, x0, x1): +- # type: (Any, Any, Any) -> Any +- if self.data is None: +- return None +- data =3D self.data[k] +- return data[x0], data[x1] +- +- def item(self, idx): +- # type: (Any) -> Any +- if self.data is None: +- return None +- return self.data[idx][0], self.data[idx][1] +- +- def add_idx_line_col(self, key, data): +- # type: (Any, Any) -> None +- if self.data is None: +- self.data =3D {} +- self.data[key] =3D data +- +- +-class Tag(object): +- """store tag information for roundtripping""" +- +- __slots__ =3D ('value',) +- attrib =3D tag_attrib +- +- def __init__(self): +- # type: () -> None +- self.value =3D None +- +- def __repr__(self): +- # type: () -> Any +- return '{0.__class__.__name__}({0.value!r})'.format(self) +- +- +-class CommentedBase(object): +- @property +- def ca(self): +- # type: () -> Any +- if not hasattr(self, Comment.attrib): +- setattr(self, Comment.attrib, Comment()) +- return getattr(self, Comment.attrib) +- +- def yaml_end_comment_extend(self, comment, clear=3DFalse): +- # type: (Any, bool) -> None +- if comment is None: +- return +- if clear or self.ca.end is None: +- self.ca.end =3D [] +- self.ca.end.extend(comment) +- +- def yaml_key_comment_extend(self, key, comment, clear=3DFalse): +- # type: (Any, Any, bool) -> None +- r =3D self.ca._items.setdefault(key, [None, None, None, None]) +- if clear or r[1] is None: +- if comment[1] is not None: +- assert isinstance(comment[1], list) +- r[1] =3D comment[1] +- else: +- r[1].extend(comment[0]) +- r[0] =3D comment[0] +- +- def yaml_value_comment_extend(self, key, comment, clear=3DFalse): +- # type: (Any, Any, bool) -> None +- r =3D self.ca._items.setdefault(key, [None, None, None, None]) +- if clear or r[3] is None: +- if comment[1] is not None: +- assert isinstance(comment[1], list) +- r[3] =3D comment[1] +- else: +- r[3].extend(comment[0]) +- r[2] =3D comment[0] +- +- def yaml_set_start_comment(self, comment, indent=3D0): +- # type: (Any, Any) -> None +- """overwrites any preceding comment lines on an object +- expects comment to be without `#` and possible have multiple lines +- """ +- from .error import CommentMark +- from .tokens import CommentToken +- +- pre_comments =3D self._yaml_get_pre_comment() +- if comment[-1] =3D=3D '\n': +- comment =3D comment[:-1] # strip final newline if there +- start_mark =3D CommentMark(indent) +- for com in comment.split('\n'): +- pre_comments.append(CommentToken('# ' + com + '\n', start_mar= k, None)) +- +- def yaml_set_comment_before_after_key( +- self, key, before=3DNone, indent=3D0, after=3DNone, after_indent= =3DNone +- ): +- # type: (Any, Any, Any, Any, Any) -> None +- """ +- expects comment (before/after) to be without `#` and possible hav= e multiple lines +- """ +- from dynaconf.vendor.ruamel.yaml.error import CommentMark +- from dynaconf.vendor.ruamel.yaml.tokens import CommentToken +- +- def comment_token(s, mark): +- # type: (Any, Any) -> Any +- # handle empty lines as having no comment +- return CommentToken(('# ' if s else "") + s + '\n', mark, Non= e) +- +- if after_indent is None: +- after_indent =3D indent + 2 +- if before and (len(before) > 1) and before[-1] =3D=3D '\n': +- before =3D before[:-1] # strip final newline if there +- if after and after[-1] =3D=3D '\n': +- after =3D after[:-1] # strip final newline if there +- start_mark =3D CommentMark(indent) +- c =3D self.ca.items.setdefault(key, [None, [], None, None]) +- if before =3D=3D '\n': +- c[1].append(comment_token("", start_mark)) +- elif before: +- for com in before.split('\n'): +- c[1].append(comment_token(com, start_mark)) +- if after: +- start_mark =3D CommentMark(after_indent) +- if c[3] is None: +- c[3] =3D [] +- for com in after.split('\n'): +- c[3].append(comment_token(com, start_mark)) # type: igno= re +- +- @property +- def fa(self): +- # type: () -> Any +- """format attribute +- +- set_flow_style()/set_block_style()""" +- if not hasattr(self, Format.attrib): +- setattr(self, Format.attrib, Format()) +- return getattr(self, Format.attrib) +- +- def yaml_add_eol_comment(self, comment, key=3DNoComment, column=3DNon= e): +- # type: (Any, Optional[Any], Optional[Any]) -> None +- """ +- there is a problem as eol comments should start with ' #' +- (but at the beginning of the line the space doesn't have to be be= fore +- the #. The column index is for the # mark +- """ +- from .tokens import CommentToken +- from .error import CommentMark +- +- if column is None: +- try: +- column =3D self._yaml_get_column(key) +- except AttributeError: +- column =3D 0 +- if comment[0] !=3D '#': +- comment =3D '# ' + comment +- if column is None: +- if comment[0] =3D=3D '#': +- comment =3D ' ' + comment +- column =3D 0 +- start_mark =3D CommentMark(column) +- ct =3D [CommentToken(comment, start_mark, None), None] +- self._yaml_add_eol_comment(ct, key=3Dkey) +- +- @property +- def lc(self): +- # type: () -> Any +- if not hasattr(self, LineCol.attrib): +- setattr(self, LineCol.attrib, LineCol()) +- return getattr(self, LineCol.attrib) +- +- def _yaml_set_line_col(self, line, col): +- # type: (Any, Any) -> None +- self.lc.line =3D line +- self.lc.col =3D col +- +- def _yaml_set_kv_line_col(self, key, data): +- # type: (Any, Any) -> None +- self.lc.add_kv_line_col(key, data) +- +- def _yaml_set_idx_line_col(self, key, data): +- # type: (Any, Any) -> None +- self.lc.add_idx_line_col(key, data) +- +- @property +- def anchor(self): +- # type: () -> Any +- if not hasattr(self, Anchor.attrib): +- setattr(self, Anchor.attrib, Anchor()) +- return getattr(self, Anchor.attrib) +- +- def yaml_anchor(self): +- # type: () -> Any +- if not hasattr(self, Anchor.attrib): +- return None +- return self.anchor +- +- def yaml_set_anchor(self, value, always_dump=3DFalse): +- # type: (Any, bool) -> None +- self.anchor.value =3D value +- self.anchor.always_dump =3D always_dump +- +- @property +- def tag(self): +- # type: () -> Any +- if not hasattr(self, Tag.attrib): +- setattr(self, Tag.attrib, Tag()) +- return getattr(self, Tag.attrib) +- +- def yaml_set_tag(self, value): +- # type: (Any) -> None +- self.tag.value =3D value +- +- def copy_attributes(self, t, memo=3DNone): +- # type: (Any, Any) -> None +- # fmt: off +- for a in [Comment.attrib, Format.attrib, LineCol.attrib, Anchor.a= ttrib, +- Tag.attrib, merge_attrib]: +- if hasattr(self, a): +- if memo is not None: +- setattr(t, a, copy.deepcopy(getattr(self, a, memo))) +- else: +- setattr(t, a, getattr(self, a)) +- # fmt: on +- +- def _yaml_add_eol_comment(self, comment, key): +- # type: (Any, Any) -> None +- raise NotImplementedError +- +- def _yaml_get_pre_comment(self): +- # type: () -> Any +- raise NotImplementedError +- +- def _yaml_get_column(self, key): +- # type: (Any) -> Any +- raise NotImplementedError +- +- +-class CommentedSeq(MutableSliceableSequence, list, CommentedBase): # typ= e: ignore +- __slots__ =3D (Comment.attrib, '_lst') +- +- def __init__(self, *args, **kw): +- # type: (Any, Any) -> None +- list.__init__(self, *args, **kw) +- +- def __getsingleitem__(self, idx): +- # type: (Any) -> Any +- return list.__getitem__(self, idx) +- +- def __setsingleitem__(self, idx, value): +- # type: (Any, Any) -> None +- # try to preserve the scalarstring type if setting an existing ke= y to a new value +- if idx < len(self): +- if ( +- isinstance(value, string_types) +- and not isinstance(value, ScalarString) +- and isinstance(self[idx], ScalarString) +- ): +- value =3D type(self[idx])(value) +- list.__setitem__(self, idx, value) +- +- def __delsingleitem__(self, idx=3DNone): +- # type: (Any) -> Any +- list.__delitem__(self, idx) +- self.ca.items.pop(idx, None) # might not be there -> default val= ue +- for list_index in sorted(self.ca.items): +- if list_index < idx: +- continue +- self.ca.items[list_index - 1] =3D self.ca.items.pop(list_inde= x) +- +- def __len__(self): +- # type: () -> int +- return list.__len__(self) +- +- def insert(self, idx, val): +- # type: (Any, Any) -> None +- """the comments after the insertion have to move forward""" +- list.insert(self, idx, val) +- for list_index in sorted(self.ca.items, reverse=3DTrue): +- if list_index < idx: +- break +- self.ca.items[list_index + 1] =3D self.ca.items.pop(list_inde= x) +- +- def extend(self, val): +- # type: (Any) -> None +- list.extend(self, val) +- +- def __eq__(self, other): +- # type: (Any) -> bool +- return list.__eq__(self, other) +- +- def _yaml_add_comment(self, comment, key=3DNoComment): +- # type: (Any, Optional[Any]) -> None +- if key is not NoComment: +- self.yaml_key_comment_extend(key, comment) +- else: +- self.ca.comment =3D comment +- +- def _yaml_add_eol_comment(self, comment, key): +- # type: (Any, Any) -> None +- self._yaml_add_comment(comment, key=3Dkey) +- +- def _yaml_get_columnX(self, key): +- # type: (Any) -> Any +- return self.ca.items[key][0].start_mark.column +- +- def _yaml_get_column(self, key): +- # type: (Any) -> Any +- column =3D None +- sel_idx =3D None +- pre, post =3D key - 1, key + 1 +- if pre in self.ca.items: +- sel_idx =3D pre +- elif post in self.ca.items: +- sel_idx =3D post +- else: +- # self.ca.items is not ordered +- for row_idx, _k1 in enumerate(self): +- if row_idx >=3D key: +- break +- if row_idx not in self.ca.items: +- continue +- sel_idx =3D row_idx +- if sel_idx is not None: +- column =3D self._yaml_get_columnX(sel_idx) +- return column +- +- def _yaml_get_pre_comment(self): +- # type: () -> Any +- pre_comments =3D [] # type: List[Any] +- if self.ca.comment is None: +- self.ca.comment =3D [None, pre_comments] +- else: +- self.ca.comment[1] =3D pre_comments +- return pre_comments +- +- def __deepcopy__(self, memo): +- # type: (Any) -> Any +- res =3D self.__class__() +- memo[id(self)] =3D res +- for k in self: +- res.append(copy.deepcopy(k, memo)) +- self.copy_attributes(res, memo=3Dmemo) +- return res +- +- def __add__(self, other): +- # type: (Any) -> Any +- return list.__add__(self, other) +- +- def sort(self, key=3DNone, reverse=3DFalse): # type: ignore +- # type: (Any, bool) -> None +- if key is None: +- tmp_lst =3D sorted(zip(self, range(len(self))), reverse=3Drev= erse) +- list.__init__(self, [x[0] for x in tmp_lst]) +- else: +- tmp_lst =3D sorted( +- zip(map(key, list.__iter__(self)), range(len(self))), rev= erse=3Dreverse +- ) +- list.__init__(self, [list.__getitem__(self, x[1]) for x in tm= p_lst]) +- itm =3D self.ca.items +- self.ca._items =3D {} +- for idx, x in enumerate(tmp_lst): +- old_index =3D x[1] +- if old_index in itm: +- self.ca.items[idx] =3D itm[old_index] +- +- def __repr__(self): +- # type: () -> Any +- return list.__repr__(self) +- +- +-class CommentedKeySeq(tuple, CommentedBase): # type: ignore +- """This primarily exists to be able to roundtrip keys that are sequen= ces""" +- +- def _yaml_add_comment(self, comment, key=3DNoComment): +- # type: (Any, Optional[Any]) -> None +- if key is not NoComment: +- self.yaml_key_comment_extend(key, comment) +- else: +- self.ca.comment =3D comment +- +- def _yaml_add_eol_comment(self, comment, key): +- # type: (Any, Any) -> None +- self._yaml_add_comment(comment, key=3Dkey) +- +- def _yaml_get_columnX(self, key): +- # type: (Any) -> Any +- return self.ca.items[key][0].start_mark.column +- +- def _yaml_get_column(self, key): +- # type: (Any) -> Any +- column =3D None +- sel_idx =3D None +- pre, post =3D key - 1, key + 1 +- if pre in self.ca.items: +- sel_idx =3D pre +- elif post in self.ca.items: +- sel_idx =3D post +- else: +- # self.ca.items is not ordered +- for row_idx, _k1 in enumerate(self): +- if row_idx >=3D key: +- break +- if row_idx not in self.ca.items: +- continue +- sel_idx =3D row_idx +- if sel_idx is not None: +- column =3D self._yaml_get_columnX(sel_idx) +- return column +- +- def _yaml_get_pre_comment(self): +- # type: () -> Any +- pre_comments =3D [] # type: List[Any] +- if self.ca.comment is None: +- self.ca.comment =3D [None, pre_comments] +- else: +- self.ca.comment[1] =3D pre_comments +- return pre_comments +- +- +-class CommentedMapView(Sized): +- __slots__ =3D ('_mapping',) +- +- def __init__(self, mapping): +- # type: (Any) -> None +- self._mapping =3D mapping +- +- def __len__(self): +- # type: () -> int +- count =3D len(self._mapping) +- return count +- +- +-class CommentedMapKeysView(CommentedMapView, Set): # type: ignore +- __slots__ =3D () +- +- @classmethod +- def _from_iterable(self, it): +- # type: (Any) -> Any +- return set(it) +- +- def __contains__(self, key): +- # type: (Any) -> Any +- return key in self._mapping +- +- def __iter__(self): +- # type: () -> Any # yield from self._mapping # not in py27, pypy +- # for x in self._mapping._keys(): +- for x in self._mapping: +- yield x +- +- +-class CommentedMapItemsView(CommentedMapView, Set): # type: ignore +- __slots__ =3D () +- +- @classmethod +- def _from_iterable(self, it): +- # type: (Any) -> Any +- return set(it) +- +- def __contains__(self, item): +- # type: (Any) -> Any +- key, value =3D item +- try: +- v =3D self._mapping[key] +- except KeyError: +- return False +- else: +- return v =3D=3D value +- +- def __iter__(self): +- # type: () -> Any +- for key in self._mapping._keys(): +- yield (key, self._mapping[key]) +- +- +-class CommentedMapValuesView(CommentedMapView): +- __slots__ =3D () +- +- def __contains__(self, value): +- # type: (Any) -> Any +- for key in self._mapping: +- if value =3D=3D self._mapping[key]: +- return True +- return False +- +- def __iter__(self): +- # type: () -> Any +- for key in self._mapping._keys(): +- yield self._mapping[key] +- +- +-class CommentedMap(ordereddict, CommentedBase): # type: ignore +- __slots__ =3D (Comment.attrib, '_ok', '_ref') +- +- def __init__(self, *args, **kw): +- # type: (Any, Any) -> None +- self._ok =3D set() # type: MutableSet[Any] # own keys +- self._ref =3D [] # type: List[CommentedMap] +- ordereddict.__init__(self, *args, **kw) +- +- def _yaml_add_comment(self, comment, key=3DNoComment, value=3DNoComme= nt): +- # type: (Any, Optional[Any], Optional[Any]) -> None +- """values is set to key to indicate a value attachment of comment= """ +- if key is not NoComment: +- self.yaml_key_comment_extend(key, comment) +- return +- if value is not NoComment: +- self.yaml_value_comment_extend(value, comment) +- else: +- self.ca.comment =3D comment +- +- def _yaml_add_eol_comment(self, comment, key): +- # type: (Any, Any) -> None +- """add on the value line, with value specified by the key""" +- self._yaml_add_comment(comment, value=3Dkey) +- +- def _yaml_get_columnX(self, key): +- # type: (Any) -> Any +- return self.ca.items[key][2].start_mark.column +- +- def _yaml_get_column(self, key): +- # type: (Any) -> Any +- column =3D None +- sel_idx =3D None +- pre, post, last =3D None, None, None +- for x in self: +- if pre is not None and x !=3D key: +- post =3D x +- break +- if x =3D=3D key: +- pre =3D last +- last =3D x +- if pre in self.ca.items: +- sel_idx =3D pre +- elif post in self.ca.items: +- sel_idx =3D post +- else: +- # self.ca.items is not ordered +- for k1 in self: +- if k1 >=3D key: +- break +- if k1 not in self.ca.items: +- continue +- sel_idx =3D k1 +- if sel_idx is not None: +- column =3D self._yaml_get_columnX(sel_idx) +- return column +- +- def _yaml_get_pre_comment(self): +- # type: () -> Any +- pre_comments =3D [] # type: List[Any] +- if self.ca.comment is None: +- self.ca.comment =3D [None, pre_comments] +- else: +- self.ca.comment[1] =3D pre_comments +- return pre_comments +- +- def update(self, vals): +- # type: (Any) -> None +- try: +- ordereddict.update(self, vals) +- except TypeError: +- # probably a dict that is used +- for x in vals: +- self[x] =3D vals[x] +- try: +- self._ok.update(vals.keys()) # type: ignore +- except AttributeError: +- # assume a list/tuple of two element lists/tuples +- for x in vals: +- self._ok.add(x[0]) +- +- def insert(self, pos, key, value, comment=3DNone): +- # type: (Any, Any, Any, Optional[Any]) -> None +- """insert key value into given position +- attach comment if provided +- """ +- ordereddict.insert(self, pos, key, value) +- self._ok.add(key) +- if comment is not None: +- self.yaml_add_eol_comment(comment, key=3Dkey) +- +- def mlget(self, key, default=3DNone, list_ok=3DFalse): +- # type: (Any, Any, Any) -> Any +- """multi-level get that expects dicts within dicts""" +- if not isinstance(key, list): +- return self.get(key, default) +- # assume that the key is a list of recursively accessible dicts +- +- def get_one_level(key_list, level, d): +- # type: (Any, Any, Any) -> Any +- if not list_ok: +- assert isinstance(d, dict) +- if level >=3D len(key_list): +- if level > len(key_list): +- raise IndexError +- return d[key_list[level - 1]] +- return get_one_level(key_list, level + 1, d[key_list[level - = 1]]) +- +- try: +- return get_one_level(key, 1, self) +- except KeyError: +- return default +- except (TypeError, IndexError): +- if not list_ok: +- raise +- return default +- +- def __getitem__(self, key): +- # type: (Any) -> Any +- try: +- return ordereddict.__getitem__(self, key) +- except KeyError: +- for merged in getattr(self, merge_attrib, []): +- if key in merged[1]: +- return merged[1][key] +- raise +- +- def __setitem__(self, key, value): +- # type: (Any, Any) -> None +- # try to preserve the scalarstring type if setting an existing ke= y to a new value +- if key in self: +- if ( +- isinstance(value, string_types) +- and not isinstance(value, ScalarString) +- and isinstance(self[key], ScalarString) +- ): +- value =3D type(self[key])(value) +- ordereddict.__setitem__(self, key, value) +- self._ok.add(key) +- +- def _unmerged_contains(self, key): +- # type: (Any) -> Any +- if key in self._ok: +- return True +- return None +- +- def __contains__(self, key): +- # type: (Any) -> bool +- return bool(ordereddict.__contains__(self, key)) +- +- def get(self, key, default=3DNone): +- # type: (Any, Any) -> Any +- try: +- return self.__getitem__(key) +- except: # NOQA +- return default +- +- def __repr__(self): +- # type: () -> Any +- return ordereddict.__repr__(self).replace('CommentedMap', 'ordere= ddict') +- +- def non_merged_items(self): +- # type: () -> Any +- for x in ordereddict.__iter__(self): +- if x in self._ok: +- yield x, ordereddict.__getitem__(self, x) +- +- def __delitem__(self, key): +- # type: (Any) -> None +- # for merged in getattr(self, merge_attrib, []): +- # if key in merged[1]: +- # value =3D merged[1][key] +- # break +- # else: +- # # not found in merged in stuff +- # ordereddict.__delitem__(self, key) +- # for referer in self._ref: +- # referer.update_key_value(key) +- # return +- # +- # ordereddict.__setitem__(self, key, value) # merge might have d= ifferent value +- # self._ok.discard(key) +- self._ok.discard(key) +- ordereddict.__delitem__(self, key) +- for referer in self._ref: +- referer.update_key_value(key) +- +- def __iter__(self): +- # type: () -> Any +- for x in ordereddict.__iter__(self): +- yield x +- +- def _keys(self): +- # type: () -> Any +- for x in ordereddict.__iter__(self): +- yield x +- +- def __len__(self): +- # type: () -> int +- return int(ordereddict.__len__(self)) +- +- def __eq__(self, other): +- # type: (Any) -> bool +- return bool(dict(self) =3D=3D other) +- +- if PY2: +- +- def keys(self): +- # type: () -> Any +- return list(self._keys()) +- +- def iterkeys(self): +- # type: () -> Any +- return self._keys() +- +- def viewkeys(self): +- # type: () -> Any +- return CommentedMapKeysView(self) +- +- else: +- +- def keys(self): +- # type: () -> Any +- return CommentedMapKeysView(self) +- +- if PY2: +- +- def _values(self): +- # type: () -> Any +- for x in ordereddict.__iter__(self): +- yield ordereddict.__getitem__(self, x) +- +- def values(self): +- # type: () -> Any +- return list(self._values()) +- +- def itervalues(self): +- # type: () -> Any +- return self._values() +- +- def viewvalues(self): +- # type: () -> Any +- return CommentedMapValuesView(self) +- +- else: +- +- def values(self): +- # type: () -> Any +- return CommentedMapValuesView(self) +- +- def _items(self): +- # type: () -> Any +- for x in ordereddict.__iter__(self): +- yield x, ordereddict.__getitem__(self, x) +- +- if PY2: +- +- def items(self): +- # type: () -> Any +- return list(self._items()) +- +- def iteritems(self): +- # type: () -> Any +- return self._items() +- +- def viewitems(self): +- # type: () -> Any +- return CommentedMapItemsView(self) +- +- else: +- +- def items(self): +- # type: () -> Any +- return CommentedMapItemsView(self) +- +- @property +- def merge(self): +- # type: () -> Any +- if not hasattr(self, merge_attrib): +- setattr(self, merge_attrib, []) +- return getattr(self, merge_attrib) +- +- def copy(self): +- # type: () -> Any +- x =3D type(self)() # update doesn't work +- for k, v in self._items(): +- x[k] =3D v +- self.copy_attributes(x) +- return x +- +- def add_referent(self, cm): +- # type: (Any) -> None +- if cm not in self._ref: +- self._ref.append(cm) +- +- def add_yaml_merge(self, value): +- # type: (Any) -> None +- for v in value: +- v[1].add_referent(self) +- for k, v in v[1].items(): +- if ordereddict.__contains__(self, k): +- continue +- ordereddict.__setitem__(self, k, v) +- self.merge.extend(value) +- +- def update_key_value(self, key): +- # type: (Any) -> None +- if key in self._ok: +- return +- for v in self.merge: +- if key in v[1]: +- ordereddict.__setitem__(self, key, v[1][key]) +- return +- ordereddict.__delitem__(self, key) +- +- def __deepcopy__(self, memo): +- # type: (Any) -> Any +- res =3D self.__class__() +- memo[id(self)] =3D res +- for k in self: +- res[k] =3D copy.deepcopy(self[k], memo) +- self.copy_attributes(res, memo=3Dmemo) +- return res +- +- +-# based on brownie mappings +-@classmethod # type: ignore +-def raise_immutable(cls, *args, **kwargs): +- # type: (Any, *Any, **Any) -> None +- raise TypeError('{} objects are immutable'.format(cls.__name__)) +- +- +-class CommentedKeyMap(CommentedBase, Mapping): # type: ignore +- __slots__ =3D Comment.attrib, '_od' +- """This primarily exists to be able to roundtrip keys that are mappin= gs""" +- +- def __init__(self, *args, **kw): +- # type: (Any, Any) -> None +- if hasattr(self, '_od'): +- raise_immutable(self) +- try: +- self._od =3D ordereddict(*args, **kw) +- except TypeError: +- if PY2: +- self._od =3D ordereddict(args[0].items()) +- else: +- raise +- +- __delitem__ =3D __setitem__ =3D clear =3D pop =3D popitem =3D setdefa= ult =3D update =3D raise_immutable +- +- # need to implement __getitem__, __iter__ and __len__ +- def __getitem__(self, index): +- # type: (Any) -> Any +- return self._od[index] +- +- def __iter__(self): +- # type: () -> Iterator[Any] +- for x in self._od.__iter__(): +- yield x +- +- def __len__(self): +- # type: () -> int +- return len(self._od) +- +- def __hash__(self): +- # type: () -> Any +- return hash(tuple(self.items())) +- +- def __repr__(self): +- # type: () -> Any +- if not hasattr(self, merge_attrib): +- return self._od.__repr__() +- return 'ordereddict(' + repr(list(self._od.items())) + ')' +- +- @classmethod +- def fromkeys(keys, v=3DNone): +- # type: (Any, Any) -> Any +- return CommentedKeyMap(dict.fromkeys(keys, v)) +- +- def _yaml_add_comment(self, comment, key=3DNoComment): +- # type: (Any, Optional[Any]) -> None +- if key is not NoComment: +- self.yaml_key_comment_extend(key, comment) +- else: +- self.ca.comment =3D comment +- +- def _yaml_add_eol_comment(self, comment, key): +- # type: (Any, Any) -> None +- self._yaml_add_comment(comment, key=3Dkey) +- +- def _yaml_get_columnX(self, key): +- # type: (Any) -> Any +- return self.ca.items[key][0].start_mark.column +- +- def _yaml_get_column(self, key): +- # type: (Any) -> Any +- column =3D None +- sel_idx =3D None +- pre, post =3D key - 1, key + 1 +- if pre in self.ca.items: +- sel_idx =3D pre +- elif post in self.ca.items: +- sel_idx =3D post +- else: +- # self.ca.items is not ordered +- for row_idx, _k1 in enumerate(self): +- if row_idx >=3D key: +- break +- if row_idx not in self.ca.items: +- continue +- sel_idx =3D row_idx +- if sel_idx is not None: +- column =3D self._yaml_get_columnX(sel_idx) +- return column +- +- def _yaml_get_pre_comment(self): +- # type: () -> Any +- pre_comments =3D [] # type: List[Any] +- if self.ca.comment is None: +- self.ca.comment =3D [None, pre_comments] +- else: +- self.ca.comment[1] =3D pre_comments +- return pre_comments +- +- +-class CommentedOrderedMap(CommentedMap): +- __slots__ =3D (Comment.attrib,) +- +- +-class CommentedSet(MutableSet, CommentedBase): # type: ignore # NOQA +- __slots__ =3D Comment.attrib, 'odict' +- +- def __init__(self, values=3DNone): +- # type: (Any) -> None +- self.odict =3D ordereddict() +- MutableSet.__init__(self) +- if values is not None: +- self |=3D values # type: ignore +- +- def _yaml_add_comment(self, comment, key=3DNoComment, value=3DNoComme= nt): +- # type: (Any, Optional[Any], Optional[Any]) -> None +- """values is set to key to indicate a value attachment of comment= """ +- if key is not NoComment: +- self.yaml_key_comment_extend(key, comment) +- return +- if value is not NoComment: +- self.yaml_value_comment_extend(value, comment) +- else: +- self.ca.comment =3D comment +- +- def _yaml_add_eol_comment(self, comment, key): +- # type: (Any, Any) -> None +- """add on the value line, with value specified by the key""" +- self._yaml_add_comment(comment, value=3Dkey) +- +- def add(self, value): +- # type: (Any) -> None +- """Add an element.""" +- self.odict[value] =3D None +- +- def discard(self, value): +- # type: (Any) -> None +- """Remove an element. Do not raise an exception if absent.""" +- del self.odict[value] +- +- def __contains__(self, x): +- # type: (Any) -> Any +- return x in self.odict +- +- def __iter__(self): +- # type: () -> Any +- for x in self.odict: +- yield x +- +- def __len__(self): +- # type: () -> int +- return len(self.odict) +- +- def __repr__(self): +- # type: () -> str +- return 'set({0!r})'.format(self.odict.keys()) +- +- +-class TaggedScalar(CommentedBase): +- # the value and style attributes are set during roundtrip construction +- def __init__(self, value=3DNone, style=3DNone, tag=3DNone): +- # type: (Any, Any, Any) -> None +- self.value =3D value +- self.style =3D style +- if tag is not None: +- self.yaml_set_tag(tag) +- +- def __str__(self): +- # type: () -> Any +- return self.value +- +- +-def dump_comments(d, name=3D"", sep=3D'.', out=3Dsys.stdout): +- # type: (Any, str, str, Any) -> None +- """ +- recursively dump comments, all but the toplevel preceded by the path +- in dotted form x.0.a +- """ +- if isinstance(d, dict) and hasattr(d, 'ca'): +- if name: +- sys.stdout.write('{}\n'.format(name)) +- out.write('{}\n'.format(d.ca)) # type: ignore +- for k in d: +- dump_comments(d[k], name=3D(name + sep + k) if name else k, s= ep=3Dsep, out=3Dout) +- elif isinstance(d, list) and hasattr(d, 'ca'): +- if name: +- sys.stdout.write('{}\n'.format(name)) +- out.write('{}\n'.format(d.ca)) # type: ignore +- for idx, k in enumerate(d): +- dump_comments( +- k, name=3D(name + sep + str(idx)) if name else str(idx), = sep=3Dsep, out=3Dout +- ) +diff --git a/dynaconf/vendor_src/ruamel/yaml/compat.py b/dynaconf/vendor_s= rc/ruamel/yaml/compat.py +deleted file mode 100644 +index c48cb58..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/compat.py ++++ /dev/null +@@ -1,324 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function +- +-# partially from package six by Benjamin Peterson +- +-import sys +-import os +-import types +-import traceback +-from abc import abstractmethod +- +- +-# fmt: off +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Union, BinaryIO, IO, Te= xt, Tuple # NOQA +- from typing import Optional # NOQA +-# fmt: on +- +-_DEFAULT_YAML_VERSION =3D (1, 2) +- +-try: +- from ruamel.ordereddict import ordereddict +-except: # NOQA +- try: +- from collections import OrderedDict +- except ImportError: +- from ordereddict import OrderedDict # type: ignore +- # to get the right name import ... as ordereddict doesn't do that +- +- class ordereddict(OrderedDict): # type: ignore +- if not hasattr(OrderedDict, 'insert'): +- +- def insert(self, pos, key, value): +- # type: (int, Any, Any) -> None +- if pos >=3D len(self): +- self[key] =3D value +- return +- od =3D ordereddict() +- od.update(self) +- for k in od: +- del self[k] +- for index, old_key in enumerate(od): +- if pos =3D=3D index: +- self[key] =3D value +- self[old_key] =3D od[old_key] +- +- +-PY2 =3D sys.version_info[0] =3D=3D 2 +-PY3 =3D sys.version_info[0] =3D=3D 3 +- +- +-if PY3: +- +- def utf8(s): +- # type: (str) -> str +- return s +- +- def to_str(s): +- # type: (str) -> str +- return s +- +- def to_unicode(s): +- # type: (str) -> str +- return s +- +- +-else: +- if False: +- unicode =3D str +- +- def utf8(s): +- # type: (unicode) -> str +- return s.encode('utf-8') +- +- def to_str(s): +- # type: (str) -> str +- return str(s) +- +- def to_unicode(s): +- # type: (str) -> unicode +- return unicode(s) # NOQA +- +- +-if PY3: +- string_types =3D str +- integer_types =3D int +- class_types =3D type +- text_type =3D str +- binary_type =3D bytes +- +- MAXSIZE =3D sys.maxsize +- unichr =3D chr +- import io +- +- StringIO =3D io.StringIO +- BytesIO =3D io.BytesIO +- # have unlimited precision +- no_limit_int =3D int +- from collections.abc import Hashable, MutableSequence, MutableMapping= , Mapping # NOQA +- +-else: +- string_types =3D basestring # NOQA +- integer_types =3D (int, long) # NOQA +- class_types =3D (type, types.ClassType) +- text_type =3D unicode # NOQA +- binary_type =3D str +- +- # to allow importing +- unichr =3D unichr +- from StringIO import StringIO as _StringIO +- +- StringIO =3D _StringIO +- import cStringIO +- +- BytesIO =3D cStringIO.StringIO +- # have unlimited precision +- no_limit_int =3D long # NOQA not available on Python 3 +- from collections import Hashable, MutableSequence, MutableMapping, Ma= pping # NOQA +- +-if False: # MYPY +- # StreamType =3D Union[BinaryIO, IO[str], IO[unicode], StringIO] +- # StreamType =3D Union[BinaryIO, IO[str], StringIO] # type: ignore +- StreamType =3D Any +- +- StreamTextType =3D StreamType # Union[Text, StreamType] +- VersionType =3D Union[List[int], str, Tuple[int, int]] +- +-if PY3: +- builtins_module =3D 'builtins' +-else: +- builtins_module =3D '__builtin__' +- +-UNICODE_SIZE =3D 4 if sys.maxunicode > 65535 else 2 +- +- +-def with_metaclass(meta, *bases): +- # type: (Any, Any) -> Any +- """Create a base class with a metaclass.""" +- return meta('NewBase', bases, {}) +- +- +-DBG_TOKEN =3D 1 +-DBG_EVENT =3D 2 +-DBG_NODE =3D 4 +- +- +-_debug =3D None # type: Optional[int] +-if 'RUAMELDEBUG' in os.environ: +- _debugx =3D os.environ.get('RUAMELDEBUG') +- if _debugx is None: +- _debug =3D 0 +- else: +- _debug =3D int(_debugx) +- +- +-if bool(_debug): +- +- class ObjectCounter(object): +- def __init__(self): +- # type: () -> None +- self.map =3D {} # type: Dict[Any, Any] +- +- def __call__(self, k): +- # type: (Any) -> None +- self.map[k] =3D self.map.get(k, 0) + 1 +- +- def dump(self): +- # type: () -> None +- for k in sorted(self.map): +- sys.stdout.write('{} -> {}'.format(k, self.map[k])) +- +- object_counter =3D ObjectCounter() +- +- +-# used from yaml util when testing +-def dbg(val=3DNone): +- # type: (Any) -> Any +- global _debug +- if _debug is None: +- # set to true or false +- _debugx =3D os.environ.get('YAMLDEBUG') +- if _debugx is None: +- _debug =3D 0 +- else: +- _debug =3D int(_debugx) +- if val is None: +- return _debug +- return _debug & val +- +- +-class Nprint(object): +- def __init__(self, file_name=3DNone): +- # type: (Any) -> None +- self._max_print =3D None # type: Any +- self._count =3D None # type: Any +- self._file_name =3D file_name +- +- def __call__(self, *args, **kw): +- # type: (Any, Any) -> None +- if not bool(_debug): +- return +- out =3D sys.stdout if self._file_name is None else open(self._fil= e_name, 'a') +- dbgprint =3D print # to fool checking for print statements by dv= utility +- kw1 =3D kw.copy() +- kw1['file'] =3D out +- dbgprint(*args, **kw1) +- out.flush() +- if self._max_print is not None: +- if self._count is None: +- self._count =3D self._max_print +- self._count -=3D 1 +- if self._count =3D=3D 0: +- dbgprint('forced exit\n') +- traceback.print_stack() +- out.flush() +- sys.exit(0) +- if self._file_name: +- out.close() +- +- def set_max_print(self, i): +- # type: (int) -> None +- self._max_print =3D i +- self._count =3D None +- +- +-nprint =3D Nprint() +-nprintf =3D Nprint('/var/tmp/ruamel.yaml.log') +- +-# char checkers following production rules +- +- +-def check_namespace_char(ch): +- # type: (Any) -> bool +- if u'\x21' <=3D ch <=3D u'\x7E': # ! to ~ +- return True +- if u'\xA0' <=3D ch <=3D u'\uD7FF': +- return True +- if (u'\uE000' <=3D ch <=3D u'\uFFFD') and ch !=3D u'\uFEFF': # excl.= byte order mark +- return True +- if u'\U00010000' <=3D ch <=3D u'\U0010FFFF': +- return True +- return False +- +- +-def check_anchorname_char(ch): +- # type: (Any) -> bool +- if ch in u',[]{}': +- return False +- return check_namespace_char(ch) +- +- +-def version_tnf(t1, t2=3DNone): +- # type: (Any, Any) -> Any +- """ +- return True if ruamel.yaml version_info < t1, None if t2 is specified= and bigger else False +- """ +- from dynaconf.vendor.ruamel.yaml import version_info # NOQA +- +- if version_info < t1: +- return True +- if t2 is not None and version_info < t2: +- return None +- return False +- +- +-class MutableSliceableSequence(MutableSequence): # type: ignore +- __slots__ =3D () +- +- def __getitem__(self, index): +- # type: (Any) -> Any +- if not isinstance(index, slice): +- return self.__getsingleitem__(index) +- return type(self)([self[i] for i in range(*index.indices(len(self= )))]) # type: ignore +- +- def __setitem__(self, index, value): +- # type: (Any, Any) -> None +- if not isinstance(index, slice): +- return self.__setsingleitem__(index, value) +- assert iter(value) +- # nprint(index.start, index.stop, index.step, index.indices(len(s= elf))) +- if index.step is None: +- del self[index.start : index.stop] +- for elem in reversed(value): +- self.insert(0 if index.start is None else index.start, el= em) +- else: +- range_parms =3D index.indices(len(self)) +- nr_assigned_items =3D (range_parms[1] - range_parms[0] - 1) /= / range_parms[2] + 1 +- # need to test before changing, in case TypeError is caught +- if nr_assigned_items < len(value): +- raise TypeError( +- 'too many elements in value {} < {}'.format(nr_assign= ed_items, len(value)) +- ) +- elif nr_assigned_items > len(value): +- raise TypeError( +- 'not enough elements in value {} > {}'.format( +- nr_assigned_items, len(value) +- ) +- ) +- for idx, i in enumerate(range(*range_parms)): +- self[i] =3D value[idx] +- +- def __delitem__(self, index): +- # type: (Any) -> None +- if not isinstance(index, slice): +- return self.__delsingleitem__(index) +- # nprint(index.start, index.stop, index.step, index.indices(len(s= elf))) +- for i in reversed(range(*index.indices(len(self)))): +- del self[i] +- +- @abstractmethod +- def __getsingleitem__(self, index): +- # type: (Any) -> Any +- raise IndexError +- +- @abstractmethod +- def __setsingleitem__(self, index, value): +- # type: (Any, Any) -> None +- raise IndexError +- +- @abstractmethod +- def __delsingleitem__(self, index): +- # type: (Any) -> None +- raise IndexError +diff --git a/dynaconf/vendor_src/ruamel/yaml/composer.py b/dynaconf/vendor= _src/ruamel/yaml/composer.py +deleted file mode 100644 +index 96e67a7..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/composer.py ++++ /dev/null +@@ -1,238 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import, print_function +- +-import warnings +- +-from .error import MarkedYAMLError, ReusedAnchorWarning +-from .compat import utf8, nprint, nprintf # NOQA +- +-from .events import ( +- StreamStartEvent, +- StreamEndEvent, +- MappingStartEvent, +- MappingEndEvent, +- SequenceStartEvent, +- SequenceEndEvent, +- AliasEvent, +- ScalarEvent, +-) +-from .nodes import MappingNode, ScalarNode, SequenceNode +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List # NOQA +- +-__all__ =3D ['Composer', 'ComposerError'] +- +- +-class ComposerError(MarkedYAMLError): +- pass +- +- +-class Composer(object): +- def __init__(self, loader=3DNone): +- # type: (Any) -> None +- self.loader =3D loader +- if self.loader is not None and getattr(self.loader, '_composer', = None) is None: +- self.loader._composer =3D self +- self.anchors =3D {} # type: Dict[Any, Any] +- +- @property +- def parser(self): +- # type: () -> Any +- if hasattr(self.loader, 'typ'): +- self.loader.parser +- return self.loader._parser +- +- @property +- def resolver(self): +- # type: () -> Any +- # assert self.loader._resolver is not None +- if hasattr(self.loader, 'typ'): +- self.loader.resolver +- return self.loader._resolver +- +- def check_node(self): +- # type: () -> Any +- # Drop the STREAM-START event. +- if self.parser.check_event(StreamStartEvent): +- self.parser.get_event() +- +- # If there are more documents available? +- return not self.parser.check_event(StreamEndEvent) +- +- def get_node(self): +- # type: () -> Any +- # Get the root node of the next document. +- if not self.parser.check_event(StreamEndEvent): +- return self.compose_document() +- +- def get_single_node(self): +- # type: () -> Any +- # Drop the STREAM-START event. +- self.parser.get_event() +- +- # Compose a document if the stream is not empty. +- document =3D None # type: Any +- if not self.parser.check_event(StreamEndEvent): +- document =3D self.compose_document() +- +- # Ensure that the stream contains no more documents. +- if not self.parser.check_event(StreamEndEvent): +- event =3D self.parser.get_event() +- raise ComposerError( +- 'expected a single document in the stream', +- document.start_mark, +- 'but found another document', +- event.start_mark, +- ) +- +- # Drop the STREAM-END event. +- self.parser.get_event() +- +- return document +- +- def compose_document(self): +- # type: (Any) -> Any +- # Drop the DOCUMENT-START event. +- self.parser.get_event() +- +- # Compose the root node. +- node =3D self.compose_node(None, None) +- +- # Drop the DOCUMENT-END event. +- self.parser.get_event() +- +- self.anchors =3D {} +- return node +- +- def compose_node(self, parent, index): +- # type: (Any, Any) -> Any +- if self.parser.check_event(AliasEvent): +- event =3D self.parser.get_event() +- alias =3D event.anchor +- if alias not in self.anchors: +- raise ComposerError( +- None, None, 'found undefined alias %r' % utf8(alias),= event.start_mark +- ) +- return self.anchors[alias] +- event =3D self.parser.peek_event() +- anchor =3D event.anchor +- if anchor is not None: # have an anchor +- if anchor in self.anchors: +- # raise ComposerError( +- # "found duplicate anchor %r; first occurrence" +- # % utf8(anchor), self.anchors[anchor].start_mark, +- # "second occurrence", event.start_mark) +- ws =3D ( +- '\nfound duplicate anchor {!r}\nfirst occurrence {}\n= second occurrence ' +- '{}'.format((anchor), self.anchors[anchor].start_mark= , event.start_mark) +- ) +- warnings.warn(ws, ReusedAnchorWarning) +- self.resolver.descend_resolver(parent, index) +- if self.parser.check_event(ScalarEvent): +- node =3D self.compose_scalar_node(anchor) +- elif self.parser.check_event(SequenceStartEvent): +- node =3D self.compose_sequence_node(anchor) +- elif self.parser.check_event(MappingStartEvent): +- node =3D self.compose_mapping_node(anchor) +- self.resolver.ascend_resolver() +- return node +- +- def compose_scalar_node(self, anchor): +- # type: (Any) -> Any +- event =3D self.parser.get_event() +- tag =3D event.tag +- if tag is None or tag =3D=3D u'!': +- tag =3D self.resolver.resolve(ScalarNode, event.value, event.= implicit) +- node =3D ScalarNode( +- tag, +- event.value, +- event.start_mark, +- event.end_mark, +- style=3Devent.style, +- comment=3Devent.comment, +- anchor=3Danchor, +- ) +- if anchor is not None: +- self.anchors[anchor] =3D node +- return node +- +- def compose_sequence_node(self, anchor): +- # type: (Any) -> Any +- start_event =3D self.parser.get_event() +- tag =3D start_event.tag +- if tag is None or tag =3D=3D u'!': +- tag =3D self.resolver.resolve(SequenceNode, None, start_event= .implicit) +- node =3D SequenceNode( +- tag, +- [], +- start_event.start_mark, +- None, +- flow_style=3Dstart_event.flow_style, +- comment=3Dstart_event.comment, +- anchor=3Danchor, +- ) +- if anchor is not None: +- self.anchors[anchor] =3D node +- index =3D 0 +- while not self.parser.check_event(SequenceEndEvent): +- node.value.append(self.compose_node(node, index)) +- index +=3D 1 +- end_event =3D self.parser.get_event() +- if node.flow_style is True and end_event.comment is not None: +- if node.comment is not None: +- nprint( +- 'Warning: unexpected end_event commment in sequence ' +- 'node {}'.format(node.flow_style) +- ) +- node.comment =3D end_event.comment +- node.end_mark =3D end_event.end_mark +- self.check_end_doc_comment(end_event, node) +- return node +- +- def compose_mapping_node(self, anchor): +- # type: (Any) -> Any +- start_event =3D self.parser.get_event() +- tag =3D start_event.tag +- if tag is None or tag =3D=3D u'!': +- tag =3D self.resolver.resolve(MappingNode, None, start_event.= implicit) +- node =3D MappingNode( +- tag, +- [], +- start_event.start_mark, +- None, +- flow_style=3Dstart_event.flow_style, +- comment=3Dstart_event.comment, +- anchor=3Danchor, +- ) +- if anchor is not None: +- self.anchors[anchor] =3D node +- while not self.parser.check_event(MappingEndEvent): +- # key_event =3D self.parser.peek_event() +- item_key =3D self.compose_node(node, None) +- # if item_key in node.value: +- # raise ComposerError("while composing a mapping", +- # start_event.start_mark, +- # "found duplicate key", key_event.start_mark) +- item_value =3D self.compose_node(node, item_key) +- # node.value[item_key] =3D item_value +- node.value.append((item_key, item_value)) +- end_event =3D self.parser.get_event() +- if node.flow_style is True and end_event.comment is not None: +- node.comment =3D end_event.comment +- node.end_mark =3D end_event.end_mark +- self.check_end_doc_comment(end_event, node) +- return node +- +- def check_end_doc_comment(self, end_event, node): +- # type: (Any, Any) -> None +- if end_event.comment and end_event.comment[1]: +- # pre comments on an end_event, no following to move to +- if node.comment is None: +- node.comment =3D [None, None] +- assert not isinstance(node, ScalarEvent) +- # this is a post comment on a mapping node, add as third elem= ent +- # in the list +- node.comment.append(end_event.comment[1]) +- end_event.comment[1] =3D None +diff --git a/dynaconf/vendor_src/ruamel/yaml/configobjwalker.py b/dynaconf= /vendor_src/ruamel/yaml/configobjwalker.py +deleted file mode 100644 +index 711efbc..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/configobjwalker.py ++++ /dev/null +@@ -1,14 +0,0 @@ +-# coding: utf-8 +- +-import warnings +- +-from .util import configobj_walker as new_configobj_walker +- +-if False: # MYPY +- from typing import Any # NOQA +- +- +-def configobj_walker(cfg): +- # type: (Any) -> Any +- warnings.warn('configobj_walker has moved to ruamel.yaml.util, please= update your code') +- return new_configobj_walker(cfg) +diff --git a/dynaconf/vendor_src/ruamel/yaml/constructor.py b/dynaconf/ven= dor_src/ruamel/yaml/constructor.py +deleted file mode 100644 +index 5d82ce5..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/constructor.py ++++ /dev/null +@@ -1,1805 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division +- +-import datetime +-import base64 +-import binascii +-import re +-import sys +-import types +-import warnings +- +-# fmt: off +-from .error import (MarkedYAMLError, MarkedYAMLFutureWarning, +- MantissaNoDotYAML1_1Warning) +-from .nodes import * # NOQA +-from .nodes import (SequenceNode, MappingNode, ScalarNode) +-from .compat import (utf8, builtins_module, to_str, PY2, PY3, # NOQA +- text_type, nprint, nprintf, version_tnf) +-from .compat import ordereddict, Hashable, MutableSequence # type: ignore +-from .compat import MutableMapping # type: ignore +- +-from .comments import * # NOQA +-from .comments import (CommentedMap, CommentedOrderedMap, CommentedSet, +- CommentedKeySeq, CommentedSeq, TaggedSc= alar, +- CommentedKeyMap) +-from .scalarstring import (SingleQuotedScalarString, DoubleQuotedScalarSt= ring, +- LiteralScalarString, FoldedScalarSt= ring, +- PlainScalarString, ScalarString,) +-from .scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt +-from .scalarfloat import ScalarFloat +-from .scalarbool import ScalarBoolean +-from .timestamp import TimeStamp +-from .util import RegExp +- +-if False: # MYPY +- from typing import Any, Dict, List, Set, Generator, Union, Optional = # NOQA +- +- +-__all__ =3D ['BaseConstructor', 'SafeConstructor', 'Constructor', +- 'ConstructorError', 'RoundTripConstructor'] +-# fmt: on +- +- +-class ConstructorError(MarkedYAMLError): +- pass +- +- +-class DuplicateKeyFutureWarning(MarkedYAMLFutureWarning): +- pass +- +- +-class DuplicateKeyError(MarkedYAMLFutureWarning): +- pass +- +- +-class BaseConstructor(object): +- +- yaml_constructors =3D {} # type: Dict[Any, Any] +- yaml_multi_constructors =3D {} # type: Dict[Any, Any] +- +- def __init__(self, preserve_quotes=3DNone, loader=3DNone): +- # type: (Optional[bool], Any) -> None +- self.loader =3D loader +- if self.loader is not None and getattr(self.loader, '_constructor= ', None) is None: +- self.loader._constructor =3D self +- self.loader =3D loader +- self.yaml_base_dict_type =3D dict +- self.yaml_base_list_type =3D list +- self.constructed_objects =3D {} # type: Dict[Any, Any] +- self.recursive_objects =3D {} # type: Dict[Any, Any] +- self.state_generators =3D [] # type: List[Any] +- self.deep_construct =3D False +- self._preserve_quotes =3D preserve_quotes +- self.allow_duplicate_keys =3D version_tnf((0, 15, 1), (0, 16)) +- +- @property +- def composer(self): +- # type: () -> Any +- if hasattr(self.loader, 'typ'): +- return self.loader.composer +- try: +- return self.loader._composer +- except AttributeError: +- sys.stdout.write('slt {}\n'.format(type(self))) +- sys.stdout.write('slc {}\n'.format(self.loader._composer)) +- sys.stdout.write('{}\n'.format(dir(self))) +- raise +- +- @property +- def resolver(self): +- # type: () -> Any +- if hasattr(self.loader, 'typ'): +- return self.loader.resolver +- return self.loader._resolver +- +- def check_data(self): +- # type: () -> Any +- # If there are more documents available? +- return self.composer.check_node() +- +- def get_data(self): +- # type: () -> Any +- # Construct and return the next document. +- if self.composer.check_node(): +- return self.construct_document(self.composer.get_node()) +- +- def get_single_data(self): +- # type: () -> Any +- # Ensure that the stream contains a single document and construct= it. +- node =3D self.composer.get_single_node() +- if node is not None: +- return self.construct_document(node) +- return None +- +- def construct_document(self, node): +- # type: (Any) -> Any +- data =3D self.construct_object(node) +- while bool(self.state_generators): +- state_generators =3D self.state_generators +- self.state_generators =3D [] +- for generator in state_generators: +- for _dummy in generator: +- pass +- self.constructed_objects =3D {} +- self.recursive_objects =3D {} +- self.deep_construct =3D False +- return data +- +- def construct_object(self, node, deep=3DFalse): +- # type: (Any, bool) -> Any +- """deep is True when creating an object/mapping recursively, +- in that case want the underlying elements available during constr= uction +- """ +- if node in self.constructed_objects: +- return self.constructed_objects[node] +- if deep: +- old_deep =3D self.deep_construct +- self.deep_construct =3D True +- if node in self.recursive_objects: +- return self.recursive_objects[node] +- # raise ConstructorError( +- # None, None, 'found unconstructable recursive node', nod= e.start_mark +- # ) +- self.recursive_objects[node] =3D None +- data =3D self.construct_non_recursive_object(node) +- +- self.constructed_objects[node] =3D data +- del self.recursive_objects[node] +- if deep: +- self.deep_construct =3D old_deep +- return data +- +- def construct_non_recursive_object(self, node, tag=3DNone): +- # type: (Any, Optional[str]) -> Any +- constructor =3D None # type: Any +- tag_suffix =3D None +- if tag is None: +- tag =3D node.tag +- if tag in self.yaml_constructors: +- constructor =3D self.yaml_constructors[tag] +- else: +- for tag_prefix in self.yaml_multi_constructors: +- if tag.startswith(tag_prefix): +- tag_suffix =3D tag[len(tag_prefix) :] +- constructor =3D self.yaml_multi_constructors[tag_pref= ix] +- break +- else: +- if None in self.yaml_multi_constructors: +- tag_suffix =3D tag +- constructor =3D self.yaml_multi_constructors[None] +- elif None in self.yaml_constructors: +- constructor =3D self.yaml_constructors[None] +- elif isinstance(node, ScalarNode): +- constructor =3D self.__class__.construct_scalar +- elif isinstance(node, SequenceNode): +- constructor =3D self.__class__.construct_sequence +- elif isinstance(node, MappingNode): +- constructor =3D self.__class__.construct_mapping +- if tag_suffix is None: +- data =3D constructor(self, node) +- else: +- data =3D constructor(self, tag_suffix, node) +- if isinstance(data, types.GeneratorType): +- generator =3D data +- data =3D next(generator) +- if self.deep_construct: +- for _dummy in generator: +- pass +- else: +- self.state_generators.append(generator) +- return data +- +- def construct_scalar(self, node): +- # type: (Any) -> Any +- if not isinstance(node, ScalarNode): +- raise ConstructorError( +- None, None, 'expected a scalar node, but found %s' % node= .id, node.start_mark +- ) +- return node.value +- +- def construct_sequence(self, node, deep=3DFalse): +- # type: (Any, bool) -> Any +- """deep is True when creating an object/mapping recursively, +- in that case want the underlying elements available during constr= uction +- """ +- if not isinstance(node, SequenceNode): +- raise ConstructorError( +- None, None, 'expected a sequence node, but found %s' % no= de.id, node.start_mark +- ) +- return [self.construct_object(child, deep=3Ddeep) for child in no= de.value] +- +- def construct_mapping(self, node, deep=3DFalse): +- # type: (Any, bool) -> Any +- """deep is True when creating an object/mapping recursively, +- in that case want the underlying elements available during constr= uction +- """ +- if not isinstance(node, MappingNode): +- raise ConstructorError( +- None, None, 'expected a mapping node, but found %s' % nod= e.id, node.start_mark +- ) +- total_mapping =3D self.yaml_base_dict_type() +- if getattr(node, 'merge', None) is not None: +- todo =3D [(node.merge, False), (node.value, False)] +- else: +- todo =3D [(node.value, True)] +- for values, check in todo: +- mapping =3D self.yaml_base_dict_type() # type: Dict[Any, Any] +- for key_node, value_node in values: +- # keys can be list -> deep +- key =3D self.construct_object(key_node, deep=3DTrue) +- # lists are not hashable, but tuples are +- if not isinstance(key, Hashable): +- if isinstance(key, list): +- key =3D tuple(key) +- if PY2: +- try: +- hash(key) +- except TypeError as exc: +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'found unacceptable key (%s)' % exc, +- key_node.start_mark, +- ) +- else: +- if not isinstance(key, Hashable): +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'found unhashable key', +- key_node.start_mark, +- ) +- +- value =3D self.construct_object(value_node, deep=3Ddeep) +- if check: +- if self.check_mapping_key(node, key_node, mapping, ke= y, value): +- mapping[key] =3D value +- else: +- mapping[key] =3D value +- total_mapping.update(mapping) +- return total_mapping +- +- def check_mapping_key(self, node, key_node, mapping, key, value): +- # type: (Any, Any, Any, Any, Any) -> bool +- """return True if key is unique""" +- if key in mapping: +- if not self.allow_duplicate_keys: +- mk =3D mapping.get(key) +- if PY2: +- if isinstance(key, unicode): +- key =3D key.encode('utf-8') +- if isinstance(value, unicode): +- value =3D value.encode('utf-8') +- if isinstance(mk, unicode): +- mk =3D mk.encode('utf-8') +- args =3D [ +- 'while constructing a mapping', +- node.start_mark, +- 'found duplicate key "{}" with value "{}" ' +- '(original value: "{}")'.format(key, value, mk), +- key_node.start_mark, +- """ +- To suppress this check see: +- http://yaml.readthedocs.io/en/latest/api.html#dup= licate-keys +- """, +- """\ +- Duplicate keys will become an error in future release= s, and are errors +- by default when using the new API. +- """, +- ] +- if self.allow_duplicate_keys is None: +- warnings.warn(DuplicateKeyFutureWarning(*args)) +- else: +- raise DuplicateKeyError(*args) +- return False +- return True +- +- def check_set_key(self, node, key_node, setting, key): +- # type: (Any, Any, Any, Any, Any) -> None +- if key in setting: +- if not self.allow_duplicate_keys: +- if PY2: +- if isinstance(key, unicode): +- key =3D key.encode('utf-8') +- args =3D [ +- 'while constructing a set', +- node.start_mark, +- 'found duplicate key "{}"'.format(key), +- key_node.start_mark, +- """ +- To suppress this check see: +- http://yaml.readthedocs.io/en/latest/api.html#dup= licate-keys +- """, +- """\ +- Duplicate keys will become an error in future release= s, and are errors +- by default when using the new API. +- """, +- ] +- if self.allow_duplicate_keys is None: +- warnings.warn(DuplicateKeyFutureWarning(*args)) +- else: +- raise DuplicateKeyError(*args) +- +- def construct_pairs(self, node, deep=3DFalse): +- # type: (Any, bool) -> Any +- if not isinstance(node, MappingNode): +- raise ConstructorError( +- None, None, 'expected a mapping node, but found %s' % nod= e.id, node.start_mark +- ) +- pairs =3D [] +- for key_node, value_node in node.value: +- key =3D self.construct_object(key_node, deep=3Ddeep) +- value =3D self.construct_object(value_node, deep=3Ddeep) +- pairs.append((key, value)) +- return pairs +- +- @classmethod +- def add_constructor(cls, tag, constructor): +- # type: (Any, Any) -> None +- if 'yaml_constructors' not in cls.__dict__: +- cls.yaml_constructors =3D cls.yaml_constructors.copy() +- cls.yaml_constructors[tag] =3D constructor +- +- @classmethod +- def add_multi_constructor(cls, tag_prefix, multi_constructor): +- # type: (Any, Any) -> None +- if 'yaml_multi_constructors' not in cls.__dict__: +- cls.yaml_multi_constructors =3D cls.yaml_multi_constructors.c= opy() +- cls.yaml_multi_constructors[tag_prefix] =3D multi_constructor +- +- +-class SafeConstructor(BaseConstructor): +- def construct_scalar(self, node): +- # type: (Any) -> Any +- if isinstance(node, MappingNode): +- for key_node, value_node in node.value: +- if key_node.tag =3D=3D u'tag:yaml.org,2002:value': +- return self.construct_scalar(value_node) +- return BaseConstructor.construct_scalar(self, node) +- +- def flatten_mapping(self, node): +- # type: (Any) -> Any +- """ +- This implements the merge key feature http://yaml.org/type/merge.= html +- by inserting keys from the merge dict/list of dicts if not yet +- available in this node +- """ +- merge =3D [] # type: List[Any] +- index =3D 0 +- while index < len(node.value): +- key_node, value_node =3D node.value[index] +- if key_node.tag =3D=3D u'tag:yaml.org,2002:merge': +- if merge: # double << key +- if self.allow_duplicate_keys: +- del node.value[index] +- index +=3D 1 +- continue +- args =3D [ +- 'while constructing a mapping', +- node.start_mark, +- 'found duplicate key "{}"'.format(key_node.value), +- key_node.start_mark, +- """ +- To suppress this check see: +- http://yaml.readthedocs.io/en/latest/api.html#= duplicate-keys +- """, +- """\ +- Duplicate keys will become an error in future rel= eases, and are errors +- by default when using the new API. +- """, +- ] +- if self.allow_duplicate_keys is None: +- warnings.warn(DuplicateKeyFutureWarning(*args)) +- else: +- raise DuplicateKeyError(*args) +- del node.value[index] +- if isinstance(value_node, MappingNode): +- self.flatten_mapping(value_node) +- merge.extend(value_node.value) +- elif isinstance(value_node, SequenceNode): +- submerge =3D [] +- for subnode in value_node.value: +- if not isinstance(subnode, MappingNode): +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'expected a mapping for merging, but foun= d %s' % subnode.id, +- subnode.start_mark, +- ) +- self.flatten_mapping(subnode) +- submerge.append(subnode.value) +- submerge.reverse() +- for value in submerge: +- merge.extend(value) +- else: +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'expected a mapping or list of mappings for mergi= ng, ' +- 'but found %s' % value_node.id, +- value_node.start_mark, +- ) +- elif key_node.tag =3D=3D u'tag:yaml.org,2002:value': +- key_node.tag =3D u'tag:yaml.org,2002:str' +- index +=3D 1 +- else: +- index +=3D 1 +- if bool(merge): +- node.merge =3D merge # separate merge keys to be able to upd= ate without duplicate +- node.value =3D merge + node.value +- +- def construct_mapping(self, node, deep=3DFalse): +- # type: (Any, bool) -> Any +- """deep is True when creating an object/mapping recursively, +- in that case want the underlying elements available during constr= uction +- """ +- if isinstance(node, MappingNode): +- self.flatten_mapping(node) +- return BaseConstructor.construct_mapping(self, node, deep=3Ddeep) +- +- def construct_yaml_null(self, node): +- # type: (Any) -> Any +- self.construct_scalar(node) +- return None +- +- # YAML 1.2 spec doesn't mention yes/no etc any more, 1.1 does +- bool_values =3D { +- u'yes': True, +- u'no': False, +- u'y': True, +- u'n': False, +- u'true': True, +- u'false': False, +- u'on': True, +- u'off': False, +- } +- +- def construct_yaml_bool(self, node): +- # type: (Any) -> bool +- value =3D self.construct_scalar(node) +- return self.bool_values[value.lower()] +- +- def construct_yaml_int(self, node): +- # type: (Any) -> int +- value_s =3D to_str(self.construct_scalar(node)) +- value_s =3D value_s.replace('_', "") +- sign =3D +1 +- if value_s[0] =3D=3D '-': +- sign =3D -1 +- if value_s[0] in '+-': +- value_s =3D value_s[1:] +- if value_s =3D=3D '0': +- return 0 +- elif value_s.startswith('0b'): +- return sign * int(value_s[2:], 2) +- elif value_s.startswith('0x'): +- return sign * int(value_s[2:], 16) +- elif value_s.startswith('0o'): +- return sign * int(value_s[2:], 8) +- elif self.resolver.processing_version =3D=3D (1, 1) and value_s[0= ] =3D=3D '0': +- return sign * int(value_s, 8) +- elif self.resolver.processing_version =3D=3D (1, 1) and ':' in va= lue_s: +- digits =3D [int(part) for part in value_s.split(':')] +- digits.reverse() +- base =3D 1 +- value =3D 0 +- for digit in digits: +- value +=3D digit * base +- base *=3D 60 +- return sign * value +- else: +- return sign * int(value_s) +- +- inf_value =3D 1e300 +- while inf_value !=3D inf_value * inf_value: +- inf_value *=3D inf_value +- nan_value =3D -inf_value / inf_value # Trying to make a quiet NaN (l= ike C99). +- +- def construct_yaml_float(self, node): +- # type: (Any) -> float +- value_so =3D to_str(self.construct_scalar(node)) +- value_s =3D value_so.replace('_', "").lower() +- sign =3D +1 +- if value_s[0] =3D=3D '-': +- sign =3D -1 +- if value_s[0] in '+-': +- value_s =3D value_s[1:] +- if value_s =3D=3D '.inf': +- return sign * self.inf_value +- elif value_s =3D=3D '.nan': +- return self.nan_value +- elif self.resolver.processing_version !=3D (1, 2) and ':' in valu= e_s: +- digits =3D [float(part) for part in value_s.split(':')] +- digits.reverse() +- base =3D 1 +- value =3D 0.0 +- for digit in digits: +- value +=3D digit * base +- base *=3D 60 +- return sign * value +- else: +- if self.resolver.processing_version !=3D (1, 2) and 'e' in va= lue_s: +- # value_s is lower case independent of input +- mantissa, exponent =3D value_s.split('e') +- if '.' not in mantissa: +- warnings.warn(MantissaNoDotYAML1_1Warning(node, value= _so)) +- return sign * float(value_s) +- +- if PY3: +- +- def construct_yaml_binary(self, node): +- # type: (Any) -> Any +- try: +- value =3D self.construct_scalar(node).encode('ascii') +- except UnicodeEncodeError as exc: +- raise ConstructorError( +- None, +- None, +- 'failed to convert base64 data into ascii: %s' % exc, +- node.start_mark, +- ) +- try: +- if hasattr(base64, 'decodebytes'): +- return base64.decodebytes(value) +- else: +- return base64.decodestring(value) +- except binascii.Error as exc: +- raise ConstructorError( +- None, None, 'failed to decode base64 data: %s' % exc,= node.start_mark +- ) +- +- else: +- +- def construct_yaml_binary(self, node): +- # type: (Any) -> Any +- value =3D self.construct_scalar(node) +- try: +- return to_str(value).decode('base64') +- except (binascii.Error, UnicodeEncodeError) as exc: +- raise ConstructorError( +- None, None, 'failed to decode base64 data: %s' % exc,= node.start_mark +- ) +- +- timestamp_regexp =3D RegExp( +- u"""^(?P[0-9][0-9][0-9][0-9]) +- -(?P[0-9][0-9]?) +- -(?P[0-9][0-9]?) +- (?:((?P[Tt])|[ \\t]+) # explictly not retaining extra spac= es +- (?P[0-9][0-9]?) +- :(?P[0-9][0-9]) +- :(?P[0-9][0-9]) +- (?:\\.(?P[0-9]*))? +- (?:[ \\t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) +- (?::(?P[0-9][0-9]))?))?)?$""", +- re.X, +- ) +- +- def construct_yaml_timestamp(self, node, values=3DNone): +- # type: (Any, Any) -> Any +- if values is None: +- try: +- match =3D self.timestamp_regexp.match(node.value) +- except TypeError: +- match =3D None +- if match is None: +- raise ConstructorError( +- None, +- None, +- 'failed to construct timestamp from "{}"'.format(node= .value), +- node.start_mark, +- ) +- values =3D match.groupdict() +- year =3D int(values['year']) +- month =3D int(values['month']) +- day =3D int(values['day']) +- if not values['hour']: +- return datetime.date(year, month, day) +- hour =3D int(values['hour']) +- minute =3D int(values['minute']) +- second =3D int(values['second']) +- fraction =3D 0 +- if values['fraction']: +- fraction_s =3D values['fraction'][:6] +- while len(fraction_s) < 6: +- fraction_s +=3D '0' +- fraction =3D int(fraction_s) +- if len(values['fraction']) > 6 and int(values['fraction'][6])= > 4: +- fraction +=3D 1 +- delta =3D None +- if values['tz_sign']: +- tz_hour =3D int(values['tz_hour']) +- minutes =3D values['tz_minute'] +- tz_minute =3D int(minutes) if minutes else 0 +- delta =3D datetime.timedelta(hours=3Dtz_hour, minutes=3Dtz_mi= nute) +- if values['tz_sign'] =3D=3D '-': +- delta =3D -delta +- # should do something else instead (or hook this up to the preced= ing if statement +- # in reverse +- # if delta is None: +- # return datetime.datetime(year, month, day, hour, minute, s= econd, fraction) +- # return datetime.datetime(year, month, day, hour, minute, secon= d, fraction, +- # datetime.timezone.utc) +- # the above is not good enough though, should provide tzinfo. In = Python3 that is easily +- # doable drop that kind of support for Python2 as it has not nati= ve tzinfo +- data =3D datetime.datetime(year, month, day, hour, minute, second= , fraction) +- if delta: +- data -=3D delta +- return data +- +- def construct_yaml_omap(self, node): +- # type: (Any) -> Any +- # Note: we do now check for duplicate keys +- omap =3D ordereddict() +- yield omap +- if not isinstance(node, SequenceNode): +- raise ConstructorError( +- 'while constructing an ordered map', +- node.start_mark, +- 'expected a sequence, but found %s' % node.id, +- node.start_mark, +- ) +- for subnode in node.value: +- if not isinstance(subnode, MappingNode): +- raise ConstructorError( +- 'while constructing an ordered map', +- node.start_mark, +- 'expected a mapping of length 1, but found %s' % subn= ode.id, +- subnode.start_mark, +- ) +- if len(subnode.value) !=3D 1: +- raise ConstructorError( +- 'while constructing an ordered map', +- node.start_mark, +- 'expected a single mapping item, but found %d items' = % len(subnode.value), +- subnode.start_mark, +- ) +- key_node, value_node =3D subnode.value[0] +- key =3D self.construct_object(key_node) +- assert key not in omap +- value =3D self.construct_object(value_node) +- omap[key] =3D value +- +- def construct_yaml_pairs(self, node): +- # type: (Any) -> Any +- # Note: the same code as `construct_yaml_omap`. +- pairs =3D [] # type: List[Any] +- yield pairs +- if not isinstance(node, SequenceNode): +- raise ConstructorError( +- 'while constructing pairs', +- node.start_mark, +- 'expected a sequence, but found %s' % node.id, +- node.start_mark, +- ) +- for subnode in node.value: +- if not isinstance(subnode, MappingNode): +- raise ConstructorError( +- 'while constructing pairs', +- node.start_mark, +- 'expected a mapping of length 1, but found %s' % subn= ode.id, +- subnode.start_mark, +- ) +- if len(subnode.value) !=3D 1: +- raise ConstructorError( +- 'while constructing pairs', +- node.start_mark, +- 'expected a single mapping item, but found %d items' = % len(subnode.value), +- subnode.start_mark, +- ) +- key_node, value_node =3D subnode.value[0] +- key =3D self.construct_object(key_node) +- value =3D self.construct_object(value_node) +- pairs.append((key, value)) +- +- def construct_yaml_set(self, node): +- # type: (Any) -> Any +- data =3D set() # type: Set[Any] +- yield data +- value =3D self.construct_mapping(node) +- data.update(value) +- +- def construct_yaml_str(self, node): +- # type: (Any) -> Any +- value =3D self.construct_scalar(node) +- if PY3: +- return value +- try: +- return value.encode('ascii') +- except UnicodeEncodeError: +- return value +- +- def construct_yaml_seq(self, node): +- # type: (Any) -> Any +- data =3D self.yaml_base_list_type() # type: List[Any] +- yield data +- data.extend(self.construct_sequence(node)) +- +- def construct_yaml_map(self, node): +- # type: (Any) -> Any +- data =3D self.yaml_base_dict_type() # type: Dict[Any, Any] +- yield data +- value =3D self.construct_mapping(node) +- data.update(value) +- +- def construct_yaml_object(self, node, cls): +- # type: (Any, Any) -> Any +- data =3D cls.__new__(cls) +- yield data +- if hasattr(data, '__setstate__'): +- state =3D self.construct_mapping(node, deep=3DTrue) +- data.__setstate__(state) +- else: +- state =3D self.construct_mapping(node) +- data.__dict__.update(state) +- +- def construct_undefined(self, node): +- # type: (Any) -> None +- raise ConstructorError( +- None, +- None, +- 'could not determine a constructor for the tag %r' % utf8(nod= e.tag), +- node.start_mark, +- ) +- +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:null', SafeConstructo= r.construct_yaml_null) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:bool', SafeConstructo= r.construct_yaml_bool) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:int', SafeConstructor= .construct_yaml_int) +- +-SafeConstructor.add_constructor( +- u'tag:yaml.org,2002:float', SafeConstructor.construct_yaml_float +-) +- +-SafeConstructor.add_constructor( +- u'tag:yaml.org,2002:binary', SafeConstructor.construct_yaml_binary +-) +- +-SafeConstructor.add_constructor( +- u'tag:yaml.org,2002:timestamp', SafeConstructor.construct_yaml_timest= amp +-) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:omap', SafeConstructo= r.construct_yaml_omap) +- +-SafeConstructor.add_constructor( +- u'tag:yaml.org,2002:pairs', SafeConstructor.construct_yaml_pairs +-) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:set', SafeConstructor= .construct_yaml_set) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:str', SafeConstructor= .construct_yaml_str) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:seq', SafeConstructor= .construct_yaml_seq) +- +-SafeConstructor.add_constructor(u'tag:yaml.org,2002:map', SafeConstructor= .construct_yaml_map) +- +-SafeConstructor.add_constructor(None, SafeConstructor.construct_undefined) +- +-if PY2: +- +- class classobj: +- pass +- +- +-class Constructor(SafeConstructor): +- def construct_python_str(self, node): +- # type: (Any) -> Any +- return utf8(self.construct_scalar(node)) +- +- def construct_python_unicode(self, node): +- # type: (Any) -> Any +- return self.construct_scalar(node) +- +- if PY3: +- +- def construct_python_bytes(self, node): +- # type: (Any) -> Any +- try: +- value =3D self.construct_scalar(node).encode('ascii') +- except UnicodeEncodeError as exc: +- raise ConstructorError( +- None, +- None, +- 'failed to convert base64 data into ascii: %s' % exc, +- node.start_mark, +- ) +- try: +- if hasattr(base64, 'decodebytes'): +- return base64.decodebytes(value) +- else: +- return base64.decodestring(value) +- except binascii.Error as exc: +- raise ConstructorError( +- None, None, 'failed to decode base64 data: %s' % exc,= node.start_mark +- ) +- +- def construct_python_long(self, node): +- # type: (Any) -> int +- val =3D self.construct_yaml_int(node) +- if PY3: +- return val +- return int(val) +- +- def construct_python_complex(self, node): +- # type: (Any) -> Any +- return complex(self.construct_scalar(node)) +- +- def construct_python_tuple(self, node): +- # type: (Any) -> Any +- return tuple(self.construct_sequence(node)) +- +- def find_python_module(self, name, mark): +- # type: (Any, Any) -> Any +- if not name: +- raise ConstructorError( +- 'while constructing a Python module', +- mark, +- 'expected non-empty name appended to the tag', +- mark, +- ) +- try: +- __import__(name) +- except ImportError as exc: +- raise ConstructorError( +- 'while constructing a Python module', +- mark, +- 'cannot find module %r (%s)' % (utf8(name), exc), +- mark, +- ) +- return sys.modules[name] +- +- def find_python_name(self, name, mark): +- # type: (Any, Any) -> Any +- if not name: +- raise ConstructorError( +- 'while constructing a Python object', +- mark, +- 'expected non-empty name appended to the tag', +- mark, +- ) +- if u'.' in name: +- lname =3D name.split('.') +- lmodule_name =3D lname +- lobject_name =3D [] # type: List[Any] +- while len(lmodule_name) > 1: +- lobject_name.insert(0, lmodule_name.pop()) +- module_name =3D '.'.join(lmodule_name) +- try: +- __import__(module_name) +- # object_name =3D '.'.join(object_name) +- break +- except ImportError: +- continue +- else: +- module_name =3D builtins_module +- lobject_name =3D [name] +- try: +- __import__(module_name) +- except ImportError as exc: +- raise ConstructorError( +- 'while constructing a Python object', +- mark, +- 'cannot find module %r (%s)' % (utf8(module_name), exc), +- mark, +- ) +- module =3D sys.modules[module_name] +- object_name =3D '.'.join(lobject_name) +- obj =3D module +- while lobject_name: +- if not hasattr(obj, lobject_name[0]): +- +- raise ConstructorError( +- 'while constructing a Python object', +- mark, +- 'cannot find %r in the module %r' % (utf8(object_name= ), module.__name__), +- mark, +- ) +- obj =3D getattr(obj, lobject_name.pop(0)) +- return obj +- +- def construct_python_name(self, suffix, node): +- # type: (Any, Any) -> Any +- value =3D self.construct_scalar(node) +- if value: +- raise ConstructorError( +- 'while constructing a Python name', +- node.start_mark, +- 'expected the empty value, but found %r' % utf8(value), +- node.start_mark, +- ) +- return self.find_python_name(suffix, node.start_mark) +- +- def construct_python_module(self, suffix, node): +- # type: (Any, Any) -> Any +- value =3D self.construct_scalar(node) +- if value: +- raise ConstructorError( +- 'while constructing a Python module', +- node.start_mark, +- 'expected the empty value, but found %r' % utf8(value), +- node.start_mark, +- ) +- return self.find_python_module(suffix, node.start_mark) +- +- def make_python_instance(self, suffix, node, args=3DNone, kwds=3DNone= , newobj=3DFalse): +- # type: (Any, Any, Any, Any, bool) -> Any +- if not args: +- args =3D [] +- if not kwds: +- kwds =3D {} +- cls =3D self.find_python_name(suffix, node.start_mark) +- if PY3: +- if newobj and isinstance(cls, type): +- return cls.__new__(cls, *args, **kwds) +- else: +- return cls(*args, **kwds) +- else: +- if newobj and isinstance(cls, type(classobj)) and not args an= d not kwds: +- instance =3D classobj() +- instance.__class__ =3D cls +- return instance +- elif newobj and isinstance(cls, type): +- return cls.__new__(cls, *args, **kwds) +- else: +- return cls(*args, **kwds) +- +- def set_python_instance_state(self, instance, state): +- # type: (Any, Any) -> None +- if hasattr(instance, '__setstate__'): +- instance.__setstate__(state) +- else: +- slotstate =3D {} # type: Dict[Any, Any] +- if isinstance(state, tuple) and len(state) =3D=3D 2: +- state, slotstate =3D state +- if hasattr(instance, '__dict__'): +- instance.__dict__.update(state) +- elif state: +- slotstate.update(state) +- for key, value in slotstate.items(): +- setattr(instance, key, value) +- +- def construct_python_object(self, suffix, node): +- # type: (Any, Any) -> Any +- # Format: +- # !!python/object:module.name { ... state ... } +- instance =3D self.make_python_instance(suffix, node, newobj=3DTru= e) +- self.recursive_objects[node] =3D instance +- yield instance +- deep =3D hasattr(instance, '__setstate__') +- state =3D self.construct_mapping(node, deep=3Ddeep) +- self.set_python_instance_state(instance, state) +- +- def construct_python_object_apply(self, suffix, node, newobj=3DFalse): +- # type: (Any, Any, bool) -> Any +- # Format: +- # !!python/object/apply # (or !!python/object/new) +- # args: [ ... arguments ... ] +- # kwds: { ... keywords ... } +- # state: ... state ... +- # listitems: [ ... listitems ... ] +- # dictitems: { ... dictitems ... } +- # or short format: +- # !!python/object/apply [ ... arguments ... ] +- # The difference between !!python/object/apply and !!python/objec= t/new +- # is how an object is created, check make_python_instance for det= ails. +- if isinstance(node, SequenceNode): +- args =3D self.construct_sequence(node, deep=3DTrue) +- kwds =3D {} # type: Dict[Any, Any] +- state =3D {} # type: Dict[Any, Any] +- listitems =3D [] # type: List[Any] +- dictitems =3D {} # type: Dict[Any, Any] +- else: +- value =3D self.construct_mapping(node, deep=3DTrue) +- args =3D value.get('args', []) +- kwds =3D value.get('kwds', {}) +- state =3D value.get('state', {}) +- listitems =3D value.get('listitems', []) +- dictitems =3D value.get('dictitems', {}) +- instance =3D self.make_python_instance(suffix, node, args, kwds, = newobj) +- if bool(state): +- self.set_python_instance_state(instance, state) +- if bool(listitems): +- instance.extend(listitems) +- if bool(dictitems): +- for key in dictitems: +- instance[key] =3D dictitems[key] +- return instance +- +- def construct_python_object_new(self, suffix, node): +- # type: (Any, Any) -> Any +- return self.construct_python_object_apply(suffix, node, newobj=3D= True) +- +- +-Constructor.add_constructor(u'tag:yaml.org,2002:python/none', Constructor= .construct_yaml_null) +- +-Constructor.add_constructor(u'tag:yaml.org,2002:python/bool', Constructor= .construct_yaml_bool) +- +-Constructor.add_constructor(u'tag:yaml.org,2002:python/str', Constructor.= construct_python_str) +- +-Constructor.add_constructor( +- u'tag:yaml.org,2002:python/unicode', Constructor.construct_python_uni= code +-) +- +-if PY3: +- Constructor.add_constructor( +- u'tag:yaml.org,2002:python/bytes', Constructor.construct_python_b= ytes +- ) +- +-Constructor.add_constructor(u'tag:yaml.org,2002:python/int', Constructor.= construct_yaml_int) +- +-Constructor.add_constructor( +- u'tag:yaml.org,2002:python/long', Constructor.construct_python_long +-) +- +-Constructor.add_constructor( +- u'tag:yaml.org,2002:python/float', Constructor.construct_yaml_float +-) +- +-Constructor.add_constructor( +- u'tag:yaml.org,2002:python/complex', Constructor.construct_python_com= plex +-) +- +-Constructor.add_constructor(u'tag:yaml.org,2002:python/list', Constructor= .construct_yaml_seq) +- +-Constructor.add_constructor( +- u'tag:yaml.org,2002:python/tuple', Constructor.construct_python_tuple +-) +- +-Constructor.add_constructor(u'tag:yaml.org,2002:python/dict', Constructor= .construct_yaml_map) +- +-Constructor.add_multi_constructor( +- u'tag:yaml.org,2002:python/name:', Constructor.construct_python_name +-) +- +-Constructor.add_multi_constructor( +- u'tag:yaml.org,2002:python/module:', Constructor.construct_python_mod= ule +-) +- +-Constructor.add_multi_constructor( +- u'tag:yaml.org,2002:python/object:', Constructor.construct_python_obj= ect +-) +- +-Constructor.add_multi_constructor( +- u'tag:yaml.org,2002:python/object/apply:', Constructor.construct_pyth= on_object_apply +-) +- +-Constructor.add_multi_constructor( +- u'tag:yaml.org,2002:python/object/new:', Constructor.construct_python= _object_new +-) +- +- +-class RoundTripConstructor(SafeConstructor): +- """need to store the comments on the node itself, +- as well as on the items +- """ +- +- def construct_scalar(self, node): +- # type: (Any) -> Any +- if not isinstance(node, ScalarNode): +- raise ConstructorError( +- None, None, 'expected a scalar node, but found %s' % node= .id, node.start_mark +- ) +- +- if node.style =3D=3D '|' and isinstance(node.value, text_type): +- lss =3D LiteralScalarString(node.value, anchor=3Dnode.anchor) +- if node.comment and node.comment[1]: +- lss.comment =3D node.comment[1][0] # type: ignore +- return lss +- if node.style =3D=3D '>' and isinstance(node.value, text_type): +- fold_positions =3D [] # type: List[int] +- idx =3D -1 +- while True: +- idx =3D node.value.find('\a', idx + 1) +- if idx < 0: +- break +- fold_positions.append(idx - len(fold_positions)) +- fss =3D FoldedScalarString(node.value.replace('\a', ''), anch= or=3Dnode.anchor) +- if node.comment and node.comment[1]: +- fss.comment =3D node.comment[1][0] # type: ignore +- if fold_positions: +- fss.fold_pos =3D fold_positions # type: ignore +- return fss +- elif bool(self._preserve_quotes) and isinstance(node.value, text_= type): +- if node.style =3D=3D "'": +- return SingleQuotedScalarString(node.value, anchor=3Dnode= .anchor) +- if node.style =3D=3D '"': +- return DoubleQuotedScalarString(node.value, anchor=3Dnode= .anchor) +- if node.anchor: +- return PlainScalarString(node.value, anchor=3Dnode.anchor) +- return node.value +- +- def construct_yaml_int(self, node): +- # type: (Any) -> Any +- width =3D None # type: Any +- value_su =3D to_str(self.construct_scalar(node)) +- try: +- sx =3D value_su.rstrip('_') +- underscore =3D [len(sx) - sx.rindex('_') - 1, False, False] = # type: Any +- except ValueError: +- underscore =3D None +- except IndexError: +- underscore =3D None +- value_s =3D value_su.replace('_', "") +- sign =3D +1 +- if value_s[0] =3D=3D '-': +- sign =3D -1 +- if value_s[0] in '+-': +- value_s =3D value_s[1:] +- if value_s =3D=3D '0': +- return 0 +- elif value_s.startswith('0b'): +- if self.resolver.processing_version > (1, 1) and value_s[2] = =3D=3D '0': +- width =3D len(value_s[2:]) +- if underscore is not None: +- underscore[1] =3D value_su[2] =3D=3D '_' +- underscore[2] =3D len(value_su[2:]) > 1 and value_su[-1] = =3D=3D '_' +- return BinaryInt( +- sign * int(value_s[2:], 2), +- width=3Dwidth, +- underscore=3Dunderscore, +- anchor=3Dnode.anchor, +- ) +- elif value_s.startswith('0x'): +- # default to lower-case if no a-fA-F in string +- if self.resolver.processing_version > (1, 1) and value_s[2] = =3D=3D '0': +- width =3D len(value_s[2:]) +- hex_fun =3D HexInt # type: Any +- for ch in value_s[2:]: +- if ch in 'ABCDEF': # first non-digit is capital +- hex_fun =3D HexCapsInt +- break +- if ch in 'abcdef': +- break +- if underscore is not None: +- underscore[1] =3D value_su[2] =3D=3D '_' +- underscore[2] =3D len(value_su[2:]) > 1 and value_su[-1] = =3D=3D '_' +- return hex_fun( +- sign * int(value_s[2:], 16), +- width=3Dwidth, +- underscore=3Dunderscore, +- anchor=3Dnode.anchor, +- ) +- elif value_s.startswith('0o'): +- if self.resolver.processing_version > (1, 1) and value_s[2] = =3D=3D '0': +- width =3D len(value_s[2:]) +- if underscore is not None: +- underscore[1] =3D value_su[2] =3D=3D '_' +- underscore[2] =3D len(value_su[2:]) > 1 and value_su[-1] = =3D=3D '_' +- return OctalInt( +- sign * int(value_s[2:], 8), +- width=3Dwidth, +- underscore=3Dunderscore, +- anchor=3Dnode.anchor, +- ) +- elif self.resolver.processing_version !=3D (1, 2) and value_s[0] = =3D=3D '0': +- return sign * int(value_s, 8) +- elif self.resolver.processing_version !=3D (1, 2) and ':' in valu= e_s: +- digits =3D [int(part) for part in value_s.split(':')] +- digits.reverse() +- base =3D 1 +- value =3D 0 +- for digit in digits: +- value +=3D digit * base +- base *=3D 60 +- return sign * value +- elif self.resolver.processing_version > (1, 1) and value_s[0] =3D= =3D '0': +- # not an octal, an integer with leading zero(s) +- if underscore is not None: +- # cannot have a leading underscore +- underscore[2] =3D len(value_su) > 1 and value_su[-1] =3D= =3D '_' +- return ScalarInt(sign * int(value_s), width=3Dlen(value_s), u= nderscore=3Dunderscore) +- elif underscore: +- # cannot have a leading underscore +- underscore[2] =3D len(value_su) > 1 and value_su[-1] =3D=3D '= _' +- return ScalarInt( +- sign * int(value_s), width=3DNone, underscore=3Dunderscor= e, anchor=3Dnode.anchor +- ) +- elif node.anchor: +- return ScalarInt(sign * int(value_s), width=3DNone, anchor=3D= node.anchor) +- else: +- return sign * int(value_s) +- +- def construct_yaml_float(self, node): +- # type: (Any) -> Any +- def leading_zeros(v): +- # type: (Any) -> int +- lead0 =3D 0 +- idx =3D 0 +- while idx < len(v) and v[idx] in '0.': +- if v[idx] =3D=3D '0': +- lead0 +=3D 1 +- idx +=3D 1 +- return lead0 +- +- # underscore =3D None +- m_sign =3D False # type: Any +- value_so =3D to_str(self.construct_scalar(node)) +- value_s =3D value_so.replace('_', "").lower() +- sign =3D +1 +- if value_s[0] =3D=3D '-': +- sign =3D -1 +- if value_s[0] in '+-': +- m_sign =3D value_s[0] +- value_s =3D value_s[1:] +- if value_s =3D=3D '.inf': +- return sign * self.inf_value +- if value_s =3D=3D '.nan': +- return self.nan_value +- if self.resolver.processing_version !=3D (1, 2) and ':' in value_= s: +- digits =3D [float(part) for part in value_s.split(':')] +- digits.reverse() +- base =3D 1 +- value =3D 0.0 +- for digit in digits: +- value +=3D digit * base +- base *=3D 60 +- return sign * value +- if 'e' in value_s: +- try: +- mantissa, exponent =3D value_so.split('e') +- exp =3D 'e' +- except ValueError: +- mantissa, exponent =3D value_so.split('E') +- exp =3D 'E' +- if self.resolver.processing_version !=3D (1, 2): +- # value_s is lower case independent of input +- if '.' not in mantissa: +- warnings.warn(MantissaNoDotYAML1_1Warning(node, value= _so)) +- lead0 =3D leading_zeros(mantissa) +- width =3D len(mantissa) +- prec =3D mantissa.find('.') +- if m_sign: +- width -=3D 1 +- e_width =3D len(exponent) +- e_sign =3D exponent[0] in '+-' +- # nprint('sf', width, prec, m_sign, exp, e_width, e_sign) +- return ScalarFloat( +- sign * float(value_s), +- width=3Dwidth, +- prec=3Dprec, +- m_sign=3Dm_sign, +- m_lead0=3Dlead0, +- exp=3Dexp, +- e_width=3De_width, +- e_sign=3De_sign, +- anchor=3Dnode.anchor, +- ) +- width =3D len(value_so) +- prec =3D value_so.index('.') # you can use index, this would not= be float without dot +- lead0 =3D leading_zeros(value_so) +- return ScalarFloat( +- sign * float(value_s), +- width=3Dwidth, +- prec=3Dprec, +- m_sign=3Dm_sign, +- m_lead0=3Dlead0, +- anchor=3Dnode.anchor, +- ) +- +- def construct_yaml_str(self, node): +- # type: (Any) -> Any +- value =3D self.construct_scalar(node) +- if isinstance(value, ScalarString): +- return value +- if PY3: +- return value +- try: +- return value.encode('ascii') +- except AttributeError: +- # in case you replace the node dynamically e.g. with a dict +- return value +- except UnicodeEncodeError: +- return value +- +- def construct_rt_sequence(self, node, seqtyp, deep=3DFalse): +- # type: (Any, Any, bool) -> Any +- if not isinstance(node, SequenceNode): +- raise ConstructorError( +- None, None, 'expected a sequence node, but found %s' % no= de.id, node.start_mark +- ) +- ret_val =3D [] +- if node.comment: +- seqtyp._yaml_add_comment(node.comment[:2]) +- if len(node.comment) > 2: +- seqtyp.yaml_end_comment_extend(node.comment[2], clear=3DT= rue) +- if node.anchor: +- from dynaconf.vendor.ruamel.yaml.serializer import templated_= id +- +- if not templated_id(node.anchor): +- seqtyp.yaml_set_anchor(node.anchor) +- for idx, child in enumerate(node.value): +- if child.comment: +- seqtyp._yaml_add_comment(child.comment, key=3Didx) +- child.comment =3D None # if moved to sequence remove fro= m child +- ret_val.append(self.construct_object(child, deep=3Ddeep)) +- seqtyp._yaml_set_idx_line_col( +- idx, [child.start_mark.line, child.start_mark.column] +- ) +- return ret_val +- +- def flatten_mapping(self, node): +- # type: (Any) -> Any +- """ +- This implements the merge key feature http://yaml.org/type/merge.= html +- by inserting keys from the merge dict/list of dicts if not yet +- available in this node +- """ +- +- def constructed(value_node): +- # type: (Any) -> Any +- # If the contents of a merge are defined within the +- # merge marker, then they won't have been constructed +- # yet. But if they were already constructed, we need to use +- # the existing object. +- if value_node in self.constructed_objects: +- value =3D self.constructed_objects[value_node] +- else: +- value =3D self.construct_object(value_node, deep=3DFalse) +- return value +- +- # merge =3D [] +- merge_map_list =3D [] # type: List[Any] +- index =3D 0 +- while index < len(node.value): +- key_node, value_node =3D node.value[index] +- if key_node.tag =3D=3D u'tag:yaml.org,2002:merge': +- if merge_map_list: # double << key +- if self.allow_duplicate_keys: +- del node.value[index] +- index +=3D 1 +- continue +- args =3D [ +- 'while constructing a mapping', +- node.start_mark, +- 'found duplicate key "{}"'.format(key_node.value), +- key_node.start_mark, +- """ +- To suppress this check see: +- http://yaml.readthedocs.io/en/latest/api.html#= duplicate-keys +- """, +- """\ +- Duplicate keys will become an error in future rel= eases, and are errors +- by default when using the new API. +- """, +- ] +- if self.allow_duplicate_keys is None: +- warnings.warn(DuplicateKeyFutureWarning(*args)) +- else: +- raise DuplicateKeyError(*args) +- del node.value[index] +- if isinstance(value_node, MappingNode): +- merge_map_list.append((index, constructed(value_node)= )) +- # self.flatten_mapping(value_node) +- # merge.extend(value_node.value) +- elif isinstance(value_node, SequenceNode): +- # submerge =3D [] +- for subnode in value_node.value: +- if not isinstance(subnode, MappingNode): +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'expected a mapping for merging, but foun= d %s' % subnode.id, +- subnode.start_mark, +- ) +- merge_map_list.append((index, constructed(subnode= ))) +- # self.flatten_mapping(subnode) +- # submerge.append(subnode.value) +- # submerge.reverse() +- # for value in submerge: +- # merge.extend(value) +- else: +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'expected a mapping or list of mappings for mergi= ng, ' +- 'but found %s' % value_node.id, +- value_node.start_mark, +- ) +- elif key_node.tag =3D=3D u'tag:yaml.org,2002:value': +- key_node.tag =3D u'tag:yaml.org,2002:str' +- index +=3D 1 +- else: +- index +=3D 1 +- return merge_map_list +- # if merge: +- # node.value =3D merge + node.value +- +- def _sentinel(self): +- # type: () -> None +- pass +- +- def construct_mapping(self, node, maptyp, deep=3DFalse): # type: ign= ore +- # type: (Any, Any, bool) -> Any +- if not isinstance(node, MappingNode): +- raise ConstructorError( +- None, None, 'expected a mapping node, but found %s' % nod= e.id, node.start_mark +- ) +- merge_map =3D self.flatten_mapping(node) +- # mapping =3D {} +- if node.comment: +- maptyp._yaml_add_comment(node.comment[:2]) +- if len(node.comment) > 2: +- maptyp.yaml_end_comment_extend(node.comment[2], clear=3DT= rue) +- if node.anchor: +- from dynaconf.vendor.ruamel.yaml.serializer import templated_= id +- +- if not templated_id(node.anchor): +- maptyp.yaml_set_anchor(node.anchor) +- last_key, last_value =3D None, self._sentinel +- for key_node, value_node in node.value: +- # keys can be list -> deep +- key =3D self.construct_object(key_node, deep=3DTrue) +- # lists are not hashable, but tuples are +- if not isinstance(key, Hashable): +- if isinstance(key, MutableSequence): +- key_s =3D CommentedKeySeq(key) +- if key_node.flow_style is True: +- key_s.fa.set_flow_style() +- elif key_node.flow_style is False: +- key_s.fa.set_block_style() +- key =3D key_s +- elif isinstance(key, MutableMapping): +- key_m =3D CommentedKeyMap(key) +- if key_node.flow_style is True: +- key_m.fa.set_flow_style() +- elif key_node.flow_style is False: +- key_m.fa.set_block_style() +- key =3D key_m +- if PY2: +- try: +- hash(key) +- except TypeError as exc: +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'found unacceptable key (%s)' % exc, +- key_node.start_mark, +- ) +- else: +- if not isinstance(key, Hashable): +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'found unhashable key', +- key_node.start_mark, +- ) +- value =3D self.construct_object(value_node, deep=3Ddeep) +- if self.check_mapping_key(node, key_node, maptyp, key, value): +- if key_node.comment and len(key_node.comment) > 4 and key= _node.comment[4]: +- if last_value is None: +- key_node.comment[0] =3D key_node.comment.pop(4) +- maptyp._yaml_add_comment(key_node.comment, value= =3Dlast_key) +- else: +- key_node.comment[2] =3D key_node.comment.pop(4) +- maptyp._yaml_add_comment(key_node.comment, key=3D= key) +- key_node.comment =3D None +- if key_node.comment: +- maptyp._yaml_add_comment(key_node.comment, key=3Dkey) +- if value_node.comment: +- maptyp._yaml_add_comment(value_node.comment, value=3D= key) +- maptyp._yaml_set_kv_line_col( +- key, +- [ +- key_node.start_mark.line, +- key_node.start_mark.column, +- value_node.start_mark.line, +- value_node.start_mark.column, +- ], +- ) +- maptyp[key] =3D value +- last_key, last_value =3D key, value # could use indexing +- # do this last, or <<: before a key will prevent insertion in ins= tances +- # of collections.OrderedDict (as they have no __contains__ +- if merge_map: +- maptyp.add_yaml_merge(merge_map) +- +- def construct_setting(self, node, typ, deep=3DFalse): +- # type: (Any, Any, bool) -> Any +- if not isinstance(node, MappingNode): +- raise ConstructorError( +- None, None, 'expected a mapping node, but found %s' % nod= e.id, node.start_mark +- ) +- if node.comment: +- typ._yaml_add_comment(node.comment[:2]) +- if len(node.comment) > 2: +- typ.yaml_end_comment_extend(node.comment[2], clear=3DTrue) +- if node.anchor: +- from dynaconf.vendor.ruamel.yaml.serializer import templated_= id +- +- if not templated_id(node.anchor): +- typ.yaml_set_anchor(node.anchor) +- for key_node, value_node in node.value: +- # keys can be list -> deep +- key =3D self.construct_object(key_node, deep=3DTrue) +- # lists are not hashable, but tuples are +- if not isinstance(key, Hashable): +- if isinstance(key, list): +- key =3D tuple(key) +- if PY2: +- try: +- hash(key) +- except TypeError as exc: +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'found unacceptable key (%s)' % exc, +- key_node.start_mark, +- ) +- else: +- if not isinstance(key, Hashable): +- raise ConstructorError( +- 'while constructing a mapping', +- node.start_mark, +- 'found unhashable key', +- key_node.start_mark, +- ) +- # construct but should be null +- value =3D self.construct_object(value_node, deep=3Ddeep) # N= OQA +- self.check_set_key(node, key_node, typ, key) +- if key_node.comment: +- typ._yaml_add_comment(key_node.comment, key=3Dkey) +- if value_node.comment: +- typ._yaml_add_comment(value_node.comment, value=3Dkey) +- typ.add(key) +- +- def construct_yaml_seq(self, node): +- # type: (Any) -> Any +- data =3D CommentedSeq() +- data._yaml_set_line_col(node.start_mark.line, node.start_mark.col= umn) +- if node.comment: +- data._yaml_add_comment(node.comment) +- yield data +- data.extend(self.construct_rt_sequence(node, data)) +- self.set_collection_style(data, node) +- +- def construct_yaml_map(self, node): +- # type: (Any) -> Any +- data =3D CommentedMap() +- data._yaml_set_line_col(node.start_mark.line, node.start_mark.col= umn) +- yield data +- self.construct_mapping(node, data, deep=3DTrue) +- self.set_collection_style(data, node) +- +- def set_collection_style(self, data, node): +- # type: (Any, Any) -> None +- if len(data) =3D=3D 0: +- return +- if node.flow_style is True: +- data.fa.set_flow_style() +- elif node.flow_style is False: +- data.fa.set_block_style() +- +- def construct_yaml_object(self, node, cls): +- # type: (Any, Any) -> Any +- data =3D cls.__new__(cls) +- yield data +- if hasattr(data, '__setstate__'): +- state =3D SafeConstructor.construct_mapping(self, node, deep= =3DTrue) +- data.__setstate__(state) +- else: +- state =3D SafeConstructor.construct_mapping(self, node) +- data.__dict__.update(state) +- +- def construct_yaml_omap(self, node): +- # type: (Any) -> Any +- # Note: we do now check for duplicate keys +- omap =3D CommentedOrderedMap() +- omap._yaml_set_line_col(node.start_mark.line, node.start_mark.col= umn) +- if node.flow_style is True: +- omap.fa.set_flow_style() +- elif node.flow_style is False: +- omap.fa.set_block_style() +- yield omap +- if node.comment: +- omap._yaml_add_comment(node.comment[:2]) +- if len(node.comment) > 2: +- omap.yaml_end_comment_extend(node.comment[2], clear=3DTru= e) +- if not isinstance(node, SequenceNode): +- raise ConstructorError( +- 'while constructing an ordered map', +- node.start_mark, +- 'expected a sequence, but found %s' % node.id, +- node.start_mark, +- ) +- for subnode in node.value: +- if not isinstance(subnode, MappingNode): +- raise ConstructorError( +- 'while constructing an ordered map', +- node.start_mark, +- 'expected a mapping of length 1, but found %s' % subn= ode.id, +- subnode.start_mark, +- ) +- if len(subnode.value) !=3D 1: +- raise ConstructorError( +- 'while constructing an ordered map', +- node.start_mark, +- 'expected a single mapping item, but found %d items' = % len(subnode.value), +- subnode.start_mark, +- ) +- key_node, value_node =3D subnode.value[0] +- key =3D self.construct_object(key_node) +- assert key not in omap +- value =3D self.construct_object(value_node) +- if key_node.comment: +- omap._yaml_add_comment(key_node.comment, key=3Dkey) +- if subnode.comment: +- omap._yaml_add_comment(subnode.comment, key=3Dkey) +- if value_node.comment: +- omap._yaml_add_comment(value_node.comment, value=3Dkey) +- omap[key] =3D value +- +- def construct_yaml_set(self, node): +- # type: (Any) -> Any +- data =3D CommentedSet() +- data._yaml_set_line_col(node.start_mark.line, node.start_mark.col= umn) +- yield data +- self.construct_setting(node, data) +- +- def construct_undefined(self, node): +- # type: (Any) -> Any +- try: +- if isinstance(node, MappingNode): +- data =3D CommentedMap() +- data._yaml_set_line_col(node.start_mark.line, node.start_= mark.column) +- if node.flow_style is True: +- data.fa.set_flow_style() +- elif node.flow_style is False: +- data.fa.set_block_style() +- data.yaml_set_tag(node.tag) +- yield data +- if node.anchor: +- data.yaml_set_anchor(node.anchor) +- self.construct_mapping(node, data) +- return +- elif isinstance(node, ScalarNode): +- data2 =3D TaggedScalar() +- data2.value =3D self.construct_scalar(node) +- data2.style =3D node.style +- data2.yaml_set_tag(node.tag) +- yield data2 +- if node.anchor: +- data2.yaml_set_anchor(node.anchor, always_dump=3DTrue) +- return +- elif isinstance(node, SequenceNode): +- data3 =3D CommentedSeq() +- data3._yaml_set_line_col(node.start_mark.line, node.start= _mark.column) +- if node.flow_style is True: +- data3.fa.set_flow_style() +- elif node.flow_style is False: +- data3.fa.set_block_style() +- data3.yaml_set_tag(node.tag) +- yield data3 +- if node.anchor: +- data3.yaml_set_anchor(node.anchor) +- data3.extend(self.construct_sequence(node)) +- return +- except: # NOQA +- pass +- raise ConstructorError( +- None, +- None, +- 'could not determine a constructor for the tag %r' % utf8(nod= e.tag), +- node.start_mark, +- ) +- +- def construct_yaml_timestamp(self, node, values=3DNone): +- # type: (Any, Any) -> Any +- try: +- match =3D self.timestamp_regexp.match(node.value) +- except TypeError: +- match =3D None +- if match is None: +- raise ConstructorError( +- None, +- None, +- 'failed to construct timestamp from "{}"'.format(node.val= ue), +- node.start_mark, +- ) +- values =3D match.groupdict() +- if not values['hour']: +- return SafeConstructor.construct_yaml_timestamp(self, node, v= alues) +- for part in ['t', 'tz_sign', 'tz_hour', 'tz_minute']: +- if values[part]: +- break +- else: +- return SafeConstructor.construct_yaml_timestamp(self, node, v= alues) +- year =3D int(values['year']) +- month =3D int(values['month']) +- day =3D int(values['day']) +- hour =3D int(values['hour']) +- minute =3D int(values['minute']) +- second =3D int(values['second']) +- fraction =3D 0 +- if values['fraction']: +- fraction_s =3D values['fraction'][:6] +- while len(fraction_s) < 6: +- fraction_s +=3D '0' +- fraction =3D int(fraction_s) +- if len(values['fraction']) > 6 and int(values['fraction'][6])= > 4: +- fraction +=3D 1 +- delta =3D None +- if values['tz_sign']: +- tz_hour =3D int(values['tz_hour']) +- minutes =3D values['tz_minute'] +- tz_minute =3D int(minutes) if minutes else 0 +- delta =3D datetime.timedelta(hours=3Dtz_hour, minutes=3Dtz_mi= nute) +- if values['tz_sign'] =3D=3D '-': +- delta =3D -delta +- if delta: +- dt =3D datetime.datetime(year, month, day, hour, minute) +- dt -=3D delta +- data =3D TimeStamp(dt.year, dt.month, dt.day, dt.hour, dt.min= ute, second, fraction) +- data._yaml['delta'] =3D delta +- tz =3D values['tz_sign'] + values['tz_hour'] +- if values['tz_minute']: +- tz +=3D ':' + values['tz_minute'] +- data._yaml['tz'] =3D tz +- else: +- data =3D TimeStamp(year, month, day, hour, minute, second, fr= action) +- if values['tz']: # no delta +- data._yaml['tz'] =3D values['tz'] +- +- if values['t']: +- data._yaml['t'] =3D True +- return data +- +- def construct_yaml_bool(self, node): +- # type: (Any) -> Any +- b =3D SafeConstructor.construct_yaml_bool(self, node) +- if node.anchor: +- return ScalarBoolean(b, anchor=3Dnode.anchor) +- return b +- +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:null', RoundTripConstructor.construct_yaml_null +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:bool', RoundTripConstructor.construct_yaml_bool +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:int', RoundTripConstructor.construct_yaml_int +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:float', RoundTripConstructor.construct_yaml_float +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:binary', RoundTripConstructor.construct_yaml_bina= ry +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:timestamp', RoundTripConstructor.construct_yaml_t= imestamp +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:omap', RoundTripConstructor.construct_yaml_omap +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:pairs', RoundTripConstructor.construct_yaml_pairs +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:set', RoundTripConstructor.construct_yaml_set +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:str', RoundTripConstructor.construct_yaml_str +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:seq', RoundTripConstructor.construct_yaml_seq +-) +- +-RoundTripConstructor.add_constructor( +- u'tag:yaml.org,2002:map', RoundTripConstructor.construct_yaml_map +-) +- +-RoundTripConstructor.add_constructor(None, RoundTripConstructor.construct= _undefined) +diff --git a/dynaconf/vendor_src/ruamel/yaml/cyaml.py b/dynaconf/vendor_sr= c/ruamel/yaml/cyaml.py +deleted file mode 100644 +index 2db5b01..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/cyaml.py ++++ /dev/null +@@ -1,185 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-from _ruamel_yaml import CParser, CEmitter # type: ignore +- +-from .constructor import Constructor, BaseConstructor, SafeConstructor +-from .representer import Representer, SafeRepresenter, BaseRepresenter +-from .resolver import Resolver, BaseResolver +- +-if False: # MYPY +- from typing import Any, Union, Optional # NOQA +- from .compat import StreamTextType, StreamType, VersionType # NOQA +- +-__all__ =3D ['CBaseLoader', 'CSafeLoader', 'CLoader', 'CBaseDumper', 'CSa= feDumper', 'CDumper'] +- +- +-# this includes some hacks to solve the usage of resolver by lower level +-# parts of the parser +- +- +-class CBaseLoader(CParser, BaseConstructor, BaseResolver): # type: ignore +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- CParser.__init__(self, stream) +- self._parser =3D self._composer =3D self +- BaseConstructor.__init__(self, loader=3Dself) +- BaseResolver.__init__(self, loadumper=3Dself) +- # self.descend_resolver =3D self._resolver.descend_resolver +- # self.ascend_resolver =3D self._resolver.ascend_resolver +- # self.resolve =3D self._resolver.resolve +- +- +-class CSafeLoader(CParser, SafeConstructor, Resolver): # type: ignore +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- CParser.__init__(self, stream) +- self._parser =3D self._composer =3D self +- SafeConstructor.__init__(self, loader=3Dself) +- Resolver.__init__(self, loadumper=3Dself) +- # self.descend_resolver =3D self._resolver.descend_resolver +- # self.ascend_resolver =3D self._resolver.ascend_resolver +- # self.resolve =3D self._resolver.resolve +- +- +-class CLoader(CParser, Constructor, Resolver): # type: ignore +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- CParser.__init__(self, stream) +- self._parser =3D self._composer =3D self +- Constructor.__init__(self, loader=3Dself) +- Resolver.__init__(self, loadumper=3Dself) +- # self.descend_resolver =3D self._resolver.descend_resolver +- # self.ascend_resolver =3D self._resolver.ascend_resolver +- # self.resolve =3D self._resolver.resolve +- +- +-class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): # type: igno= re +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Any, Any, Optional[bool], Optional[int]= , Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], = Any, Any, Any, Any, Any) -> None # NOQA +- CEmitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- encoding=3Dencoding, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- ) +- self._emitter =3D self._serializer =3D self._representer =3D self +- BaseRepresenter.__init__( +- self, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- dumper=3Dself, +- ) +- BaseResolver.__init__(self, loadumper=3Dself) +- +- +-class CSafeDumper(CEmitter, SafeRepresenter, Resolver): # type: ignore +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Any, Any, Optional[bool], Optional[int]= , Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], = Any, Any, Any, Any, Any) -> None # NOQA +- self._emitter =3D self._serializer =3D self._representer =3D self +- CEmitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- encoding=3Dencoding, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- ) +- self._emitter =3D self._serializer =3D self._representer =3D self +- SafeRepresenter.__init__( +- self, default_style=3Ddefault_style, default_flow_style=3Ddef= ault_flow_style +- ) +- Resolver.__init__(self) +- +- +-class CDumper(CEmitter, Representer, Resolver): # type: ignore +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Any, Any, Optional[bool], Optional[int]= , Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], = Any, Any, Any, Any, Any) -> None # NOQA +- CEmitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- encoding=3Dencoding, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- ) +- self._emitter =3D self._serializer =3D self._representer =3D self +- Representer.__init__( +- self, default_style=3Ddefault_style, default_flow_style=3Ddef= ault_flow_style +- ) +- Resolver.__init__(self) +diff --git a/dynaconf/vendor_src/ruamel/yaml/dumper.py b/dynaconf/vendor_s= rc/ruamel/yaml/dumper.py +deleted file mode 100644 +index a2cd7b4..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/dumper.py ++++ /dev/null +@@ -1,221 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-from .emitter import Emitter +-from .serializer import Serializer +-from .representer import ( +- Representer, +- SafeRepresenter, +- BaseRepresenter, +- RoundTripRepresenter, +-) +-from .resolver import Resolver, BaseResolver, VersionedResolver +- +-if False: # MYPY +- from typing import Any, Dict, List, Union, Optional # NOQA +- from .compat import StreamType, VersionType # NOQA +- +-__all__ =3D ['BaseDumper', 'SafeDumper', 'Dumper', 'RoundTripDumper'] +- +- +-class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (Any, StreamType, Any, Any, Optional[bool], Optional[int]= , Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], = Any, Any, Any, Any, Any) -> None # NOQA +- Emitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- block_seq_indent=3Dblock_seq_indent, +- dumper=3Dself, +- ) +- Serializer.__init__( +- self, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- dumper=3Dself, +- ) +- BaseRepresenter.__init__( +- self, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- dumper=3Dself, +- ) +- BaseResolver.__init__(self, loadumper=3Dself) +- +- +-class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Any, Optional[bool], Optional[int], Opt= ional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], Any, = Any, Any, Any, Any) -> None # NOQA +- Emitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- block_seq_indent=3Dblock_seq_indent, +- dumper=3Dself, +- ) +- Serializer.__init__( +- self, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- dumper=3Dself, +- ) +- SafeRepresenter.__init__( +- self, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- dumper=3Dself, +- ) +- Resolver.__init__(self, loadumper=3Dself) +- +- +-class Dumper(Emitter, Serializer, Representer, Resolver): +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Any, Optional[bool], Optional[int], Opt= ional[int], Optional[bool], Any, Any, Optional[bool], Optional[bool], Any, = Any, Any, Any, Any) -> None # NOQA +- Emitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- block_seq_indent=3Dblock_seq_indent, +- dumper=3Dself, +- ) +- Serializer.__init__( +- self, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- dumper=3Dself, +- ) +- Representer.__init__( +- self, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- dumper=3Dself, +- ) +- Resolver.__init__(self, loadumper=3Dself) +- +- +-class RoundTripDumper(Emitter, Serializer, RoundTripRepresenter, Versione= dResolver): +- def __init__( +- self, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Optional[bool], Optional[int], Optional= [int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optional[bo= ol], Any, Any, Any, Any, Any) -> None # NOQA +- Emitter.__init__( +- self, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- block_seq_indent=3Dblock_seq_indent, +- top_level_colon_align=3Dtop_level_colon_align, +- prefix_colon=3Dprefix_colon, +- dumper=3Dself, +- ) +- Serializer.__init__( +- self, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- dumper=3Dself, +- ) +- RoundTripRepresenter.__init__( +- self, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- dumper=3Dself, +- ) +- VersionedResolver.__init__(self, loader=3Dself) +diff --git a/dynaconf/vendor_src/ruamel/yaml/emitter.py b/dynaconf/vendor_= src/ruamel/yaml/emitter.py +deleted file mode 100644 +index c1eff8b..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/emitter.py ++++ /dev/null +@@ -1,1688 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +-from __future__ import print_function +- +-# Emitter expects events obeying the following grammar: +-# stream ::=3D STREAM-START document* STREAM-END +-# document ::=3D DOCUMENT-START node DOCUMENT-END +-# node ::=3D SCALAR | sequence | mapping +-# sequence ::=3D SEQUENCE-START node* SEQUENCE-END +-# mapping ::=3D MAPPING-START (node node)* MAPPING-END +- +-import sys +-from .error import YAMLError, YAMLStreamError +-from .events import * # NOQA +- +-# fmt: off +-from .compat import utf8, text_type, PY2, nprint, dbg, DBG_EVENT, check_a= nchorname_char +-# fmt: on +- +-if False: # MYPY +- from typing import Any, Dict, List, Union, Text, Tuple, Optional # N= OQA +- from .compat import StreamType # NOQA +- +-__all__ =3D ['Emitter', 'EmitterError'] +- +- +-class EmitterError(YAMLError): +- pass +- +- +-class ScalarAnalysis(object): +- def __init__( +- self, +- scalar, +- empty, +- multiline, +- allow_flow_plain, +- allow_block_plain, +- allow_single_quoted, +- allow_double_quoted, +- allow_block, +- ): +- # type: (Any, Any, Any, bool, bool, bool, bool, bool) -> None +- self.scalar =3D scalar +- self.empty =3D empty +- self.multiline =3D multiline +- self.allow_flow_plain =3D allow_flow_plain +- self.allow_block_plain =3D allow_block_plain +- self.allow_single_quoted =3D allow_single_quoted +- self.allow_double_quoted =3D allow_double_quoted +- self.allow_block =3D allow_block +- +- +-class Indents(object): +- # replacement for the list based stack of None/int +- def __init__(self): +- # type: () -> None +- self.values =3D [] # type: List[Tuple[int, bool]] +- +- def append(self, val, seq): +- # type: (Any, Any) -> None +- self.values.append((val, seq)) +- +- def pop(self): +- # type: () -> Any +- return self.values.pop()[0] +- +- def last_seq(self): +- # type: () -> bool +- # return the seq(uence) value for the element added before the la= st one +- # in increase_indent() +- try: +- return self.values[-2][1] +- except IndexError: +- return False +- +- def seq_flow_align(self, seq_indent, column): +- # type: (int, int) -> int +- # extra spaces because of dash +- if len(self.values) < 2 or not self.values[-1][1]: +- return 0 +- # -1 for the dash +- base =3D self.values[-1][0] if self.values[-1][0] is not None els= e 0 +- return base + seq_indent - column - 1 +- +- def __len__(self): +- # type: () -> int +- return len(self.values) +- +- +-class Emitter(object): +- # fmt: off +- DEFAULT_TAG_PREFIXES =3D { +- u'!': u'!', +- u'tag:yaml.org,2002:': u'!!', +- } +- # fmt: on +- +- MAX_SIMPLE_KEY_LENGTH =3D 128 +- +- def __init__( +- self, +- stream, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- brace_single_entry_mapping_in_flow_sequence=3DNone, +- dumper=3DNone, +- ): +- # type: (StreamType, Any, Optional[int], Optional[int], Optional[= bool], Any, Optional[int], Optional[bool], Any, Optional[bool], Any) -> Non= e # NOQA +- self.dumper =3D dumper +- if self.dumper is not None and getattr(self.dumper, '_emitter', N= one) is None: +- self.dumper._emitter =3D self +- self.stream =3D stream +- +- # Encoding can be overriden by STREAM-START. +- self.encoding =3D None # type: Optional[Text] +- self.allow_space_break =3D None +- +- # Emitter is a state machine with a stack of states to handle nes= ted +- # structures. +- self.states =3D [] # type: List[Any] +- self.state =3D self.expect_stream_start # type: Any +- +- # Current event and the event queue. +- self.events =3D [] # type: List[Any] +- self.event =3D None # type: Any +- +- # The current indentation level and the stack of previous indents. +- self.indents =3D Indents() +- self.indent =3D None # type: Optional[int] +- +- # flow_context is an expanding/shrinking list consisting of '{' a= nd '[' +- # for each unclosed flow context. If empty list that means block = context +- self.flow_context =3D [] # type: List[Text] +- +- # Contexts. +- self.root_context =3D False +- self.sequence_context =3D False +- self.mapping_context =3D False +- self.simple_key_context =3D False +- +- # Characteristics of the last emitted character: +- # - current position. +- # - is it a whitespace? +- # - is it an indention character +- # (indentation space, '-', '?', or ':')? +- self.line =3D 0 +- self.column =3D 0 +- self.whitespace =3D True +- self.indention =3D True +- self.compact_seq_seq =3D True # dash after dash +- self.compact_seq_map =3D True # key after dash +- # self.compact_ms =3D False # dash after key, only when excplic= it key with ? +- self.no_newline =3D None # type: Optional[bool] # set if direct= ly after `- ` +- +- # Whether the document requires an explicit document end indicator +- self.open_ended =3D False +- +- # colon handling +- self.colon =3D u':' +- self.prefixed_colon =3D self.colon if prefix_colon is None else p= refix_colon + self.colon +- # single entry mappings in flow sequence +- self.brace_single_entry_mapping_in_flow_sequence =3D ( +- brace_single_entry_mapping_in_flow_sequence +- ) # NOQA +- +- # Formatting details. +- self.canonical =3D canonical +- self.allow_unicode =3D allow_unicode +- # set to False to get "\Uxxxxxxxx" for non-basic unicode like emo= jis +- self.unicode_supplementary =3D sys.maxunicode > 0xffff +- self.sequence_dash_offset =3D block_seq_indent if block_seq_inden= t else 0 +- self.top_level_colon_align =3D top_level_colon_align +- self.best_sequence_indent =3D 2 +- self.requested_indent =3D indent # specific for literal zero ind= ent +- if indent and 1 < indent < 10: +- self.best_sequence_indent =3D indent +- self.best_map_indent =3D self.best_sequence_indent +- # if self.best_sequence_indent < self.sequence_dash_offset + 1: +- # self.best_sequence_indent =3D self.sequence_dash_offset + 1 +- self.best_width =3D 80 +- if width and width > self.best_sequence_indent * 2: +- self.best_width =3D width +- self.best_line_break =3D u'\n' # type: Any +- if line_break in [u'\r', u'\n', u'\r\n']: +- self.best_line_break =3D line_break +- +- # Tag prefixes. +- self.tag_prefixes =3D None # type: Any +- +- # Prepared anchor and tag. +- self.prepared_anchor =3D None # type: Any +- self.prepared_tag =3D None # type: Any +- +- # Scalar analysis and style. +- self.analysis =3D None # type: Any +- self.style =3D None # type: Any +- +- self.scalar_after_indicator =3D True # write a scalar on the sam= e line as `---` +- +- @property +- def stream(self): +- # type: () -> Any +- try: +- return self._stream +- except AttributeError: +- raise YAMLStreamError('output stream needs to specified') +- +- @stream.setter +- def stream(self, val): +- # type: (Any) -> None +- if val is None: +- return +- if not hasattr(val, 'write'): +- raise YAMLStreamError('stream argument needs to have a write(= ) method') +- self._stream =3D val +- +- @property +- def serializer(self): +- # type: () -> Any +- try: +- if hasattr(self.dumper, 'typ'): +- return self.dumper.serializer +- return self.dumper._serializer +- except AttributeError: +- return self # cyaml +- +- @property +- def flow_level(self): +- # type: () -> int +- return len(self.flow_context) +- +- def dispose(self): +- # type: () -> None +- # Reset the state attributes (to clear self-references) +- self.states =3D [] +- self.state =3D None +- +- def emit(self, event): +- # type: (Any) -> None +- if dbg(DBG_EVENT): +- nprint(event) +- self.events.append(event) +- while not self.need_more_events(): +- self.event =3D self.events.pop(0) +- self.state() +- self.event =3D None +- +- # In some cases, we wait for a few next events before emitting. +- +- def need_more_events(self): +- # type: () -> bool +- if not self.events: +- return True +- event =3D self.events[0] +- if isinstance(event, DocumentStartEvent): +- return self.need_events(1) +- elif isinstance(event, SequenceStartEvent): +- return self.need_events(2) +- elif isinstance(event, MappingStartEvent): +- return self.need_events(3) +- else: +- return False +- +- def need_events(self, count): +- # type: (int) -> bool +- level =3D 0 +- for event in self.events[1:]: +- if isinstance(event, (DocumentStartEvent, CollectionStartEven= t)): +- level +=3D 1 +- elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)= ): +- level -=3D 1 +- elif isinstance(event, StreamEndEvent): +- level =3D -1 +- if level < 0: +- return False +- return len(self.events) < count + 1 +- +- def increase_indent(self, flow=3DFalse, sequence=3DNone, indentless= =3DFalse): +- # type: (bool, Optional[bool], bool) -> None +- self.indents.append(self.indent, sequence) +- if self.indent is None: # top level +- if flow: +- # self.indent =3D self.best_sequence_indent if self.inden= ts.last_seq() else \ +- # self.best_map_indent +- # self.indent =3D self.best_sequence_indent +- self.indent =3D self.requested_indent +- else: +- self.indent =3D 0 +- elif not indentless: +- self.indent +=3D ( +- self.best_sequence_indent if self.indents.last_seq() else= self.best_map_indent +- ) +- # if self.indents.last_seq(): +- # if self.indent =3D=3D 0: # top level block sequence +- # self.indent =3D self.best_sequence_indent - self.se= quence_dash_offset +- # else: +- # self.indent +=3D self.best_sequence_indent +- # else: +- # self.indent +=3D self.best_map_indent +- +- # States. +- +- # Stream handlers. +- +- def expect_stream_start(self): +- # type: () -> None +- if isinstance(self.event, StreamStartEvent): +- if PY2: +- if self.event.encoding and not getattr(self.stream, 'enco= ding', None): +- self.encoding =3D self.event.encoding +- else: +- if self.event.encoding and not hasattr(self.stream, 'enco= ding'): +- self.encoding =3D self.event.encoding +- self.write_stream_start() +- self.state =3D self.expect_first_document_start +- else: +- raise EmitterError('expected StreamStartEvent, but got %s' % = (self.event,)) +- +- def expect_nothing(self): +- # type: () -> None +- raise EmitterError('expected nothing, but got %s' % (self.event,)) +- +- # Document handlers. +- +- def expect_first_document_start(self): +- # type: () -> Any +- return self.expect_document_start(first=3DTrue) +- +- def expect_document_start(self, first=3DFalse): +- # type: (bool) -> None +- if isinstance(self.event, DocumentStartEvent): +- if (self.event.version or self.event.tags) and self.open_ende= d: +- self.write_indicator(u'...', True) +- self.write_indent() +- if self.event.version: +- version_text =3D self.prepare_version(self.event.version) +- self.write_version_directive(version_text) +- self.tag_prefixes =3D self.DEFAULT_TAG_PREFIXES.copy() +- if self.event.tags: +- handles =3D sorted(self.event.tags.keys()) +- for handle in handles: +- prefix =3D self.event.tags[handle] +- self.tag_prefixes[prefix] =3D handle +- handle_text =3D self.prepare_tag_handle(handle) +- prefix_text =3D self.prepare_tag_prefix(prefix) +- self.write_tag_directive(handle_text, prefix_text) +- implicit =3D ( +- first +- and not self.event.explicit +- and not self.canonical +- and not self.event.version +- and not self.event.tags +- and not self.check_empty_document() +- ) +- if not implicit: +- self.write_indent() +- self.write_indicator(u'---', True) +- if self.canonical: +- self.write_indent() +- self.state =3D self.expect_document_root +- elif isinstance(self.event, StreamEndEvent): +- if self.open_ended: +- self.write_indicator(u'...', True) +- self.write_indent() +- self.write_stream_end() +- self.state =3D self.expect_nothing +- else: +- raise EmitterError('expected DocumentStartEvent, but got %s' = % (self.event,)) +- +- def expect_document_end(self): +- # type: () -> None +- if isinstance(self.event, DocumentEndEvent): +- self.write_indent() +- if self.event.explicit: +- self.write_indicator(u'...', True) +- self.write_indent() +- self.flush_stream() +- self.state =3D self.expect_document_start +- else: +- raise EmitterError('expected DocumentEndEvent, but got %s' % = (self.event,)) +- +- def expect_document_root(self): +- # type: () -> None +- self.states.append(self.expect_document_end) +- self.expect_node(root=3DTrue) +- +- # Node handlers. +- +- def expect_node(self, root=3DFalse, sequence=3DFalse, mapping=3DFalse= , simple_key=3DFalse): +- # type: (bool, bool, bool, bool) -> None +- self.root_context =3D root +- self.sequence_context =3D sequence # not used in PyYAML +- self.mapping_context =3D mapping +- self.simple_key_context =3D simple_key +- if isinstance(self.event, AliasEvent): +- self.expect_alias() +- elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): +- if ( +- self.process_anchor(u'&') +- and isinstance(self.event, ScalarEvent) +- and self.sequence_context +- ): +- self.sequence_context =3D False +- if ( +- root +- and isinstance(self.event, ScalarEvent) +- and not self.scalar_after_indicator +- ): +- self.write_indent() +- self.process_tag() +- if isinstance(self.event, ScalarEvent): +- # nprint('@', self.indention, self.no_newline, self.colum= n) +- self.expect_scalar() +- elif isinstance(self.event, SequenceStartEvent): +- # nprint('@', self.indention, self.no_newline, self.colum= n) +- i2, n2 =3D self.indention, self.no_newline # NOQA +- if self.event.comment: +- if self.event.flow_style is False and self.event.comm= ent: +- if self.write_post_comment(self.event): +- self.indention =3D False +- self.no_newline =3D True +- if self.write_pre_comment(self.event): +- self.indention =3D i2 +- self.no_newline =3D not self.indention +- if ( +- self.flow_level +- or self.canonical +- or self.event.flow_style +- or self.check_empty_sequence() +- ): +- self.expect_flow_sequence() +- else: +- self.expect_block_sequence() +- elif isinstance(self.event, MappingStartEvent): +- if self.event.flow_style is False and self.event.comment: +- self.write_post_comment(self.event) +- if self.event.comment and self.event.comment[1]: +- self.write_pre_comment(self.event) +- if ( +- self.flow_level +- or self.canonical +- or self.event.flow_style +- or self.check_empty_mapping() +- ): +- self.expect_flow_mapping(single=3Dself.event.nr_items= =3D=3D 1) +- else: +- self.expect_block_mapping() +- else: +- raise EmitterError('expected NodeEvent, but got %s' % (self.e= vent,)) +- +- def expect_alias(self): +- # type: () -> None +- if self.event.anchor is None: +- raise EmitterError('anchor is not specified for alias') +- self.process_anchor(u'*') +- self.state =3D self.states.pop() +- +- def expect_scalar(self): +- # type: () -> None +- self.increase_indent(flow=3DTrue) +- self.process_scalar() +- self.indent =3D self.indents.pop() +- self.state =3D self.states.pop() +- +- # Flow sequence handlers. +- +- def expect_flow_sequence(self): +- # type: () -> None +- ind =3D self.indents.seq_flow_align(self.best_sequence_indent, se= lf.column) +- self.write_indicator(u' ' * ind + u'[', True, whitespace=3DTrue) +- self.increase_indent(flow=3DTrue, sequence=3DTrue) +- self.flow_context.append('[') +- self.state =3D self.expect_first_flow_sequence_item +- +- def expect_first_flow_sequence_item(self): +- # type: () -> None +- if isinstance(self.event, SequenceEndEvent): +- self.indent =3D self.indents.pop() +- popped =3D self.flow_context.pop() +- assert popped =3D=3D '[' +- self.write_indicator(u']', False) +- if self.event.comment and self.event.comment[0]: +- # eol comment on empty flow sequence +- self.write_post_comment(self.event) +- elif self.flow_level =3D=3D 0: +- self.write_line_break() +- self.state =3D self.states.pop() +- else: +- if self.canonical or self.column > self.best_width: +- self.write_indent() +- self.states.append(self.expect_flow_sequence_item) +- self.expect_node(sequence=3DTrue) +- +- def expect_flow_sequence_item(self): +- # type: () -> None +- if isinstance(self.event, SequenceEndEvent): +- self.indent =3D self.indents.pop() +- popped =3D self.flow_context.pop() +- assert popped =3D=3D '[' +- if self.canonical: +- self.write_indicator(u',', False) +- self.write_indent() +- self.write_indicator(u']', False) +- if self.event.comment and self.event.comment[0]: +- # eol comment on flow sequence +- self.write_post_comment(self.event) +- else: +- self.no_newline =3D False +- self.state =3D self.states.pop() +- else: +- self.write_indicator(u',', False) +- if self.canonical or self.column > self.best_width: +- self.write_indent() +- self.states.append(self.expect_flow_sequence_item) +- self.expect_node(sequence=3DTrue) +- +- # Flow mapping handlers. +- +- def expect_flow_mapping(self, single=3DFalse): +- # type: (Optional[bool]) -> None +- ind =3D self.indents.seq_flow_align(self.best_sequence_indent, se= lf.column) +- map_init =3D u'{' +- if ( +- single +- and self.flow_level +- and self.flow_context[-1] =3D=3D '[' +- and not self.canonical +- and not self.brace_single_entry_mapping_in_flow_sequence +- ): +- # single map item with flow context, no curly braces necessary +- map_init =3D u'' +- self.write_indicator(u' ' * ind + map_init, True, whitespace=3DTr= ue) +- self.flow_context.append(map_init) +- self.increase_indent(flow=3DTrue, sequence=3DFalse) +- self.state =3D self.expect_first_flow_mapping_key +- +- def expect_first_flow_mapping_key(self): +- # type: () -> None +- if isinstance(self.event, MappingEndEvent): +- self.indent =3D self.indents.pop() +- popped =3D self.flow_context.pop() +- assert popped =3D=3D '{' # empty flow mapping +- self.write_indicator(u'}', False) +- if self.event.comment and self.event.comment[0]: +- # eol comment on empty mapping +- self.write_post_comment(self.event) +- elif self.flow_level =3D=3D 0: +- self.write_line_break() +- self.state =3D self.states.pop() +- else: +- if self.canonical or self.column > self.best_width: +- self.write_indent() +- if not self.canonical and self.check_simple_key(): +- self.states.append(self.expect_flow_mapping_simple_value) +- self.expect_node(mapping=3DTrue, simple_key=3DTrue) +- else: +- self.write_indicator(u'?', True) +- self.states.append(self.expect_flow_mapping_value) +- self.expect_node(mapping=3DTrue) +- +- def expect_flow_mapping_key(self): +- # type: () -> None +- if isinstance(self.event, MappingEndEvent): +- # if self.event.comment and self.event.comment[1]: +- # self.write_pre_comment(self.event) +- self.indent =3D self.indents.pop() +- popped =3D self.flow_context.pop() +- assert popped in [u'{', u''] +- if self.canonical: +- self.write_indicator(u',', False) +- self.write_indent() +- if popped !=3D u'': +- self.write_indicator(u'}', False) +- if self.event.comment and self.event.comment[0]: +- # eol comment on flow mapping, never reached on empty map= pings +- self.write_post_comment(self.event) +- else: +- self.no_newline =3D False +- self.state =3D self.states.pop() +- else: +- self.write_indicator(u',', False) +- if self.canonical or self.column > self.best_width: +- self.write_indent() +- if not self.canonical and self.check_simple_key(): +- self.states.append(self.expect_flow_mapping_simple_value) +- self.expect_node(mapping=3DTrue, simple_key=3DTrue) +- else: +- self.write_indicator(u'?', True) +- self.states.append(self.expect_flow_mapping_value) +- self.expect_node(mapping=3DTrue) +- +- def expect_flow_mapping_simple_value(self): +- # type: () -> None +- self.write_indicator(self.prefixed_colon, False) +- self.states.append(self.expect_flow_mapping_key) +- self.expect_node(mapping=3DTrue) +- +- def expect_flow_mapping_value(self): +- # type: () -> None +- if self.canonical or self.column > self.best_width: +- self.write_indent() +- self.write_indicator(self.prefixed_colon, True) +- self.states.append(self.expect_flow_mapping_key) +- self.expect_node(mapping=3DTrue) +- +- # Block sequence handlers. +- +- def expect_block_sequence(self): +- # type: () -> None +- if self.mapping_context: +- indentless =3D not self.indention +- else: +- indentless =3D False +- if not self.compact_seq_seq and self.column !=3D 0: +- self.write_line_break() +- self.increase_indent(flow=3DFalse, sequence=3DTrue, indentless=3D= indentless) +- self.state =3D self.expect_first_block_sequence_item +- +- def expect_first_block_sequence_item(self): +- # type: () -> Any +- return self.expect_block_sequence_item(first=3DTrue) +- +- def expect_block_sequence_item(self, first=3DFalse): +- # type: (bool) -> None +- if not first and isinstance(self.event, SequenceEndEvent): +- if self.event.comment and self.event.comment[1]: +- # final comments on a block list e.g. empty line +- self.write_pre_comment(self.event) +- self.indent =3D self.indents.pop() +- self.state =3D self.states.pop() +- self.no_newline =3D False +- else: +- if self.event.comment and self.event.comment[1]: +- self.write_pre_comment(self.event) +- nonl =3D self.no_newline if self.column =3D=3D 0 else False +- self.write_indent() +- ind =3D self.sequence_dash_offset # if len(self.indents) > = 1 else 0 +- self.write_indicator(u' ' * ind + u'-', True, indention=3DTru= e) +- if nonl or self.sequence_dash_offset + 2 > self.best_sequence= _indent: +- self.no_newline =3D True +- self.states.append(self.expect_block_sequence_item) +- self.expect_node(sequence=3DTrue) +- +- # Block mapping handlers. +- +- def expect_block_mapping(self): +- # type: () -> None +- if not self.mapping_context and not (self.compact_seq_map or self= .column =3D=3D 0): +- self.write_line_break() +- self.increase_indent(flow=3DFalse, sequence=3DFalse) +- self.state =3D self.expect_first_block_mapping_key +- +- def expect_first_block_mapping_key(self): +- # type: () -> None +- return self.expect_block_mapping_key(first=3DTrue) +- +- def expect_block_mapping_key(self, first=3DFalse): +- # type: (Any) -> None +- if not first and isinstance(self.event, MappingEndEvent): +- if self.event.comment and self.event.comment[1]: +- # final comments from a doc +- self.write_pre_comment(self.event) +- self.indent =3D self.indents.pop() +- self.state =3D self.states.pop() +- else: +- if self.event.comment and self.event.comment[1]: +- # final comments from a doc +- self.write_pre_comment(self.event) +- self.write_indent() +- if self.check_simple_key(): +- if not isinstance( +- self.event, (SequenceStartEvent, MappingStartEvent) +- ): # sequence keys +- try: +- if self.event.style =3D=3D '?': +- self.write_indicator(u'?', True, indention=3D= True) +- except AttributeError: # aliases have no style +- pass +- self.states.append(self.expect_block_mapping_simple_value) +- self.expect_node(mapping=3DTrue, simple_key=3DTrue) +- if isinstance(self.event, AliasEvent): +- self.stream.write(u' ') +- else: +- self.write_indicator(u'?', True, indention=3DTrue) +- self.states.append(self.expect_block_mapping_value) +- self.expect_node(mapping=3DTrue) +- +- def expect_block_mapping_simple_value(self): +- # type: () -> None +- if getattr(self.event, 'style', None) !=3D '?': +- # prefix =3D u'' +- if self.indent =3D=3D 0 and self.top_level_colon_align is not= None: +- # write non-prefixed colon +- c =3D u' ' * (self.top_level_colon_align - self.column) += self.colon +- else: +- c =3D self.prefixed_colon +- self.write_indicator(c, False) +- self.states.append(self.expect_block_mapping_key) +- self.expect_node(mapping=3DTrue) +- +- def expect_block_mapping_value(self): +- # type: () -> None +- self.write_indent() +- self.write_indicator(self.prefixed_colon, True, indention=3DTrue) +- self.states.append(self.expect_block_mapping_key) +- self.expect_node(mapping=3DTrue) +- +- # Checkers. +- +- def check_empty_sequence(self): +- # type: () -> bool +- return ( +- isinstance(self.event, SequenceStartEvent) +- and bool(self.events) +- and isinstance(self.events[0], SequenceEndEvent) +- ) +- +- def check_empty_mapping(self): +- # type: () -> bool +- return ( +- isinstance(self.event, MappingStartEvent) +- and bool(self.events) +- and isinstance(self.events[0], MappingEndEvent) +- ) +- +- def check_empty_document(self): +- # type: () -> bool +- if not isinstance(self.event, DocumentStartEvent) or not self.eve= nts: +- return False +- event =3D self.events[0] +- return ( +- isinstance(event, ScalarEvent) +- and event.anchor is None +- and event.tag is None +- and event.implicit +- and event.value =3D=3D "" +- ) +- +- def check_simple_key(self): +- # type: () -> bool +- length =3D 0 +- if isinstance(self.event, NodeEvent) and self.event.anchor is not= None: +- if self.prepared_anchor is None: +- self.prepared_anchor =3D self.prepare_anchor(self.event.a= nchor) +- length +=3D len(self.prepared_anchor) +- if ( +- isinstance(self.event, (ScalarEvent, CollectionStartEvent)) +- and self.event.tag is not None +- ): +- if self.prepared_tag is None: +- self.prepared_tag =3D self.prepare_tag(self.event.tag) +- length +=3D len(self.prepared_tag) +- if isinstance(self.event, ScalarEvent): +- if self.analysis is None: +- self.analysis =3D self.analyze_scalar(self.event.value) +- length +=3D len(self.analysis.scalar) +- return length < self.MAX_SIMPLE_KEY_LENGTH and ( +- isinstance(self.event, AliasEvent) +- or (isinstance(self.event, SequenceStartEvent) and self.event= .flow_style is True) +- or (isinstance(self.event, MappingStartEvent) and self.event.= flow_style is True) +- or ( +- isinstance(self.event, ScalarEvent) +- # if there is an explicit style for an empty string, it i= s a simple key +- and not (self.analysis.empty and self.style and self.styl= e not in '\'"') +- and not self.analysis.multiline +- ) +- or self.check_empty_sequence() +- or self.check_empty_mapping() +- ) +- +- # Anchor, Tag, and Scalar processors. +- +- def process_anchor(self, indicator): +- # type: (Any) -> bool +- if self.event.anchor is None: +- self.prepared_anchor =3D None +- return False +- if self.prepared_anchor is None: +- self.prepared_anchor =3D self.prepare_anchor(self.event.ancho= r) +- if self.prepared_anchor: +- self.write_indicator(indicator + self.prepared_anchor, True) +- # issue 288 +- self.no_newline =3D False +- self.prepared_anchor =3D None +- return True +- +- def process_tag(self): +- # type: () -> None +- tag =3D self.event.tag +- if isinstance(self.event, ScalarEvent): +- if self.style is None: +- self.style =3D self.choose_scalar_style() +- if (not self.canonical or tag is None) and ( +- (self.style =3D=3D "" and self.event.implicit[0]) +- or (self.style !=3D "" and self.event.implicit[1]) +- ): +- self.prepared_tag =3D None +- return +- if self.event.implicit[0] and tag is None: +- tag =3D u'!' +- self.prepared_tag =3D None +- else: +- if (not self.canonical or tag is None) and self.event.implici= t: +- self.prepared_tag =3D None +- return +- if tag is None: +- raise EmitterError('tag is not specified') +- if self.prepared_tag is None: +- self.prepared_tag =3D self.prepare_tag(tag) +- if self.prepared_tag: +- self.write_indicator(self.prepared_tag, True) +- if ( +- self.sequence_context +- and not self.flow_level +- and isinstance(self.event, ScalarEvent) +- ): +- self.no_newline =3D True +- self.prepared_tag =3D None +- +- def choose_scalar_style(self): +- # type: () -> Any +- if self.analysis is None: +- self.analysis =3D self.analyze_scalar(self.event.value) +- if self.event.style =3D=3D '"' or self.canonical: +- return '"' +- if (not self.event.style or self.event.style =3D=3D '?') and ( +- self.event.implicit[0] or not self.event.implicit[2] +- ): +- if not ( +- self.simple_key_context and (self.analysis.empty or self.= analysis.multiline) +- ) and ( +- self.flow_level +- and self.analysis.allow_flow_plain +- or (not self.flow_level and self.analysis.allow_block_pla= in) +- ): +- return "" +- self.analysis.allow_block =3D True +- if self.event.style and self.event.style in '|>': +- if ( +- not self.flow_level +- and not self.simple_key_context +- and self.analysis.allow_block +- ): +- return self.event.style +- if not self.event.style and self.analysis.allow_double_quoted: +- if "'" in self.event.value or '\n' in self.event.value: +- return '"' +- if not self.event.style or self.event.style =3D=3D "'": +- if self.analysis.allow_single_quoted and not ( +- self.simple_key_context and self.analysis.multiline +- ): +- return "'" +- return '"' +- +- def process_scalar(self): +- # type: () -> None +- if self.analysis is None: +- self.analysis =3D self.analyze_scalar(self.event.value) +- if self.style is None: +- self.style =3D self.choose_scalar_style() +- split =3D not self.simple_key_context +- # if self.analysis.multiline and split \ +- # and (not self.style or self.style in '\'\"'): +- # self.write_indent() +- # nprint('xx', self.sequence_context, self.flow_level) +- if self.sequence_context and not self.flow_level: +- self.write_indent() +- if self.style =3D=3D '"': +- self.write_double_quoted(self.analysis.scalar, split) +- elif self.style =3D=3D "'": +- self.write_single_quoted(self.analysis.scalar, split) +- elif self.style =3D=3D '>': +- self.write_folded(self.analysis.scalar) +- elif self.style =3D=3D '|': +- self.write_literal(self.analysis.scalar, self.event.comment) +- else: +- self.write_plain(self.analysis.scalar, split) +- self.analysis =3D None +- self.style =3D None +- if self.event.comment: +- self.write_post_comment(self.event) +- +- # Analyzers. +- +- def prepare_version(self, version): +- # type: (Any) -> Any +- major, minor =3D version +- if major !=3D 1: +- raise EmitterError('unsupported YAML version: %d.%d' % (major= , minor)) +- return u'%d.%d' % (major, minor) +- +- def prepare_tag_handle(self, handle): +- # type: (Any) -> Any +- if not handle: +- raise EmitterError('tag handle must not be empty') +- if handle[0] !=3D u'!' or handle[-1] !=3D u'!': +- raise EmitterError("tag handle must start and end with '!': %= r" % (utf8(handle))) +- for ch in handle[1:-1]: +- if not ( +- u'0' <=3D ch <=3D u'9' or u'A' <=3D ch <=3D u'Z' or u'a' = <=3D ch <=3D u'z' or ch in u'-_' +- ): +- raise EmitterError( +- 'invalid character %r in the tag handle: %r' % (utf8(= ch), utf8(handle)) +- ) +- return handle +- +- def prepare_tag_prefix(self, prefix): +- # type: (Any) -> Any +- if not prefix: +- raise EmitterError('tag prefix must not be empty') +- chunks =3D [] # type: List[Any] +- start =3D end =3D 0 +- if prefix[0] =3D=3D u'!': +- end =3D 1 +- ch_set =3D u"-;/?:@&=3D+$,_.~*'()[]" +- if self.dumper: +- version =3D getattr(self.dumper, 'version', (1, 2)) +- if version is None or version >=3D (1, 2): +- ch_set +=3D u'#' +- while end < len(prefix): +- ch =3D prefix[end] +- if u'0' <=3D ch <=3D u'9' or u'A' <=3D ch <=3D u'Z' or u'a' <= =3D ch <=3D u'z' or ch in ch_set: +- end +=3D 1 +- else: +- if start < end: +- chunks.append(prefix[start:end]) +- start =3D end =3D end + 1 +- data =3D utf8(ch) +- for ch in data: +- chunks.append(u'%%%02X' % ord(ch)) +- if start < end: +- chunks.append(prefix[start:end]) +- return "".join(chunks) +- +- def prepare_tag(self, tag): +- # type: (Any) -> Any +- if not tag: +- raise EmitterError('tag must not be empty') +- if tag =3D=3D u'!': +- return tag +- handle =3D None +- suffix =3D tag +- prefixes =3D sorted(self.tag_prefixes.keys()) +- for prefix in prefixes: +- if tag.startswith(prefix) and (prefix =3D=3D u'!' or len(pref= ix) < len(tag)): +- handle =3D self.tag_prefixes[prefix] +- suffix =3D tag[len(prefix) :] +- chunks =3D [] # type: List[Any] +- start =3D end =3D 0 +- ch_set =3D u"-;/?:@&=3D+$,_.~*'()[]" +- if self.dumper: +- version =3D getattr(self.dumper, 'version', (1, 2)) +- if version is None or version >=3D (1, 2): +- ch_set +=3D u'#' +- while end < len(suffix): +- ch =3D suffix[end] +- if ( +- u'0' <=3D ch <=3D u'9' +- or u'A' <=3D ch <=3D u'Z' +- or u'a' <=3D ch <=3D u'z' +- or ch in ch_set +- or (ch =3D=3D u'!' and handle !=3D u'!') +- ): +- end +=3D 1 +- else: +- if start < end: +- chunks.append(suffix[start:end]) +- start =3D end =3D end + 1 +- data =3D utf8(ch) +- for ch in data: +- chunks.append(u'%%%02X' % ord(ch)) +- if start < end: +- chunks.append(suffix[start:end]) +- suffix_text =3D "".join(chunks) +- if handle: +- return u'%s%s' % (handle, suffix_text) +- else: +- return u'!<%s>' % suffix_text +- +- def prepare_anchor(self, anchor): +- # type: (Any) -> Any +- if not anchor: +- raise EmitterError('anchor must not be empty') +- for ch in anchor: +- if not check_anchorname_char(ch): +- raise EmitterError( +- 'invalid character %r in the anchor: %r' % (utf8(ch),= utf8(anchor)) +- ) +- return anchor +- +- def analyze_scalar(self, scalar): +- # type: (Any) -> Any +- # Empty scalar is a special case. +- if not scalar: +- return ScalarAnalysis( +- scalar=3Dscalar, +- empty=3DTrue, +- multiline=3DFalse, +- allow_flow_plain=3DFalse, +- allow_block_plain=3DTrue, +- allow_single_quoted=3DTrue, +- allow_double_quoted=3DTrue, +- allow_block=3DFalse, +- ) +- +- # Indicators and special characters. +- block_indicators =3D False +- flow_indicators =3D False +- line_breaks =3D False +- special_characters =3D False +- +- # Important whitespace combinations. +- leading_space =3D False +- leading_break =3D False +- trailing_space =3D False +- trailing_break =3D False +- break_space =3D False +- space_break =3D False +- +- # Check document indicators. +- if scalar.startswith(u'---') or scalar.startswith(u'...'): +- block_indicators =3D True +- flow_indicators =3D True +- +- # First character or preceded by a whitespace. +- preceeded_by_whitespace =3D True +- +- # Last character or followed by a whitespace. +- followed_by_whitespace =3D len(scalar) =3D=3D 1 or scalar[1] in u= '\0 \t\r\n\x85\u2028\u2029' +- +- # The previous character is a space. +- previous_space =3D False +- +- # The previous character is a break. +- previous_break =3D False +- +- index =3D 0 +- while index < len(scalar): +- ch =3D scalar[index] +- +- # Check for indicators. +- if index =3D=3D 0: +- # Leading indicators are special characters. +- if ch in u'#,[]{}&*!|>\'"%@`': +- flow_indicators =3D True +- block_indicators =3D True +- if ch in u'?:': # ToDo +- if self.serializer.use_version =3D=3D (1, 1): +- flow_indicators =3D True +- elif len(scalar) =3D=3D 1: # single character +- flow_indicators =3D True +- if followed_by_whitespace: +- block_indicators =3D True +- if ch =3D=3D u'-' and followed_by_whitespace: +- flow_indicators =3D True +- block_indicators =3D True +- else: +- # Some indicators cannot appear within a scalar as well. +- if ch in u',[]{}': # http://yaml.org/spec/1.2/spec.html#= id2788859 +- flow_indicators =3D True +- if ch =3D=3D u'?' and self.serializer.use_version =3D=3D = (1, 1): +- flow_indicators =3D True +- if ch =3D=3D u':': +- if followed_by_whitespace: +- flow_indicators =3D True +- block_indicators =3D True +- if ch =3D=3D u'#' and preceeded_by_whitespace: +- flow_indicators =3D True +- block_indicators =3D True +- +- # Check for line breaks, special, and unicode characters. +- if ch in u'\n\x85\u2028\u2029': +- line_breaks =3D True +- if not (ch =3D=3D u'\n' or u'\x20' <=3D ch <=3D u'\x7E'): +- if ( +- ch =3D=3D u'\x85' +- or u'\xA0' <=3D ch <=3D u'\uD7FF' +- or u'\uE000' <=3D ch <=3D u'\uFFFD' +- or (self.unicode_supplementary and (u'\U00010000' <= =3D ch <=3D u'\U0010FFFF')) +- ) and ch !=3D u'\uFEFF': +- # unicode_characters =3D True +- if not self.allow_unicode: +- special_characters =3D True +- else: +- special_characters =3D True +- +- # Detect important whitespace combinations. +- if ch =3D=3D u' ': +- if index =3D=3D 0: +- leading_space =3D True +- if index =3D=3D len(scalar) - 1: +- trailing_space =3D True +- if previous_break: +- break_space =3D True +- previous_space =3D True +- previous_break =3D False +- elif ch in u'\n\x85\u2028\u2029': +- if index =3D=3D 0: +- leading_break =3D True +- if index =3D=3D len(scalar) - 1: +- trailing_break =3D True +- if previous_space: +- space_break =3D True +- previous_space =3D False +- previous_break =3D True +- else: +- previous_space =3D False +- previous_break =3D False +- +- # Prepare for the next character. +- index +=3D 1 +- preceeded_by_whitespace =3D ch in u'\0 \t\r\n\x85\u2028\u2029' +- followed_by_whitespace =3D ( +- index + 1 >=3D len(scalar) or scalar[index + 1] in u'\0 \= t\r\n\x85\u2028\u2029' +- ) +- +- # Let's decide what styles are allowed. +- allow_flow_plain =3D True +- allow_block_plain =3D True +- allow_single_quoted =3D True +- allow_double_quoted =3D True +- allow_block =3D True +- +- # Leading and trailing whitespaces are bad for plain scalars. +- if leading_space or leading_break or trailing_space or trailing_b= reak: +- allow_flow_plain =3D allow_block_plain =3D False +- +- # We do not permit trailing spaces for block scalars. +- if trailing_space: +- allow_block =3D False +- +- # Spaces at the beginning of a new line are only acceptable for b= lock +- # scalars. +- if break_space: +- allow_flow_plain =3D allow_block_plain =3D allow_single_quote= d =3D False +- +- # Spaces followed by breaks, as well as special character are only +- # allowed for double quoted scalars. +- if special_characters: +- allow_flow_plain =3D allow_block_plain =3D allow_single_quote= d =3D allow_block =3D False +- elif space_break: +- allow_flow_plain =3D allow_block_plain =3D allow_single_quote= d =3D False +- if not self.allow_space_break: +- allow_block =3D False +- +- # Although the plain scalar writer supports breaks, we never emit +- # multiline plain scalars. +- if line_breaks: +- allow_flow_plain =3D allow_block_plain =3D False +- +- # Flow indicators are forbidden for flow plain scalars. +- if flow_indicators: +- allow_flow_plain =3D False +- +- # Block indicators are forbidden for block plain scalars. +- if block_indicators: +- allow_block_plain =3D False +- +- return ScalarAnalysis( +- scalar=3Dscalar, +- empty=3DFalse, +- multiline=3Dline_breaks, +- allow_flow_plain=3Dallow_flow_plain, +- allow_block_plain=3Dallow_block_plain, +- allow_single_quoted=3Dallow_single_quoted, +- allow_double_quoted=3Dallow_double_quoted, +- allow_block=3Dallow_block, +- ) +- +- # Writers. +- +- def flush_stream(self): +- # type: () -> None +- if hasattr(self.stream, 'flush'): +- self.stream.flush() +- +- def write_stream_start(self): +- # type: () -> None +- # Write BOM if needed. +- if self.encoding and self.encoding.startswith('utf-16'): +- self.stream.write(u'\uFEFF'.encode(self.encoding)) +- +- def write_stream_end(self): +- # type: () -> None +- self.flush_stream() +- +- def write_indicator(self, indicator, need_whitespace, whitespace=3DFa= lse, indention=3DFalse): +- # type: (Any, Any, bool, bool) -> None +- if self.whitespace or not need_whitespace: +- data =3D indicator +- else: +- data =3D u' ' + indicator +- self.whitespace =3D whitespace +- self.indention =3D self.indention and indention +- self.column +=3D len(data) +- self.open_ended =3D False +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- +- def write_indent(self): +- # type: () -> None +- indent =3D self.indent or 0 +- if ( +- not self.indention +- or self.column > indent +- or (self.column =3D=3D indent and not self.whitespace) +- ): +- if bool(self.no_newline): +- self.no_newline =3D False +- else: +- self.write_line_break() +- if self.column < indent: +- self.whitespace =3D True +- data =3D u' ' * (indent - self.column) +- self.column =3D indent +- if self.encoding: +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- +- def write_line_break(self, data=3DNone): +- # type: (Any) -> None +- if data is None: +- data =3D self.best_line_break +- self.whitespace =3D True +- self.indention =3D True +- self.line +=3D 1 +- self.column =3D 0 +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- +- def write_version_directive(self, version_text): +- # type: (Any) -> None +- data =3D u'%%YAML %s' % version_text +- if self.encoding: +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- self.write_line_break() +- +- def write_tag_directive(self, handle_text, prefix_text): +- # type: (Any, Any) -> None +- data =3D u'%%TAG %s %s' % (handle_text, prefix_text) +- if self.encoding: +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- self.write_line_break() +- +- # Scalar streams. +- +- def write_single_quoted(self, text, split=3DTrue): +- # type: (Any, Any) -> None +- if self.root_context: +- if self.requested_indent is not None: +- self.write_line_break() +- if self.requested_indent !=3D 0: +- self.write_indent() +- self.write_indicator(u"'", True) +- spaces =3D False +- breaks =3D False +- start =3D end =3D 0 +- while end <=3D len(text): +- ch =3D None +- if end < len(text): +- ch =3D text[end] +- if spaces: +- if ch is None or ch !=3D u' ': +- if ( +- start + 1 =3D=3D end +- and self.column > self.best_width +- and split +- and start !=3D 0 +- and end !=3D len(text) +- ): +- self.write_indent() +- else: +- data =3D text[start:end] +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end +- elif breaks: +- if ch is None or ch not in u'\n\x85\u2028\u2029': +- if text[start] =3D=3D u'\n': +- self.write_line_break() +- for br in text[start:end]: +- if br =3D=3D u'\n': +- self.write_line_break() +- else: +- self.write_line_break(br) +- self.write_indent() +- start =3D end +- else: +- if ch is None or ch in u' \n\x85\u2028\u2029' or ch =3D= =3D u"'": +- if start < end: +- data =3D text[start:end] +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end +- if ch =3D=3D u"'": +- data =3D u"''" +- self.column +=3D 2 +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end + 1 +- if ch is not None: +- spaces =3D ch =3D=3D u' ' +- breaks =3D ch in u'\n\x85\u2028\u2029' +- end +=3D 1 +- self.write_indicator(u"'", False) +- +- ESCAPE_REPLACEMENTS =3D { +- u'\0': u'0', +- u'\x07': u'a', +- u'\x08': u'b', +- u'\x09': u't', +- u'\x0A': u'n', +- u'\x0B': u'v', +- u'\x0C': u'f', +- u'\x0D': u'r', +- u'\x1B': u'e', +- u'"': u'"', +- u'\\': u'\\', +- u'\x85': u'N', +- u'\xA0': u'_', +- u'\u2028': u'L', +- u'\u2029': u'P', +- } +- +- def write_double_quoted(self, text, split=3DTrue): +- # type: (Any, Any) -> None +- if self.root_context: +- if self.requested_indent is not None: +- self.write_line_break() +- if self.requested_indent !=3D 0: +- self.write_indent() +- self.write_indicator(u'"', True) +- start =3D end =3D 0 +- while end <=3D len(text): +- ch =3D None +- if end < len(text): +- ch =3D text[end] +- if ( +- ch is None +- or ch in u'"\\\x85\u2028\u2029\uFEFF' +- or not ( +- u'\x20' <=3D ch <=3D u'\x7E' +- or ( +- self.allow_unicode +- and (u'\xA0' <=3D ch <=3D u'\uD7FF' or u'\uE000' = <=3D ch <=3D u'\uFFFD') +- ) +- ) +- ): +- if start < end: +- data =3D text[start:end] +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end +- if ch is not None: +- if ch in self.ESCAPE_REPLACEMENTS: +- data =3D u'\\' + self.ESCAPE_REPLACEMENTS[ch] +- elif ch <=3D u'\xFF': +- data =3D u'\\x%02X' % ord(ch) +- elif ch <=3D u'\uFFFF': +- data =3D u'\\u%04X' % ord(ch) +- else: +- data =3D u'\\U%08X' % ord(ch) +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end + 1 +- if ( +- 0 < end < len(text) - 1 +- and (ch =3D=3D u' ' or start >=3D end) +- and self.column + (end - start) > self.best_width +- and split +- ): +- data =3D text[start:end] + u'\\' +- if start < end: +- start =3D end +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- self.write_indent() +- self.whitespace =3D False +- self.indention =3D False +- if text[start] =3D=3D u' ': +- data =3D u'\\' +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- end +=3D 1 +- self.write_indicator(u'"', False) +- +- def determine_block_hints(self, text): +- # type: (Any) -> Any +- indent =3D 0 +- indicator =3D u'' +- hints =3D u'' +- if text: +- if text[0] in u' \n\x85\u2028\u2029': +- indent =3D self.best_sequence_indent +- hints +=3D text_type(indent) +- elif self.root_context: +- for end in ['\n---', '\n...']: +- pos =3D 0 +- while True: +- pos =3D text.find(end, pos) +- if pos =3D=3D -1: +- break +- try: +- if text[pos + 4] in ' \r\n': +- break +- except IndexError: +- pass +- pos +=3D 1 +- if pos > -1: +- break +- if pos > 0: +- indent =3D self.best_sequence_indent +- if text[-1] not in u'\n\x85\u2028\u2029': +- indicator =3D u'-' +- elif len(text) =3D=3D 1 or text[-2] in u'\n\x85\u2028\u2029': +- indicator =3D u'+' +- hints +=3D indicator +- return hints, indent, indicator +- +- def write_folded(self, text): +- # type: (Any) -> None +- hints, _indent, _indicator =3D self.determine_block_hints(text) +- self.write_indicator(u'>' + hints, True) +- if _indicator =3D=3D u'+': +- self.open_ended =3D True +- self.write_line_break() +- leading_space =3D True +- spaces =3D False +- breaks =3D True +- start =3D end =3D 0 +- while end <=3D len(text): +- ch =3D None +- if end < len(text): +- ch =3D text[end] +- if breaks: +- if ch is None or ch not in u'\n\x85\u2028\u2029\a': +- if ( +- not leading_space +- and ch is not None +- and ch !=3D u' ' +- and text[start] =3D=3D u'\n' +- ): +- self.write_line_break() +- leading_space =3D ch =3D=3D u' ' +- for br in text[start:end]: +- if br =3D=3D u'\n': +- self.write_line_break() +- else: +- self.write_line_break(br) +- if ch is not None: +- self.write_indent() +- start =3D end +- elif spaces: +- if ch !=3D u' ': +- if start + 1 =3D=3D end and self.column > self.best_w= idth: +- self.write_indent() +- else: +- data =3D text[start:end] +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end +- else: +- if ch is None or ch in u' \n\x85\u2028\u2029\a': +- data =3D text[start:end] +- self.column +=3D len(data) +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- if ch =3D=3D u'\a': +- if end < (len(text) - 1) and not text[end + 2].is= space(): +- self.write_line_break() +- self.write_indent() +- end +=3D 2 # \a and the space that is insert= ed on the fold +- else: +- raise EmitterError('unexcpected fold indicato= r \\a before space') +- if ch is None: +- self.write_line_break() +- start =3D end +- if ch is not None: +- breaks =3D ch in u'\n\x85\u2028\u2029' +- spaces =3D ch =3D=3D u' ' +- end +=3D 1 +- +- def write_literal(self, text, comment=3DNone): +- # type: (Any, Any) -> None +- hints, _indent, _indicator =3D self.determine_block_hints(text) +- self.write_indicator(u'|' + hints, True) +- try: +- comment =3D comment[1][0] +- if comment: +- self.stream.write(comment) +- except (TypeError, IndexError): +- pass +- if _indicator =3D=3D u'+': +- self.open_ended =3D True +- self.write_line_break() +- breaks =3D True +- start =3D end =3D 0 +- while end <=3D len(text): +- ch =3D None +- if end < len(text): +- ch =3D text[end] +- if breaks: +- if ch is None or ch not in u'\n\x85\u2028\u2029': +- for br in text[start:end]: +- if br =3D=3D u'\n': +- self.write_line_break() +- else: +- self.write_line_break(br) +- if ch is not None: +- if self.root_context: +- idnx =3D self.indent if self.indent is not No= ne else 0 +- self.stream.write(u' ' * (_indent + idnx)) +- else: +- self.write_indent() +- start =3D end +- else: +- if ch is None or ch in u'\n\x85\u2028\u2029': +- data =3D text[start:end] +- if bool(self.encoding): +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- if ch is None: +- self.write_line_break() +- start =3D end +- if ch is not None: +- breaks =3D ch in u'\n\x85\u2028\u2029' +- end +=3D 1 +- +- def write_plain(self, text, split=3DTrue): +- # type: (Any, Any) -> None +- if self.root_context: +- if self.requested_indent is not None: +- self.write_line_break() +- if self.requested_indent !=3D 0: +- self.write_indent() +- else: +- self.open_ended =3D True +- if not text: +- return +- if not self.whitespace: +- data =3D u' ' +- self.column +=3D len(data) +- if self.encoding: +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- self.whitespace =3D False +- self.indention =3D False +- spaces =3D False +- breaks =3D False +- start =3D end =3D 0 +- while end <=3D len(text): +- ch =3D None +- if end < len(text): +- ch =3D text[end] +- if spaces: +- if ch !=3D u' ': +- if start + 1 =3D=3D end and self.column > self.best_w= idth and split: +- self.write_indent() +- self.whitespace =3D False +- self.indention =3D False +- else: +- data =3D text[start:end] +- self.column +=3D len(data) +- if self.encoding: +- data =3D data.encode(self.encoding) +- self.stream.write(data) +- start =3D end +- elif breaks: +- if ch not in u'\n\x85\u2028\u2029': # type: ignore +- if text[start] =3D=3D u'\n': +- self.write_line_break() +- for br in text[start:end]: +- if br =3D=3D u'\n': +- self.write_line_break() +- else: +- self.write_line_break(br) +- self.write_indent() +- self.whitespace =3D False +- self.indention =3D False +- start =3D end +- else: +- if ch is None or ch in u' \n\x85\u2028\u2029': +- data =3D text[start:end] +- self.column +=3D len(data) +- if self.encoding: +- data =3D data.encode(self.encoding) +- try: +- self.stream.write(data) +- except: # NOQA +- sys.stdout.write(repr(data) + '\n') +- raise +- start =3D end +- if ch is not None: +- spaces =3D ch =3D=3D u' ' +- breaks =3D ch in u'\n\x85\u2028\u2029' +- end +=3D 1 +- +- def write_comment(self, comment, pre=3DFalse): +- # type: (Any, bool) -> None +- value =3D comment.value +- # nprintf('{:02d} {:02d} {!r}'.format(self.column, comment.start_= mark.column, value)) +- if not pre and value[-1] =3D=3D '\n': +- value =3D value[:-1] +- try: +- # get original column position +- col =3D comment.start_mark.column +- if comment.value and comment.value.startswith('\n'): +- # never inject extra spaces if the comment starts with a = newline +- # and not a real comment (e.g. if you have an empty line = following a key-value +- col =3D self.column +- elif col < self.column + 1: +- ValueError +- except ValueError: +- col =3D self.column + 1 +- # nprint('post_comment', self.line, self.column, value) +- try: +- # at least one space if the current column >=3D the start col= umn of the comment +- # but not at the start of a line +- nr_spaces =3D col - self.column +- if self.column and value.strip() and nr_spaces < 1 and value[= 0] !=3D '\n': +- nr_spaces =3D 1 +- value =3D ' ' * nr_spaces + value +- try: +- if bool(self.encoding): +- value =3D value.encode(self.encoding) +- except UnicodeDecodeError: +- pass +- self.stream.write(value) +- except TypeError: +- raise +- if not pre: +- self.write_line_break() +- +- def write_pre_comment(self, event): +- # type: (Any) -> bool +- comments =3D event.comment[1] +- if comments is None: +- return False +- try: +- start_events =3D (MappingStartEvent, SequenceStartEvent) +- for comment in comments: +- if isinstance(event, start_events) and getattr(comment, '= pre_done', None): +- continue +- if self.column !=3D 0: +- self.write_line_break() +- self.write_comment(comment, pre=3DTrue) +- if isinstance(event, start_events): +- comment.pre_done =3D True +- except TypeError: +- sys.stdout.write('eventtt {} {}'.format(type(event), event)) +- raise +- return True +- +- def write_post_comment(self, event): +- # type: (Any) -> bool +- if self.event.comment[0] is None: +- return False +- comment =3D event.comment[0] +- self.write_comment(comment) +- return True +diff --git a/dynaconf/vendor_src/ruamel/yaml/error.py b/dynaconf/vendor_sr= c/ruamel/yaml/error.py +deleted file mode 100644 +index b034d02..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/error.py ++++ /dev/null +@@ -1,311 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-import warnings +-import textwrap +- +-from .compat import utf8 +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Text # NOQA +- +- +-__all__ =3D [ +- 'FileMark', +- 'StringMark', +- 'CommentMark', +- 'YAMLError', +- 'MarkedYAMLError', +- 'ReusedAnchorWarning', +- 'UnsafeLoaderWarning', +- 'MarkedYAMLWarning', +- 'MarkedYAMLFutureWarning', +-] +- +- +-class StreamMark(object): +- __slots__ =3D 'name', 'index', 'line', 'column' +- +- def __init__(self, name, index, line, column): +- # type: (Any, int, int, int) -> None +- self.name =3D name +- self.index =3D index +- self.line =3D line +- self.column =3D column +- +- def __str__(self): +- # type: () -> Any +- where =3D ' in "%s", line %d, column %d' % (self.name, self.line= + 1, self.column + 1) +- return where +- +- def __eq__(self, other): +- # type: (Any) -> bool +- if self.line !=3D other.line or self.column !=3D other.column: +- return False +- if self.name !=3D other.name or self.index !=3D other.index: +- return False +- return True +- +- def __ne__(self, other): +- # type: (Any) -> bool +- return not self.__eq__(other) +- +- +-class FileMark(StreamMark): +- __slots__ =3D () +- +- +-class StringMark(StreamMark): +- __slots__ =3D 'name', 'index', 'line', 'column', 'buffer', 'pointer' +- +- def __init__(self, name, index, line, column, buffer, pointer): +- # type: (Any, int, int, int, Any, Any) -> None +- StreamMark.__init__(self, name, index, line, column) +- self.buffer =3D buffer +- self.pointer =3D pointer +- +- def get_snippet(self, indent=3D4, max_length=3D75): +- # type: (int, int) -> Any +- if self.buffer is None: # always False +- return None +- head =3D "" +- start =3D self.pointer +- while start > 0 and self.buffer[start - 1] not in u'\0\r\n\x85\u2= 028\u2029': +- start -=3D 1 +- if self.pointer - start > max_length / 2 - 1: +- head =3D ' ... ' +- start +=3D 5 +- break +- tail =3D "" +- end =3D self.pointer +- while end < len(self.buffer) and self.buffer[end] not in u'\0\r\n= \x85\u2028\u2029': +- end +=3D 1 +- if end - self.pointer > max_length / 2 - 1: +- tail =3D ' ... ' +- end -=3D 5 +- break +- snippet =3D utf8(self.buffer[start:end]) +- caret =3D '^' +- caret =3D '^ (line: {})'.format(self.line + 1) +- return ( +- ' ' * indent +- + head +- + snippet +- + tail +- + '\n' +- + ' ' * (indent + self.pointer - start + len(head)) +- + caret +- ) +- +- def __str__(self): +- # type: () -> Any +- snippet =3D self.get_snippet() +- where =3D ' in "%s", line %d, column %d' % (self.name, self.line= + 1, self.column + 1) +- if snippet is not None: +- where +=3D ':\n' + snippet +- return where +- +- +-class CommentMark(object): +- __slots__ =3D ('column',) +- +- def __init__(self, column): +- # type: (Any) -> None +- self.column =3D column +- +- +-class YAMLError(Exception): +- pass +- +- +-class MarkedYAMLError(YAMLError): +- def __init__( +- self, +- context=3DNone, +- context_mark=3DNone, +- problem=3DNone, +- problem_mark=3DNone, +- note=3DNone, +- warn=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- self.context =3D context +- self.context_mark =3D context_mark +- self.problem =3D problem +- self.problem_mark =3D problem_mark +- self.note =3D note +- # warn is ignored +- +- def __str__(self): +- # type: () -> Any +- lines =3D [] # type: List[str] +- if self.context is not None: +- lines.append(self.context) +- if self.context_mark is not None and ( +- self.problem is None +- or self.problem_mark is None +- or self.context_mark.name !=3D self.problem_mark.name +- or self.context_mark.line !=3D self.problem_mark.line +- or self.context_mark.column !=3D self.problem_mark.column +- ): +- lines.append(str(self.context_mark)) +- if self.problem is not None: +- lines.append(self.problem) +- if self.problem_mark is not None: +- lines.append(str(self.problem_mark)) +- if self.note is not None and self.note: +- note =3D textwrap.dedent(self.note) +- lines.append(note) +- return '\n'.join(lines) +- +- +-class YAMLStreamError(Exception): +- pass +- +- +-class YAMLWarning(Warning): +- pass +- +- +-class MarkedYAMLWarning(YAMLWarning): +- def __init__( +- self, +- context=3DNone, +- context_mark=3DNone, +- problem=3DNone, +- problem_mark=3DNone, +- note=3DNone, +- warn=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- self.context =3D context +- self.context_mark =3D context_mark +- self.problem =3D problem +- self.problem_mark =3D problem_mark +- self.note =3D note +- self.warn =3D warn +- +- def __str__(self): +- # type: () -> Any +- lines =3D [] # type: List[str] +- if self.context is not None: +- lines.append(self.context) +- if self.context_mark is not None and ( +- self.problem is None +- or self.problem_mark is None +- or self.context_mark.name !=3D self.problem_mark.name +- or self.context_mark.line !=3D self.problem_mark.line +- or self.context_mark.column !=3D self.problem_mark.column +- ): +- lines.append(str(self.context_mark)) +- if self.problem is not None: +- lines.append(self.problem) +- if self.problem_mark is not None: +- lines.append(str(self.problem_mark)) +- if self.note is not None and self.note: +- note =3D textwrap.dedent(self.note) +- lines.append(note) +- if self.warn is not None and self.warn: +- warn =3D textwrap.dedent(self.warn) +- lines.append(warn) +- return '\n'.join(lines) +- +- +-class ReusedAnchorWarning(YAMLWarning): +- pass +- +- +-class UnsafeLoaderWarning(YAMLWarning): +- text =3D """ +-The default 'Loader' for 'load(stream)' without further arguments can be = unsafe. +-Use 'load(stream, Loader=3Druamel.yaml.Loader)' explicitly if that is OK. +-Alternatively include the following in your code: +- +- import warnings +- warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning) +- +-In most other cases you should consider using 'safe_load(stream)'""" +- pass +- +- +-warnings.simplefilter('once', UnsafeLoaderWarning) +- +- +-class MantissaNoDotYAML1_1Warning(YAMLWarning): +- def __init__(self, node, flt_str): +- # type: (Any, Any) -> None +- self.node =3D node +- self.flt =3D flt_str +- +- def __str__(self): +- # type: () -> Any +- line =3D self.node.start_mark.line +- col =3D self.node.start_mark.column +- return """ +-In YAML 1.1 floating point values should have a dot ('.') in their mantis= sa. +-See the Floating-Point Language-Independent Type for YAML=E2=84=A2 Versio= n 1.1 specification +-( http://yaml.org/type/float.html ). This dot is not required for JSON no= r for YAML 1.2 +- +-Correct your float: "{}" on line: {}, column: {} +- +-or alternatively include the following in your code: +- +- import warnings +- warnings.simplefilter('ignore', ruamel.yaml.error.MantissaNoDotYAML1_1W= arning) +- +-""".format( +- self.flt, line, col +- ) +- +- +-warnings.simplefilter('once', MantissaNoDotYAML1_1Warning) +- +- +-class YAMLFutureWarning(Warning): +- pass +- +- +-class MarkedYAMLFutureWarning(YAMLFutureWarning): +- def __init__( +- self, +- context=3DNone, +- context_mark=3DNone, +- problem=3DNone, +- problem_mark=3DNone, +- note=3DNone, +- warn=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- self.context =3D context +- self.context_mark =3D context_mark +- self.problem =3D problem +- self.problem_mark =3D problem_mark +- self.note =3D note +- self.warn =3D warn +- +- def __str__(self): +- # type: () -> Any +- lines =3D [] # type: List[str] +- if self.context is not None: +- lines.append(self.context) +- +- if self.context_mark is not None and ( +- self.problem is None +- or self.problem_mark is None +- or self.context_mark.name !=3D self.problem_mark.name +- or self.context_mark.line !=3D self.problem_mark.line +- or self.context_mark.column !=3D self.problem_mark.column +- ): +- lines.append(str(self.context_mark)) +- if self.problem is not None: +- lines.append(self.problem) +- if self.problem_mark is not None: +- lines.append(str(self.problem_mark)) +- if self.note is not None and self.note: +- note =3D textwrap.dedent(self.note) +- lines.append(note) +- if self.warn is not None and self.warn: +- warn =3D textwrap.dedent(self.warn) +- lines.append(warn) +- return '\n'.join(lines) +diff --git a/dynaconf/vendor_src/ruamel/yaml/events.py b/dynaconf/vendor_s= rc/ruamel/yaml/events.py +deleted file mode 100644 +index 58b2121..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/events.py ++++ /dev/null +@@ -1,157 +0,0 @@ +-# coding: utf-8 +- +-# Abstract classes. +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List # NOQA +- +- +-def CommentCheck(): +- # type: () -> None +- pass +- +- +-class Event(object): +- __slots__ =3D 'start_mark', 'end_mark', 'comment' +- +- def __init__(self, start_mark=3DNone, end_mark=3DNone, comment=3DComm= entCheck): +- # type: (Any, Any, Any) -> None +- self.start_mark =3D start_mark +- self.end_mark =3D end_mark +- # assert comment is not CommentCheck +- if comment is CommentCheck: +- comment =3D None +- self.comment =3D comment +- +- def __repr__(self): +- # type: () -> Any +- attributes =3D [ +- key +- for key in ['anchor', 'tag', 'implicit', 'value', 'flow_style= ', 'style'] +- if hasattr(self, key) +- ] +- arguments =3D ', '.join(['%s=3D%r' % (key, getattr(self, key)) fo= r key in attributes]) +- if self.comment not in [None, CommentCheck]: +- arguments +=3D ', comment=3D{!r}'.format(self.comment) +- return '%s(%s)' % (self.__class__.__name__, arguments) +- +- +-class NodeEvent(Event): +- __slots__ =3D ('anchor',) +- +- def __init__(self, anchor, start_mark=3DNone, end_mark=3DNone, commen= t=3DNone): +- # type: (Any, Any, Any, Any) -> None +- Event.__init__(self, start_mark, end_mark, comment) +- self.anchor =3D anchor +- +- +-class CollectionStartEvent(NodeEvent): +- __slots__ =3D 'tag', 'implicit', 'flow_style', 'nr_items' +- +- def __init__( +- self, +- anchor, +- tag, +- implicit, +- start_mark=3DNone, +- end_mark=3DNone, +- flow_style=3DNone, +- comment=3DNone, +- nr_items=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any, Any, Optional[int]) -> None +- NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) +- self.tag =3D tag +- self.implicit =3D implicit +- self.flow_style =3D flow_style +- self.nr_items =3D nr_items +- +- +-class CollectionEndEvent(Event): +- __slots__ =3D () +- +- +-# Implementations. +- +- +-class StreamStartEvent(Event): +- __slots__ =3D ('encoding',) +- +- def __init__(self, start_mark=3DNone, end_mark=3DNone, encoding=3DNon= e, comment=3DNone): +- # type: (Any, Any, Any, Any) -> None +- Event.__init__(self, start_mark, end_mark, comment) +- self.encoding =3D encoding +- +- +-class StreamEndEvent(Event): +- __slots__ =3D () +- +- +-class DocumentStartEvent(Event): +- __slots__ =3D 'explicit', 'version', 'tags' +- +- def __init__( +- self, +- start_mark=3DNone, +- end_mark=3DNone, +- explicit=3DNone, +- version=3DNone, +- tags=3DNone, +- comment=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- Event.__init__(self, start_mark, end_mark, comment) +- self.explicit =3D explicit +- self.version =3D version +- self.tags =3D tags +- +- +-class DocumentEndEvent(Event): +- __slots__ =3D ('explicit',) +- +- def __init__(self, start_mark=3DNone, end_mark=3DNone, explicit=3DNon= e, comment=3DNone): +- # type: (Any, Any, Any, Any) -> None +- Event.__init__(self, start_mark, end_mark, comment) +- self.explicit =3D explicit +- +- +-class AliasEvent(NodeEvent): +- __slots__ =3D () +- +- +-class ScalarEvent(NodeEvent): +- __slots__ =3D 'tag', 'implicit', 'value', 'style' +- +- def __init__( +- self, +- anchor, +- tag, +- implicit, +- value, +- start_mark=3DNone, +- end_mark=3DNone, +- style=3DNone, +- comment=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any, Any, Any) -> None +- NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) +- self.tag =3D tag +- self.implicit =3D implicit +- self.value =3D value +- self.style =3D style +- +- +-class SequenceStartEvent(CollectionStartEvent): +- __slots__ =3D () +- +- +-class SequenceEndEvent(CollectionEndEvent): +- __slots__ =3D () +- +- +-class MappingStartEvent(CollectionStartEvent): +- __slots__ =3D () +- +- +-class MappingEndEvent(CollectionEndEvent): +- __slots__ =3D () +diff --git a/dynaconf/vendor_src/ruamel/yaml/loader.py b/dynaconf/vendor_s= rc/ruamel/yaml/loader.py +deleted file mode 100644 +index 53dd576..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/loader.py ++++ /dev/null +@@ -1,74 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +- +-from .reader import Reader +-from .scanner import Scanner, RoundTripScanner +-from .parser import Parser, RoundTripParser +-from .composer import Composer +-from .constructor import ( +- BaseConstructor, +- SafeConstructor, +- Constructor, +- RoundTripConstructor, +-) +-from .resolver import VersionedResolver +- +-if False: # MYPY +- from typing import Any, Dict, List, Union, Optional # NOQA +- from .compat import StreamTextType, VersionType # NOQA +- +-__all__ =3D ['BaseLoader', 'SafeLoader', 'Loader', 'RoundTripLoader'] +- +- +-class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, Vers= ionedResolver): +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- Reader.__init__(self, stream, loader=3Dself) +- Scanner.__init__(self, loader=3Dself) +- Parser.__init__(self, loader=3Dself) +- Composer.__init__(self, loader=3Dself) +- BaseConstructor.__init__(self, loader=3Dself) +- VersionedResolver.__init__(self, version, loader=3Dself) +- +- +-class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Vers= ionedResolver): +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- Reader.__init__(self, stream, loader=3Dself) +- Scanner.__init__(self, loader=3Dself) +- Parser.__init__(self, loader=3Dself) +- Composer.__init__(self, loader=3Dself) +- SafeConstructor.__init__(self, loader=3Dself) +- VersionedResolver.__init__(self, version, loader=3Dself) +- +- +-class Loader(Reader, Scanner, Parser, Composer, Constructor, VersionedRes= olver): +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- Reader.__init__(self, stream, loader=3Dself) +- Scanner.__init__(self, loader=3Dself) +- Parser.__init__(self, loader=3Dself) +- Composer.__init__(self, loader=3Dself) +- Constructor.__init__(self, loader=3Dself) +- VersionedResolver.__init__(self, version, loader=3Dself) +- +- +-class RoundTripLoader( +- Reader, +- RoundTripScanner, +- RoundTripParser, +- Composer, +- RoundTripConstructor, +- VersionedResolver, +-): +- def __init__(self, stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -= > None +- # self.reader =3D Reader.__init__(self, stream) +- Reader.__init__(self, stream, loader=3Dself) +- RoundTripScanner.__init__(self, loader=3Dself) +- RoundTripParser.__init__(self, loader=3Dself) +- Composer.__init__(self, loader=3Dself) +- RoundTripConstructor.__init__(self, preserve_quotes=3Dpreserve_qu= otes, loader=3Dself) +- VersionedResolver.__init__(self, version, loader=3Dself) +diff --git a/dynaconf/vendor_src/ruamel/yaml/main.py b/dynaconf/vendor_src= /ruamel/yaml/main.py +deleted file mode 100644 +index 7023331..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/main.py ++++ /dev/null +@@ -1,1534 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import, unicode_literals, print_function +- +-import sys +-import os +-import warnings +-import glob +-from importlib import import_module +- +- +-import dynaconf.vendor.ruamel as ruamel +-from .error import UnsafeLoaderWarning, YAMLError # NOQA +- +-from .tokens import * # NOQA +-from .events import * # NOQA +-from .nodes import * # NOQA +- +-from .loader import BaseLoader, SafeLoader, Loader, RoundTripLoader # NO= QA +-from .dumper import BaseDumper, SafeDumper, Dumper, RoundTripDumper # NO= QA +-from .compat import StringIO, BytesIO, with_metaclass, PY3, nprint +-from .resolver import VersionedResolver, Resolver # NOQA +-from .representer import ( +- BaseRepresenter, +- SafeRepresenter, +- Representer, +- RoundTripRepresenter, +-) +-from .constructor import ( +- BaseConstructor, +- SafeConstructor, +- Constructor, +- RoundTripConstructor, +-) +-from .loader import Loader as UnsafeLoader +- +-if False: # MYPY +- from typing import List, Set, Dict, Union, Any, Callable, Optional, T= ext # NOQA +- from .compat import StreamType, StreamTextType, VersionType # NOQA +- +- if PY3: +- from pathlib import Path +- else: +- Path =3D Any +- +-try: +- from _ruamel_yaml import CParser, CEmitter # type: ignore +-except: # NOQA +- CParser =3D CEmitter =3D None +- +-# import io +- +-enforce =3D object() +- +- +-# YAML is an acronym, i.e. spoken: rhymes with "camel". And thus a +-# subset of abbreviations, which should be all caps according to PEP8 +- +- +-class YAML(object): +- def __init__( +- self, _kw=3Denforce, typ=3DNone, pure=3DFalse, output=3DNone, plu= g_ins=3DNone # input=3DNone, +- ): +- # type: (Any, Optional[Text], Any, Any, Any) -> None +- """ +- _kw: not used, forces keyword arguments in 2.7 (in 3 you can do (= *, safe_load=3D..) +- typ: 'rt'/None -> RoundTripLoader/RoundTripDumper, (default) +- 'safe' -> SafeLoader/SafeDumper, +- 'unsafe' -> normal/unsafe Loader/Dumper +- 'base' -> baseloader +- pure: if True only use Python modules +- input/output: needed to work as context manager +- plug_ins: a list of plug-in files +- """ +- if _kw is not enforce: +- raise TypeError( +- '{}.__init__() takes no positional argument but at least ' +- 'one was given ({!r})'.format(self.__class__.__name__, _k= w) +- ) +- +- self.typ =3D ['rt'] if typ is None else (typ if isinstance(typ, l= ist) else [typ]) +- self.pure =3D pure +- +- # self._input =3D input +- self._output =3D output +- self._context_manager =3D None # type: Any +- +- self.plug_ins =3D [] # type: List[Any] +- for pu in ([] if plug_ins is None else plug_ins) + self.official_= plug_ins(): +- file_name =3D pu.replace(os.sep, '.') +- self.plug_ins.append(import_module(file_name)) +- self.Resolver =3D ruamel.yaml.resolver.VersionedResolver # type:= Any +- self.allow_unicode =3D True +- self.Reader =3D None # type: Any +- self.Representer =3D None # type: Any +- self.Constructor =3D None # type: Any +- self.Scanner =3D None # type: Any +- self.Serializer =3D None # type: Any +- self.default_flow_style =3D None # type: Any +- typ_found =3D 1 +- setup_rt =3D False +- if 'rt' in self.typ: +- setup_rt =3D True +- elif 'safe' in self.typ: +- self.Emitter =3D ( +- ruamel.yaml.emitter.Emitter if pure or CEmitter is None e= lse CEmitter +- ) +- self.Representer =3D ruamel.yaml.representer.SafeRepresenter +- self.Parser =3D ruamel.yaml.parser.Parser if pure or CParser = is None else CParser +- self.Composer =3D ruamel.yaml.composer.Composer +- self.Constructor =3D ruamel.yaml.constructor.SafeConstructor +- elif 'base' in self.typ: +- self.Emitter =3D ruamel.yaml.emitter.Emitter +- self.Representer =3D ruamel.yaml.representer.BaseRepresenter +- self.Parser =3D ruamel.yaml.parser.Parser if pure or CParser = is None else CParser +- self.Composer =3D ruamel.yaml.composer.Composer +- self.Constructor =3D ruamel.yaml.constructor.BaseConstructor +- elif 'unsafe' in self.typ: +- self.Emitter =3D ( +- ruamel.yaml.emitter.Emitter if pure or CEmitter is None e= lse CEmitter +- ) +- self.Representer =3D ruamel.yaml.representer.Representer +- self.Parser =3D ruamel.yaml.parser.Parser if pure or CParser = is None else CParser +- self.Composer =3D ruamel.yaml.composer.Composer +- self.Constructor =3D ruamel.yaml.constructor.Constructor +- else: +- setup_rt =3D True +- typ_found =3D 0 +- if setup_rt: +- self.default_flow_style =3D False +- # no optimized rt-dumper yet +- self.Emitter =3D ruamel.yaml.emitter.Emitter +- self.Serializer =3D ruamel.yaml.serializer.Serializer +- self.Representer =3D ruamel.yaml.representer.RoundTripReprese= nter +- self.Scanner =3D ruamel.yaml.scanner.RoundTripScanner +- # no optimized rt-parser yet +- self.Parser =3D ruamel.yaml.parser.RoundTripParser +- self.Composer =3D ruamel.yaml.composer.Composer +- self.Constructor =3D ruamel.yaml.constructor.RoundTripConstru= ctor +- del setup_rt +- self.stream =3D None +- self.canonical =3D None +- self.old_indent =3D None +- self.width =3D None +- self.line_break =3D None +- +- self.map_indent =3D None +- self.sequence_indent =3D None +- self.sequence_dash_offset =3D 0 +- self.compact_seq_seq =3D None +- self.compact_seq_map =3D None +- self.sort_base_mapping_type_on_output =3D None # default: sort +- +- self.top_level_colon_align =3D None +- self.prefix_colon =3D None +- self.version =3D None +- self.preserve_quotes =3D None +- self.allow_duplicate_keys =3D False # duplicate keys in map, set +- self.encoding =3D 'utf-8' +- self.explicit_start =3D None +- self.explicit_end =3D None +- self.tags =3D None +- self.default_style =3D None +- self.top_level_block_style_scalar_no_indent_error_1_1 =3D False +- # directives end indicator with single scalar document +- self.scalar_after_indicator =3D None +- # [a, b: 1, c: {d: 2}] vs. [a, {b: 1}, {c: {d: 2}}] +- self.brace_single_entry_mapping_in_flow_sequence =3D False +- for module in self.plug_ins: +- if getattr(module, 'typ', None) in self.typ: +- typ_found +=3D 1 +- module.init_typ(self) +- break +- if typ_found =3D=3D 0: +- raise NotImplementedError( +- 'typ "{}"not recognised (need to install plug-in?)'.forma= t(self.typ) +- ) +- +- @property +- def reader(self): +- # type: () -> Any +- try: +- return self._reader # type: ignore +- except AttributeError: +- self._reader =3D self.Reader(None, loader=3Dself) +- return self._reader +- +- @property +- def scanner(self): +- # type: () -> Any +- try: +- return self._scanner # type: ignore +- except AttributeError: +- self._scanner =3D self.Scanner(loader=3Dself) +- return self._scanner +- +- @property +- def parser(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- if self.Parser is not CParser: +- setattr(self, attr, self.Parser(loader=3Dself)) +- else: +- if getattr(self, '_stream', None) is None: +- # wait for the stream +- return None +- else: +- # if not hasattr(self._stream, 'read') and hasattr(se= lf._stream, 'open'): +- # # pathlib.Path() instance +- # setattr(self, attr, CParser(self._stream)) +- # else: +- setattr(self, attr, CParser(self._stream)) +- # self._parser =3D self._composer =3D self +- # nprint('scanner', self.loader.scanner) +- +- return getattr(self, attr) +- +- @property +- def composer(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- setattr(self, attr, self.Composer(loader=3Dself)) +- return getattr(self, attr) +- +- @property +- def constructor(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- cnst =3D self.Constructor(preserve_quotes=3Dself.preserve_quo= tes, loader=3Dself) +- cnst.allow_duplicate_keys =3D self.allow_duplicate_keys +- setattr(self, attr, cnst) +- return getattr(self, attr) +- +- @property +- def resolver(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- setattr(self, attr, self.Resolver(version=3Dself.version, loa= der=3Dself)) +- return getattr(self, attr) +- +- @property +- def emitter(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- if self.Emitter is not CEmitter: +- _emitter =3D self.Emitter( +- None, +- canonical=3Dself.canonical, +- indent=3Dself.old_indent, +- width=3Dself.width, +- allow_unicode=3Dself.allow_unicode, +- line_break=3Dself.line_break, +- prefix_colon=3Dself.prefix_colon, +- brace_single_entry_mapping_in_flow_sequence=3Dself.br= ace_single_entry_mapping_in_flow_sequence, # NOQA +- dumper=3Dself, +- ) +- setattr(self, attr, _emitter) +- if self.map_indent is not None: +- _emitter.best_map_indent =3D self.map_indent +- if self.sequence_indent is not None: +- _emitter.best_sequence_indent =3D self.sequence_indent +- if self.sequence_dash_offset is not None: +- _emitter.sequence_dash_offset =3D self.sequence_dash_= offset +- # _emitter.block_seq_indent =3D self.sequence_dash_of= fset +- if self.compact_seq_seq is not None: +- _emitter.compact_seq_seq =3D self.compact_seq_seq +- if self.compact_seq_map is not None: +- _emitter.compact_seq_map =3D self.compact_seq_map +- else: +- if getattr(self, '_stream', None) is None: +- # wait for the stream +- return None +- return None +- return getattr(self, attr) +- +- @property +- def serializer(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- setattr( +- self, +- attr, +- self.Serializer( +- encoding=3Dself.encoding, +- explicit_start=3Dself.explicit_start, +- explicit_end=3Dself.explicit_end, +- version=3Dself.version, +- tags=3Dself.tags, +- dumper=3Dself, +- ), +- ) +- return getattr(self, attr) +- +- @property +- def representer(self): +- # type: () -> Any +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- repres =3D self.Representer( +- default_style=3Dself.default_style, +- default_flow_style=3Dself.default_flow_style, +- dumper=3Dself, +- ) +- if self.sort_base_mapping_type_on_output is not None: +- repres.sort_base_mapping_type_on_output =3D self.sort_bas= e_mapping_type_on_output +- setattr(self, attr, repres) +- return getattr(self, attr) +- +- # separate output resolver? +- +- # def load(self, stream=3DNone): +- # if self._context_manager: +- # if not self._input: +- # raise TypeError("Missing input stream while dumping fro= m context manager") +- # for data in self._context_manager.load(): +- # yield data +- # return +- # if stream is None: +- # raise TypeError("Need a stream argument when not loading fr= om context manager") +- # return self.load_one(stream) +- +- def load(self, stream): +- # type: (Union[Path, StreamTextType]) -> Any +- """ +- at this point you either have the non-pure Parser (which has its = own reader and +- scanner) or you have the pure Parser. +- If the pure Parser is set, then set the Reader and Scanner, if no= t already set. +- If either the Scanner or Reader are set, you cannot use the non-p= ure Parser, +- so reset it to the pure parser and set the Reader resp. Scann= er if necessary +- """ +- if not hasattr(stream, 'read') and hasattr(stream, 'open'): +- # pathlib.Path() instance +- with stream.open('rb') as fp: +- return self.load(fp) +- constructor, parser =3D self.get_constructor_parser(stream) +- try: +- return constructor.get_single_data() +- finally: +- parser.dispose() +- try: +- self._reader.reset_reader() +- except AttributeError: +- pass +- try: +- self._scanner.reset_scanner() +- except AttributeError: +- pass +- +- def load_all(self, stream, _kw=3Denforce): # , skip=3DNone): +- # type: (Union[Path, StreamTextType], Any) -> Any +- if _kw is not enforce: +- raise TypeError( +- '{}.__init__() takes no positional argument but at least ' +- 'one was given ({!r})'.format(self.__class__.__name__, _k= w) +- ) +- if not hasattr(stream, 'read') and hasattr(stream, 'open'): +- # pathlib.Path() instance +- with stream.open('r') as fp: +- for d in self.load_all(fp, _kw=3Denforce): +- yield d +- return +- # if skip is None: +- # skip =3D [] +- # elif isinstance(skip, int): +- # skip =3D [skip] +- constructor, parser =3D self.get_constructor_parser(stream) +- try: +- while constructor.check_data(): +- yield constructor.get_data() +- finally: +- parser.dispose() +- try: +- self._reader.reset_reader() +- except AttributeError: +- pass +- try: +- self._scanner.reset_scanner() +- except AttributeError: +- pass +- +- def get_constructor_parser(self, stream): +- # type: (StreamTextType) -> Any +- """ +- the old cyaml needs special setup, and therefore the stream +- """ +- if self.Parser is not CParser: +- if self.Reader is None: +- self.Reader =3D ruamel.yaml.reader.Reader +- if self.Scanner is None: +- self.Scanner =3D ruamel.yaml.scanner.Scanner +- self.reader.stream =3D stream +- else: +- if self.Reader is not None: +- if self.Scanner is None: +- self.Scanner =3D ruamel.yaml.scanner.Scanner +- self.Parser =3D ruamel.yaml.parser.Parser +- self.reader.stream =3D stream +- elif self.Scanner is not None: +- if self.Reader is None: +- self.Reader =3D ruamel.yaml.reader.Reader +- self.Parser =3D ruamel.yaml.parser.Parser +- self.reader.stream =3D stream +- else: +- # combined C level reader>scanner>parser +- # does some calls to the resolver, e.g. BaseResolver.desc= end_resolver +- # if you just initialise the CParser, to much of resolver= .py +- # is actually used +- rslvr =3D self.Resolver +- # if rslvr is ruamel.yaml.resolver.VersionedResolver: +- # rslvr =3D ruamel.yaml.resolver.Resolver +- +- class XLoader(self.Parser, self.Constructor, rslvr): # t= ype: ignore +- def __init__(selfx, stream, version=3Dself.version, p= reserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], O= ptional[bool]) -> None # NOQA +- CParser.__init__(selfx, stream) +- selfx._parser =3D selfx._composer =3D selfx +- self.Constructor.__init__(selfx, loader=3Dselfx) +- selfx.allow_duplicate_keys =3D self.allow_duplica= te_keys +- rslvr.__init__(selfx, version=3Dversion, loadumpe= r=3Dselfx) +- +- self._stream =3D stream +- loader =3D XLoader(stream) +- return loader, loader +- return self.constructor, self.parser +- +- def dump(self, data, stream=3DNone, _kw=3Denforce, transform=3DNone): +- # type: (Any, Union[Path, StreamType], Any, Any) -> Any +- if self._context_manager: +- if not self._output: +- raise TypeError('Missing output stream while dumping from= context manager') +- if _kw is not enforce: +- raise TypeError( +- '{}.dump() takes one positional argument but at least= ' +- 'two were given ({!r})'.format(self.__class__.__name_= _, _kw) +- ) +- if transform is not None: +- raise TypeError( +- '{}.dump() in the context manager cannot have transfo= rm keyword ' +- ''.format(self.__class__.__name__) +- ) +- self._context_manager.dump(data) +- else: # old style +- if stream is None: +- raise TypeError('Need a stream argument when not dumping = from context manager') +- return self.dump_all([data], stream, _kw, transform=3Dtransfo= rm) +- +- def dump_all(self, documents, stream, _kw=3Denforce, transform=3DNone= ): +- # type: (Any, Union[Path, StreamType], Any, Any) -> Any +- if self._context_manager: +- raise NotImplementedError +- if _kw is not enforce: +- raise TypeError( +- '{}.dump(_all) takes two positional argument but at least= ' +- 'three were given ({!r})'.format(self.__class__.__name__,= _kw) +- ) +- self._output =3D stream +- self._context_manager =3D YAMLContextManager(self, transform=3Dtr= ansform) +- for data in documents: +- self._context_manager.dump(data) +- self._context_manager.teardown_output() +- self._output =3D None +- self._context_manager =3D None +- +- def Xdump_all(self, documents, stream, _kw=3Denforce, transform=3DNon= e): +- # type: (Any, Union[Path, StreamType], Any, Any) -> Any +- """ +- Serialize a sequence of Python objects into a YAML stream. +- """ +- if not hasattr(stream, 'write') and hasattr(stream, 'open'): +- # pathlib.Path() instance +- with stream.open('w') as fp: +- return self.dump_all(documents, fp, _kw, transform=3Dtran= sform) +- if _kw is not enforce: +- raise TypeError( +- '{}.dump(_all) takes two positional argument but at least= ' +- 'three were given ({!r})'.format(self.__class__.__name__,= _kw) +- ) +- # The stream should have the methods `write` and possibly `flush`. +- if self.top_level_colon_align is True: +- tlca =3D max([len(str(x)) for x in documents[0]]) # type: Any +- else: +- tlca =3D self.top_level_colon_align +- if transform is not None: +- fstream =3D stream +- if self.encoding is None: +- stream =3D StringIO() +- else: +- stream =3D BytesIO() +- serializer, representer, emitter =3D self.get_serializer_represen= ter_emitter( +- stream, tlca +- ) +- try: +- self.serializer.open() +- for data in documents: +- try: +- self.representer.represent(data) +- except AttributeError: +- # nprint(dir(dumper._representer)) +- raise +- self.serializer.close() +- finally: +- try: +- self.emitter.dispose() +- except AttributeError: +- raise +- # self.dumper.dispose() # cyaml +- delattr(self, '_serializer') +- delattr(self, '_emitter') +- if transform: +- val =3D stream.getvalue() +- if self.encoding: +- val =3D val.decode(self.encoding) +- if fstream is None: +- transform(val) +- else: +- fstream.write(transform(val)) +- return None +- +- def get_serializer_representer_emitter(self, stream, tlca): +- # type: (StreamType, Any) -> Any +- # we have only .Serializer to deal with (vs .Reader & .Scanner), = much simpler +- if self.Emitter is not CEmitter: +- if self.Serializer is None: +- self.Serializer =3D ruamel.yaml.serializer.Serializer +- self.emitter.stream =3D stream +- self.emitter.top_level_colon_align =3D tlca +- if self.scalar_after_indicator is not None: +- self.emitter.scalar_after_indicator =3D self.scalar_after= _indicator +- return self.serializer, self.representer, self.emitter +- if self.Serializer is not None: +- # cannot set serializer with CEmitter +- self.Emitter =3D ruamel.yaml.emitter.Emitter +- self.emitter.stream =3D stream +- self.emitter.top_level_colon_align =3D tlca +- if self.scalar_after_indicator is not None: +- self.emitter.scalar_after_indicator =3D self.scalar_after= _indicator +- return self.serializer, self.representer, self.emitter +- # C routines +- +- rslvr =3D ( +- ruamel.yaml.resolver.BaseResolver +- if 'base' in self.typ +- else ruamel.yaml.resolver.Resolver +- ) +- +- class XDumper(CEmitter, self.Representer, rslvr): # type: ignore +- def __init__( +- selfx, +- stream, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +- ): +- # type: (StreamType, Any, Any, Any, Optional[bool], Optio= nal[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optional= [bool], Any, Any, Any, Any, Any) -> None # NOQA +- CEmitter.__init__( +- selfx, +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- encoding=3Dencoding, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- ) +- selfx._emitter =3D selfx._serializer =3D selfx._represent= er =3D selfx +- self.Representer.__init__( +- selfx, default_style=3Ddefault_style, default_flow_st= yle=3Ddefault_flow_style +- ) +- rslvr.__init__(selfx) +- +- self._stream =3D stream +- dumper =3D XDumper( +- stream, +- default_style=3Dself.default_style, +- default_flow_style=3Dself.default_flow_style, +- canonical=3Dself.canonical, +- indent=3Dself.old_indent, +- width=3Dself.width, +- allow_unicode=3Dself.allow_unicode, +- line_break=3Dself.line_break, +- explicit_start=3Dself.explicit_start, +- explicit_end=3Dself.explicit_end, +- version=3Dself.version, +- tags=3Dself.tags, +- ) +- self._emitter =3D self._serializer =3D dumper +- return dumper, dumper, dumper +- +- # basic types +- def map(self, **kw): +- # type: (Any) -> Any +- if 'rt' in self.typ: +- from dynaconf.vendor.ruamel.yaml.comments import CommentedMap +- +- return CommentedMap(**kw) +- else: +- return dict(**kw) +- +- def seq(self, *args): +- # type: (Any) -> Any +- if 'rt' in self.typ: +- from dynaconf.vendor.ruamel.yaml.comments import CommentedSeq +- +- return CommentedSeq(*args) +- else: +- return list(*args) +- +- # helpers +- def official_plug_ins(self): +- # type: () -> Any +- bd =3D os.path.dirname(__file__) +- gpbd =3D os.path.dirname(os.path.dirname(bd)) +- res =3D [x.replace(gpbd, "")[1:-3] for x in glob.glob(bd + '/*/__= plug_in__.py')] +- return res +- +- def register_class(self, cls): +- # type:(Any) -> Any +- """ +- register a class for dumping loading +- - if it has attribute yaml_tag use that to register, else use cla= ss name +- - if it has methods to_yaml/from_yaml use those to dump/load else= dump attributes +- as mapping +- """ +- tag =3D getattr(cls, 'yaml_tag', '!' + cls.__name__) +- try: +- self.representer.add_representer(cls, cls.to_yaml) +- except AttributeError: +- +- def t_y(representer, data): +- # type: (Any, Any) -> Any +- return representer.represent_yaml_object( +- tag, data, cls, flow_style=3Drepresenter.default_flow= _style +- ) +- +- self.representer.add_representer(cls, t_y) +- try: +- self.constructor.add_constructor(tag, cls.from_yaml) +- except AttributeError: +- +- def f_y(constructor, node): +- # type: (Any, Any) -> Any +- return constructor.construct_yaml_object(node, cls) +- +- self.constructor.add_constructor(tag, f_y) +- return cls +- +- def parse(self, stream): +- # type: (StreamTextType) -> Any +- """ +- Parse a YAML stream and produce parsing events. +- """ +- _, parser =3D self.get_constructor_parser(stream) +- try: +- while parser.check_event(): +- yield parser.get_event() +- finally: +- parser.dispose() +- try: +- self._reader.reset_reader() +- except AttributeError: +- pass +- try: +- self._scanner.reset_scanner() +- except AttributeError: +- pass +- +- # ### context manager +- +- def __enter__(self): +- # type: () -> Any +- self._context_manager =3D YAMLContextManager(self) +- return self +- +- def __exit__(self, typ, value, traceback): +- # type: (Any, Any, Any) -> None +- if typ: +- nprint('typ', typ) +- self._context_manager.teardown_output() +- # self._context_manager.teardown_input() +- self._context_manager =3D None +- +- # ### backwards compatibility +- def _indent(self, mapping=3DNone, sequence=3DNone, offset=3DNone): +- # type: (Any, Any, Any) -> None +- if mapping is not None: +- self.map_indent =3D mapping +- if sequence is not None: +- self.sequence_indent =3D sequence +- if offset is not None: +- self.sequence_dash_offset =3D offset +- +- @property +- def indent(self): +- # type: () -> Any +- return self._indent +- +- @indent.setter +- def indent(self, val): +- # type: (Any) -> None +- self.old_indent =3D val +- +- @property +- def block_seq_indent(self): +- # type: () -> Any +- return self.sequence_dash_offset +- +- @block_seq_indent.setter +- def block_seq_indent(self, val): +- # type: (Any) -> None +- self.sequence_dash_offset =3D val +- +- def compact(self, seq_seq=3DNone, seq_map=3DNone): +- # type: (Any, Any) -> None +- self.compact_seq_seq =3D seq_seq +- self.compact_seq_map =3D seq_map +- +- +-class YAMLContextManager(object): +- def __init__(self, yaml, transform=3DNone): +- # type: (Any, Any) -> None # used to be: (Any, Optional[Callable= ]) -> None +- self._yaml =3D yaml +- self._output_inited =3D False +- self._output_path =3D None +- self._output =3D self._yaml._output +- self._transform =3D transform +- +- # self._input_inited =3D False +- # self._input =3D input +- # self._input_path =3D None +- # self._transform =3D yaml.transform +- # self._fstream =3D None +- +- if not hasattr(self._output, 'write') and hasattr(self._output, '= open'): +- # pathlib.Path() instance, open with the same mode +- self._output_path =3D self._output +- self._output =3D self._output_path.open('w') +- +- # if not hasattr(self._stream, 'write') and hasattr(stream, 'open= '): +- # if not hasattr(self._input, 'read') and hasattr(self._input, 'o= pen'): +- # # pathlib.Path() instance, open with the same mode +- # self._input_path =3D self._input +- # self._input =3D self._input_path.open('r') +- +- if self._transform is not None: +- self._fstream =3D self._output +- if self._yaml.encoding is None: +- self._output =3D StringIO() +- else: +- self._output =3D BytesIO() +- +- def teardown_output(self): +- # type: () -> None +- if self._output_inited: +- self._yaml.serializer.close() +- else: +- return +- try: +- self._yaml.emitter.dispose() +- except AttributeError: +- raise +- # self.dumper.dispose() # cyaml +- try: +- delattr(self._yaml, '_serializer') +- delattr(self._yaml, '_emitter') +- except AttributeError: +- raise +- if self._transform: +- val =3D self._output.getvalue() +- if self._yaml.encoding: +- val =3D val.decode(self._yaml.encoding) +- if self._fstream is None: +- self._transform(val) +- else: +- self._fstream.write(self._transform(val)) +- self._fstream.flush() +- self._output =3D self._fstream # maybe not necessary +- if self._output_path is not None: +- self._output.close() +- +- def init_output(self, first_data): +- # type: (Any) -> None +- if self._yaml.top_level_colon_align is True: +- tlca =3D max([len(str(x)) for x in first_data]) # type: Any +- else: +- tlca =3D self._yaml.top_level_colon_align +- self._yaml.get_serializer_representer_emitter(self._output, tlca) +- self._yaml.serializer.open() +- self._output_inited =3D True +- +- def dump(self, data): +- # type: (Any) -> None +- if not self._output_inited: +- self.init_output(data) +- try: +- self._yaml.representer.represent(data) +- except AttributeError: +- # nprint(dir(dumper._representer)) +- raise +- +- # def teardown_input(self): +- # pass +- # +- # def init_input(self): +- # # set the constructor and parser on YAML() instance +- # self._yaml.get_constructor_parser(stream) +- # +- # def load(self): +- # if not self._input_inited: +- # self.init_input() +- # try: +- # while self._yaml.constructor.check_data(): +- # yield self._yaml.constructor.get_data() +- # finally: +- # parser.dispose() +- # try: +- # self._reader.reset_reader() # type: ignore +- # except AttributeError: +- # pass +- # try: +- # self._scanner.reset_scanner() # type: ignore +- # except AttributeError: +- # pass +- +- +-def yaml_object(yml): +- # type: (Any) -> Any +- """ decorator for classes that needs to dump/load objects +- The tag for such objects is taken from the class attribute yaml_tag (= or the +- class name in lowercase in case unavailable) +- If methods to_yaml and/or from_yaml are available, these are called f= or dumping resp. +- loading, default routines (dumping a mapping of the attributes) used = otherwise. +- """ +- +- def yo_deco(cls): +- # type: (Any) -> Any +- tag =3D getattr(cls, 'yaml_tag', '!' + cls.__name__) +- try: +- yml.representer.add_representer(cls, cls.to_yaml) +- except AttributeError: +- +- def t_y(representer, data): +- # type: (Any, Any) -> Any +- return representer.represent_yaml_object( +- tag, data, cls, flow_style=3Drepresenter.default_flow= _style +- ) +- +- yml.representer.add_representer(cls, t_y) +- try: +- yml.constructor.add_constructor(tag, cls.from_yaml) +- except AttributeError: +- +- def f_y(constructor, node): +- # type: (Any, Any) -> Any +- return constructor.construct_yaml_object(node, cls) +- +- yml.constructor.add_constructor(tag, f_y) +- return cls +- +- return yo_deco +- +- +-#########################################################################= ############### +- +- +-def scan(stream, Loader=3DLoader): +- # type: (StreamTextType, Any) -> Any +- """ +- Scan a YAML stream and produce scanning tokens. +- """ +- loader =3D Loader(stream) +- try: +- while loader.scanner.check_token(): +- yield loader.scanner.get_token() +- finally: +- loader._parser.dispose() +- +- +-def parse(stream, Loader=3DLoader): +- # type: (StreamTextType, Any) -> Any +- """ +- Parse a YAML stream and produce parsing events. +- """ +- loader =3D Loader(stream) +- try: +- while loader._parser.check_event(): +- yield loader._parser.get_event() +- finally: +- loader._parser.dispose() +- +- +-def compose(stream, Loader=3DLoader): +- # type: (StreamTextType, Any) -> Any +- """ +- Parse the first YAML document in a stream +- and produce the corresponding representation tree. +- """ +- loader =3D Loader(stream) +- try: +- return loader.get_single_node() +- finally: +- loader.dispose() +- +- +-def compose_all(stream, Loader=3DLoader): +- # type: (StreamTextType, Any) -> Any +- """ +- Parse all YAML documents in a stream +- and produce corresponding representation trees. +- """ +- loader =3D Loader(stream) +- try: +- while loader.check_node(): +- yield loader._composer.get_node() +- finally: +- loader._parser.dispose() +- +- +-def load(stream, Loader=3DNone, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Any, Optional[VersionType], Any) -> Any +- """ +- Parse the first YAML document in a stream +- and produce the corresponding Python object. +- """ +- if Loader is None: +- warnings.warn(UnsafeLoaderWarning.text, UnsafeLoaderWarning, stac= klevel=3D2) +- Loader =3D UnsafeLoader +- loader =3D Loader(stream, version, preserve_quotes=3Dpreserve_quotes) +- try: +- return loader._constructor.get_single_data() +- finally: +- loader._parser.dispose() +- try: +- loader._reader.reset_reader() +- except AttributeError: +- pass +- try: +- loader._scanner.reset_scanner() +- except AttributeError: +- pass +- +- +-def load_all(stream, Loader=3DNone, version=3DNone, preserve_quotes=3DNon= e): +- # type: (Optional[StreamTextType], Any, Optional[VersionType], Option= al[bool]) -> Any # NOQA +- """ +- Parse all YAML documents in a stream +- and produce corresponding Python objects. +- """ +- if Loader is None: +- warnings.warn(UnsafeLoaderWarning.text, UnsafeLoaderWarning, stac= klevel=3D2) +- Loader =3D UnsafeLoader +- loader =3D Loader(stream, version, preserve_quotes=3Dpreserve_quotes) +- try: +- while loader._constructor.check_data(): +- yield loader._constructor.get_data() +- finally: +- loader._parser.dispose() +- try: +- loader._reader.reset_reader() +- except AttributeError: +- pass +- try: +- loader._scanner.reset_scanner() +- except AttributeError: +- pass +- +- +-def safe_load(stream, version=3DNone): +- # type: (StreamTextType, Optional[VersionType]) -> Any +- """ +- Parse the first YAML document in a stream +- and produce the corresponding Python object. +- Resolve only basic YAML tags. +- """ +- return load(stream, SafeLoader, version) +- +- +-def safe_load_all(stream, version=3DNone): +- # type: (StreamTextType, Optional[VersionType]) -> Any +- """ +- Parse all YAML documents in a stream +- and produce corresponding Python objects. +- Resolve only basic YAML tags. +- """ +- return load_all(stream, SafeLoader, version) +- +- +-def round_trip_load(stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> Any +- """ +- Parse the first YAML document in a stream +- and produce the corresponding Python object. +- Resolve only basic YAML tags. +- """ +- return load(stream, RoundTripLoader, version, preserve_quotes=3Dprese= rve_quotes) +- +- +-def round_trip_load_all(stream, version=3DNone, preserve_quotes=3DNone): +- # type: (StreamTextType, Optional[VersionType], Optional[bool]) -> Any +- """ +- Parse all YAML documents in a stream +- and produce corresponding Python objects. +- Resolve only basic YAML tags. +- """ +- return load_all(stream, RoundTripLoader, version, preserve_quotes=3Dp= reserve_quotes) +- +- +-def emit( +- events, +- stream=3DNone, +- Dumper=3DDumper, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +-): +- # type: (Any, Optional[StreamType], Any, Optional[bool], Union[int, N= one], Optional[int], Optional[bool], Any) -> Any # NOQA +- """ +- Emit YAML parsing events into a stream. +- If stream is None, return the produced string instead. +- """ +- getvalue =3D None +- if stream is None: +- stream =3D StringIO() +- getvalue =3D stream.getvalue +- dumper =3D Dumper( +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- ) +- try: +- for event in events: +- dumper.emit(event) +- finally: +- try: +- dumper._emitter.dispose() +- except AttributeError: +- raise +- dumper.dispose() # cyaml +- if getvalue is not None: +- return getvalue() +- +- +-enc =3D None if PY3 else 'utf-8' +- +- +-def serialize_all( +- nodes, +- stream=3DNone, +- Dumper=3DDumper, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3Denc, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +-): +- # type: (Any, Optional[StreamType], Any, Any, Optional[int], Optional= [int], Optional[bool], Any, Any, Optional[bool], Optional[bool], Optional[V= ersionType], Any) -> Any # NOQA +- """ +- Serialize a sequence of representation trees into a YAML stream. +- If stream is None, return the produced string instead. +- """ +- getvalue =3D None +- if stream is None: +- if encoding is None: +- stream =3D StringIO() +- else: +- stream =3D BytesIO() +- getvalue =3D stream.getvalue +- dumper =3D Dumper( +- stream, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- encoding=3Dencoding, +- version=3Dversion, +- tags=3Dtags, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- ) +- try: +- dumper._serializer.open() +- for node in nodes: +- dumper.serialize(node) +- dumper._serializer.close() +- finally: +- try: +- dumper._emitter.dispose() +- except AttributeError: +- raise +- dumper.dispose() # cyaml +- if getvalue is not None: +- return getvalue() +- +- +-def serialize(node, stream=3DNone, Dumper=3DDumper, **kwds): +- # type: (Any, Optional[StreamType], Any, Any) -> Any +- """ +- Serialize a representation tree into a YAML stream. +- If stream is None, return the produced string instead. +- """ +- return serialize_all([node], stream, Dumper=3DDumper, **kwds) +- +- +-def dump_all( +- documents, +- stream=3DNone, +- Dumper=3DDumper, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3Denc, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +-): +- # type: (Any, Optional[StreamType], Any, Any, Any, Optional[bool], Op= tional[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optio= nal[bool], Any, Any, Any, Any, Any) -> Optional[str] # NOQA +- """ +- Serialize a sequence of Python objects into a YAML stream. +- If stream is None, return the produced string instead. +- """ +- getvalue =3D None +- if top_level_colon_align is True: +- top_level_colon_align =3D max([len(str(x)) for x in documents[0]]) +- if stream is None: +- if encoding is None: +- stream =3D StringIO() +- else: +- stream =3D BytesIO() +- getvalue =3D stream.getvalue +- dumper =3D Dumper( +- stream, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- block_seq_indent=3Dblock_seq_indent, +- top_level_colon_align=3Dtop_level_colon_align, +- prefix_colon=3Dprefix_colon, +- ) +- try: +- dumper._serializer.open() +- for data in documents: +- try: +- dumper._representer.represent(data) +- except AttributeError: +- # nprint(dir(dumper._representer)) +- raise +- dumper._serializer.close() +- finally: +- try: +- dumper._emitter.dispose() +- except AttributeError: +- raise +- dumper.dispose() # cyaml +- if getvalue is not None: +- return getvalue() +- return None +- +- +-def dump( +- data, +- stream=3DNone, +- Dumper=3DDumper, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3Denc, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +-): +- # type: (Any, Optional[StreamType], Any, Any, Any, Optional[bool], Op= tional[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optio= nal[bool], Optional[VersionType], Any, Any) -> Optional[str] # NOQA +- """ +- Serialize a Python object into a YAML stream. +- If stream is None, return the produced string instead. +- +- default_style =E2=88=88 None, '', '"', "'", '|', '>' +- +- """ +- return dump_all( +- [data], +- stream, +- Dumper=3DDumper, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- block_seq_indent=3Dblock_seq_indent, +- ) +- +- +-def safe_dump_all(documents, stream=3DNone, **kwds): +- # type: (Any, Optional[StreamType], Any) -> Optional[str] +- """ +- Serialize a sequence of Python objects into a YAML stream. +- Produce only basic YAML tags. +- If stream is None, return the produced string instead. +- """ +- return dump_all(documents, stream, Dumper=3DSafeDumper, **kwds) +- +- +-def safe_dump(data, stream=3DNone, **kwds): +- # type: (Any, Optional[StreamType], Any) -> Optional[str] +- """ +- Serialize a Python object into a YAML stream. +- Produce only basic YAML tags. +- If stream is None, return the produced string instead. +- """ +- return dump_all([data], stream, Dumper=3DSafeDumper, **kwds) +- +- +-def round_trip_dump( +- data, +- stream=3DNone, +- Dumper=3DRoundTripDumper, +- default_style=3DNone, +- default_flow_style=3DNone, +- canonical=3DNone, +- indent=3DNone, +- width=3DNone, +- allow_unicode=3DNone, +- line_break=3DNone, +- encoding=3Denc, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- block_seq_indent=3DNone, +- top_level_colon_align=3DNone, +- prefix_colon=3DNone, +-): +- # type: (Any, Optional[StreamType], Any, Any, Any, Optional[bool], Op= tional[int], Optional[int], Optional[bool], Any, Any, Optional[bool], Optio= nal[bool], Optional[VersionType], Any, Any, Any, Any) -> Optional[str] # = NOQA +- allow_unicode =3D True if allow_unicode is None else allow_unicode +- return dump_all( +- [data], +- stream, +- Dumper=3DDumper, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- canonical=3Dcanonical, +- indent=3Dindent, +- width=3Dwidth, +- allow_unicode=3Dallow_unicode, +- line_break=3Dline_break, +- encoding=3Dencoding, +- explicit_start=3Dexplicit_start, +- explicit_end=3Dexplicit_end, +- version=3Dversion, +- tags=3Dtags, +- block_seq_indent=3Dblock_seq_indent, +- top_level_colon_align=3Dtop_level_colon_align, +- prefix_colon=3Dprefix_colon, +- ) +- +- +-# Loader/Dumper are no longer composites, to get to the associated +-# Resolver()/Representer(), etc., you need to instantiate the class +- +- +-def add_implicit_resolver( +- tag, regexp, first=3DNone, Loader=3DNone, Dumper=3DNone, resolver=3DR= esolver +-): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- """ +- Add an implicit scalar detector. +- If an implicit scalar value matches the given regexp, +- the corresponding tag is assigned to the scalar. +- first is a sequence of possible initial characters or None. +- """ +- if Loader is None and Dumper is None: +- resolver.add_implicit_resolver(tag, regexp, first) +- return +- if Loader: +- if hasattr(Loader, 'add_implicit_resolver'): +- Loader.add_implicit_resolver(tag, regexp, first) +- elif issubclass( +- Loader, (BaseLoader, SafeLoader, ruamel.yaml.loader.Loader, R= oundTripLoader) +- ): +- Resolver.add_implicit_resolver(tag, regexp, first) +- else: +- raise NotImplementedError +- if Dumper: +- if hasattr(Dumper, 'add_implicit_resolver'): +- Dumper.add_implicit_resolver(tag, regexp, first) +- elif issubclass( +- Dumper, (BaseDumper, SafeDumper, ruamel.yaml.dumper.Dumper, R= oundTripDumper) +- ): +- Resolver.add_implicit_resolver(tag, regexp, first) +- else: +- raise NotImplementedError +- +- +-# this code currently not tested +-def add_path_resolver(tag, path, kind=3DNone, Loader=3DNone, Dumper=3DNon= e, resolver=3DResolver): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- """ +- Add a path based resolver for the given tag. +- A path is a list of keys that forms a path +- to a node in the representation tree. +- Keys can be string values, integers, or None. +- """ +- if Loader is None and Dumper is None: +- resolver.add_path_resolver(tag, path, kind) +- return +- if Loader: +- if hasattr(Loader, 'add_path_resolver'): +- Loader.add_path_resolver(tag, path, kind) +- elif issubclass( +- Loader, (BaseLoader, SafeLoader, ruamel.yaml.loader.Loader, R= oundTripLoader) +- ): +- Resolver.add_path_resolver(tag, path, kind) +- else: +- raise NotImplementedError +- if Dumper: +- if hasattr(Dumper, 'add_path_resolver'): +- Dumper.add_path_resolver(tag, path, kind) +- elif issubclass( +- Dumper, (BaseDumper, SafeDumper, ruamel.yaml.dumper.Dumper, R= oundTripDumper) +- ): +- Resolver.add_path_resolver(tag, path, kind) +- else: +- raise NotImplementedError +- +- +-def add_constructor(tag, object_constructor, Loader=3DNone, constructor= =3DConstructor): +- # type: (Any, Any, Any, Any) -> None +- """ +- Add an object constructor for the given tag. +- object_onstructor is a function that accepts a Loader instance +- and a node object and produces the corresponding Python object. +- """ +- if Loader is None: +- constructor.add_constructor(tag, object_constructor) +- else: +- if hasattr(Loader, 'add_constructor'): +- Loader.add_constructor(tag, object_constructor) +- return +- if issubclass(Loader, BaseLoader): +- BaseConstructor.add_constructor(tag, object_constructor) +- elif issubclass(Loader, SafeLoader): +- SafeConstructor.add_constructor(tag, object_constructor) +- elif issubclass(Loader, Loader): +- Constructor.add_constructor(tag, object_constructor) +- elif issubclass(Loader, RoundTripLoader): +- RoundTripConstructor.add_constructor(tag, object_constructor) +- else: +- raise NotImplementedError +- +- +-def add_multi_constructor(tag_prefix, multi_constructor, Loader=3DNone, c= onstructor=3DConstructor): +- # type: (Any, Any, Any, Any) -> None +- """ +- Add a multi-constructor for the given tag prefix. +- Multi-constructor is called for a node if its tag starts with tag_pre= fix. +- Multi-constructor accepts a Loader instance, a tag suffix, +- and a node object and produces the corresponding Python object. +- """ +- if Loader is None: +- constructor.add_multi_constructor(tag_prefix, multi_constructor) +- else: +- if False and hasattr(Loader, 'add_multi_constructor'): +- Loader.add_multi_constructor(tag_prefix, constructor) +- return +- if issubclass(Loader, BaseLoader): +- BaseConstructor.add_multi_constructor(tag_prefix, multi_const= ructor) +- elif issubclass(Loader, SafeLoader): +- SafeConstructor.add_multi_constructor(tag_prefix, multi_const= ructor) +- elif issubclass(Loader, ruamel.yaml.loader.Loader): +- Constructor.add_multi_constructor(tag_prefix, multi_construct= or) +- elif issubclass(Loader, RoundTripLoader): +- RoundTripConstructor.add_multi_constructor(tag_prefix, multi_= constructor) +- else: +- raise NotImplementedError +- +- +-def add_representer(data_type, object_representer, Dumper=3DNone, represe= nter=3DRepresenter): +- # type: (Any, Any, Any, Any) -> None +- """ +- Add a representer for the given type. +- object_representer is a function accepting a Dumper instance +- and an instance of the given data type +- and producing the corresponding representation node. +- """ +- if Dumper is None: +- representer.add_representer(data_type, object_representer) +- else: +- if hasattr(Dumper, 'add_representer'): +- Dumper.add_representer(data_type, object_representer) +- return +- if issubclass(Dumper, BaseDumper): +- BaseRepresenter.add_representer(data_type, object_representer) +- elif issubclass(Dumper, SafeDumper): +- SafeRepresenter.add_representer(data_type, object_representer) +- elif issubclass(Dumper, Dumper): +- Representer.add_representer(data_type, object_representer) +- elif issubclass(Dumper, RoundTripDumper): +- RoundTripRepresenter.add_representer(data_type, object_repres= enter) +- else: +- raise NotImplementedError +- +- +-# this code currently not tested +-def add_multi_representer(data_type, multi_representer, Dumper=3DNone, re= presenter=3DRepresenter): +- # type: (Any, Any, Any, Any) -> None +- """ +- Add a representer for the given type. +- multi_representer is a function accepting a Dumper instance +- and an instance of the given data type or subtype +- and producing the corresponding representation node. +- """ +- if Dumper is None: +- representer.add_multi_representer(data_type, multi_representer) +- else: +- if hasattr(Dumper, 'add_multi_representer'): +- Dumper.add_multi_representer(data_type, multi_representer) +- return +- if issubclass(Dumper, BaseDumper): +- BaseRepresenter.add_multi_representer(data_type, multi_repres= enter) +- elif issubclass(Dumper, SafeDumper): +- SafeRepresenter.add_multi_representer(data_type, multi_repres= enter) +- elif issubclass(Dumper, Dumper): +- Representer.add_multi_representer(data_type, multi_represente= r) +- elif issubclass(Dumper, RoundTripDumper): +- RoundTripRepresenter.add_multi_representer(data_type, multi_r= epresenter) +- else: +- raise NotImplementedError +- +- +-class YAMLObjectMetaclass(type): +- """ +- The metaclass for YAMLObject. +- """ +- +- def __init__(cls, name, bases, kwds): +- # type: (Any, Any, Any) -> None +- super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds) +- if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: +- cls.yaml_constructor.add_constructor(cls.yaml_tag, cls.from_y= aml) # type: ignore +- cls.yaml_representer.add_representer(cls, cls.to_yaml) # typ= e: ignore +- +- +-class YAMLObject(with_metaclass(YAMLObjectMetaclass)): # type: ignore +- """ +- An object that can dump itself to a YAML stream +- and load itself from a YAML stream. +- """ +- +- __slots__ =3D () # no direct instantiation, so allow immutable subcl= asses +- +- yaml_constructor =3D Constructor +- yaml_representer =3D Representer +- +- yaml_tag =3D None # type: Any +- yaml_flow_style =3D None # type: Any +- +- @classmethod +- def from_yaml(cls, constructor, node): +- # type: (Any, Any) -> Any +- """ +- Convert a representation node to a Python object. +- """ +- return constructor.construct_yaml_object(node, cls) +- +- @classmethod +- def to_yaml(cls, representer, data): +- # type: (Any, Any) -> Any +- """ +- Convert a Python object to a representation node. +- """ +- return representer.represent_yaml_object( +- cls.yaml_tag, data, cls, flow_style=3Dcls.yaml_flow_style +- ) +diff --git a/dynaconf/vendor_src/ruamel/yaml/nodes.py b/dynaconf/vendor_sr= c/ruamel/yaml/nodes.py +deleted file mode 100644 +index da86e9c..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/nodes.py ++++ /dev/null +@@ -1,131 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function +- +-import sys +-from .compat import string_types +- +-if False: # MYPY +- from typing import Dict, Any, Text # NOQA +- +- +-class Node(object): +- __slots__ =3D 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'a= nchor' +- +- def __init__(self, tag, value, start_mark, end_mark, comment=3DNone, = anchor=3DNone): +- # type: (Any, Any, Any, Any, Any, Any) -> None +- self.tag =3D tag +- self.value =3D value +- self.start_mark =3D start_mark +- self.end_mark =3D end_mark +- self.comment =3D comment +- self.anchor =3D anchor +- +- def __repr__(self): +- # type: () -> str +- value =3D self.value +- # if isinstance(value, list): +- # if len(value) =3D=3D 0: +- # value =3D '' +- # elif len(value) =3D=3D 1: +- # value =3D '<1 item>' +- # else: +- # value =3D '<%d items>' % len(value) +- # else: +- # if len(value) > 75: +- # value =3D repr(value[:70]+u' ... ') +- # else: +- # value =3D repr(value) +- value =3D repr(value) +- return '%s(tag=3D%r, value=3D%s)' % (self.__class__.__name__, sel= f.tag, value) +- +- def dump(self, indent=3D0): +- # type: (int) -> None +- if isinstance(self.value, string_types): +- sys.stdout.write( +- '{}{}(tag=3D{!r}, value=3D{!r})\n'.format( +- ' ' * indent, self.__class__.__name__, self.tag, sel= f.value +- ) +- ) +- if self.comment: +- sys.stdout.write(' {}comment: {})\n'.format(' ' * ind= ent, self.comment)) +- return +- sys.stdout.write( +- '{}{}(tag=3D{!r})\n'.format(' ' * indent, self.__class__.__n= ame__, self.tag) +- ) +- if self.comment: +- sys.stdout.write(' {}comment: {})\n'.format(' ' * indent,= self.comment)) +- for v in self.value: +- if isinstance(v, tuple): +- for v1 in v: +- v1.dump(indent + 1) +- elif isinstance(v, Node): +- v.dump(indent + 1) +- else: +- sys.stdout.write('Node value type? {}\n'.format(type(v))) +- +- +-class ScalarNode(Node): +- """ +- styles: +- ? -> set() ? key, no value +- " -> double quoted +- ' -> single quoted +- | -> literal style +- > -> folding style +- """ +- +- __slots__ =3D ('style',) +- id =3D 'scalar' +- +- def __init__( +- self, tag, value, start_mark=3DNone, end_mark=3DNone, style=3DNon= e, comment=3DNone, anchor=3DNone +- ): +- # type: (Any, Any, Any, Any, Any, Any, Any) -> None +- Node.__init__(self, tag, value, start_mark, end_mark, comment=3Dc= omment, anchor=3Danchor) +- self.style =3D style +- +- +-class CollectionNode(Node): +- __slots__ =3D ('flow_style',) +- +- def __init__( +- self, +- tag, +- value, +- start_mark=3DNone, +- end_mark=3DNone, +- flow_style=3DNone, +- comment=3DNone, +- anchor=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any, Any) -> None +- Node.__init__(self, tag, value, start_mark, end_mark, comment=3Dc= omment) +- self.flow_style =3D flow_style +- self.anchor =3D anchor +- +- +-class SequenceNode(CollectionNode): +- __slots__ =3D () +- id =3D 'sequence' +- +- +-class MappingNode(CollectionNode): +- __slots__ =3D ('merge',) +- id =3D 'mapping' +- +- def __init__( +- self, +- tag, +- value, +- start_mark=3DNone, +- end_mark=3DNone, +- flow_style=3DNone, +- comment=3DNone, +- anchor=3DNone, +- ): +- # type: (Any, Any, Any, Any, Any, Any, Any) -> None +- CollectionNode.__init__( +- self, tag, value, start_mark, end_mark, flow_style, comment, = anchor +- ) +- self.merge =3D None +diff --git a/dynaconf/vendor_src/ruamel/yaml/parser.py b/dynaconf/vendor_s= rc/ruamel/yaml/parser.py +deleted file mode 100644 +index 3d67a1c..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/parser.py ++++ /dev/null +@@ -1,802 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-# The following YAML grammar is LL(1) and is parsed by a recursive descent +-# parser. +-# +-# stream ::=3D STREAM-START implicit_document? explicit_docume= nt* +-# STREA= M-END +-# implicit_document ::=3D block_node DOCUMENT-END* +-# explicit_document ::=3D DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-= END* +-# block_node_or_indentless_sequence ::=3D +-# ALIAS +-# | properties (block_content | +-# indentless_block_sequ= ence)? +-# | block_content +-# | indentless_block_sequence +-# block_node ::=3D ALIAS +-# | properties block_content? +-# | block_content +-# flow_node ::=3D ALIAS +-# | properties flow_content? +-# | flow_content +-# properties ::=3D TAG ANCHOR? | ANCHOR TAG? +-# block_content ::=3D block_collection | flow_collection | SCALAR +-# flow_content ::=3D flow_collection | SCALAR +-# block_collection ::=3D block_sequence | block_mapping +-# flow_collection ::=3D flow_sequence | flow_mapping +-# block_sequence ::=3D BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* +-# BLOCK= -END +-# indentless_sequence ::=3D (BLOCK-ENTRY block_node?)+ +-# block_mapping ::=3D BLOCK-MAPPING_START +-# ((KEY block_node_or_indentless_sequence?)? +-# (VALUE block_node_or_indentless_sequence?)?)* +-# BLOCK-END +-# flow_sequence ::=3D FLOW-SEQUENCE-START +-# (flow_sequence_entry FLOW-ENTRY)* +-# flow_sequence_entry? +-# FLOW-SEQUENCE-END +-# flow_sequence_entry ::=3D flow_node | KEY flow_node? (VALUE flow_node= ?)? +-# flow_mapping ::=3D FLOW-MAPPING-START +-# (flow_mapping_entry FLOW-ENTRY)* +-# flow_mapping_entry? +-# FLOW-MAPPING-END +-# flow_mapping_entry ::=3D flow_node | KEY flow_node? (VALUE flow_node= ?)? +-# +-# FIRST sets: +-# +-# stream: { STREAM-START } +-# explicit_document: { DIRECTIVE DOCUMENT-START } +-# implicit_document: FIRST(block_node) +-# block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START +-# BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-S= TART } +-# flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-S= TART } +-# block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START +-# FLOW-SEQUENCE-START FLOW-MAPPING-START SC= ALAR } +-# flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +-# block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START } +-# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +-# block_sequence: { BLOCK-SEQUENCE-START } +-# block_mapping: { BLOCK-MAPPING-START } +-# block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR +-# BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-ST= ART +-# FLOW-MAPPING-START BLOCK-ENTRY } +-# indentless_sequence: { ENTRY } +-# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +-# flow_sequence: { FLOW-SEQUENCE-START } +-# flow_mapping: { FLOW-MAPPING-START } +-# flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START +-# FLOW-MAPPING-START K= EY } +-# flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START +-# FLOW-MAPPING-START K= EY } +- +-# need to have full path with import, as pkg_resources tries to load pars= er.py in __init__.py +-# only to not do anything with the package afterwards +-# and for Jython too +- +- +-from .error import MarkedYAMLError +-from .tokens import * # NOQA +-from .events import * # NOQA +-from .scanner import Scanner, RoundTripScanner, ScannerError # NOQA +-from .compat import utf8, nprint, nprintf # NOQA +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List # NOQA +- +-__all__ =3D ['Parser', 'RoundTripParser', 'ParserError'] +- +- +-class ParserError(MarkedYAMLError): +- pass +- +- +-class Parser(object): +- # Since writing a recursive-descendant parser is a straightforward ta= sk, we +- # do not give many comments here. +- +- DEFAULT_TAGS =3D {u'!': u'!', u'!!': u'tag:yaml.org,2002:'} +- +- def __init__(self, loader): +- # type: (Any) -> None +- self.loader =3D loader +- if self.loader is not None and getattr(self.loader, '_parser', No= ne) is None: +- self.loader._parser =3D self +- self.reset_parser() +- +- def reset_parser(self): +- # type: () -> None +- # Reset the state attributes (to clear self-references) +- self.current_event =3D None +- self.tag_handles =3D {} # type: Dict[Any, Any] +- self.states =3D [] # type: List[Any] +- self.marks =3D [] # type: List[Any] +- self.state =3D self.parse_stream_start # type: Any +- +- def dispose(self): +- # type: () -> None +- self.reset_parser() +- +- @property +- def scanner(self): +- # type: () -> Any +- if hasattr(self.loader, 'typ'): +- return self.loader.scanner +- return self.loader._scanner +- +- @property +- def resolver(self): +- # type: () -> Any +- if hasattr(self.loader, 'typ'): +- return self.loader.resolver +- return self.loader._resolver +- +- def check_event(self, *choices): +- # type: (Any) -> bool +- # Check the type of the next event. +- if self.current_event is None: +- if self.state: +- self.current_event =3D self.state() +- if self.current_event is not None: +- if not choices: +- return True +- for choice in choices: +- if isinstance(self.current_event, choice): +- return True +- return False +- +- def peek_event(self): +- # type: () -> Any +- # Get the next event. +- if self.current_event is None: +- if self.state: +- self.current_event =3D self.state() +- return self.current_event +- +- def get_event(self): +- # type: () -> Any +- # Get the next event and proceed further. +- if self.current_event is None: +- if self.state: +- self.current_event =3D self.state() +- value =3D self.current_event +- self.current_event =3D None +- return value +- +- # stream ::=3D STREAM-START implicit_document? explicit_document* +- # STREA= M-END +- # implicit_document ::=3D block_node DOCUMENT-END* +- # explicit_document ::=3D DIRECTIVE* DOCUMENT-START block_node? DOCUM= ENT-END* +- +- def parse_stream_start(self): +- # type: () -> Any +- # Parse the stream start. +- token =3D self.scanner.get_token() +- token.move_comment(self.scanner.peek_token()) +- event =3D StreamStartEvent(token.start_mark, token.end_mark, enco= ding=3Dtoken.encoding) +- +- # Prepare the next state. +- self.state =3D self.parse_implicit_document_start +- +- return event +- +- def parse_implicit_document_start(self): +- # type: () -> Any +- # Parse an implicit document. +- if not self.scanner.check_token(DirectiveToken, DocumentStartToke= n, StreamEndToken): +- self.tag_handles =3D self.DEFAULT_TAGS +- token =3D self.scanner.peek_token() +- start_mark =3D end_mark =3D token.start_mark +- event =3D DocumentStartEvent(start_mark, end_mark, explicit= =3DFalse) +- +- # Prepare the next state. +- self.states.append(self.parse_document_end) +- self.state =3D self.parse_block_node +- +- return event +- +- else: +- return self.parse_document_start() +- +- def parse_document_start(self): +- # type: () -> Any +- # Parse any extra document end indicators. +- while self.scanner.check_token(DocumentEndToken): +- self.scanner.get_token() +- # Parse an explicit document. +- if not self.scanner.check_token(StreamEndToken): +- token =3D self.scanner.peek_token() +- start_mark =3D token.start_mark +- version, tags =3D self.process_directives() +- if not self.scanner.check_token(DocumentStartToken): +- raise ParserError( +- None, +- None, +- "expected '', but found %r" % self.sc= anner.peek_token().id, +- self.scanner.peek_token().start_mark, +- ) +- token =3D self.scanner.get_token() +- end_mark =3D token.end_mark +- # if self.loader is not None and \ +- # end_mark.line !=3D self.scanner.peek_token().start_mark.= line: +- # self.loader.scalar_after_indicator =3D False +- event =3D DocumentStartEvent( +- start_mark, end_mark, explicit=3DTrue, version=3Dversion,= tags=3Dtags +- ) # type: Any +- self.states.append(self.parse_document_end) +- self.state =3D self.parse_document_content +- else: +- # Parse the end of the stream. +- token =3D self.scanner.get_token() +- event =3D StreamEndEvent(token.start_mark, token.end_mark, co= mment=3Dtoken.comment) +- assert not self.states +- assert not self.marks +- self.state =3D None +- return event +- +- def parse_document_end(self): +- # type: () -> Any +- # Parse the document end. +- token =3D self.scanner.peek_token() +- start_mark =3D end_mark =3D token.start_mark +- explicit =3D False +- if self.scanner.check_token(DocumentEndToken): +- token =3D self.scanner.get_token() +- end_mark =3D token.end_mark +- explicit =3D True +- event =3D DocumentEndEvent(start_mark, end_mark, explicit=3Dexpli= cit) +- +- # Prepare the next state. +- if self.resolver.processing_version =3D=3D (1, 1): +- self.state =3D self.parse_document_start +- else: +- self.state =3D self.parse_implicit_document_start +- +- return event +- +- def parse_document_content(self): +- # type: () -> Any +- if self.scanner.check_token( +- DirectiveToken, DocumentStartToken, DocumentEndToken, StreamE= ndToken +- ): +- event =3D self.process_empty_scalar(self.scanner.peek_token()= .start_mark) +- self.state =3D self.states.pop() +- return event +- else: +- return self.parse_block_node() +- +- def process_directives(self): +- # type: () -> Any +- yaml_version =3D None +- self.tag_handles =3D {} +- while self.scanner.check_token(DirectiveToken): +- token =3D self.scanner.get_token() +- if token.name =3D=3D u'YAML': +- if yaml_version is not None: +- raise ParserError( +- None, None, 'found duplicate YAML directive', tok= en.start_mark +- ) +- major, minor =3D token.value +- if major !=3D 1: +- raise ParserError( +- None, +- None, +- 'found incompatible YAML document (version 1.* is= ' 'required)', +- token.start_mark, +- ) +- yaml_version =3D token.value +- elif token.name =3D=3D u'TAG': +- handle, prefix =3D token.value +- if handle in self.tag_handles: +- raise ParserError( +- None, None, 'duplicate tag handle %r' % utf8(hand= le), token.start_mark +- ) +- self.tag_handles[handle] =3D prefix +- if bool(self.tag_handles): +- value =3D yaml_version, self.tag_handles.copy() # type: Any +- else: +- value =3D yaml_version, None +- if self.loader is not None and hasattr(self.loader, 'tags'): +- self.loader.version =3D yaml_version +- if self.loader.tags is None: +- self.loader.tags =3D {} +- for k in self.tag_handles: +- self.loader.tags[k] =3D self.tag_handles[k] +- for key in self.DEFAULT_TAGS: +- if key not in self.tag_handles: +- self.tag_handles[key] =3D self.DEFAULT_TAGS[key] +- return value +- +- # block_node_or_indentless_sequence ::=3D ALIAS +- # | properties (block_content | indentless_block_sequen= ce)? +- # | block_content +- # | indentless_block_sequence +- # block_node ::=3D ALIAS +- # | properties block_content? +- # | block_content +- # flow_node ::=3D ALIAS +- # | properties flow_content? +- # | flow_content +- # properties ::=3D TAG ANCHOR? | ANCHOR TAG? +- # block_content ::=3D block_collection | flow_collection | SCALAR +- # flow_content ::=3D flow_collection | SCALAR +- # block_collection ::=3D block_sequence | block_mapping +- # flow_collection ::=3D flow_sequence | flow_mapping +- +- def parse_block_node(self): +- # type: () -> Any +- return self.parse_node(block=3DTrue) +- +- def parse_flow_node(self): +- # type: () -> Any +- return self.parse_node() +- +- def parse_block_node_or_indentless_sequence(self): +- # type: () -> Any +- return self.parse_node(block=3DTrue, indentless_sequence=3DTrue) +- +- def transform_tag(self, handle, suffix): +- # type: (Any, Any) -> Any +- return self.tag_handles[handle] + suffix +- +- def parse_node(self, block=3DFalse, indentless_sequence=3DFalse): +- # type: (bool, bool) -> Any +- if self.scanner.check_token(AliasToken): +- token =3D self.scanner.get_token() +- event =3D AliasEvent(token.value, token.start_mark, token.end= _mark) # type: Any +- self.state =3D self.states.pop() +- return event +- +- anchor =3D None +- tag =3D None +- start_mark =3D end_mark =3D tag_mark =3D None +- if self.scanner.check_token(AnchorToken): +- token =3D self.scanner.get_token() +- start_mark =3D token.start_mark +- end_mark =3D token.end_mark +- anchor =3D token.value +- if self.scanner.check_token(TagToken): +- token =3D self.scanner.get_token() +- tag_mark =3D token.start_mark +- end_mark =3D token.end_mark +- tag =3D token.value +- elif self.scanner.check_token(TagToken): +- token =3D self.scanner.get_token() +- start_mark =3D tag_mark =3D token.start_mark +- end_mark =3D token.end_mark +- tag =3D token.value +- if self.scanner.check_token(AnchorToken): +- token =3D self.scanner.get_token() +- start_mark =3D tag_mark =3D token.start_mark +- end_mark =3D token.end_mark +- anchor =3D token.value +- if tag is not None: +- handle, suffix =3D tag +- if handle is not None: +- if handle not in self.tag_handles: +- raise ParserError( +- 'while parsing a node', +- start_mark, +- 'found undefined tag handle %r' % utf8(handle), +- tag_mark, +- ) +- tag =3D self.transform_tag(handle, suffix) +- else: +- tag =3D suffix +- # if tag =3D=3D u'!': +- # raise ParserError("while parsing a node", start_mark, +- # "found non-specific tag '!'", tag_mark, +- # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' +- # and share your opinion.") +- if start_mark is None: +- start_mark =3D end_mark =3D self.scanner.peek_token().start_m= ark +- event =3D None +- implicit =3D tag is None or tag =3D=3D u'!' +- if indentless_sequence and self.scanner.check_token(BlockEntryTok= en): +- comment =3D None +- pt =3D self.scanner.peek_token() +- if pt.comment and pt.comment[0]: +- comment =3D [pt.comment[0], []] +- pt.comment[0] =3D None +- end_mark =3D self.scanner.peek_token().end_mark +- event =3D SequenceStartEvent( +- anchor, tag, implicit, start_mark, end_mark, flow_style= =3DFalse, comment=3Dcomment +- ) +- self.state =3D self.parse_indentless_sequence_entry +- return event +- +- if self.scanner.check_token(ScalarToken): +- token =3D self.scanner.get_token() +- # self.scanner.peek_token_same_line_comment(token) +- end_mark =3D token.end_mark +- if (token.plain and tag is None) or tag =3D=3D u'!': +- implicit =3D (True, False) +- elif tag is None: +- implicit =3D (False, True) +- else: +- implicit =3D (False, False) +- # nprint('se', token.value, token.comment) +- event =3D ScalarEvent( +- anchor, +- tag, +- implicit, +- token.value, +- start_mark, +- end_mark, +- style=3Dtoken.style, +- comment=3Dtoken.comment, +- ) +- self.state =3D self.states.pop() +- elif self.scanner.check_token(FlowSequenceStartToken): +- pt =3D self.scanner.peek_token() +- end_mark =3D pt.end_mark +- event =3D SequenceStartEvent( +- anchor, +- tag, +- implicit, +- start_mark, +- end_mark, +- flow_style=3DTrue, +- comment=3Dpt.comment, +- ) +- self.state =3D self.parse_flow_sequence_first_entry +- elif self.scanner.check_token(FlowMappingStartToken): +- pt =3D self.scanner.peek_token() +- end_mark =3D pt.end_mark +- event =3D MappingStartEvent( +- anchor, +- tag, +- implicit, +- start_mark, +- end_mark, +- flow_style=3DTrue, +- comment=3Dpt.comment, +- ) +- self.state =3D self.parse_flow_mapping_first_key +- elif block and self.scanner.check_token(BlockSequenceStartToken): +- end_mark =3D self.scanner.peek_token().start_mark +- # should inserting the comment be dependent on the +- # indentation? +- pt =3D self.scanner.peek_token() +- comment =3D pt.comment +- # nprint('pt0', type(pt)) +- if comment is None or comment[1] is None: +- comment =3D pt.split_comment() +- # nprint('pt1', comment) +- event =3D SequenceStartEvent( +- anchor, tag, implicit, start_mark, end_mark, flow_style= =3DFalse, comment=3Dcomment +- ) +- self.state =3D self.parse_block_sequence_first_entry +- elif block and self.scanner.check_token(BlockMappingStartToken): +- end_mark =3D self.scanner.peek_token().start_mark +- comment =3D self.scanner.peek_token().comment +- event =3D MappingStartEvent( +- anchor, tag, implicit, start_mark, end_mark, flow_style= =3DFalse, comment=3Dcomment +- ) +- self.state =3D self.parse_block_mapping_first_key +- elif anchor is not None or tag is not None: +- # Empty scalars are allowed even if a tag or an anchor is +- # specified. +- event =3D ScalarEvent(anchor, tag, (implicit, False), "", sta= rt_mark, end_mark) +- self.state =3D self.states.pop() +- else: +- if block: +- node =3D 'block' +- else: +- node =3D 'flow' +- token =3D self.scanner.peek_token() +- raise ParserError( +- 'while parsing a %s node' % node, +- start_mark, +- 'expected the node content, but found %r' % token.id, +- token.start_mark, +- ) +- return event +- +- # block_sequence ::=3D BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* +- # BLOCK= -END +- +- def parse_block_sequence_first_entry(self): +- # type: () -> Any +- token =3D self.scanner.get_token() +- # move any comment from start token +- # token.move_comment(self.scanner.peek_token()) +- self.marks.append(token.start_mark) +- return self.parse_block_sequence_entry() +- +- def parse_block_sequence_entry(self): +- # type: () -> Any +- if self.scanner.check_token(BlockEntryToken): +- token =3D self.scanner.get_token() +- token.move_comment(self.scanner.peek_token()) +- if not self.scanner.check_token(BlockEntryToken, BlockEndToke= n): +- self.states.append(self.parse_block_sequence_entry) +- return self.parse_block_node() +- else: +- self.state =3D self.parse_block_sequence_entry +- return self.process_empty_scalar(token.end_mark) +- if not self.scanner.check_token(BlockEndToken): +- token =3D self.scanner.peek_token() +- raise ParserError( +- 'while parsing a block collection', +- self.marks[-1], +- 'expected , but found %r' % token.id, +- token.start_mark, +- ) +- token =3D self.scanner.get_token() # BlockEndToken +- event =3D SequenceEndEvent(token.start_mark, token.end_mark, comm= ent=3Dtoken.comment) +- self.state =3D self.states.pop() +- self.marks.pop() +- return event +- +- # indentless_sequence ::=3D (BLOCK-ENTRY block_node?)+ +- +- # indentless_sequence? +- # sequence: +- # - entry +- # - nested +- +- def parse_indentless_sequence_entry(self): +- # type: () -> Any +- if self.scanner.check_token(BlockEntryToken): +- token =3D self.scanner.get_token() +- token.move_comment(self.scanner.peek_token()) +- if not self.scanner.check_token( +- BlockEntryToken, KeyToken, ValueToken, BlockEndToken +- ): +- self.states.append(self.parse_indentless_sequence_entry) +- return self.parse_block_node() +- else: +- self.state =3D self.parse_indentless_sequence_entry +- return self.process_empty_scalar(token.end_mark) +- token =3D self.scanner.peek_token() +- event =3D SequenceEndEvent(token.start_mark, token.start_mark, co= mment=3Dtoken.comment) +- self.state =3D self.states.pop() +- return event +- +- # block_mapping ::=3D BLOCK-MAPPING_START +- # ((KEY block_node_or_indentless_sequence?)? +- # (VALUE block_node_or_indentless_sequence?)?)* +- # BLOCK-END +- +- def parse_block_mapping_first_key(self): +- # type: () -> Any +- token =3D self.scanner.get_token() +- self.marks.append(token.start_mark) +- return self.parse_block_mapping_key() +- +- def parse_block_mapping_key(self): +- # type: () -> Any +- if self.scanner.check_token(KeyToken): +- token =3D self.scanner.get_token() +- token.move_comment(self.scanner.peek_token()) +- if not self.scanner.check_token(KeyToken, ValueToken, BlockEn= dToken): +- self.states.append(self.parse_block_mapping_value) +- return self.parse_block_node_or_indentless_sequence() +- else: +- self.state =3D self.parse_block_mapping_value +- return self.process_empty_scalar(token.end_mark) +- if self.resolver.processing_version > (1, 1) and self.scanner.che= ck_token(ValueToken): +- self.state =3D self.parse_block_mapping_value +- return self.process_empty_scalar(self.scanner.peek_token().st= art_mark) +- if not self.scanner.check_token(BlockEndToken): +- token =3D self.scanner.peek_token() +- raise ParserError( +- 'while parsing a block mapping', +- self.marks[-1], +- 'expected , but found %r' % token.id, +- token.start_mark, +- ) +- token =3D self.scanner.get_token() +- token.move_comment(self.scanner.peek_token()) +- event =3D MappingEndEvent(token.start_mark, token.end_mark, comme= nt=3Dtoken.comment) +- self.state =3D self.states.pop() +- self.marks.pop() +- return event +- +- def parse_block_mapping_value(self): +- # type: () -> Any +- if self.scanner.check_token(ValueToken): +- token =3D self.scanner.get_token() +- # value token might have post comment move it to e.g. block +- if self.scanner.check_token(ValueToken): +- token.move_comment(self.scanner.peek_token()) +- else: +- if not self.scanner.check_token(KeyToken): +- token.move_comment(self.scanner.peek_token(), empty= =3DTrue) +- # else: empty value for this key cannot move token.comment +- if not self.scanner.check_token(KeyToken, ValueToken, BlockEn= dToken): +- self.states.append(self.parse_block_mapping_key) +- return self.parse_block_node_or_indentless_sequence() +- else: +- self.state =3D self.parse_block_mapping_key +- comment =3D token.comment +- if comment is None: +- token =3D self.scanner.peek_token() +- comment =3D token.comment +- if comment: +- token._comment =3D [None, comment[1]] +- comment =3D [comment[0], None] +- return self.process_empty_scalar(token.end_mark, comment= =3Dcomment) +- else: +- self.state =3D self.parse_block_mapping_key +- token =3D self.scanner.peek_token() +- return self.process_empty_scalar(token.start_mark) +- +- # flow_sequence ::=3D FLOW-SEQUENCE-START +- # (flow_sequence_entry FLOW-ENTRY)* +- # flow_sequence_entry? +- # FLOW-SEQUENCE-END +- # flow_sequence_entry ::=3D flow_node | KEY flow_node? (VALUE flow_= node?)? +- # +- # Note that while production rules for both flow_sequence_entry and +- # flow_mapping_entry are equal, their interpretations are different. +- # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_nod= e?)?` +- # generate an inline mapping (set syntax). +- +- def parse_flow_sequence_first_entry(self): +- # type: () -> Any +- token =3D self.scanner.get_token() +- self.marks.append(token.start_mark) +- return self.parse_flow_sequence_entry(first=3DTrue) +- +- def parse_flow_sequence_entry(self, first=3DFalse): +- # type: (bool) -> Any +- if not self.scanner.check_token(FlowSequenceEndToken): +- if not first: +- if self.scanner.check_token(FlowEntryToken): +- self.scanner.get_token() +- else: +- token =3D self.scanner.peek_token() +- raise ParserError( +- 'while parsing a flow sequence', +- self.marks[-1], +- "expected ',' or ']', but got %r" % token.id, +- token.start_mark, +- ) +- +- if self.scanner.check_token(KeyToken): +- token =3D self.scanner.peek_token() +- event =3D MappingStartEvent( +- None, None, True, token.start_mark, token.end_mark, f= low_style=3DTrue +- ) # type: Any +- self.state =3D self.parse_flow_sequence_entry_mapping_key +- return event +- elif not self.scanner.check_token(FlowSequenceEndToken): +- self.states.append(self.parse_flow_sequence_entry) +- return self.parse_flow_node() +- token =3D self.scanner.get_token() +- event =3D SequenceEndEvent(token.start_mark, token.end_mark, comm= ent=3Dtoken.comment) +- self.state =3D self.states.pop() +- self.marks.pop() +- return event +- +- def parse_flow_sequence_entry_mapping_key(self): +- # type: () -> Any +- token =3D self.scanner.get_token() +- if not self.scanner.check_token(ValueToken, FlowEntryToken, FlowS= equenceEndToken): +- self.states.append(self.parse_flow_sequence_entry_mapping_val= ue) +- return self.parse_flow_node() +- else: +- self.state =3D self.parse_flow_sequence_entry_mapping_value +- return self.process_empty_scalar(token.end_mark) +- +- def parse_flow_sequence_entry_mapping_value(self): +- # type: () -> Any +- if self.scanner.check_token(ValueToken): +- token =3D self.scanner.get_token() +- if not self.scanner.check_token(FlowEntryToken, FlowSequenceE= ndToken): +- self.states.append(self.parse_flow_sequence_entry_mapping= _end) +- return self.parse_flow_node() +- else: +- self.state =3D self.parse_flow_sequence_entry_mapping_end +- return self.process_empty_scalar(token.end_mark) +- else: +- self.state =3D self.parse_flow_sequence_entry_mapping_end +- token =3D self.scanner.peek_token() +- return self.process_empty_scalar(token.start_mark) +- +- def parse_flow_sequence_entry_mapping_end(self): +- # type: () -> Any +- self.state =3D self.parse_flow_sequence_entry +- token =3D self.scanner.peek_token() +- return MappingEndEvent(token.start_mark, token.start_mark) +- +- # flow_mapping ::=3D FLOW-MAPPING-START +- # (flow_mapping_entry FLOW-ENTRY)* +- # flow_mapping_entry? +- # FLOW-MAPPING-END +- # flow_mapping_entry ::=3D flow_node | KEY flow_node? (VALUE flow_= node?)? +- +- def parse_flow_mapping_first_key(self): +- # type: () -> Any +- token =3D self.scanner.get_token() +- self.marks.append(token.start_mark) +- return self.parse_flow_mapping_key(first=3DTrue) +- +- def parse_flow_mapping_key(self, first=3DFalse): +- # type: (Any) -> Any +- if not self.scanner.check_token(FlowMappingEndToken): +- if not first: +- if self.scanner.check_token(FlowEntryToken): +- self.scanner.get_token() +- else: +- token =3D self.scanner.peek_token() +- raise ParserError( +- 'while parsing a flow mapping', +- self.marks[-1], +- "expected ',' or '}', but got %r" % token.id, +- token.start_mark, +- ) +- if self.scanner.check_token(KeyToken): +- token =3D self.scanner.get_token() +- if not self.scanner.check_token( +- ValueToken, FlowEntryToken, FlowMappingEndToken +- ): +- self.states.append(self.parse_flow_mapping_value) +- return self.parse_flow_node() +- else: +- self.state =3D self.parse_flow_mapping_value +- return self.process_empty_scalar(token.end_mark) +- elif self.resolver.processing_version > (1, 1) and self.scann= er.check_token( +- ValueToken +- ): +- self.state =3D self.parse_flow_mapping_value +- return self.process_empty_scalar(self.scanner.peek_token(= ).end_mark) +- elif not self.scanner.check_token(FlowMappingEndToken): +- self.states.append(self.parse_flow_mapping_empty_value) +- return self.parse_flow_node() +- token =3D self.scanner.get_token() +- event =3D MappingEndEvent(token.start_mark, token.end_mark, comme= nt=3Dtoken.comment) +- self.state =3D self.states.pop() +- self.marks.pop() +- return event +- +- def parse_flow_mapping_value(self): +- # type: () -> Any +- if self.scanner.check_token(ValueToken): +- token =3D self.scanner.get_token() +- if not self.scanner.check_token(FlowEntryToken, FlowMappingEn= dToken): +- self.states.append(self.parse_flow_mapping_key) +- return self.parse_flow_node() +- else: +- self.state =3D self.parse_flow_mapping_key +- return self.process_empty_scalar(token.end_mark) +- else: +- self.state =3D self.parse_flow_mapping_key +- token =3D self.scanner.peek_token() +- return self.process_empty_scalar(token.start_mark) +- +- def parse_flow_mapping_empty_value(self): +- # type: () -> Any +- self.state =3D self.parse_flow_mapping_key +- return self.process_empty_scalar(self.scanner.peek_token().start_= mark) +- +- def process_empty_scalar(self, mark, comment=3DNone): +- # type: (Any, Any) -> Any +- return ScalarEvent(None, None, (True, False), "", mark, mark, com= ment=3Dcomment) +- +- +-class RoundTripParser(Parser): +- """roundtrip is a safe loader, that wants to see the unmangled tag""" +- +- def transform_tag(self, handle, suffix): +- # type: (Any, Any) -> Any +- # return self.tag_handles[handle]+suffix +- if handle =3D=3D '!!' and suffix in ( +- u'null', +- u'bool', +- u'int', +- u'float', +- u'binary', +- u'timestamp', +- u'omap', +- u'pairs', +- u'set', +- u'str', +- u'seq', +- u'map', +- ): +- return Parser.transform_tag(self, handle, suffix) +- return handle + suffix +diff --git a/dynaconf/vendor_src/ruamel/yaml/py.typed b/dynaconf/vendor_sr= c/ruamel/yaml/py.typed +deleted file mode 100644 +index e69de29..0000000 +diff --git a/dynaconf/vendor_src/ruamel/yaml/reader.py b/dynaconf/vendor_s= rc/ruamel/yaml/reader.py +deleted file mode 100644 +index 52ec9a9..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/reader.py ++++ /dev/null +@@ -1,311 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-# This module contains abstractions for the input stream. You don't have = to +-# looks further, there are no pretty code. +-# +-# We define two classes here. +-# +-# Mark(source, line, column) +-# It's just a record and its only use is producing nice error messages. +-# Parser does not use it for any other purposes. +-# +-# Reader(source, data) +-# Reader determines the encoding of `data` and converts it to unicode. +-# Reader provides the following methods and attributes: +-# reader.peek(length=3D1) - return the next `length` characters +-# reader.forward(length=3D1) - move the current position to `length` +-# characters. +-# reader.index - the number of the current character. +-# reader.line, stream.column - the line and the column of the current +-# character. +- +-import codecs +- +-from .error import YAMLError, FileMark, StringMark, YAMLStreamError +-from .compat import text_type, binary_type, PY3, UNICODE_SIZE +-from .util import RegExp +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Union, Text, Tuple, Opt= ional # NOQA +-# from .compat import StreamTextType # NOQA +- +-__all__ =3D ['Reader', 'ReaderError'] +- +- +-class ReaderError(YAMLError): +- def __init__(self, name, position, character, encoding, reason): +- # type: (Any, Any, Any, Any, Any) -> None +- self.name =3D name +- self.character =3D character +- self.position =3D position +- self.encoding =3D encoding +- self.reason =3D reason +- +- def __str__(self): +- # type: () -> str +- if isinstance(self.character, binary_type): +- return "'%s' codec can't decode byte #x%02x: %s\n" ' in "%s"= , position %d' % ( +- self.encoding, +- ord(self.character), +- self.reason, +- self.name, +- self.position, +- ) +- else: +- return 'unacceptable character #x%04x: %s\n' ' in "%s", posi= tion %d' % ( +- self.character, +- self.reason, +- self.name, +- self.position, +- ) +- +- +-class Reader(object): +- # Reader: +- # - determines the data encoding and converts it to a unicode string, +- # - checks if characters are in allowed range, +- # - adds '\0' to the end. +- +- # Reader accepts +- # - a `str` object (PY2) / a `bytes` object (PY3), +- # - a `unicode` object (PY2) / a `str` object (PY3), +- # - a file-like object with its `read` method returning `str`, +- # - a file-like object with its `read` method returning `unicode`. +- +- # Yeah, it's ugly and slow. +- +- def __init__(self, stream, loader=3DNone): +- # type: (Any, Any) -> None +- self.loader =3D loader +- if self.loader is not None and getattr(self.loader, '_reader', No= ne) is None: +- self.loader._reader =3D self +- self.reset_reader() +- self.stream =3D stream # type: Any # as .read is called +- +- def reset_reader(self): +- # type: () -> None +- self.name =3D None # type: Any +- self.stream_pointer =3D 0 +- self.eof =3D True +- self.buffer =3D "" +- self.pointer =3D 0 +- self.raw_buffer =3D None # type: Any +- self.raw_decode =3D None +- self.encoding =3D None # type: Optional[Text] +- self.index =3D 0 +- self.line =3D 0 +- self.column =3D 0 +- +- @property +- def stream(self): +- # type: () -> Any +- try: +- return self._stream +- except AttributeError: +- raise YAMLStreamError('input stream needs to specified') +- +- @stream.setter +- def stream(self, val): +- # type: (Any) -> None +- if val is None: +- return +- self._stream =3D None +- if isinstance(val, text_type): +- self.name =3D '' +- self.check_printable(val) +- self.buffer =3D val + u'\0' # type: ignore +- elif isinstance(val, binary_type): +- self.name =3D '' +- self.raw_buffer =3D val +- self.determine_encoding() +- else: +- if not hasattr(val, 'read'): +- raise YAMLStreamError('stream argument needs to have a re= ad() method') +- self._stream =3D val +- self.name =3D getattr(self.stream, 'name', '') +- self.eof =3D False +- self.raw_buffer =3D None +- self.determine_encoding() +- +- def peek(self, index=3D0): +- # type: (int) -> Text +- try: +- return self.buffer[self.pointer + index] +- except IndexError: +- self.update(index + 1) +- return self.buffer[self.pointer + index] +- +- def prefix(self, length=3D1): +- # type: (int) -> Any +- if self.pointer + length >=3D len(self.buffer): +- self.update(length) +- return self.buffer[self.pointer : self.pointer + length] +- +- def forward_1_1(self, length=3D1): +- # type: (int) -> None +- if self.pointer + length + 1 >=3D len(self.buffer): +- self.update(length + 1) +- while length !=3D 0: +- ch =3D self.buffer[self.pointer] +- self.pointer +=3D 1 +- self.index +=3D 1 +- if ch in u'\n\x85\u2028\u2029' or ( +- ch =3D=3D u'\r' and self.buffer[self.pointer] !=3D u'\n' +- ): +- self.line +=3D 1 +- self.column =3D 0 +- elif ch !=3D u'\uFEFF': +- self.column +=3D 1 +- length -=3D 1 +- +- def forward(self, length=3D1): +- # type: (int) -> None +- if self.pointer + length + 1 >=3D len(self.buffer): +- self.update(length + 1) +- while length !=3D 0: +- ch =3D self.buffer[self.pointer] +- self.pointer +=3D 1 +- self.index +=3D 1 +- if ch =3D=3D u'\n' or (ch =3D=3D u'\r' and self.buffer[self.p= ointer] !=3D u'\n'): +- self.line +=3D 1 +- self.column =3D 0 +- elif ch !=3D u'\uFEFF': +- self.column +=3D 1 +- length -=3D 1 +- +- def get_mark(self): +- # type: () -> Any +- if self.stream is None: +- return StringMark( +- self.name, self.index, self.line, self.column, self.buffe= r, self.pointer +- ) +- else: +- return FileMark(self.name, self.index, self.line, self.column) +- +- def determine_encoding(self): +- # type: () -> None +- while not self.eof and (self.raw_buffer is None or len(self.raw_b= uffer) < 2): +- self.update_raw() +- if isinstance(self.raw_buffer, binary_type): +- if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): +- self.raw_decode =3D codecs.utf_16_le_decode # type: igno= re +- self.encoding =3D 'utf-16-le' +- elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): +- self.raw_decode =3D codecs.utf_16_be_decode # type: igno= re +- self.encoding =3D 'utf-16-be' +- else: +- self.raw_decode =3D codecs.utf_8_decode # type: ignore +- self.encoding =3D 'utf-8' +- self.update(1) +- +- if UNICODE_SIZE =3D=3D 2: +- NON_PRINTABLE =3D RegExp( +- u'[^\x09\x0A\x0D\x20-\x7E\x85' u'\xA0-\uD7FF' u'\uE000-\uFFFD= ' u']' +- ) +- else: +- NON_PRINTABLE =3D RegExp( +- u'[^\x09\x0A\x0D\x20-\x7E\x85' +- u'\xA0-\uD7FF' +- u'\uE000-\uFFFD' +- u'\U00010000-\U0010FFFF' +- u']' +- ) +- +- _printable_ascii =3D ('\x09\x0A\x0D' + "".join(map(chr, range(0x20, 0= x7F)))).encode('ascii') +- +- @classmethod +- def _get_non_printable_ascii(cls, data): # type: ignore +- # type: (Text, bytes) -> Optional[Tuple[int, Text]] +- ascii_bytes =3D data.encode('ascii') +- non_printables =3D ascii_bytes.translate(None, cls._printable_asc= ii) # type: ignore +- if not non_printables: +- return None +- non_printable =3D non_printables[:1] +- return ascii_bytes.index(non_printable), non_printable.decode('as= cii') +- +- @classmethod +- def _get_non_printable_regex(cls, data): +- # type: (Text) -> Optional[Tuple[int, Text]] +- match =3D cls.NON_PRINTABLE.search(data) +- if not bool(match): +- return None +- return match.start(), match.group() +- +- @classmethod +- def _get_non_printable(cls, data): +- # type: (Text) -> Optional[Tuple[int, Text]] +- try: +- return cls._get_non_printable_ascii(data) # type: ignore +- except UnicodeEncodeError: +- return cls._get_non_printable_regex(data) +- +- def check_printable(self, data): +- # type: (Any) -> None +- non_printable_match =3D self._get_non_printable(data) +- if non_printable_match is not None: +- start, character =3D non_printable_match +- position =3D self.index + (len(self.buffer) - self.pointer) += start +- raise ReaderError( +- self.name, +- position, +- ord(character), +- 'unicode', +- 'special characters are not allowed', +- ) +- +- def update(self, length): +- # type: (int) -> None +- if self.raw_buffer is None: +- return +- self.buffer =3D self.buffer[self.pointer :] +- self.pointer =3D 0 +- while len(self.buffer) < length: +- if not self.eof: +- self.update_raw() +- if self.raw_decode is not None: +- try: +- data, converted =3D self.raw_decode(self.raw_buffer, = 'strict', self.eof) +- except UnicodeDecodeError as exc: +- if PY3: +- character =3D self.raw_buffer[exc.start] +- else: +- character =3D exc.object[exc.start] +- if self.stream is not None: +- position =3D self.stream_pointer - len(self.raw_b= uffer) + exc.start +- elif self.stream is not None: +- position =3D self.stream_pointer - len(self.raw_b= uffer) + exc.start +- else: +- position =3D exc.start +- raise ReaderError(self.name, position, character, exc= .encoding, exc.reason) +- else: +- data =3D self.raw_buffer +- converted =3D len(data) +- self.check_printable(data) +- self.buffer +=3D data +- self.raw_buffer =3D self.raw_buffer[converted:] +- if self.eof: +- self.buffer +=3D '\0' +- self.raw_buffer =3D None +- break +- +- def update_raw(self, size=3DNone): +- # type: (Optional[int]) -> None +- if size is None: +- size =3D 4096 if PY3 else 1024 +- data =3D self.stream.read(size) +- if self.raw_buffer is None: +- self.raw_buffer =3D data +- else: +- self.raw_buffer +=3D data +- self.stream_pointer +=3D len(data) +- if not data: +- self.eof =3D True +- +- +-# try: +-# import psyco +-# psyco.bind(Reader) +-# except ImportError: +-# pass +diff --git a/dynaconf/vendor_src/ruamel/yaml/representer.py b/dynaconf/ven= dor_src/ruamel/yaml/representer.py +deleted file mode 100644 +index 985c9b2..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/representer.py ++++ /dev/null +@@ -1,1283 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division +- +- +-from .error import * # NOQA +-from .nodes import * # NOQA +-from .compat import text_type, binary_type, to_unicode, PY2, PY3 +-from .compat import ordereddict # type: ignore +-from .compat import nprint, nprintf # NOQA +-from .scalarstring import ( +- LiteralScalarString, +- FoldedScalarString, +- SingleQuotedScalarString, +- DoubleQuotedScalarString, +- PlainScalarString, +-) +-from .scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt +-from .scalarfloat import ScalarFloat +-from .scalarbool import ScalarBoolean +-from .timestamp import TimeStamp +- +-import datetime +-import sys +-import types +- +-if PY3: +- import copyreg +- import base64 +-else: +- import copy_reg as copyreg # type: ignore +- +-if False: # MYPY +- from typing import Dict, List, Any, Union, Text, Optional # NOQA +- +-# fmt: off +-__all__ =3D ['BaseRepresenter', 'SafeRepresenter', 'Representer', +- 'RepresenterError', 'RoundTripRepresenter'] +-# fmt: on +- +- +-class RepresenterError(YAMLError): +- pass +- +- +-if PY2: +- +- def get_classobj_bases(cls): +- # type: (Any) -> Any +- bases =3D [cls] +- for base in cls.__bases__: +- bases.extend(get_classobj_bases(base)) +- return bases +- +- +-class BaseRepresenter(object): +- +- yaml_representers =3D {} # type: Dict[Any, Any] +- yaml_multi_representers =3D {} # type: Dict[Any, Any] +- +- def __init__(self, default_style=3DNone, default_flow_style=3DNone, d= umper=3DNone): +- # type: (Any, Any, Any, Any) -> None +- self.dumper =3D dumper +- if self.dumper is not None: +- self.dumper._representer =3D self +- self.default_style =3D default_style +- self.default_flow_style =3D default_flow_style +- self.represented_objects =3D {} # type: Dict[Any, Any] +- self.object_keeper =3D [] # type: List[Any] +- self.alias_key =3D None # type: Optional[int] +- self.sort_base_mapping_type_on_output =3D True +- +- @property +- def serializer(self): +- # type: () -> Any +- try: +- if hasattr(self.dumper, 'typ'): +- return self.dumper.serializer +- return self.dumper._serializer +- except AttributeError: +- return self # cyaml +- +- def represent(self, data): +- # type: (Any) -> None +- node =3D self.represent_data(data) +- self.serializer.serialize(node) +- self.represented_objects =3D {} +- self.object_keeper =3D [] +- self.alias_key =3D None +- +- def represent_data(self, data): +- # type: (Any) -> Any +- if self.ignore_aliases(data): +- self.alias_key =3D None +- else: +- self.alias_key =3D id(data) +- if self.alias_key is not None: +- if self.alias_key in self.represented_objects: +- node =3D self.represented_objects[self.alias_key] +- # if node is None: +- # raise RepresenterError( +- # "recursive objects are not allowed: %r" % data) +- return node +- # self.represented_objects[alias_key] =3D None +- self.object_keeper.append(data) +- data_types =3D type(data).__mro__ +- if PY2: +- # if type(data) is types.InstanceType: +- if isinstance(data, types.InstanceType): +- data_types =3D get_classobj_bases(data.__class__) + list(= data_types) +- if data_types[0] in self.yaml_representers: +- node =3D self.yaml_representers[data_types[0]](self, data) +- else: +- for data_type in data_types: +- if data_type in self.yaml_multi_representers: +- node =3D self.yaml_multi_representers[data_type](self= , data) +- break +- else: +- if None in self.yaml_multi_representers: +- node =3D self.yaml_multi_representers[None](self, dat= a) +- elif None in self.yaml_representers: +- node =3D self.yaml_representers[None](self, data) +- else: +- node =3D ScalarNode(None, text_type(data)) +- # if alias_key is not None: +- # self.represented_objects[alias_key] =3D node +- return node +- +- def represent_key(self, data): +- # type: (Any) -> Any +- """ +- David Fraser: Extract a method to represent keys in mappings, so = that +- a subclass can choose not to quote them (for example) +- used in represent_mapping +- https://bitbucket.org/davidfraser/pyyaml/commits/d81df6eb95f20cac= 4a79eed95ae553b5c6f77b8c +- """ +- return self.represent_data(data) +- +- @classmethod +- def add_representer(cls, data_type, representer): +- # type: (Any, Any) -> None +- if 'yaml_representers' not in cls.__dict__: +- cls.yaml_representers =3D cls.yaml_representers.copy() +- cls.yaml_representers[data_type] =3D representer +- +- @classmethod +- def add_multi_representer(cls, data_type, representer): +- # type: (Any, Any) -> None +- if 'yaml_multi_representers' not in cls.__dict__: +- cls.yaml_multi_representers =3D cls.yaml_multi_representers.c= opy() +- cls.yaml_multi_representers[data_type] =3D representer +- +- def represent_scalar(self, tag, value, style=3DNone, anchor=3DNone): +- # type: (Any, Any, Any, Any) -> Any +- if style is None: +- style =3D self.default_style +- comment =3D None +- if style and style[0] in '|>': +- comment =3D getattr(value, 'comment', None) +- if comment: +- comment =3D [None, [comment]] +- node =3D ScalarNode(tag, value, style=3Dstyle, comment=3Dcomment,= anchor=3Danchor) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- return node +- +- def represent_sequence(self, tag, sequence, flow_style=3DNone): +- # type: (Any, Any, Any) -> Any +- value =3D [] # type: List[Any] +- node =3D SequenceNode(tag, value, flow_style=3Dflow_style) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- for item in sequence: +- node_item =3D self.represent_data(item) +- if not (isinstance(node_item, ScalarNode) and not node_item.s= tyle): +- best_style =3D False +- value.append(node_item) +- if flow_style is None: +- if self.default_flow_style is not None: +- node.flow_style =3D self.default_flow_style +- else: +- node.flow_style =3D best_style +- return node +- +- def represent_omap(self, tag, omap, flow_style=3DNone): +- # type: (Any, Any, Any) -> Any +- value =3D [] # type: List[Any] +- node =3D SequenceNode(tag, value, flow_style=3Dflow_style) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- for item_key in omap: +- item_val =3D omap[item_key] +- node_item =3D self.represent_data({item_key: item_val}) +- # if not (isinstance(node_item, ScalarNode) \ +- # and not node_item.style): +- # best_style =3D False +- value.append(node_item) +- if flow_style is None: +- if self.default_flow_style is not None: +- node.flow_style =3D self.default_flow_style +- else: +- node.flow_style =3D best_style +- return node +- +- def represent_mapping(self, tag, mapping, flow_style=3DNone): +- # type: (Any, Any, Any) -> Any +- value =3D [] # type: List[Any] +- node =3D MappingNode(tag, value, flow_style=3Dflow_style) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- if hasattr(mapping, 'items'): +- mapping =3D list(mapping.items()) +- if self.sort_base_mapping_type_on_output: +- try: +- mapping =3D sorted(mapping) +- except TypeError: +- pass +- for item_key, item_value in mapping: +- node_key =3D self.represent_key(item_key) +- node_value =3D self.represent_data(item_value) +- if not (isinstance(node_key, ScalarNode) and not node_key.sty= le): +- best_style =3D False +- if not (isinstance(node_value, ScalarNode) and not node_value= .style): +- best_style =3D False +- value.append((node_key, node_value)) +- if flow_style is None: +- if self.default_flow_style is not None: +- node.flow_style =3D self.default_flow_style +- else: +- node.flow_style =3D best_style +- return node +- +- def ignore_aliases(self, data): +- # type: (Any) -> bool +- return False +- +- +-class SafeRepresenter(BaseRepresenter): +- def ignore_aliases(self, data): +- # type: (Any) -> bool +- # https://docs.python.org/3/reference/expressions.html#parenthesi= zed-forms : +- # "i.e. two occurrences of the empty tuple may or may not yield t= he same object" +- # so "data is ()" should not be used +- if data is None or (isinstance(data, tuple) and data =3D=3D ()): +- return True +- if isinstance(data, (binary_type, text_type, bool, int, float)): +- return True +- return False +- +- def represent_none(self, data): +- # type: (Any) -> Any +- return self.represent_scalar(u'tag:yaml.org,2002:null', u'null') +- +- if PY3: +- +- def represent_str(self, data): +- # type: (Any) -> Any +- return self.represent_scalar(u'tag:yaml.org,2002:str', data) +- +- def represent_binary(self, data): +- # type: (Any) -> Any +- if hasattr(base64, 'encodebytes'): +- data =3D base64.encodebytes(data).decode('ascii') +- else: +- data =3D base64.encodestring(data).decode('ascii') +- return self.represent_scalar(u'tag:yaml.org,2002:binary', dat= a, style=3D'|') +- +- else: +- +- def represent_str(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D None +- try: +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- except UnicodeDecodeError: +- try: +- data =3D unicode(data, 'utf-8') +- tag =3D u'tag:yaml.org,2002:str' +- except UnicodeDecodeError: +- data =3D data.encode('base64') +- tag =3D u'tag:yaml.org,2002:binary' +- style =3D '|' +- return self.represent_scalar(tag, data, style=3Dstyle) +- +- def represent_unicode(self, data): +- # type: (Any) -> Any +- return self.represent_scalar(u'tag:yaml.org,2002:str', data) +- +- def represent_bool(self, data, anchor=3DNone): +- # type: (Any, Optional[Any]) -> Any +- try: +- value =3D self.dumper.boolean_representation[bool(data)] +- except AttributeError: +- if data: +- value =3D u'true' +- else: +- value =3D u'false' +- return self.represent_scalar(u'tag:yaml.org,2002:bool', value, an= chor=3Danchor) +- +- def represent_int(self, data): +- # type: (Any) -> Any +- return self.represent_scalar(u'tag:yaml.org,2002:int', text_type(= data)) +- +- if PY2: +- +- def represent_long(self, data): +- # type: (Any) -> Any +- return self.represent_scalar(u'tag:yaml.org,2002:int', text_t= ype(data)) +- +- inf_value =3D 1e300 +- while repr(inf_value) !=3D repr(inf_value * inf_value): +- inf_value *=3D inf_value +- +- def represent_float(self, data): +- # type: (Any) -> Any +- if data !=3D data or (data =3D=3D 0.0 and data =3D=3D 1.0): +- value =3D u'.nan' +- elif data =3D=3D self.inf_value: +- value =3D u'.inf' +- elif data =3D=3D -self.inf_value: +- value =3D u'-.inf' +- else: +- value =3D to_unicode(repr(data)).lower() +- if getattr(self.serializer, 'use_version', None) =3D=3D (1, 1= ): +- if u'.' not in value and u'e' in value: +- # Note that in some cases `repr(data)` represents a f= loat number +- # without the decimal parts. For instance: +- # >>> repr(1e17) +- # '1e17' +- # Unfortunately, this is not a valid float representa= tion according +- # to the definition of the `!!float` tag in YAML 1.1.= We fix +- # this by adding '.0' before the 'e' symbol. +- value =3D value.replace(u'e', u'.0e', 1) +- return self.represent_scalar(u'tag:yaml.org,2002:float', value) +- +- def represent_list(self, data): +- # type: (Any) -> Any +- # pairs =3D (len(data) > 0 and isinstance(data, list)) +- # if pairs: +- # for item in data: +- # if not isinstance(item, tuple) or len(item) !=3D 2: +- # pairs =3D False +- # break +- # if not pairs: +- return self.represent_sequence(u'tag:yaml.org,2002:seq', data) +- +- # value =3D [] +- # for item_key, item_value in data: +- # value.append(self.represent_mapping(u'tag:yaml.org,2002:map', +- # [(item_key, item_value)])) +- # return SequenceNode(u'tag:yaml.org,2002:pairs', value) +- +- def represent_dict(self, data): +- # type: (Any) -> Any +- return self.represent_mapping(u'tag:yaml.org,2002:map', data) +- +- def represent_ordereddict(self, data): +- # type: (Any) -> Any +- return self.represent_omap(u'tag:yaml.org,2002:omap', data) +- +- def represent_set(self, data): +- # type: (Any) -> Any +- value =3D {} # type: Dict[Any, None] +- for key in data: +- value[key] =3D None +- return self.represent_mapping(u'tag:yaml.org,2002:set', value) +- +- def represent_date(self, data): +- # type: (Any) -> Any +- value =3D to_unicode(data.isoformat()) +- return self.represent_scalar(u'tag:yaml.org,2002:timestamp', valu= e) +- +- def represent_datetime(self, data): +- # type: (Any) -> Any +- value =3D to_unicode(data.isoformat(' ')) +- return self.represent_scalar(u'tag:yaml.org,2002:timestamp', valu= e) +- +- def represent_yaml_object(self, tag, data, cls, flow_style=3DNone): +- # type: (Any, Any, Any, Any) -> Any +- if hasattr(data, '__getstate__'): +- state =3D data.__getstate__() +- else: +- state =3D data.__dict__.copy() +- return self.represent_mapping(tag, state, flow_style=3Dflow_style) +- +- def represent_undefined(self, data): +- # type: (Any) -> None +- raise RepresenterError('cannot represent an object: %s' % (data,)) +- +- +-SafeRepresenter.add_representer(type(None), SafeRepresenter.represent_non= e) +- +-SafeRepresenter.add_representer(str, SafeRepresenter.represent_str) +- +-if PY2: +- SafeRepresenter.add_representer(unicode, SafeRepresenter.represent_un= icode) +-else: +- SafeRepresenter.add_representer(bytes, SafeRepresenter.represent_bina= ry) +- +-SafeRepresenter.add_representer(bool, SafeRepresenter.represent_bool) +- +-SafeRepresenter.add_representer(int, SafeRepresenter.represent_int) +- +-if PY2: +- SafeRepresenter.add_representer(long, SafeRepresenter.represent_long) +- +-SafeRepresenter.add_representer(float, SafeRepresenter.represent_float) +- +-SafeRepresenter.add_representer(list, SafeRepresenter.represent_list) +- +-SafeRepresenter.add_representer(tuple, SafeRepresenter.represent_list) +- +-SafeRepresenter.add_representer(dict, SafeRepresenter.represent_dict) +- +-SafeRepresenter.add_representer(set, SafeRepresenter.represent_set) +- +-SafeRepresenter.add_representer(ordereddict, SafeRepresenter.represent_or= dereddict) +- +-if sys.version_info >=3D (2, 7): +- import collections +- +- SafeRepresenter.add_representer( +- collections.OrderedDict, SafeRepresenter.represent_ordereddict +- ) +- +-SafeRepresenter.add_representer(datetime.date, SafeRepresenter.represent_= date) +- +-SafeRepresenter.add_representer(datetime.datetime, SafeRepresenter.repres= ent_datetime) +- +-SafeRepresenter.add_representer(None, SafeRepresenter.represent_undefined) +- +- +-class Representer(SafeRepresenter): +- if PY2: +- +- def represent_str(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D None +- try: +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- except UnicodeDecodeError: +- try: +- data =3D unicode(data, 'utf-8') +- tag =3D u'tag:yaml.org,2002:python/str' +- except UnicodeDecodeError: +- data =3D data.encode('base64') +- tag =3D u'tag:yaml.org,2002:binary' +- style =3D '|' +- return self.represent_scalar(tag, data, style=3Dstyle) +- +- def represent_unicode(self, data): +- # type: (Any) -> Any +- tag =3D None +- try: +- data.encode('ascii') +- tag =3D u'tag:yaml.org,2002:python/unicode' +- except UnicodeEncodeError: +- tag =3D u'tag:yaml.org,2002:str' +- return self.represent_scalar(tag, data) +- +- def represent_long(self, data): +- # type: (Any) -> Any +- tag =3D u'tag:yaml.org,2002:int' +- if int(data) is not data: +- tag =3D u'tag:yaml.org,2002:python/long' +- return self.represent_scalar(tag, to_unicode(data)) +- +- def represent_complex(self, data): +- # type: (Any) -> Any +- if data.imag =3D=3D 0.0: +- data =3D u'%r' % data.real +- elif data.real =3D=3D 0.0: +- data =3D u'%rj' % data.imag +- elif data.imag > 0: +- data =3D u'%r+%rj' % (data.real, data.imag) +- else: +- data =3D u'%r%rj' % (data.real, data.imag) +- return self.represent_scalar(u'tag:yaml.org,2002:python/complex',= data) +- +- def represent_tuple(self, data): +- # type: (Any) -> Any +- return self.represent_sequence(u'tag:yaml.org,2002:python/tuple',= data) +- +- def represent_name(self, data): +- # type: (Any) -> Any +- try: +- name =3D u'%s.%s' % (data.__module__, data.__qualname__) +- except AttributeError: +- # probably PY2 +- name =3D u'%s.%s' % (data.__module__, data.__name__) +- return self.represent_scalar(u'tag:yaml.org,2002:python/name:' + = name, "") +- +- def represent_module(self, data): +- # type: (Any) -> Any +- return self.represent_scalar(u'tag:yaml.org,2002:python/module:' = + data.__name__, "") +- +- if PY2: +- +- def represent_instance(self, data): +- # type: (Any) -> Any +- # For instances of classic classes, we use __getinitargs__ and +- # __getstate__ to serialize the data. +- +- # If data.__getinitargs__ exists, the object must be reconstr= ucted +- # by calling cls(**args), where args is a tuple returned by +- # __getinitargs__. Otherwise, the cls.__init__ method should = never +- # be called and the class instance is created by instantiatin= g a +- # trivial class and assigning to the instance's __class__ var= iable. +- +- # If data.__getstate__ exists, it returns the state of the ob= ject. +- # Otherwise, the state of the object is data.__dict__. +- +- # We produce either a !!python/object or !!python/object/new = node. +- # If data.__getinitargs__ does not exist and state is a dicti= onary, +- # we produce a !!python/object node . Otherwise we produce a +- # !!python/object/new node. +- +- cls =3D data.__class__ +- class_name =3D u'%s.%s' % (cls.__module__, cls.__name__) +- args =3D None +- state =3D None +- if hasattr(data, '__getinitargs__'): +- args =3D list(data.__getinitargs__()) +- if hasattr(data, '__getstate__'): +- state =3D data.__getstate__() +- else: +- state =3D data.__dict__ +- if args is None and isinstance(state, dict): +- return self.represent_mapping( +- u'tag:yaml.org,2002:python/object:' + class_name, sta= te +- ) +- if isinstance(state, dict) and not state: +- return self.represent_sequence( +- u'tag:yaml.org,2002:python/object/new:' + class_name,= args +- ) +- value =3D {} +- if bool(args): +- value['args'] =3D args +- value['state'] =3D state # type: ignore +- return self.represent_mapping( +- u'tag:yaml.org,2002:python/object/new:' + class_name, val= ue +- ) +- +- def represent_object(self, data): +- # type: (Any) -> Any +- # We use __reduce__ API to save the data. data.__reduce__ returns +- # a tuple of length 2-5: +- # (function, args, state, listitems, dictitems) +- +- # For reconstructing, we calls function(*args), then set its stat= e, +- # listitems, and dictitems if they are not None. +- +- # A special case is when function.__name__ =3D=3D '__newobj__'. I= n this +- # case we create the object with args[0].__new__(*args). +- +- # Another special case is when __reduce__ returns a string - we d= on't +- # support it. +- +- # We produce a !!python/object, !!python/object/new or +- # !!python/object/apply node. +- +- cls =3D type(data) +- if cls in copyreg.dispatch_table: +- reduce =3D copyreg.dispatch_table[cls](data) +- elif hasattr(data, '__reduce_ex__'): +- reduce =3D data.__reduce_ex__(2) +- elif hasattr(data, '__reduce__'): +- reduce =3D data.__reduce__() +- else: +- raise RepresenterError('cannot represent object: %r' % (data,= )) +- reduce =3D (list(reduce) + [None] * 5)[:5] +- function, args, state, listitems, dictitems =3D reduce +- args =3D list(args) +- if state is None: +- state =3D {} +- if listitems is not None: +- listitems =3D list(listitems) +- if dictitems is not None: +- dictitems =3D dict(dictitems) +- if function.__name__ =3D=3D '__newobj__': +- function =3D args[0] +- args =3D args[1:] +- tag =3D u'tag:yaml.org,2002:python/object/new:' +- newobj =3D True +- else: +- tag =3D u'tag:yaml.org,2002:python/object/apply:' +- newobj =3D False +- try: +- function_name =3D u'%s.%s' % (function.__module__, function._= _qualname__) +- except AttributeError: +- # probably PY2 +- function_name =3D u'%s.%s' % (function.__module__, function._= _name__) +- if not args and not listitems and not dictitems and isinstance(st= ate, dict) and newobj: +- return self.represent_mapping( +- u'tag:yaml.org,2002:python/object:' + function_name, state +- ) +- if not listitems and not dictitems and isinstance(state, dict) an= d not state: +- return self.represent_sequence(tag + function_name, args) +- value =3D {} +- if args: +- value['args'] =3D args +- if state or not isinstance(state, dict): +- value['state'] =3D state +- if listitems: +- value['listitems'] =3D listitems +- if dictitems: +- value['dictitems'] =3D dictitems +- return self.represent_mapping(tag + function_name, value) +- +- +-if PY2: +- Representer.add_representer(str, Representer.represent_str) +- +- Representer.add_representer(unicode, Representer.represent_unicode) +- +- Representer.add_representer(long, Representer.represent_long) +- +-Representer.add_representer(complex, Representer.represent_complex) +- +-Representer.add_representer(tuple, Representer.represent_tuple) +- +-Representer.add_representer(type, Representer.represent_name) +- +-if PY2: +- Representer.add_representer(types.ClassType, Representer.represent_na= me) +- +-Representer.add_representer(types.FunctionType, Representer.represent_nam= e) +- +-Representer.add_representer(types.BuiltinFunctionType, Representer.repres= ent_name) +- +-Representer.add_representer(types.ModuleType, Representer.represent_modul= e) +- +-if PY2: +- Representer.add_multi_representer(types.InstanceType, Representer.rep= resent_instance) +- +-Representer.add_multi_representer(object, Representer.represent_object) +- +-Representer.add_multi_representer(type, Representer.represent_name) +- +-from .comments import ( +- CommentedMap, +- CommentedOrderedMap, +- CommentedSeq, +- CommentedKeySeq, +- CommentedKeyMap, +- CommentedSet, +- comment_attrib, +- merge_attrib, +- TaggedScalar, +-) # NOQA +- +- +-class RoundTripRepresenter(SafeRepresenter): +- # need to add type here and write out the .comment +- # in serializer and emitter +- +- def __init__(self, default_style=3DNone, default_flow_style=3DNone, d= umper=3DNone): +- # type: (Any, Any, Any) -> None +- if not hasattr(dumper, 'typ') and default_flow_style is None: +- default_flow_style =3D False +- SafeRepresenter.__init__( +- self, +- default_style=3Ddefault_style, +- default_flow_style=3Ddefault_flow_style, +- dumper=3Ddumper, +- ) +- +- def ignore_aliases(self, data): +- # type: (Any) -> bool +- try: +- if data.anchor is not None and data.anchor.value is not None: +- return False +- except AttributeError: +- pass +- return SafeRepresenter.ignore_aliases(self, data) +- +- def represent_none(self, data): +- # type: (Any) -> Any +- if len(self.represented_objects) =3D=3D 0 and not self.serializer= .use_explicit_start: +- # this will be open ended (although it is not yet) +- return self.represent_scalar(u'tag:yaml.org,2002:null', u'nul= l') +- return self.represent_scalar(u'tag:yaml.org,2002:null', "") +- +- def represent_literal_scalarstring(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D '|' +- anchor =3D data.yaml_anchor(any=3DTrue) +- if PY2 and not isinstance(data, unicode): +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- return self.represent_scalar(tag, data, style=3Dstyle, anchor=3Da= nchor) +- +- represent_preserved_scalarstring =3D represent_literal_scalarstring +- +- def represent_folded_scalarstring(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D '>' +- anchor =3D data.yaml_anchor(any=3DTrue) +- for fold_pos in reversed(getattr(data, 'fold_pos', [])): +- if ( +- data[fold_pos] =3D=3D ' ' +- and (fold_pos > 0 and not data[fold_pos - 1].isspace()) +- and (fold_pos < len(data) and not data[fold_pos + 1].issp= ace()) +- ): +- data =3D data[:fold_pos] + '\a' + data[fold_pos:] +- if PY2 and not isinstance(data, unicode): +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- return self.represent_scalar(tag, data, style=3Dstyle, anchor=3Da= nchor) +- +- def represent_single_quoted_scalarstring(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D "'" +- anchor =3D data.yaml_anchor(any=3DTrue) +- if PY2 and not isinstance(data, unicode): +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- return self.represent_scalar(tag, data, style=3Dstyle, anchor=3Da= nchor) +- +- def represent_double_quoted_scalarstring(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D '"' +- anchor =3D data.yaml_anchor(any=3DTrue) +- if PY2 and not isinstance(data, unicode): +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- return self.represent_scalar(tag, data, style=3Dstyle, anchor=3Da= nchor) +- +- def represent_plain_scalarstring(self, data): +- # type: (Any) -> Any +- tag =3D None +- style =3D '' +- anchor =3D data.yaml_anchor(any=3DTrue) +- if PY2 and not isinstance(data, unicode): +- data =3D unicode(data, 'ascii') +- tag =3D u'tag:yaml.org,2002:str' +- return self.represent_scalar(tag, data, style=3Dstyle, anchor=3Da= nchor) +- +- def insert_underscore(self, prefix, s, underscore, anchor=3DNone): +- # type: (Any, Any, Any, Any) -> Any +- if underscore is None: +- return self.represent_scalar(u'tag:yaml.org,2002:int', prefix= + s, anchor=3Danchor) +- if underscore[0]: +- sl =3D list(s) +- pos =3D len(s) - underscore[0] +- while pos > 0: +- sl.insert(pos, '_') +- pos -=3D underscore[0] +- s =3D "".join(sl) +- if underscore[1]: +- s =3D '_' + s +- if underscore[2]: +- s +=3D '_' +- return self.represent_scalar(u'tag:yaml.org,2002:int', prefix + s= , anchor=3Danchor) +- +- def represent_scalar_int(self, data): +- # type: (Any) -> Any +- if data._width is not None: +- s =3D '{:0{}d}'.format(data, data._width) +- else: +- s =3D format(data, 'd') +- anchor =3D data.yaml_anchor(any=3DTrue) +- return self.insert_underscore("", s, data._underscore, anchor=3Da= nchor) +- +- def represent_binary_int(self, data): +- # type: (Any) -> Any +- if data._width is not None: +- # cannot use '{:#0{}b}', that strips the zeros +- s =3D '{:0{}b}'.format(data, data._width) +- else: +- s =3D format(data, 'b') +- anchor =3D data.yaml_anchor(any=3DTrue) +- return self.insert_underscore('0b', s, data._underscore, anchor= =3Danchor) +- +- def represent_octal_int(self, data): +- # type: (Any) -> Any +- if data._width is not None: +- # cannot use '{:#0{}o}', that strips the zeros +- s =3D '{:0{}o}'.format(data, data._width) +- else: +- s =3D format(data, 'o') +- anchor =3D data.yaml_anchor(any=3DTrue) +- return self.insert_underscore('0o', s, data._underscore, anchor= =3Danchor) +- +- def represent_hex_int(self, data): +- # type: (Any) -> Any +- if data._width is not None: +- # cannot use '{:#0{}x}', that strips the zeros +- s =3D '{:0{}x}'.format(data, data._width) +- else: +- s =3D format(data, 'x') +- anchor =3D data.yaml_anchor(any=3DTrue) +- return self.insert_underscore('0x', s, data._underscore, anchor= =3Danchor) +- +- def represent_hex_caps_int(self, data): +- # type: (Any) -> Any +- if data._width is not None: +- # cannot use '{:#0{}X}', that strips the zeros +- s =3D '{:0{}X}'.format(data, data._width) +- else: +- s =3D format(data, 'X') +- anchor =3D data.yaml_anchor(any=3DTrue) +- return self.insert_underscore('0x', s, data._underscore, anchor= =3Danchor) +- +- def represent_scalar_float(self, data): +- # type: (Any) -> Any +- """ this is way more complicated """ +- value =3D None +- anchor =3D data.yaml_anchor(any=3DTrue) +- if data !=3D data or (data =3D=3D 0.0 and data =3D=3D 1.0): +- value =3D u'.nan' +- elif data =3D=3D self.inf_value: +- value =3D u'.inf' +- elif data =3D=3D -self.inf_value: +- value =3D u'-.inf' +- if value: +- return self.represent_scalar(u'tag:yaml.org,2002:float', valu= e, anchor=3Danchor) +- if data._exp is None and data._prec > 0 and data._prec =3D=3D dat= a._width - 1: +- # no exponent, but trailing dot +- value =3D u'{}{:d}.'.format(data._m_sign if data._m_sign else= "", abs(int(data))) +- elif data._exp is None: +- # no exponent, "normal" dot +- prec =3D data._prec +- ms =3D data._m_sign if data._m_sign else "" +- # -1 for the dot +- value =3D u'{}{:0{}.{}f}'.format( +- ms, abs(data), data._width - len(ms), data._width - prec = - 1 +- ) +- if prec =3D=3D 0 or (prec =3D=3D 1 and ms !=3D ""): +- value =3D value.replace(u'0.', u'.') +- while len(value) < data._width: +- value +=3D u'0' +- else: +- # exponent +- m, es =3D u'{:{}.{}e}'.format( +- # data, data._width, data._width - data._prec + (1 if dat= a._m_sign else 0) +- data, +- data._width, +- data._width + (1 if data._m_sign else 0), +- ).split('e') +- w =3D data._width if data._prec > 0 else (data._width + 1) +- if data < 0: +- w +=3D 1 +- m =3D m[:w] +- e =3D int(es) +- m1, m2 =3D m.split('.') # always second? +- while len(m1) + len(m2) < data._width - (1 if data._prec >=3D= 0 else 0): +- m2 +=3D u'0' +- if data._m_sign and data > 0: +- m1 =3D '+' + m1 +- esgn =3D u'+' if data._e_sign else "" +- if data._prec < 0: # mantissa without dot +- if m2 !=3D u'0': +- e -=3D len(m2) +- else: +- m2 =3D "" +- while (len(m1) + len(m2) - (1 if data._m_sign else 0)) < = data._width: +- m2 +=3D u'0' +- e -=3D 1 +- value =3D m1 + m2 + data._exp + u'{:{}0{}d}'.format(e, es= gn, data._e_width) +- elif data._prec =3D=3D 0: # mantissa with trailing dot +- e -=3D len(m2) +- value =3D ( +- m1 + m2 + u'.' + data._exp + u'{:{}0{}d}'.format(e, e= sgn, data._e_width) +- ) +- else: +- if data._m_lead0 > 0: +- m2 =3D u'0' * (data._m_lead0 - 1) + m1 + m2 +- m1 =3D u'0' +- m2 =3D m2[: -data._m_lead0] # these should be zeros +- e +=3D data._m_lead0 +- while len(m1) < data._prec: +- m1 +=3D m2[0] +- m2 =3D m2[1:] +- e -=3D 1 +- value =3D ( +- m1 + u'.' + m2 + data._exp + u'{:{}0{}d}'.format(e, e= sgn, data._e_width) +- ) +- +- if value is None: +- value =3D to_unicode(repr(data)).lower() +- return self.represent_scalar(u'tag:yaml.org,2002:float', value, a= nchor=3Danchor) +- +- def represent_sequence(self, tag, sequence, flow_style=3DNone): +- # type: (Any, Any, Any) -> Any +- value =3D [] # type: List[Any] +- # if the flow_style is None, the flow style tacked on to the obje= ct +- # explicitly will be taken. If that is None as well the default f= low +- # style rules +- try: +- flow_style =3D sequence.fa.flow_style(flow_style) +- except AttributeError: +- flow_style =3D flow_style +- try: +- anchor =3D sequence.yaml_anchor() +- except AttributeError: +- anchor =3D None +- node =3D SequenceNode(tag, value, flow_style=3Dflow_style, anchor= =3Danchor) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- try: +- comment =3D getattr(sequence, comment_attrib) +- node.comment =3D comment.comment +- # reset any comment already printed information +- if node.comment and node.comment[1]: +- for ct in node.comment[1]: +- ct.reset() +- item_comments =3D comment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]: +- ct.reset() +- item_comments =3D comment.items +- node.comment =3D comment.comment +- try: +- node.comment.append(comment.end) +- except AttributeError: +- pass +- except AttributeError: +- item_comments =3D {} +- for idx, item in enumerate(sequence): +- node_item =3D self.represent_data(item) +- self.merge_comments(node_item, item_comments.get(idx)) +- if not (isinstance(node_item, ScalarNode) and not node_item.s= tyle): +- best_style =3D False +- value.append(node_item) +- if flow_style is None: +- if len(sequence) !=3D 0 and self.default_flow_style is not No= ne: +- node.flow_style =3D self.default_flow_style +- else: +- node.flow_style =3D best_style +- return node +- +- def merge_comments(self, node, comments): +- # type: (Any, Any) -> Any +- if comments is None: +- assert hasattr(node, 'comment') +- return node +- if getattr(node, 'comment', None) is not None: +- for idx, val in enumerate(comments): +- if idx >=3D len(node.comment): +- continue +- nc =3D node.comment[idx] +- if nc is not None: +- assert val is None or val =3D=3D nc +- comments[idx] =3D nc +- node.comment =3D comments +- return node +- +- def represent_key(self, data): +- # type: (Any) -> Any +- if isinstance(data, CommentedKeySeq): +- self.alias_key =3D None +- return self.represent_sequence(u'tag:yaml.org,2002:seq', data= , flow_style=3DTrue) +- if isinstance(data, CommentedKeyMap): +- self.alias_key =3D None +- return self.represent_mapping(u'tag:yaml.org,2002:map', data,= flow_style=3DTrue) +- return SafeRepresenter.represent_key(self, data) +- +- def represent_mapping(self, tag, mapping, flow_style=3DNone): +- # type: (Any, Any, Any) -> Any +- value =3D [] # type: List[Any] +- try: +- flow_style =3D mapping.fa.flow_style(flow_style) +- except AttributeError: +- flow_style =3D flow_style +- try: +- anchor =3D mapping.yaml_anchor() +- except AttributeError: +- anchor =3D None +- node =3D MappingNode(tag, value, flow_style=3Dflow_style, anchor= =3Danchor) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- # no sorting! !! +- try: +- comment =3D getattr(mapping, comment_attrib) +- node.comment =3D comment.comment +- if node.comment and node.comment[1]: +- for ct in node.comment[1]: +- ct.reset() +- item_comments =3D comment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]: +- ct.reset() +- try: +- node.comment.append(comment.end) +- except AttributeError: +- pass +- except AttributeError: +- item_comments =3D {} +- merge_list =3D [m[1] for m in getattr(mapping, merge_attrib, [])] +- try: +- merge_pos =3D getattr(mapping, merge_attrib, [[0]])[0][0] +- except IndexError: +- merge_pos =3D 0 +- item_count =3D 0 +- if bool(merge_list): +- items =3D mapping.non_merged_items() +- else: +- items =3D mapping.items() +- for item_key, item_value in items: +- item_count +=3D 1 +- node_key =3D self.represent_key(item_key) +- node_value =3D self.represent_data(item_value) +- item_comment =3D item_comments.get(item_key) +- if item_comment: +- assert getattr(node_key, 'comment', None) is None +- node_key.comment =3D item_comment[:2] +- nvc =3D getattr(node_value, 'comment', None) +- if nvc is not None: # end comment already there +- nvc[0] =3D item_comment[2] +- nvc[1] =3D item_comment[3] +- else: +- node_value.comment =3D item_comment[2:] +- if not (isinstance(node_key, ScalarNode) and not node_key.sty= le): +- best_style =3D False +- if not (isinstance(node_value, ScalarNode) and not node_value= .style): +- best_style =3D False +- value.append((node_key, node_value)) +- if flow_style is None: +- if ((item_count !=3D 0) or bool(merge_list)) and self.default= _flow_style is not None: +- node.flow_style =3D self.default_flow_style +- else: +- node.flow_style =3D best_style +- if bool(merge_list): +- # because of the call to represent_data here, the anchors +- # are marked as being used and thereby created +- if len(merge_list) =3D=3D 1: +- arg =3D self.represent_data(merge_list[0]) +- else: +- arg =3D self.represent_data(merge_list) +- arg.flow_style =3D True +- value.insert(merge_pos, (ScalarNode(u'tag:yaml.org,2002:merge= ', '<<'), arg)) +- return node +- +- def represent_omap(self, tag, omap, flow_style=3DNone): +- # type: (Any, Any, Any) -> Any +- value =3D [] # type: List[Any] +- try: +- flow_style =3D omap.fa.flow_style(flow_style) +- except AttributeError: +- flow_style =3D flow_style +- try: +- anchor =3D omap.yaml_anchor() +- except AttributeError: +- anchor =3D None +- node =3D SequenceNode(tag, value, flow_style=3Dflow_style, anchor= =3Danchor) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- try: +- comment =3D getattr(omap, comment_attrib) +- node.comment =3D comment.comment +- if node.comment and node.comment[1]: +- for ct in node.comment[1]: +- ct.reset() +- item_comments =3D comment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]: +- ct.reset() +- try: +- node.comment.append(comment.end) +- except AttributeError: +- pass +- except AttributeError: +- item_comments =3D {} +- for item_key in omap: +- item_val =3D omap[item_key] +- node_item =3D self.represent_data({item_key: item_val}) +- # node_item.flow_style =3D False +- # node item has two scalars in value: node_key and node_value +- item_comment =3D item_comments.get(item_key) +- if item_comment: +- if item_comment[1]: +- node_item.comment =3D [None, item_comment[1]] +- assert getattr(node_item.value[0][0], 'comment', None) is= None +- node_item.value[0][0].comment =3D [item_comment[0], None] +- nvc =3D getattr(node_item.value[0][1], 'comment', None) +- if nvc is not None: # end comment already there +- nvc[0] =3D item_comment[2] +- nvc[1] =3D item_comment[3] +- else: +- node_item.value[0][1].comment =3D item_comment[2:] +- # if not (isinstance(node_item, ScalarNode) \ +- # and not node_item.style): +- # best_style =3D False +- value.append(node_item) +- if flow_style is None: +- if self.default_flow_style is not None: +- node.flow_style =3D self.default_flow_style +- else: +- node.flow_style =3D best_style +- return node +- +- def represent_set(self, setting): +- # type: (Any) -> Any +- flow_style =3D False +- tag =3D u'tag:yaml.org,2002:set' +- # return self.represent_mapping(tag, value) +- value =3D [] # type: List[Any] +- flow_style =3D setting.fa.flow_style(flow_style) +- try: +- anchor =3D setting.yaml_anchor() +- except AttributeError: +- anchor =3D None +- node =3D MappingNode(tag, value, flow_style=3Dflow_style, anchor= =3Danchor) +- if self.alias_key is not None: +- self.represented_objects[self.alias_key] =3D node +- best_style =3D True +- # no sorting! !! +- try: +- comment =3D getattr(setting, comment_attrib) +- node.comment =3D comment.comment +- if node.comment and node.comment[1]: +- for ct in node.comment[1]: +- ct.reset() +- item_comments =3D comment.items +- for v in item_comments.values(): +- if v and v[1]: +- for ct in v[1]: +- ct.reset() +- try: +- node.comment.append(comment.end) +- except AttributeError: +- pass +- except AttributeError: +- item_comments =3D {} +- for item_key in setting.odict: +- node_key =3D self.represent_key(item_key) +- node_value =3D self.represent_data(None) +- item_comment =3D item_comments.get(item_key) +- if item_comment: +- assert getattr(node_key, 'comment', None) is None +- node_key.comment =3D item_comment[:2] +- node_key.style =3D node_value.style =3D '?' +- if not (isinstance(node_key, ScalarNode) and not node_key.sty= le): +- best_style =3D False +- if not (isinstance(node_value, ScalarNode) and not node_value= .style): +- best_style =3D False +- value.append((node_key, node_value)) +- best_style =3D best_style +- return node +- +- def represent_dict(self, data): +- # type: (Any) -> Any +- """write out tag if saved on loading""" +- try: +- t =3D data.tag.value +- except AttributeError: +- t =3D None +- if t: +- if t.startswith('!!'): +- tag =3D 'tag:yaml.org,2002:' + t[2:] +- else: +- tag =3D t +- else: +- tag =3D u'tag:yaml.org,2002:map' +- return self.represent_mapping(tag, data) +- +- def represent_list(self, data): +- # type: (Any) -> Any +- try: +- t =3D data.tag.value +- except AttributeError: +- t =3D None +- if t: +- if t.startswith('!!'): +- tag =3D 'tag:yaml.org,2002:' + t[2:] +- else: +- tag =3D t +- else: +- tag =3D u'tag:yaml.org,2002:seq' +- return self.represent_sequence(tag, data) +- +- def represent_datetime(self, data): +- # type: (Any) -> Any +- inter =3D 'T' if data._yaml['t'] else ' ' +- _yaml =3D data._yaml +- if _yaml['delta']: +- data +=3D _yaml['delta'] +- value =3D data.isoformat(inter) +- else: +- value =3D data.isoformat(inter) +- if _yaml['tz']: +- value +=3D _yaml['tz'] +- return self.represent_scalar(u'tag:yaml.org,2002:timestamp', to_u= nicode(value)) +- +- def represent_tagged_scalar(self, data): +- # type: (Any) -> Any +- try: +- tag =3D data.tag.value +- except AttributeError: +- tag =3D None +- try: +- anchor =3D data.yaml_anchor() +- except AttributeError: +- anchor =3D None +- return self.represent_scalar(tag, data.value, style=3Ddata.style,= anchor=3Danchor) +- +- def represent_scalar_bool(self, data): +- # type: (Any) -> Any +- try: +- anchor =3D data.yaml_anchor() +- except AttributeError: +- anchor =3D None +- return SafeRepresenter.represent_bool(self, data, anchor=3Danchor) +- +- +-RoundTripRepresenter.add_representer(type(None), RoundTripRepresenter.rep= resent_none) +- +-RoundTripRepresenter.add_representer( +- LiteralScalarString, RoundTripRepresenter.represent_literal_scalarstr= ing +-) +- +-RoundTripRepresenter.add_representer( +- FoldedScalarString, RoundTripRepresenter.represent_folded_scalarstring +-) +- +-RoundTripRepresenter.add_representer( +- SingleQuotedScalarString, RoundTripRepresenter.represent_single_quote= d_scalarstring +-) +- +-RoundTripRepresenter.add_representer( +- DoubleQuotedScalarString, RoundTripRepresenter.represent_double_quote= d_scalarstring +-) +- +-RoundTripRepresenter.add_representer( +- PlainScalarString, RoundTripRepresenter.represent_plain_scalarstring +-) +- +-# RoundTripRepresenter.add_representer(tuple, Representer.represent_tuple) +- +-RoundTripRepresenter.add_representer(ScalarInt, RoundTripRepresenter.repr= esent_scalar_int) +- +-RoundTripRepresenter.add_representer(BinaryInt, RoundTripRepresenter.repr= esent_binary_int) +- +-RoundTripRepresenter.add_representer(OctalInt, RoundTripRepresenter.repre= sent_octal_int) +- +-RoundTripRepresenter.add_representer(HexInt, RoundTripRepresenter.represe= nt_hex_int) +- +-RoundTripRepresenter.add_representer(HexCapsInt, RoundTripRepresenter.rep= resent_hex_caps_int) +- +-RoundTripRepresenter.add_representer(ScalarFloat, RoundTripRepresenter.re= present_scalar_float) +- +-RoundTripRepresenter.add_representer(ScalarBoolean, RoundTripRepresenter.= represent_scalar_bool) +- +-RoundTripRepresenter.add_representer(CommentedSeq, RoundTripRepresenter.r= epresent_list) +- +-RoundTripRepresenter.add_representer(CommentedMap, RoundTripRepresenter.r= epresent_dict) +- +-RoundTripRepresenter.add_representer( +- CommentedOrderedMap, RoundTripRepresenter.represent_ordereddict +-) +- +-if sys.version_info >=3D (2, 7): +- import collections +- +- RoundTripRepresenter.add_representer( +- collections.OrderedDict, RoundTripRepresenter.represent_ordereddi= ct +- ) +- +-RoundTripRepresenter.add_representer(CommentedSet, RoundTripRepresenter.r= epresent_set) +- +-RoundTripRepresenter.add_representer( +- TaggedScalar, RoundTripRepresenter.represent_tagged_scalar +-) +- +-RoundTripRepresenter.add_representer(TimeStamp, RoundTripRepresenter.repr= esent_datetime) +diff --git a/dynaconf/vendor_src/ruamel/yaml/resolver.py b/dynaconf/vendor= _src/ruamel/yaml/resolver.py +deleted file mode 100644 +index d771d80..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/resolver.py ++++ /dev/null +@@ -1,399 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-import re +- +-if False: # MYPY +- from typing import Any, Dict, List, Union, Text, Optional # NOQA +- from .compat import VersionType # NOQA +- +-from .compat import string_types, _DEFAULT_YAML_VERSION # NOQA +-from .error import * # NOQA +-from .nodes import MappingNode, ScalarNode, SequenceNode # NOQA +-from .util import RegExp # NOQA +- +-__all__ =3D ['BaseResolver', 'Resolver', 'VersionedResolver'] +- +- +-# fmt: off +-# resolvers consist of +-# - a list of applicable version +-# - a tag +-# - a regexp +-# - a list of first characters to match +-implicit_resolvers =3D [ +- ([(1, 2)], +- u'tag:yaml.org,2002:bool', +- RegExp(u'''^(?:true|True|TRUE|false|False|FALSE)$''', re.X), +- list(u'tTfF')), +- ([(1, 1)], +- u'tag:yaml.org,2002:bool', +- RegExp(u'''^(?:y|Y|yes|Yes|YES|n|N|no|No|NO +- |true|True|TRUE|false|False|FALSE +- |on|On|ON|off|Off|OFF)$''', re.X), +- list(u'yYnNtTfFoO')), +- ([(1, 2)], +- u'tag:yaml.org,2002:float', +- RegExp(u'''^(?: +- [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? +- |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) +- |[-+]?\\.[0-9_]+(?:[eE][-+][0-9]+)? +- |[-+]?\\.(?:inf|Inf|INF) +- |\\.(?:nan|NaN|NAN))$''', re.X), +- list(u'-+0123456789.')), +- ([(1, 1)], +- u'tag:yaml.org,2002:float', +- RegExp(u'''^(?: +- [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? +- |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) +- |\\.[0-9_]+(?:[eE][-+][0-9]+)? +- |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]* # sexagesimal float +- |[-+]?\\.(?:inf|Inf|INF) +- |\\.(?:nan|NaN|NAN))$''', re.X), +- list(u'-+0123456789.')), +- ([(1, 2)], +- u'tag:yaml.org,2002:int', +- RegExp(u'''^(?:[-+]?0b[0-1_]+ +- |[-+]?0o?[0-7_]+ +- |[-+]?[0-9_]+ +- |[-+]?0x[0-9a-fA-F_]+)$''', re.X), +- list(u'-+0123456789')), +- ([(1, 1)], +- u'tag:yaml.org,2002:int', +- RegExp(u'''^(?:[-+]?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), # sexagesimal i= nt +- list(u'-+0123456789')), +- ([(1, 2), (1, 1)], +- u'tag:yaml.org,2002:merge', +- RegExp(u'^(?:<<)$'), +- [u'<']), +- ([(1, 2), (1, 1)], +- u'tag:yaml.org,2002:null', +- RegExp(u'''^(?: ~ +- |null|Null|NULL +- | )$''', re.X), +- [u'~', u'n', u'N', u'']), +- ([(1, 2), (1, 1)], +- u'tag:yaml.org,2002:timestamp', +- RegExp(u'''^(?:[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), +- list(u'0123456789')), +- ([(1, 2), (1, 1)], +- u'tag:yaml.org,2002:value', +- RegExp(u'^(?:=3D)$'), +- [u'=3D']), +- # The following resolver is only for documentation purposes. It canno= t work +- # because plain scalars cannot start with '!', '&', or '*'. +- ([(1, 2), (1, 1)], +- u'tag:yaml.org,2002:yaml', +- RegExp(u'^(?:!|&|\\*)$'), +- list(u'!&*')), +-] +-# fmt: on +- +- +-class ResolverError(YAMLError): +- pass +- +- +-class BaseResolver(object): +- +- DEFAULT_SCALAR_TAG =3D u'tag:yaml.org,2002:str' +- DEFAULT_SEQUENCE_TAG =3D u'tag:yaml.org,2002:seq' +- DEFAULT_MAPPING_TAG =3D u'tag:yaml.org,2002:map' +- +- yaml_implicit_resolvers =3D {} # type: Dict[Any, Any] +- yaml_path_resolvers =3D {} # type: Dict[Any, Any] +- +- def __init__(self, loadumper=3DNone): +- # type: (Any, Any) -> None +- self.loadumper =3D loadumper +- if self.loadumper is not None and getattr(self.loadumper, '_resol= ver', None) is None: +- self.loadumper._resolver =3D self.loadumper +- self._loader_version =3D None # type: Any +- self.resolver_exact_paths =3D [] # type: List[Any] +- self.resolver_prefix_paths =3D [] # type: List[Any] +- +- @property +- def parser(self): +- # type: () -> Any +- if self.loadumper is not None: +- if hasattr(self.loadumper, 'typ'): +- return self.loadumper.parser +- return self.loadumper._parser +- return None +- +- @classmethod +- def add_implicit_resolver_base(cls, tag, regexp, first): +- # type: (Any, Any, Any) -> None +- if 'yaml_implicit_resolvers' not in cls.__dict__: +- # deepcopy doesn't work here +- cls.yaml_implicit_resolvers =3D dict( +- (k, cls.yaml_implicit_resolvers[k][:]) for k in cls.yaml_= implicit_resolvers +- ) +- if first is None: +- first =3D [None] +- for ch in first: +- cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, r= egexp)) +- +- @classmethod +- def add_implicit_resolver(cls, tag, regexp, first): +- # type: (Any, Any, Any) -> None +- if 'yaml_implicit_resolvers' not in cls.__dict__: +- # deepcopy doesn't work here +- cls.yaml_implicit_resolvers =3D dict( +- (k, cls.yaml_implicit_resolvers[k][:]) for k in cls.yaml_= implicit_resolvers +- ) +- if first is None: +- first =3D [None] +- for ch in first: +- cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, r= egexp)) +- implicit_resolvers.append(([(1, 2), (1, 1)], tag, regexp, first)) +- +- # @classmethod +- # def add_implicit_resolver(cls, tag, regexp, first): +- +- @classmethod +- def add_path_resolver(cls, tag, path, kind=3DNone): +- # type: (Any, Any, Any) -> None +- # Note: `add_path_resolver` is experimental. The API could be ch= anged. +- # `new_path` is a pattern that is matched against the path from t= he +- # root to the node that is being considered. `node_path` element= s are +- # tuples `(node_check, index_check)`. `node_check` is a node cla= ss: +- # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` +- # matches any kind of a node. `index_check` could be `None`, a b= oolean +- # value, a string value, or a number. `None` and `False` match a= gainst +- # any _value_ of sequence and mapping nodes. `True` matches agai= nst +- # any _key_ of a mapping node. A string `index_check` matches ag= ainst +- # a mapping value that corresponds to a scalar key which content = is +- # equal to the `index_check` value. An integer `index_check` mat= ches +- # against a sequence value with the index equal to `index_check`. +- if 'yaml_path_resolvers' not in cls.__dict__: +- cls.yaml_path_resolvers =3D cls.yaml_path_resolvers.copy() +- new_path =3D [] # type: List[Any] +- for element in path: +- if isinstance(element, (list, tuple)): +- if len(element) =3D=3D 2: +- node_check, index_check =3D element +- elif len(element) =3D=3D 1: +- node_check =3D element[0] +- index_check =3D True +- else: +- raise ResolverError('Invalid path element: %s' % (ele= ment,)) +- else: +- node_check =3D None +- index_check =3D element +- if node_check is str: +- node_check =3D ScalarNode +- elif node_check is list: +- node_check =3D SequenceNode +- elif node_check is dict: +- node_check =3D MappingNode +- elif ( +- node_check not in [ScalarNode, SequenceNode, MappingNode] +- and not isinstance(node_check, string_types) +- and node_check is not None +- ): +- raise ResolverError('Invalid node checker: %s' % (node_ch= eck,)) +- if not isinstance(index_check, (string_types, int)) and index= _check is not None: +- raise ResolverError('Invalid index checker: %s' % (index_= check,)) +- new_path.append((node_check, index_check)) +- if kind is str: +- kind =3D ScalarNode +- elif kind is list: +- kind =3D SequenceNode +- elif kind is dict: +- kind =3D MappingNode +- elif kind not in [ScalarNode, SequenceNode, MappingNode] and kind= is not None: +- raise ResolverError('Invalid node kind: %s' % (kind,)) +- cls.yaml_path_resolvers[tuple(new_path), kind] =3D tag +- +- def descend_resolver(self, current_node, current_index): +- # type: (Any, Any) -> None +- if not self.yaml_path_resolvers: +- return +- exact_paths =3D {} +- prefix_paths =3D [] +- if current_node: +- depth =3D len(self.resolver_prefix_paths) +- for path, kind in self.resolver_prefix_paths[-1]: +- if self.check_resolver_prefix(depth, path, kind, current_= node, current_index): +- if len(path) > depth: +- prefix_paths.append((path, kind)) +- else: +- exact_paths[kind] =3D self.yaml_path_resolvers[pa= th, kind] +- else: +- for path, kind in self.yaml_path_resolvers: +- if not path: +- exact_paths[kind] =3D self.yaml_path_resolvers[path, = kind] +- else: +- prefix_paths.append((path, kind)) +- self.resolver_exact_paths.append(exact_paths) +- self.resolver_prefix_paths.append(prefix_paths) +- +- def ascend_resolver(self): +- # type: () -> None +- if not self.yaml_path_resolvers: +- return +- self.resolver_exact_paths.pop() +- self.resolver_prefix_paths.pop() +- +- def check_resolver_prefix(self, depth, path, kind, current_node, curr= ent_index): +- # type: (int, Text, Any, Any, Any) -> bool +- node_check, index_check =3D path[depth - 1] +- if isinstance(node_check, string_types): +- if current_node.tag !=3D node_check: +- return False +- elif node_check is not None: +- if not isinstance(current_node, node_check): +- return False +- if index_check is True and current_index is not None: +- return False +- if (index_check is False or index_check is None) and current_inde= x is None: +- return False +- if isinstance(index_check, string_types): +- if not ( +- isinstance(current_index, ScalarNode) and index_check =3D= =3D current_index.value +- ): +- return False +- elif isinstance(index_check, int) and not isinstance(index_check,= bool): +- if index_check !=3D current_index: +- return False +- return True +- +- def resolve(self, kind, value, implicit): +- # type: (Any, Any, Any) -> Any +- if kind is ScalarNode and implicit[0]: +- if value =3D=3D "": +- resolvers =3D self.yaml_implicit_resolvers.get("", []) +- else: +- resolvers =3D self.yaml_implicit_resolvers.get(value[0], = []) +- resolvers +=3D self.yaml_implicit_resolvers.get(None, []) +- for tag, regexp in resolvers: +- if regexp.match(value): +- return tag +- implicit =3D implicit[1] +- if bool(self.yaml_path_resolvers): +- exact_paths =3D self.resolver_exact_paths[-1] +- if kind in exact_paths: +- return exact_paths[kind] +- if None in exact_paths: +- return exact_paths[None] +- if kind is ScalarNode: +- return self.DEFAULT_SCALAR_TAG +- elif kind is SequenceNode: +- return self.DEFAULT_SEQUENCE_TAG +- elif kind is MappingNode: +- return self.DEFAULT_MAPPING_TAG +- +- @property +- def processing_version(self): +- # type: () -> Any +- return None +- +- +-class Resolver(BaseResolver): +- pass +- +- +-for ir in implicit_resolvers: +- if (1, 2) in ir[0]: +- Resolver.add_implicit_resolver_base(*ir[1:]) +- +- +-class VersionedResolver(BaseResolver): +- """ +- contrary to the "normal" resolver, the smart resolver delays loading +- the pattern matching rules. That way it can decide to load 1.1 rules +- or the (default) 1.2 rules, that no longer support octal without 0o, = sexagesimals +- and Yes/No/On/Off booleans. +- """ +- +- def __init__(self, version=3DNone, loader=3DNone, loadumper=3DNone): +- # type: (Optional[VersionType], Any, Any) -> None +- if loader is None and loadumper is not None: +- loader =3D loadumper +- BaseResolver.__init__(self, loader) +- self._loader_version =3D self.get_loader_version(version) +- self._version_implicit_resolver =3D {} # type: Dict[Any, Any] +- +- def add_version_implicit_resolver(self, version, tag, regexp, first): +- # type: (VersionType, Any, Any, Any) -> None +- if first is None: +- first =3D [None] +- impl_resolver =3D self._version_implicit_resolver.setdefault(vers= ion, {}) +- for ch in first: +- impl_resolver.setdefault(ch, []).append((tag, regexp)) +- +- def get_loader_version(self, version): +- # type: (Optional[VersionType]) -> Any +- if version is None or isinstance(version, tuple): +- return version +- if isinstance(version, list): +- return tuple(version) +- # assume string +- return tuple(map(int, version.split(u'.'))) +- +- @property +- def versioned_resolver(self): +- # type: () -> Any +- """ +- select the resolver based on the version we are parsing +- """ +- version =3D self.processing_version +- if version not in self._version_implicit_resolver: +- for x in implicit_resolvers: +- if version in x[0]: +- self.add_version_implicit_resolver(version, x[1], x[2= ], x[3]) +- return self._version_implicit_resolver[version] +- +- def resolve(self, kind, value, implicit): +- # type: (Any, Any, Any) -> Any +- if kind is ScalarNode and implicit[0]: +- if value =3D=3D "": +- resolvers =3D self.versioned_resolver.get("", []) +- else: +- resolvers =3D self.versioned_resolver.get(value[0], []) +- resolvers +=3D self.versioned_resolver.get(None, []) +- for tag, regexp in resolvers: +- if regexp.match(value): +- return tag +- implicit =3D implicit[1] +- if bool(self.yaml_path_resolvers): +- exact_paths =3D self.resolver_exact_paths[-1] +- if kind in exact_paths: +- return exact_paths[kind] +- if None in exact_paths: +- return exact_paths[None] +- if kind is ScalarNode: +- return self.DEFAULT_SCALAR_TAG +- elif kind is SequenceNode: +- return self.DEFAULT_SEQUENCE_TAG +- elif kind is MappingNode: +- return self.DEFAULT_MAPPING_TAG +- +- @property +- def processing_version(self): +- # type: () -> Any +- try: +- version =3D self.loadumper._scanner.yaml_version +- except AttributeError: +- try: +- if hasattr(self.loadumper, 'typ'): +- version =3D self.loadumper.version +- else: +- version =3D self.loadumper._serializer.use_version #= dumping +- except AttributeError: +- version =3D None +- if version is None: +- version =3D self._loader_version +- if version is None: +- version =3D _DEFAULT_YAML_VERSION +- return version +diff --git a/dynaconf/vendor_src/ruamel/yaml/scalarbool.py b/dynaconf/vend= or_src/ruamel/yaml/scalarbool.py +deleted file mode 100644 +index e3ea2f2..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/scalarbool.py ++++ /dev/null +@@ -1,51 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-""" +-You cannot subclass bool, and this is necessary for round-tripping anchor= ed +-bool values (and also if you want to preserve the original way of writing) +- +-bool.__bases__ is type 'int', so that is what is used as the basis for Sc= alarBoolean as well. +- +-You can use these in an if statement, but not when testing equivalence +-""" +- +-from .anchor import Anchor +- +-if False: # MYPY +- from typing import Text, Any, Dict, List # NOQA +- +-__all__ =3D ['ScalarBoolean'] +- +-# no need for no_limit_int -> int +- +- +-class ScalarBoolean(int): +- def __new__(cls, *args, **kw): +- # type: (Any, Any, Any) -> Any +- anchor =3D kw.pop('anchor', None) # type: ignore +- b =3D int.__new__(cls, *args, **kw) # type: ignore +- if anchor is not None: +- b.yaml_set_anchor(anchor, always_dump=3DTrue) +- return b +- +- @property +- def anchor(self): +- # type: () -> Any +- if not hasattr(self, Anchor.attrib): +- setattr(self, Anchor.attrib, Anchor()) +- return getattr(self, Anchor.attrib) +- +- def yaml_anchor(self, any=3DFalse): +- # type: (bool) -> Any +- if not hasattr(self, Anchor.attrib): +- return None +- if any or self.anchor.always_dump: +- return self.anchor +- return None +- +- def yaml_set_anchor(self, value, always_dump=3DFalse): +- # type: (Any, bool) -> None +- self.anchor.value =3D value +- self.anchor.always_dump =3D always_dump +diff --git a/dynaconf/vendor_src/ruamel/yaml/scalarfloat.py b/dynaconf/ven= dor_src/ruamel/yaml/scalarfloat.py +deleted file mode 100644 +index 9553cd5..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/scalarfloat.py ++++ /dev/null +@@ -1,127 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-import sys +-from .compat import no_limit_int # NOQA +-from .anchor import Anchor +- +-if False: # MYPY +- from typing import Text, Any, Dict, List # NOQA +- +-__all__ =3D ['ScalarFloat', 'ExponentialFloat', 'ExponentialCapsFloat'] +- +- +-class ScalarFloat(float): +- def __new__(cls, *args, **kw): +- # type: (Any, Any, Any) -> Any +- width =3D kw.pop('width', None) # type: ignore +- prec =3D kw.pop('prec', None) # type: ignore +- m_sign =3D kw.pop('m_sign', None) # type: ignore +- m_lead0 =3D kw.pop('m_lead0', 0) # type: ignore +- exp =3D kw.pop('exp', None) # type: ignore +- e_width =3D kw.pop('e_width', None) # type: ignore +- e_sign =3D kw.pop('e_sign', None) # type: ignore +- underscore =3D kw.pop('underscore', None) # type: ignore +- anchor =3D kw.pop('anchor', None) # type: ignore +- v =3D float.__new__(cls, *args, **kw) # type: ignore +- v._width =3D width +- v._prec =3D prec +- v._m_sign =3D m_sign +- v._m_lead0 =3D m_lead0 +- v._exp =3D exp +- v._e_width =3D e_width +- v._e_sign =3D e_sign +- v._underscore =3D underscore +- if anchor is not None: +- v.yaml_set_anchor(anchor, always_dump=3DTrue) +- return v +- +- def __iadd__(self, a): # type: ignore +- # type: (Any) -> Any +- return float(self) + a +- x =3D type(self)(self + a) +- x._width =3D self._width +- x._underscore =3D self._underscore[:] if self._underscore is not = None else None # NOQA +- return x +- +- def __ifloordiv__(self, a): # type: ignore +- # type: (Any) -> Any +- return float(self) // a +- x =3D type(self)(self // a) +- x._width =3D self._width +- x._underscore =3D self._underscore[:] if self._underscore is not = None else None # NOQA +- return x +- +- def __imul__(self, a): # type: ignore +- # type: (Any) -> Any +- return float(self) * a +- x =3D type(self)(self * a) +- x._width =3D self._width +- x._underscore =3D self._underscore[:] if self._underscore is not = None else None # NOQA +- x._prec =3D self._prec # check for others +- return x +- +- def __ipow__(self, a): # type: ignore +- # type: (Any) -> Any +- return float(self) ** a +- x =3D type(self)(self ** a) +- x._width =3D self._width +- x._underscore =3D self._underscore[:] if self._underscore is not = None else None # NOQA +- return x +- +- def __isub__(self, a): # type: ignore +- # type: (Any) -> Any +- return float(self) - a +- x =3D type(self)(self - a) +- x._width =3D self._width +- x._underscore =3D self._underscore[:] if self._underscore is not = None else None # NOQA +- return x +- +- @property +- def anchor(self): +- # type: () -> Any +- if not hasattr(self, Anchor.attrib): +- setattr(self, Anchor.attrib, Anchor()) +- return getattr(self, Anchor.attrib) +- +- def yaml_anchor(self, any=3DFalse): +- # type: (bool) -> Any +- if not hasattr(self, Anchor.attrib): +- return None +- if any or self.anchor.always_dump: +- return self.anchor +- return None +- +- def yaml_set_anchor(self, value, always_dump=3DFalse): +- # type: (Any, bool) -> None +- self.anchor.value =3D value +- self.anchor.always_dump =3D always_dump +- +- def dump(self, out=3Dsys.stdout): +- # type: (Any) -> Any +- out.write( +- 'ScalarFloat({}| w:{}, p:{}, s:{}, lz:{}, _:{}|{}, w:{}, s:{}= )\n'.format( +- self, +- self._width, # type: ignore +- self._prec, # type: ignore +- self._m_sign, # type: ignore +- self._m_lead0, # type: ignore +- self._underscore, # type: ignore +- self._exp, # type: ignore +- self._e_width, # type: ignore +- self._e_sign, # type: ignore +- ) +- ) +- +- +-class ExponentialFloat(ScalarFloat): +- def __new__(cls, value, width=3DNone, underscore=3DNone): +- # type: (Any, Any, Any) -> Any +- return ScalarFloat.__new__(cls, value, width=3Dwidth, underscore= =3Dunderscore) +- +- +-class ExponentialCapsFloat(ScalarFloat): +- def __new__(cls, value, width=3DNone, underscore=3DNone): +- # type: (Any, Any, Any) -> Any +- return ScalarFloat.__new__(cls, value, width=3Dwidth, underscore= =3Dunderscore) +diff --git a/dynaconf/vendor_src/ruamel/yaml/scalarint.py b/dynaconf/vendo= r_src/ruamel/yaml/scalarint.py +deleted file mode 100644 +index 305af25..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/scalarint.py ++++ /dev/null +@@ -1,130 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-from .compat import no_limit_int # NOQA +-from .anchor import Anchor +- +-if False: # MYPY +- from typing import Text, Any, Dict, List # NOQA +- +-__all__ =3D ['ScalarInt', 'BinaryInt', 'OctalInt', 'HexInt', 'HexCapsInt'= , 'DecimalInt'] +- +- +-class ScalarInt(no_limit_int): +- def __new__(cls, *args, **kw): +- # type: (Any, Any, Any) -> Any +- width =3D kw.pop('width', None) # type: ignore +- underscore =3D kw.pop('underscore', None) # type: ignore +- anchor =3D kw.pop('anchor', None) # type: ignore +- v =3D no_limit_int.__new__(cls, *args, **kw) # type: ignore +- v._width =3D width +- v._underscore =3D underscore +- if anchor is not None: +- v.yaml_set_anchor(anchor, always_dump=3DTrue) +- return v +- +- def __iadd__(self, a): # type: ignore +- # type: (Any) -> Any +- x =3D type(self)(self + a) +- x._width =3D self._width # type: ignore +- x._underscore =3D ( # type: ignore +- self._underscore[:] if self._underscore is not None else None= # type: ignore +- ) # NOQA +- return x +- +- def __ifloordiv__(self, a): # type: ignore +- # type: (Any) -> Any +- x =3D type(self)(self // a) +- x._width =3D self._width # type: ignore +- x._underscore =3D ( # type: ignore +- self._underscore[:] if self._underscore is not None else None= # type: ignore +- ) # NOQA +- return x +- +- def __imul__(self, a): # type: ignore +- # type: (Any) -> Any +- x =3D type(self)(self * a) +- x._width =3D self._width # type: ignore +- x._underscore =3D ( # type: ignore +- self._underscore[:] if self._underscore is not None else None= # type: ignore +- ) # NOQA +- return x +- +- def __ipow__(self, a): # type: ignore +- # type: (Any) -> Any +- x =3D type(self)(self ** a) +- x._width =3D self._width # type: ignore +- x._underscore =3D ( # type: ignore +- self._underscore[:] if self._underscore is not None else None= # type: ignore +- ) # NOQA +- return x +- +- def __isub__(self, a): # type: ignore +- # type: (Any) -> Any +- x =3D type(self)(self - a) +- x._width =3D self._width # type: ignore +- x._underscore =3D ( # type: ignore +- self._underscore[:] if self._underscore is not None else None= # type: ignore +- ) # NOQA +- return x +- +- @property +- def anchor(self): +- # type: () -> Any +- if not hasattr(self, Anchor.attrib): +- setattr(self, Anchor.attrib, Anchor()) +- return getattr(self, Anchor.attrib) +- +- def yaml_anchor(self, any=3DFalse): +- # type: (bool) -> Any +- if not hasattr(self, Anchor.attrib): +- return None +- if any or self.anchor.always_dump: +- return self.anchor +- return None +- +- def yaml_set_anchor(self, value, always_dump=3DFalse): +- # type: (Any, bool) -> None +- self.anchor.value =3D value +- self.anchor.always_dump =3D always_dump +- +- +-class BinaryInt(ScalarInt): +- def __new__(cls, value, width=3DNone, underscore=3DNone, anchor=3DNon= e): +- # type: (Any, Any, Any, Any) -> Any +- return ScalarInt.__new__(cls, value, width=3Dwidth, underscore=3D= underscore, anchor=3Danchor) +- +- +-class OctalInt(ScalarInt): +- def __new__(cls, value, width=3DNone, underscore=3DNone, anchor=3DNon= e): +- # type: (Any, Any, Any, Any) -> Any +- return ScalarInt.__new__(cls, value, width=3Dwidth, underscore=3D= underscore, anchor=3Danchor) +- +- +-# mixed casing of A-F is not supported, when loading the first non digit +-# determines the case +- +- +-class HexInt(ScalarInt): +- """uses lower case (a-f)""" +- +- def __new__(cls, value, width=3DNone, underscore=3DNone, anchor=3DNon= e): +- # type: (Any, Any, Any, Any) -> Any +- return ScalarInt.__new__(cls, value, width=3Dwidth, underscore=3D= underscore, anchor=3Danchor) +- +- +-class HexCapsInt(ScalarInt): +- """uses upper case (A-F)""" +- +- def __new__(cls, value, width=3DNone, underscore=3DNone, anchor=3DNon= e): +- # type: (Any, Any, Any, Any) -> Any +- return ScalarInt.__new__(cls, value, width=3Dwidth, underscore=3D= underscore, anchor=3Danchor) +- +- +-class DecimalInt(ScalarInt): +- """needed if anchor""" +- +- def __new__(cls, value, width=3DNone, underscore=3DNone, anchor=3DNon= e): +- # type: (Any, Any, Any, Any) -> Any +- return ScalarInt.__new__(cls, value, width=3Dwidth, underscore=3D= underscore, anchor=3Danchor) +diff --git a/dynaconf/vendor_src/ruamel/yaml/scalarstring.py b/dynaconf/ve= ndor_src/ruamel/yaml/scalarstring.py +deleted file mode 100644 +index 2ec4383..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/scalarstring.py ++++ /dev/null +@@ -1,156 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-from .compat import text_type +-from .anchor import Anchor +- +-if False: # MYPY +- from typing import Text, Any, Dict, List # NOQA +- +-__all__ =3D [ +- 'ScalarString', +- 'LiteralScalarString', +- 'FoldedScalarString', +- 'SingleQuotedScalarString', +- 'DoubleQuotedScalarString', +- 'PlainScalarString', +- # PreservedScalarString is the old name, as it was the first to be pr= eserved on rt, +- # use LiteralScalarString instead +- 'PreservedScalarString', +-] +- +- +-class ScalarString(text_type): +- __slots__ =3D Anchor.attrib +- +- def __new__(cls, *args, **kw): +- # type: (Any, Any) -> Any +- anchor =3D kw.pop('anchor', None) # type: ignore +- ret_val =3D text_type.__new__(cls, *args, **kw) # type: ignore +- if anchor is not None: +- ret_val.yaml_set_anchor(anchor, always_dump=3DTrue) +- return ret_val +- +- def replace(self, old, new, maxreplace=3D-1): +- # type: (Any, Any, int) -> Any +- return type(self)((text_type.replace(self, old, new, maxreplace))) +- +- @property +- def anchor(self): +- # type: () -> Any +- if not hasattr(self, Anchor.attrib): +- setattr(self, Anchor.attrib, Anchor()) +- return getattr(self, Anchor.attrib) +- +- def yaml_anchor(self, any=3DFalse): +- # type: (bool) -> Any +- if not hasattr(self, Anchor.attrib): +- return None +- if any or self.anchor.always_dump: +- return self.anchor +- return None +- +- def yaml_set_anchor(self, value, always_dump=3DFalse): +- # type: (Any, bool) -> None +- self.anchor.value =3D value +- self.anchor.always_dump =3D always_dump +- +- +-class LiteralScalarString(ScalarString): +- __slots__ =3D 'comment' # the comment after the | on the first line +- +- style =3D '|' +- +- def __new__(cls, value, anchor=3DNone): +- # type: (Text, Any) -> Any +- return ScalarString.__new__(cls, value, anchor=3Danchor) +- +- +-PreservedScalarString =3D LiteralScalarString +- +- +-class FoldedScalarString(ScalarString): +- __slots__ =3D ('fold_pos', 'comment') # the comment after the > on t= he first line +- +- style =3D '>' +- +- def __new__(cls, value, anchor=3DNone): +- # type: (Text, Any) -> Any +- return ScalarString.__new__(cls, value, anchor=3Danchor) +- +- +-class SingleQuotedScalarString(ScalarString): +- __slots__ =3D () +- +- style =3D "'" +- +- def __new__(cls, value, anchor=3DNone): +- # type: (Text, Any) -> Any +- return ScalarString.__new__(cls, value, anchor=3Danchor) +- +- +-class DoubleQuotedScalarString(ScalarString): +- __slots__ =3D () +- +- style =3D '"' +- +- def __new__(cls, value, anchor=3DNone): +- # type: (Text, Any) -> Any +- return ScalarString.__new__(cls, value, anchor=3Danchor) +- +- +-class PlainScalarString(ScalarString): +- __slots__ =3D () +- +- style =3D '' +- +- def __new__(cls, value, anchor=3DNone): +- # type: (Text, Any) -> Any +- return ScalarString.__new__(cls, value, anchor=3Danchor) +- +- +-def preserve_literal(s): +- # type: (Text) -> Text +- return LiteralScalarString(s.replace('\r\n', '\n').replace('\r', '\n'= )) +- +- +-def walk_tree(base, map=3DNone): +- # type: (Any, Any) -> None +- """ +- the routine here walks over a simple yaml tree (recursing in +- dict values and list items) and converts strings that +- have multiple lines to literal scalars +- +- You can also provide an explicit (ordered) mapping for multiple trans= forms +- (first of which is executed): +- map =3D ruamel.yaml.compat.ordereddict +- map['\n'] =3D preserve_literal +- map[':'] =3D SingleQuotedScalarString +- walk_tree(data, map=3Dmap) +- """ +- from dynaconf.vendor.ruamel.yaml.compat import string_types +- from dynaconf.vendor.ruamel.yaml.compat import MutableMapping, Mutabl= eSequence # type: ignore +- +- if map is None: +- map =3D {'\n': preserve_literal} +- +- if isinstance(base, MutableMapping): +- for k in base: +- v =3D base[k] # type: Text +- if isinstance(v, string_types): +- for ch in map: +- if ch in v: +- base[k] =3D map[ch](v) +- break +- else: +- walk_tree(v) +- elif isinstance(base, MutableSequence): +- for idx, elem in enumerate(base): +- if isinstance(elem, string_types): +- for ch in map: +- if ch in elem: # type: ignore +- base[idx] =3D map[ch](elem) +- break +- else: +- walk_tree(elem) +diff --git a/dynaconf/vendor_src/ruamel/yaml/scanner.py b/dynaconf/vendor_= src/ruamel/yaml/scanner.py +deleted file mode 100644 +index 7872a4c..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/scanner.py ++++ /dev/null +@@ -1,1980 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-# Scanner produces tokens of the following types: +-# STREAM-START +-# STREAM-END +-# DIRECTIVE(name, value) +-# DOCUMENT-START +-# DOCUMENT-END +-# BLOCK-SEQUENCE-START +-# BLOCK-MAPPING-START +-# BLOCK-END +-# FLOW-SEQUENCE-START +-# FLOW-MAPPING-START +-# FLOW-SEQUENCE-END +-# FLOW-MAPPING-END +-# BLOCK-ENTRY +-# FLOW-ENTRY +-# KEY +-# VALUE +-# ALIAS(value) +-# ANCHOR(value) +-# TAG(value) +-# SCALAR(value, plain, style) +-# +-# RoundTripScanner +-# COMMENT(value) +-# +-# Read comments in the Scanner code for more details. +-# +- +-from .error import MarkedYAMLError +-from .tokens import * # NOQA +-from .compat import utf8, unichr, PY3, check_anchorname_char, nprint # N= OQA +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Union, Text # NOQA +- from .compat import VersionType # NOQA +- +-__all__ =3D ['Scanner', 'RoundTripScanner', 'ScannerError'] +- +- +-_THE_END =3D '\n\0\r\x85\u2028\u2029' +-_THE_END_SPACE_TAB =3D ' \n\0\t\r\x85\u2028\u2029' +-_SPACE_TAB =3D ' \t' +- +- +-class ScannerError(MarkedYAMLError): +- pass +- +- +-class SimpleKey(object): +- # See below simple keys treatment. +- +- def __init__(self, token_number, required, index, line, column, mark): +- # type: (Any, Any, int, int, int, Any) -> None +- self.token_number =3D token_number +- self.required =3D required +- self.index =3D index +- self.line =3D line +- self.column =3D column +- self.mark =3D mark +- +- +-class Scanner(object): +- def __init__(self, loader=3DNone): +- # type: (Any) -> None +- """Initialize the scanner.""" +- # It is assumed that Scanner and Reader will have a common descen= dant. +- # Reader do the dirty work of checking for BOM and converting the +- # input data to Unicode. It also adds NUL to the end. +- # +- # Reader supports the following methods +- # self.peek(i=3D0) # peek the next i-th character +- # self.prefix(l=3D1) # peek the next l characters +- # self.forward(l=3D1) # read the next l characters and move the= pointer +- +- self.loader =3D loader +- if self.loader is not None and getattr(self.loader, '_scanner', N= one) is None: +- self.loader._scanner =3D self +- self.reset_scanner() +- self.first_time =3D False +- self.yaml_version =3D None # type: Any +- +- @property +- def flow_level(self): +- # type: () -> int +- return len(self.flow_context) +- +- def reset_scanner(self): +- # type: () -> None +- # Had we reached the end of the stream? +- self.done =3D False +- +- # flow_context is an expanding/shrinking list consisting of '{' a= nd '[' +- # for each unclosed flow context. If empty list that means block = context +- self.flow_context =3D [] # type: List[Text] +- +- # List of processed tokens that are not yet emitted. +- self.tokens =3D [] # type: List[Any] +- +- # Add the STREAM-START token. +- self.fetch_stream_start() +- +- # Number of tokens that were emitted through the `get_token` meth= od. +- self.tokens_taken =3D 0 +- +- # The current indentation level. +- self.indent =3D -1 +- +- # Past indentation levels. +- self.indents =3D [] # type: List[int] +- +- # Variables related to simple keys treatment. +- +- # A simple key is a key that is not denoted by the '?' indicator. +- # Example of simple keys: +- # --- +- # block simple key: value +- # ? not a simple key: +- # : { flow simple key: value } +- # We emit the KEY token before all keys, so when we find a potent= ial +- # simple key, we try to locate the corresponding ':' indicator. +- # Simple keys should be limited to a single line and 1024 charact= ers. +- +- # Can a simple key start at the current position? A simple key may +- # start: +- # - at the beginning of the line, not counting indentation spaces +- # (in block context), +- # - after '{', '[', ',' (in the flow context), +- # - after '?', ':', '-' (in the block context). +- # In the block context, this flag also signifies if a block colle= ction +- # may start at the current position. +- self.allow_simple_key =3D True +- +- # Keep track of possible simple keys. This is a dictionary. The k= ey +- # is `flow_level`; there can be no more that one possible simple = key +- # for each level. The value is a SimpleKey record: +- # (token_number, required, index, line, column, mark) +- # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow), +- # '[', or '{' tokens. +- self.possible_simple_keys =3D {} # type: Dict[Any, Any] +- +- @property +- def reader(self): +- # type: () -> Any +- try: +- return self._scanner_reader # type: ignore +- except AttributeError: +- if hasattr(self.loader, 'typ'): +- self._scanner_reader =3D self.loader.reader +- else: +- self._scanner_reader =3D self.loader._reader +- return self._scanner_reader +- +- @property +- def scanner_processing_version(self): # prefix until un-composited +- # type: () -> Any +- if hasattr(self.loader, 'typ'): +- return self.loader.resolver.processing_version +- return self.loader.processing_version +- +- # Public methods. +- +- def check_token(self, *choices): +- # type: (Any) -> bool +- # Check if the next token is one of the given types. +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- if bool(self.tokens): +- if not choices: +- return True +- for choice in choices: +- if isinstance(self.tokens[0], choice): +- return True +- return False +- +- def peek_token(self): +- # type: () -> Any +- # Return the next token, but do not delete if from the queue. +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- if bool(self.tokens): +- return self.tokens[0] +- +- def get_token(self): +- # type: () -> Any +- # Return the next token. +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- if bool(self.tokens): +- self.tokens_taken +=3D 1 +- return self.tokens.pop(0) +- +- # Private methods. +- +- def need_more_tokens(self): +- # type: () -> bool +- if self.done: +- return False +- if not self.tokens: +- return True +- # The current token may be a potential simple key, so we +- # need to look further. +- self.stale_possible_simple_keys() +- if self.next_possible_simple_key() =3D=3D self.tokens_taken: +- return True +- return False +- +- def fetch_comment(self, comment): +- # type: (Any) -> None +- raise NotImplementedError +- +- def fetch_more_tokens(self): +- # type: () -> Any +- # Eat whitespaces and comments until we reach the next token. +- comment =3D self.scan_to_next_token() +- if comment is not None: # never happens for base scanner +- return self.fetch_comment(comment) +- # Remove obsolete possible simple keys. +- self.stale_possible_simple_keys() +- +- # Compare the current indentation and column. It may add some tok= ens +- # and decrease the current indentation level. +- self.unwind_indent(self.reader.column) +- +- # Peek the next character. +- ch =3D self.reader.peek() +- +- # Is it the end of stream? +- if ch =3D=3D '\0': +- return self.fetch_stream_end() +- +- # Is it a directive? +- if ch =3D=3D '%' and self.check_directive(): +- return self.fetch_directive() +- +- # Is it the document start? +- if ch =3D=3D '-' and self.check_document_start(): +- return self.fetch_document_start() +- +- # Is it the document end? +- if ch =3D=3D '.' and self.check_document_end(): +- return self.fetch_document_end() +- +- # TODO: support for BOM within a stream. +- # if ch =3D=3D u'\uFEFF': +- # return self.fetch_bom() <-- issue BOMToken +- +- # Note: the order of the following checks is NOT significant. +- +- # Is it the flow sequence start indicator? +- if ch =3D=3D '[': +- return self.fetch_flow_sequence_start() +- +- # Is it the flow mapping start indicator? +- if ch =3D=3D '{': +- return self.fetch_flow_mapping_start() +- +- # Is it the flow sequence end indicator? +- if ch =3D=3D ']': +- return self.fetch_flow_sequence_end() +- +- # Is it the flow mapping end indicator? +- if ch =3D=3D '}': +- return self.fetch_flow_mapping_end() +- +- # Is it the flow entry indicator? +- if ch =3D=3D ',': +- return self.fetch_flow_entry() +- +- # Is it the block entry indicator? +- if ch =3D=3D '-' and self.check_block_entry(): +- return self.fetch_block_entry() +- +- # Is it the key indicator? +- if ch =3D=3D '?' and self.check_key(): +- return self.fetch_key() +- +- # Is it the value indicator? +- if ch =3D=3D ':' and self.check_value(): +- return self.fetch_value() +- +- # Is it an alias? +- if ch =3D=3D '*': +- return self.fetch_alias() +- +- # Is it an anchor? +- if ch =3D=3D '&': +- return self.fetch_anchor() +- +- # Is it a tag? +- if ch =3D=3D '!': +- return self.fetch_tag() +- +- # Is it a literal scalar? +- if ch =3D=3D '|' and not self.flow_level: +- return self.fetch_literal() +- +- # Is it a folded scalar? +- if ch =3D=3D '>' and not self.flow_level: +- return self.fetch_folded() +- +- # Is it a single quoted scalar? +- if ch =3D=3D "'": +- return self.fetch_single() +- +- # Is it a double quoted scalar? +- if ch =3D=3D '"': +- return self.fetch_double() +- +- # It must be a plain scalar then. +- if self.check_plain(): +- return self.fetch_plain() +- +- # No? It's an error. Let's produce a nice error message. +- raise ScannerError( +- 'while scanning for the next token', +- None, +- 'found character %r that cannot start any token' % utf8(ch), +- self.reader.get_mark(), +- ) +- +- # Simple keys treatment. +- +- def next_possible_simple_key(self): +- # type: () -> Any +- # Return the number of the nearest possible simple key. Actually = we +- # don't need to loop through the whole dictionary. We may replace= it +- # with the following code: +- # if not self.possible_simple_keys: +- # return None +- # return self.possible_simple_keys[ +- # min(self.possible_simple_keys.keys())].token_number +- min_token_number =3D None +- for level in self.possible_simple_keys: +- key =3D self.possible_simple_keys[level] +- if min_token_number is None or key.token_number < min_token_n= umber: +- min_token_number =3D key.token_number +- return min_token_number +- +- def stale_possible_simple_keys(self): +- # type: () -> None +- # Remove entries that are no longer possible simple keys. Accordi= ng to +- # the YAML specification, simple keys +- # - should be limited to a single line, +- # - should be no longer than 1024 characters. +- # Disabling this procedure will allow simple keys of any length a= nd +- # height (may cause problems if indentation is broken though). +- for level in list(self.possible_simple_keys): +- key =3D self.possible_simple_keys[level] +- if key.line !=3D self.reader.line or self.reader.index - key.= index > 1024: +- if key.required: +- raise ScannerError( +- 'while scanning a simple key', +- key.mark, +- "could not find expected ':'", +- self.reader.get_mark(), +- ) +- del self.possible_simple_keys[level] +- +- def save_possible_simple_key(self): +- # type: () -> None +- # The next token may start a simple key. We check if it's possible +- # and save its position. This function is called for +- # ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'. +- +- # Check if a simple key is required at the current position. +- required =3D not self.flow_level and self.indent =3D=3D self.read= er.column +- +- # The next token might be a simple key. Let's save it's number and +- # position. +- if self.allow_simple_key: +- self.remove_possible_simple_key() +- token_number =3D self.tokens_taken + len(self.tokens) +- key =3D SimpleKey( +- token_number, +- required, +- self.reader.index, +- self.reader.line, +- self.reader.column, +- self.reader.get_mark(), +- ) +- self.possible_simple_keys[self.flow_level] =3D key +- +- def remove_possible_simple_key(self): +- # type: () -> None +- # Remove the saved possible key position at the current flow leve= l. +- if self.flow_level in self.possible_simple_keys: +- key =3D self.possible_simple_keys[self.flow_level] +- +- if key.required: +- raise ScannerError( +- 'while scanning a simple key', +- key.mark, +- "could not find expected ':'", +- self.reader.get_mark(), +- ) +- +- del self.possible_simple_keys[self.flow_level] +- +- # Indentation functions. +- +- def unwind_indent(self, column): +- # type: (Any) -> None +- # In flow context, tokens should respect indentation. +- # Actually the condition should be `self.indent >=3D column` acco= rding to +- # the spec. But this condition will prohibit intuitively correct +- # constructions such as +- # key : { +- # } +- # #### +- # if self.flow_level and self.indent > column: +- # raise ScannerError(None, None, +- # "invalid intendation or unclosed '[' or '{'", +- # self.reader.get_mark()) +- +- # In the flow context, indentation is ignored. We make the scanne= r less +- # restrictive then specification requires. +- if bool(self.flow_level): +- return +- +- # In block context, we may need to issue the BLOCK-END tokens. +- while self.indent > column: +- mark =3D self.reader.get_mark() +- self.indent =3D self.indents.pop() +- self.tokens.append(BlockEndToken(mark, mark)) +- +- def add_indent(self, column): +- # type: (int) -> bool +- # Check if we need to increase indentation. +- if self.indent < column: +- self.indents.append(self.indent) +- self.indent =3D column +- return True +- return False +- +- # Fetchers. +- +- def fetch_stream_start(self): +- # type: () -> None +- # We always add STREAM-START as the first token and STREAM-END as= the +- # last token. +- # Read the token. +- mark =3D self.reader.get_mark() +- # Add STREAM-START. +- self.tokens.append(StreamStartToken(mark, mark, encoding=3Dself.r= eader.encoding)) +- +- def fetch_stream_end(self): +- # type: () -> None +- # Set the current intendation to -1. +- self.unwind_indent(-1) +- # Reset simple keys. +- self.remove_possible_simple_key() +- self.allow_simple_key =3D False +- self.possible_simple_keys =3D {} +- # Read the token. +- mark =3D self.reader.get_mark() +- # Add STREAM-END. +- self.tokens.append(StreamEndToken(mark, mark)) +- # The steam is finished. +- self.done =3D True +- +- def fetch_directive(self): +- # type: () -> None +- # Set the current intendation to -1. +- self.unwind_indent(-1) +- +- # Reset simple keys. +- self.remove_possible_simple_key() +- self.allow_simple_key =3D False +- +- # Scan and add DIRECTIVE. +- self.tokens.append(self.scan_directive()) +- +- def fetch_document_start(self): +- # type: () -> None +- self.fetch_document_indicator(DocumentStartToken) +- +- def fetch_document_end(self): +- # type: () -> None +- self.fetch_document_indicator(DocumentEndToken) +- +- def fetch_document_indicator(self, TokenClass): +- # type: (Any) -> None +- # Set the current intendation to -1. +- self.unwind_indent(-1) +- +- # Reset simple keys. Note that there could not be a block collect= ion +- # after '---'. +- self.remove_possible_simple_key() +- self.allow_simple_key =3D False +- +- # Add DOCUMENT-START or DOCUMENT-END. +- start_mark =3D self.reader.get_mark() +- self.reader.forward(3) +- end_mark =3D self.reader.get_mark() +- self.tokens.append(TokenClass(start_mark, end_mark)) +- +- def fetch_flow_sequence_start(self): +- # type: () -> None +- self.fetch_flow_collection_start(FlowSequenceStartToken, to_push= =3D'[') +- +- def fetch_flow_mapping_start(self): +- # type: () -> None +- self.fetch_flow_collection_start(FlowMappingStartToken, to_push= =3D'{') +- +- def fetch_flow_collection_start(self, TokenClass, to_push): +- # type: (Any, Text) -> None +- # '[' and '{' may start a simple key. +- self.save_possible_simple_key() +- # Increase the flow level. +- self.flow_context.append(to_push) +- # Simple keys are allowed after '[' and '{'. +- self.allow_simple_key =3D True +- # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START. +- start_mark =3D self.reader.get_mark() +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- self.tokens.append(TokenClass(start_mark, end_mark)) +- +- def fetch_flow_sequence_end(self): +- # type: () -> None +- self.fetch_flow_collection_end(FlowSequenceEndToken) +- +- def fetch_flow_mapping_end(self): +- # type: () -> None +- self.fetch_flow_collection_end(FlowMappingEndToken) +- +- def fetch_flow_collection_end(self, TokenClass): +- # type: (Any) -> None +- # Reset possible simple key on the current level. +- self.remove_possible_simple_key() +- # Decrease the flow level. +- try: +- popped =3D self.flow_context.pop() # NOQA +- except IndexError: +- # We must not be in a list or object. +- # Defer error handling to the parser. +- pass +- # No simple keys after ']' or '}'. +- self.allow_simple_key =3D False +- # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END. +- start_mark =3D self.reader.get_mark() +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- self.tokens.append(TokenClass(start_mark, end_mark)) +- +- def fetch_flow_entry(self): +- # type: () -> None +- # Simple keys are allowed after ','. +- self.allow_simple_key =3D True +- # Reset possible simple key on the current level. +- self.remove_possible_simple_key() +- # Add FLOW-ENTRY. +- start_mark =3D self.reader.get_mark() +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- self.tokens.append(FlowEntryToken(start_mark, end_mark)) +- +- def fetch_block_entry(self): +- # type: () -> None +- # Block context needs additional checks. +- if not self.flow_level: +- # Are we allowed to start a new entry? +- if not self.allow_simple_key: +- raise ScannerError( +- None, None, 'sequence entries are not allowed here', = self.reader.get_mark() +- ) +- # We may need to add BLOCK-SEQUENCE-START. +- if self.add_indent(self.reader.column): +- mark =3D self.reader.get_mark() +- self.tokens.append(BlockSequenceStartToken(mark, mark)) +- # It's an error for the block entry to occur in the flow context, +- # but we let the parser detect this. +- else: +- pass +- # Simple keys are allowed after '-'. +- self.allow_simple_key =3D True +- # Reset possible simple key on the current level. +- self.remove_possible_simple_key() +- +- # Add BLOCK-ENTRY. +- start_mark =3D self.reader.get_mark() +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- self.tokens.append(BlockEntryToken(start_mark, end_mark)) +- +- def fetch_key(self): +- # type: () -> None +- # Block context needs additional checks. +- if not self.flow_level: +- +- # Are we allowed to start a key (not nessesary a simple)? +- if not self.allow_simple_key: +- raise ScannerError( +- None, None, 'mapping keys are not allowed here', self= .reader.get_mark() +- ) +- +- # We may need to add BLOCK-MAPPING-START. +- if self.add_indent(self.reader.column): +- mark =3D self.reader.get_mark() +- self.tokens.append(BlockMappingStartToken(mark, mark)) +- +- # Simple keys are allowed after '?' in the block context. +- self.allow_simple_key =3D not self.flow_level +- +- # Reset possible simple key on the current level. +- self.remove_possible_simple_key() +- +- # Add KEY. +- start_mark =3D self.reader.get_mark() +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- self.tokens.append(KeyToken(start_mark, end_mark)) +- +- def fetch_value(self): +- # type: () -> None +- # Do we determine a simple key? +- if self.flow_level in self.possible_simple_keys: +- # Add KEY. +- key =3D self.possible_simple_keys[self.flow_level] +- del self.possible_simple_keys[self.flow_level] +- self.tokens.insert( +- key.token_number - self.tokens_taken, KeyToken(key.mark, = key.mark) +- ) +- +- # If this key starts a new block mapping, we need to add +- # BLOCK-MAPPING-START. +- if not self.flow_level: +- if self.add_indent(key.column): +- self.tokens.insert( +- key.token_number - self.tokens_taken, +- BlockMappingStartToken(key.mark, key.mark), +- ) +- +- # There cannot be two simple keys one after another. +- self.allow_simple_key =3D False +- +- # It must be a part of a complex key. +- else: +- +- # Block context needs additional checks. +- # (Do we really need them? They will be caught by the parser +- # anyway.) +- if not self.flow_level: +- +- # We are allowed to start a complex value if and only if +- # we can start a simple key. +- if not self.allow_simple_key: +- raise ScannerError( +- None, +- None, +- 'mapping values are not allowed here', +- self.reader.get_mark(), +- ) +- +- # If this value starts a new block mapping, we need to add +- # BLOCK-MAPPING-START. It will be detected as an error later= by +- # the parser. +- if not self.flow_level: +- if self.add_indent(self.reader.column): +- mark =3D self.reader.get_mark() +- self.tokens.append(BlockMappingStartToken(mark, mark)) +- +- # Simple keys are allowed after ':' in the block context. +- self.allow_simple_key =3D not self.flow_level +- +- # Reset possible simple key on the current level. +- self.remove_possible_simple_key() +- +- # Add VALUE. +- start_mark =3D self.reader.get_mark() +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- self.tokens.append(ValueToken(start_mark, end_mark)) +- +- def fetch_alias(self): +- # type: () -> None +- # ALIAS could be a simple key. +- self.save_possible_simple_key() +- # No simple keys after ALIAS. +- self.allow_simple_key =3D False +- # Scan and add ALIAS. +- self.tokens.append(self.scan_anchor(AliasToken)) +- +- def fetch_anchor(self): +- # type: () -> None +- # ANCHOR could start a simple key. +- self.save_possible_simple_key() +- # No simple keys after ANCHOR. +- self.allow_simple_key =3D False +- # Scan and add ANCHOR. +- self.tokens.append(self.scan_anchor(AnchorToken)) +- +- def fetch_tag(self): +- # type: () -> None +- # TAG could start a simple key. +- self.save_possible_simple_key() +- # No simple keys after TAG. +- self.allow_simple_key =3D False +- # Scan and add TAG. +- self.tokens.append(self.scan_tag()) +- +- def fetch_literal(self): +- # type: () -> None +- self.fetch_block_scalar(style=3D'|') +- +- def fetch_folded(self): +- # type: () -> None +- self.fetch_block_scalar(style=3D'>') +- +- def fetch_block_scalar(self, style): +- # type: (Any) -> None +- # A simple key may follow a block scalar. +- self.allow_simple_key =3D True +- # Reset possible simple key on the current level. +- self.remove_possible_simple_key() +- # Scan and add SCALAR. +- self.tokens.append(self.scan_block_scalar(style)) +- +- def fetch_single(self): +- # type: () -> None +- self.fetch_flow_scalar(style=3D"'") +- +- def fetch_double(self): +- # type: () -> None +- self.fetch_flow_scalar(style=3D'"') +- +- def fetch_flow_scalar(self, style): +- # type: (Any) -> None +- # A flow scalar could be a simple key. +- self.save_possible_simple_key() +- # No simple keys after flow scalars. +- self.allow_simple_key =3D False +- # Scan and add SCALAR. +- self.tokens.append(self.scan_flow_scalar(style)) +- +- def fetch_plain(self): +- # type: () -> None +- # A plain scalar could be a simple key. +- self.save_possible_simple_key() +- # No simple keys after plain scalars. But note that `scan_plain` = will +- # change this flag if the scan is finished at the beginning of the +- # line. +- self.allow_simple_key =3D False +- # Scan and add SCALAR. May change `allow_simple_key`. +- self.tokens.append(self.scan_plain()) +- +- # Checkers. +- +- def check_directive(self): +- # type: () -> Any +- # DIRECTIVE: ^ '%' ... +- # The '%' indicator is already checked. +- if self.reader.column =3D=3D 0: +- return True +- return None +- +- def check_document_start(self): +- # type: () -> Any +- # DOCUMENT-START: ^ '---' (' '|'\n') +- if self.reader.column =3D=3D 0: +- if self.reader.prefix(3) =3D=3D '---' and self.reader.peek(3)= in _THE_END_SPACE_TAB: +- return True +- return None +- +- def check_document_end(self): +- # type: () -> Any +- # DOCUMENT-END: ^ '...' (' '|'\n') +- if self.reader.column =3D=3D 0: +- if self.reader.prefix(3) =3D=3D '...' and self.reader.peek(3)= in _THE_END_SPACE_TAB: +- return True +- return None +- +- def check_block_entry(self): +- # type: () -> Any +- # BLOCK-ENTRY: '-' (' '|'\n') +- return self.reader.peek(1) in _THE_END_SPACE_TAB +- +- def check_key(self): +- # type: () -> Any +- # KEY(flow context): '?' +- if bool(self.flow_level): +- return True +- # KEY(block context): '?' (' '|'\n') +- return self.reader.peek(1) in _THE_END_SPACE_TAB +- +- def check_value(self): +- # type: () -> Any +- # VALUE(flow context): ':' +- if self.scanner_processing_version =3D=3D (1, 1): +- if bool(self.flow_level): +- return True +- else: +- if bool(self.flow_level): +- if self.flow_context[-1] =3D=3D '[': +- if self.reader.peek(1) not in _THE_END_SPACE_TAB: +- return False +- elif self.tokens and isinstance(self.tokens[-1], ValueTok= en): +- # mapping flow context scanning a value token +- if self.reader.peek(1) not in _THE_END_SPACE_TAB: +- return False +- return True +- # VALUE(block context): ':' (' '|'\n') +- return self.reader.peek(1) in _THE_END_SPACE_TAB +- +- def check_plain(self): +- # type: () -> Any +- # A plain scalar may start with any non-space character except: +- # '-', '?', ':', ',', '[', ']', '{', '}', +- # '#', '&', '*', '!', '|', '>', '\'', '\"', +- # '%', '@', '`'. +- # +- # It may also start with +- # '-', '?', ':' +- # if it is followed by a non-space character. +- # +- # Note that we limit the last rule to the block context (except t= he +- # '-' character) because we want the flow context to be space +- # independent. +- srp =3D self.reader.peek +- ch =3D srp() +- if self.scanner_processing_version =3D=3D (1, 1): +- return ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'"%= @`' or ( +- srp(1) not in _THE_END_SPACE_TAB +- and (ch =3D=3D '-' or (not self.flow_level and ch in '?:'= )) +- ) +- # YAML 1.2 +- if ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'"%@`': +- # ################### ^ ??? +- return True +- ch1 =3D srp(1) +- if ch =3D=3D '-' and ch1 not in _THE_END_SPACE_TAB: +- return True +- if ch =3D=3D ':' and bool(self.flow_level) and ch1 not in _SPACE_= TAB: +- return True +- +- return srp(1) not in _THE_END_SPACE_TAB and ( +- ch =3D=3D '-' or (not self.flow_level and ch in '?:') +- ) +- +- # Scanners. +- +- def scan_to_next_token(self): +- # type: () -> Any +- # We ignore spaces, line breaks and comments. +- # If we find a line break in the block context, we set the flag +- # `allow_simple_key` on. +- # The byte order mark is stripped if it's the first character in = the +- # stream. We do not yet support BOM inside the stream as the +- # specification requires. Any such mark will be considered as a p= art +- # of the document. +- # +- # TODO: We need to make tab handling rules more sane. A good rule= is +- # Tabs cannot precede tokens +- # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, +- # KEY(block), VALUE(block), BLOCK-ENTRY +- # So the checking code is +- # if : +- # self.allow_simple_keys =3D False +- # We also need to add the check for `allow_simple_keys =3D=3D Tru= e` to +- # `unwind_indent` before issuing BLOCK-END. +- # Scanners for block, flow, and plain scalars need to be modified. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- if self.reader.index =3D=3D 0 and srp() =3D=3D '\uFEFF': +- srf() +- found =3D False +- _the_end =3D _THE_END +- while not found: +- while srp() =3D=3D ' ': +- srf() +- if srp() =3D=3D '#': +- while srp() not in _the_end: +- srf() +- if self.scan_line_break(): +- if not self.flow_level: +- self.allow_simple_key =3D True +- else: +- found =3D True +- return None +- +- def scan_directive(self): +- # type: () -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- start_mark =3D self.reader.get_mark() +- srf() +- name =3D self.scan_directive_name(start_mark) +- value =3D None +- if name =3D=3D 'YAML': +- value =3D self.scan_yaml_directive_value(start_mark) +- end_mark =3D self.reader.get_mark() +- elif name =3D=3D 'TAG': +- value =3D self.scan_tag_directive_value(start_mark) +- end_mark =3D self.reader.get_mark() +- else: +- end_mark =3D self.reader.get_mark() +- while srp() not in _THE_END: +- srf() +- self.scan_directive_ignored_line(start_mark) +- return DirectiveToken(name, value, start_mark, end_mark) +- +- def scan_directive_name(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- length =3D 0 +- srp =3D self.reader.peek +- ch =3D srp(length) +- while '0' <=3D ch <=3D '9' or 'A' <=3D ch <=3D 'Z' or 'a' <=3D ch= <=3D 'z' or ch in '-_:.': +- length +=3D 1 +- ch =3D srp(length) +- if not length: +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- 'expected alphabetic or numeric character, but found %r' = % utf8(ch), +- self.reader.get_mark(), +- ) +- value =3D self.reader.prefix(length) +- self.reader.forward(length) +- ch =3D srp() +- if ch not in '\0 \r\n\x85\u2028\u2029': +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- 'expected alphabetic or numeric character, but found %r' = % utf8(ch), +- self.reader.get_mark(), +- ) +- return value +- +- def scan_yaml_directive_value(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- while srp() =3D=3D ' ': +- srf() +- major =3D self.scan_yaml_directive_number(start_mark) +- if srp() !=3D '.': +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- "expected a digit or '.', but found %r" % utf8(srp()), +- self.reader.get_mark(), +- ) +- srf() +- minor =3D self.scan_yaml_directive_number(start_mark) +- if srp() not in '\0 \r\n\x85\u2028\u2029': +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- "expected a digit or ' ', but found %r" % utf8(srp()), +- self.reader.get_mark(), +- ) +- self.yaml_version =3D (major, minor) +- return self.yaml_version +- +- def scan_yaml_directive_number(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- ch =3D srp() +- if not ('0' <=3D ch <=3D '9'): +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- 'expected a digit, but found %r' % utf8(ch), +- self.reader.get_mark(), +- ) +- length =3D 0 +- while '0' <=3D srp(length) <=3D '9': +- length +=3D 1 +- value =3D int(self.reader.prefix(length)) +- srf(length) +- return value +- +- def scan_tag_directive_value(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- while srp() =3D=3D ' ': +- srf() +- handle =3D self.scan_tag_directive_handle(start_mark) +- while srp() =3D=3D ' ': +- srf() +- prefix =3D self.scan_tag_directive_prefix(start_mark) +- return (handle, prefix) +- +- def scan_tag_directive_handle(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- value =3D self.scan_tag_handle('directive', start_mark) +- ch =3D self.reader.peek() +- if ch !=3D ' ': +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- "expected ' ', but found %r" % utf8(ch), +- self.reader.get_mark(), +- ) +- return value +- +- def scan_tag_directive_prefix(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- value =3D self.scan_tag_uri('directive', start_mark) +- ch =3D self.reader.peek() +- if ch not in '\0 \r\n\x85\u2028\u2029': +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- "expected ' ', but found %r" % utf8(ch), +- self.reader.get_mark(), +- ) +- return value +- +- def scan_directive_ignored_line(self, start_mark): +- # type: (Any) -> None +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- while srp() =3D=3D ' ': +- srf() +- if srp() =3D=3D '#': +- while srp() not in _THE_END: +- srf() +- ch =3D srp() +- if ch not in _THE_END: +- raise ScannerError( +- 'while scanning a directive', +- start_mark, +- 'expected a comment or a line break, but found %r' % utf8= (ch), +- self.reader.get_mark(), +- ) +- self.scan_line_break() +- +- def scan_anchor(self, TokenClass): +- # type: (Any) -> Any +- # The specification does not restrict characters for anchors and +- # aliases. This may lead to problems, for instance, the document: +- # [ *alias, value ] +- # can be interpteted in two ways, as +- # [ "value" ] +- # and +- # [ *alias , "value" ] +- # Therefore we restrict aliases to numbers and ASCII letters. +- srp =3D self.reader.peek +- start_mark =3D self.reader.get_mark() +- indicator =3D srp() +- if indicator =3D=3D '*': +- name =3D 'alias' +- else: +- name =3D 'anchor' +- self.reader.forward() +- length =3D 0 +- ch =3D srp(length) +- # while u'0' <=3D ch <=3D u'9' or u'A' <=3D ch <=3D u'Z' or u'a' = <=3D ch <=3D u'z' \ +- # or ch in u'-_': +- while check_anchorname_char(ch): +- length +=3D 1 +- ch =3D srp(length) +- if not length: +- raise ScannerError( +- 'while scanning an %s' % (name,), +- start_mark, +- 'expected alphabetic or numeric character, but found %r' = % utf8(ch), +- self.reader.get_mark(), +- ) +- value =3D self.reader.prefix(length) +- self.reader.forward(length) +- # ch1 =3D ch +- # ch =3D srp() # no need to peek, ch is already set +- # assert ch1 =3D=3D ch +- if ch not in '\0 \t\r\n\x85\u2028\u2029?:,[]{}%@`': +- raise ScannerError( +- 'while scanning an %s' % (name,), +- start_mark, +- 'expected alphabetic or numeric character, but found %r' = % utf8(ch), +- self.reader.get_mark(), +- ) +- end_mark =3D self.reader.get_mark() +- return TokenClass(value, start_mark, end_mark) +- +- def scan_tag(self): +- # type: () -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- start_mark =3D self.reader.get_mark() +- ch =3D srp(1) +- if ch =3D=3D '<': +- handle =3D None +- self.reader.forward(2) +- suffix =3D self.scan_tag_uri('tag', start_mark) +- if srp() !=3D '>': +- raise ScannerError( +- 'while parsing a tag', +- start_mark, +- "expected '>', but found %r" % utf8(srp()), +- self.reader.get_mark(), +- ) +- self.reader.forward() +- elif ch in _THE_END_SPACE_TAB: +- handle =3D None +- suffix =3D '!' +- self.reader.forward() +- else: +- length =3D 1 +- use_handle =3D False +- while ch not in '\0 \r\n\x85\u2028\u2029': +- if ch =3D=3D '!': +- use_handle =3D True +- break +- length +=3D 1 +- ch =3D srp(length) +- handle =3D '!' +- if use_handle: +- handle =3D self.scan_tag_handle('tag', start_mark) +- else: +- handle =3D '!' +- self.reader.forward() +- suffix =3D self.scan_tag_uri('tag', start_mark) +- ch =3D srp() +- if ch not in '\0 \r\n\x85\u2028\u2029': +- raise ScannerError( +- 'while scanning a tag', +- start_mark, +- "expected ' ', but found %r" % utf8(ch), +- self.reader.get_mark(), +- ) +- value =3D (handle, suffix) +- end_mark =3D self.reader.get_mark() +- return TagToken(value, start_mark, end_mark) +- +- def scan_block_scalar(self, style, rt=3DFalse): +- # type: (Any, Optional[bool]) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- if style =3D=3D '>': +- folded =3D True +- else: +- folded =3D False +- +- chunks =3D [] # type: List[Any] +- start_mark =3D self.reader.get_mark() +- +- # Scan the header. +- self.reader.forward() +- chomping, increment =3D self.scan_block_scalar_indicators(start_m= ark) +- # block scalar comment e.g. : |+ # comment text +- block_scalar_comment =3D self.scan_block_scalar_ignored_line(star= t_mark) +- +- # Determine the indentation level and go to the first non-empty l= ine. +- min_indent =3D self.indent + 1 +- if increment is None: +- # no increment and top level, min_indent could be 0 +- if min_indent < 1 and ( +- style not in '|>' +- or (self.scanner_processing_version =3D=3D (1, 1)) +- and getattr( +- self.loader, 'top_level_block_style_scalar_no_indent_= error_1_1', False +- ) +- ): +- min_indent =3D 1 +- breaks, max_indent, end_mark =3D self.scan_block_scalar_inden= tation() +- indent =3D max(min_indent, max_indent) +- else: +- if min_indent < 1: +- min_indent =3D 1 +- indent =3D min_indent + increment - 1 +- breaks, end_mark =3D self.scan_block_scalar_breaks(indent) +- line_break =3D "" +- +- # Scan the inner part of the block scalar. +- while self.reader.column =3D=3D indent and srp() !=3D '\0': +- chunks.extend(breaks) +- leading_non_space =3D srp() not in ' \t' +- length =3D 0 +- while srp(length) not in _THE_END: +- length +=3D 1 +- chunks.append(self.reader.prefix(length)) +- self.reader.forward(length) +- line_break =3D self.scan_line_break() +- breaks, end_mark =3D self.scan_block_scalar_breaks(indent) +- if style in '|>' and min_indent =3D=3D 0: +- # at the beginning of a line, if in block style see if +- # end of document/start_new_document +- if self.check_document_start() or self.check_document_end= (): +- break +- if self.reader.column =3D=3D indent and srp() !=3D '\0': +- +- # Unfortunately, folding rules are ambiguous. +- # +- # This is the folding according to the specification: +- +- if rt and folded and line_break =3D=3D '\n': +- chunks.append('\a') +- if folded and line_break =3D=3D '\n' and leading_non_spac= e and srp() not in ' \t': +- if not breaks: +- chunks.append(' ') +- else: +- chunks.append(line_break) +- +- # This is Clark Evans's interpretation (also in the spec +- # examples): +- # +- # if folded and line_break =3D=3D u'\n': +- # if not breaks: +- # if srp() not in ' \t': +- # chunks.append(u' ') +- # else: +- # chunks.append(line_break) +- # else: +- # chunks.append(line_break) +- else: +- break +- +- # Process trailing line breaks. The 'chomping' setting determines +- # whether they are included in the value. +- trailing =3D [] # type: List[Any] +- if chomping in [None, True]: +- chunks.append(line_break) +- if chomping is True: +- chunks.extend(breaks) +- elif chomping in [None, False]: +- trailing.extend(breaks) +- +- # We are done. +- token =3D ScalarToken("".join(chunks), False, start_mark, end_mar= k, style) +- if block_scalar_comment is not None: +- token.add_pre_comments([block_scalar_comment]) +- if len(trailing) > 0: +- # nprint('trailing 1', trailing) # XXXXX +- # Eat whitespaces and comments until we reach the next token. +- comment =3D self.scan_to_next_token() +- while comment: +- trailing.append(' ' * comment[1].column + comment[0]) +- comment =3D self.scan_to_next_token() +- +- # Keep track of the trailing whitespace and following comments +- # as a comment token, if isn't all included in the actual val= ue. +- comment_end_mark =3D self.reader.get_mark() +- comment =3D CommentToken("".join(trailing), end_mark, comment= _end_mark) +- token.add_post_comment(comment) +- return token +- +- def scan_block_scalar_indicators(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- chomping =3D None +- increment =3D None +- ch =3D srp() +- if ch in '+-': +- if ch =3D=3D '+': +- chomping =3D True +- else: +- chomping =3D False +- self.reader.forward() +- ch =3D srp() +- if ch in '0123456789': +- increment =3D int(ch) +- if increment =3D=3D 0: +- raise ScannerError( +- 'while scanning a block scalar', +- start_mark, +- 'expected indentation indicator in the range 1-9,= ' 'but found 0', +- self.reader.get_mark(), +- ) +- self.reader.forward() +- elif ch in '0123456789': +- increment =3D int(ch) +- if increment =3D=3D 0: +- raise ScannerError( +- 'while scanning a block scalar', +- start_mark, +- 'expected indentation indicator in the range 1-9, ' '= but found 0', +- self.reader.get_mark(), +- ) +- self.reader.forward() +- ch =3D srp() +- if ch in '+-': +- if ch =3D=3D '+': +- chomping =3D True +- else: +- chomping =3D False +- self.reader.forward() +- ch =3D srp() +- if ch not in '\0 \r\n\x85\u2028\u2029': +- raise ScannerError( +- 'while scanning a block scalar', +- start_mark, +- 'expected chomping or indentation indicators, but found %= r' % utf8(ch), +- self.reader.get_mark(), +- ) +- return chomping, increment +- +- def scan_block_scalar_ignored_line(self, start_mark): +- # type: (Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- prefix =3D '' +- comment =3D None +- while srp() =3D=3D ' ': +- prefix +=3D srp() +- srf() +- if srp() =3D=3D '#': +- comment =3D prefix +- while srp() not in _THE_END: +- comment +=3D srp() +- srf() +- ch =3D srp() +- if ch not in _THE_END: +- raise ScannerError( +- 'while scanning a block scalar', +- start_mark, +- 'expected a comment or a line break, but found %r' % utf8= (ch), +- self.reader.get_mark(), +- ) +- self.scan_line_break() +- return comment +- +- def scan_block_scalar_indentation(self): +- # type: () -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- chunks =3D [] +- max_indent =3D 0 +- end_mark =3D self.reader.get_mark() +- while srp() in ' \r\n\x85\u2028\u2029': +- if srp() !=3D ' ': +- chunks.append(self.scan_line_break()) +- end_mark =3D self.reader.get_mark() +- else: +- srf() +- if self.reader.column > max_indent: +- max_indent =3D self.reader.column +- return chunks, max_indent, end_mark +- +- def scan_block_scalar_breaks(self, indent): +- # type: (int) -> Any +- # See the specification for details. +- chunks =3D [] +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- end_mark =3D self.reader.get_mark() +- while self.reader.column < indent and srp() =3D=3D ' ': +- srf() +- while srp() in '\r\n\x85\u2028\u2029': +- chunks.append(self.scan_line_break()) +- end_mark =3D self.reader.get_mark() +- while self.reader.column < indent and srp() =3D=3D ' ': +- srf() +- return chunks, end_mark +- +- def scan_flow_scalar(self, style): +- # type: (Any) -> Any +- # See the specification for details. +- # Note that we loose indentation rules for quoted scalars. Quoted +- # scalars don't need to adhere indentation because " and ' clearly +- # mark the beginning and the end of them. Therefore we are less +- # restrictive then the specification requires. We only need to ch= eck +- # that document separators are not included in scalars. +- if style =3D=3D '"': +- double =3D True +- else: +- double =3D False +- srp =3D self.reader.peek +- chunks =3D [] # type: List[Any] +- start_mark =3D self.reader.get_mark() +- quote =3D srp() +- self.reader.forward() +- chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark= )) +- while srp() !=3D quote: +- chunks.extend(self.scan_flow_scalar_spaces(double, start_mark= )) +- chunks.extend(self.scan_flow_scalar_non_spaces(double, start_= mark)) +- self.reader.forward() +- end_mark =3D self.reader.get_mark() +- return ScalarToken("".join(chunks), False, start_mark, end_mark, = style) +- +- ESCAPE_REPLACEMENTS =3D { +- '0': '\0', +- 'a': '\x07', +- 'b': '\x08', +- 't': '\x09', +- '\t': '\x09', +- 'n': '\x0A', +- 'v': '\x0B', +- 'f': '\x0C', +- 'r': '\x0D', +- 'e': '\x1B', +- ' ': '\x20', +- '"': '"', +- '/': '/', # as per http://www.json.org/ +- '\\': '\\', +- 'N': '\x85', +- '_': '\xA0', +- 'L': '\u2028', +- 'P': '\u2029', +- } +- +- ESCAPE_CODES =3D {'x': 2, 'u': 4, 'U': 8} +- +- def scan_flow_scalar_non_spaces(self, double, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- chunks =3D [] # type: List[Any] +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- while True: +- length =3D 0 +- while srp(length) not in ' \n\'"\\\0\t\r\x85\u2028\u2029': +- length +=3D 1 +- if length !=3D 0: +- chunks.append(self.reader.prefix(length)) +- srf(length) +- ch =3D srp() +- if not double and ch =3D=3D "'" and srp(1) =3D=3D "'": +- chunks.append("'") +- srf(2) +- elif (double and ch =3D=3D "'") or (not double and ch in '"\\= '): +- chunks.append(ch) +- srf() +- elif double and ch =3D=3D '\\': +- srf() +- ch =3D srp() +- if ch in self.ESCAPE_REPLACEMENTS: +- chunks.append(self.ESCAPE_REPLACEMENTS[ch]) +- srf() +- elif ch in self.ESCAPE_CODES: +- length =3D self.ESCAPE_CODES[ch] +- srf() +- for k in range(length): +- if srp(k) not in '0123456789ABCDEFabcdef': +- raise ScannerError( +- 'while scanning a double-quoted scalar', +- start_mark, +- 'expected escape sequence of %d hexdecima= l ' +- 'numbers, but found %r' % (length, utf8(s= rp(k))), +- self.reader.get_mark(), +- ) +- code =3D int(self.reader.prefix(length), 16) +- chunks.append(unichr(code)) +- srf(length) +- elif ch in '\n\r\x85\u2028\u2029': +- self.scan_line_break() +- chunks.extend(self.scan_flow_scalar_breaks(double, st= art_mark)) +- else: +- raise ScannerError( +- 'while scanning a double-quoted scalar', +- start_mark, +- 'found unknown escape character %r' % utf8(ch), +- self.reader.get_mark(), +- ) +- else: +- return chunks +- +- def scan_flow_scalar_spaces(self, double, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- chunks =3D [] +- length =3D 0 +- while srp(length) in ' \t': +- length +=3D 1 +- whitespaces =3D self.reader.prefix(length) +- self.reader.forward(length) +- ch =3D srp() +- if ch =3D=3D '\0': +- raise ScannerError( +- 'while scanning a quoted scalar', +- start_mark, +- 'found unexpected end of stream', +- self.reader.get_mark(), +- ) +- elif ch in '\r\n\x85\u2028\u2029': +- line_break =3D self.scan_line_break() +- breaks =3D self.scan_flow_scalar_breaks(double, start_mark) +- if line_break !=3D '\n': +- chunks.append(line_break) +- elif not breaks: +- chunks.append(' ') +- chunks.extend(breaks) +- else: +- chunks.append(whitespaces) +- return chunks +- +- def scan_flow_scalar_breaks(self, double, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- chunks =3D [] # type: List[Any] +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- while True: +- # Instead of checking indentation, we check for document +- # separators. +- prefix =3D self.reader.prefix(3) +- if (prefix =3D=3D '---' or prefix =3D=3D '...') and srp(3) in= _THE_END_SPACE_TAB: +- raise ScannerError( +- 'while scanning a quoted scalar', +- start_mark, +- 'found unexpected document separator', +- self.reader.get_mark(), +- ) +- while srp() in ' \t': +- srf() +- if srp() in '\r\n\x85\u2028\u2029': +- chunks.append(self.scan_line_break()) +- else: +- return chunks +- +- def scan_plain(self): +- # type: () -> Any +- # See the specification for details. +- # We add an additional restriction for the flow context: +- # plain scalars in the flow context cannot contain ',', ': ' a= nd '?'. +- # We also keep track of the `allow_simple_key` flag here. +- # Indentation rules are loosed for the flow context. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- chunks =3D [] # type: List[Any] +- start_mark =3D self.reader.get_mark() +- end_mark =3D start_mark +- indent =3D self.indent + 1 +- # We allow zero indentation for scalars, but then we need to chec= k for +- # document separators at the beginning of the line. +- # if indent =3D=3D 0: +- # indent =3D 1 +- spaces =3D [] # type: List[Any] +- while True: +- length =3D 0 +- if srp() =3D=3D '#': +- break +- while True: +- ch =3D srp(length) +- if ch =3D=3D ':' and srp(length + 1) not in _THE_END_SPAC= E_TAB: +- pass +- elif ch =3D=3D '?' and self.scanner_processing_version != =3D (1, 1): +- pass +- elif ( +- ch in _THE_END_SPACE_TAB +- or ( +- not self.flow_level +- and ch =3D=3D ':' +- and srp(length + 1) in _THE_END_SPACE_TAB +- ) +- or (self.flow_level and ch in ',:?[]{}') +- ): +- break +- length +=3D 1 +- # It's not clear what we should do with ':' in the flow conte= xt. +- if ( +- self.flow_level +- and ch =3D=3D ':' +- and srp(length + 1) not in '\0 \t\r\n\x85\u2028\u2029,[]{= }' +- ): +- srf(length) +- raise ScannerError( +- 'while scanning a plain scalar', +- start_mark, +- "found unexpected ':'", +- self.reader.get_mark(), +- 'Please check ' +- 'http://pyyaml.org/wiki/YAMLColonInFlowContext ' +- 'for details.', +- ) +- if length =3D=3D 0: +- break +- self.allow_simple_key =3D False +- chunks.extend(spaces) +- chunks.append(self.reader.prefix(length)) +- srf(length) +- end_mark =3D self.reader.get_mark() +- spaces =3D self.scan_plain_spaces(indent, start_mark) +- if ( +- not spaces +- or srp() =3D=3D '#' +- or (not self.flow_level and self.reader.column < indent) +- ): +- break +- +- token =3D ScalarToken("".join(chunks), True, start_mark, end_mark) +- if spaces and spaces[0] =3D=3D '\n': +- # Create a comment token to preserve the trailing line breaks. +- comment =3D CommentToken("".join(spaces) + '\n', start_mark, = end_mark) +- token.add_post_comment(comment) +- return token +- +- def scan_plain_spaces(self, indent, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- # The specification is really confusing about tabs in plain scala= rs. +- # We just forbid them completely. Do not use tabs in YAML! +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- chunks =3D [] +- length =3D 0 +- while srp(length) in ' ': +- length +=3D 1 +- whitespaces =3D self.reader.prefix(length) +- self.reader.forward(length) +- ch =3D srp() +- if ch in '\r\n\x85\u2028\u2029': +- line_break =3D self.scan_line_break() +- self.allow_simple_key =3D True +- prefix =3D self.reader.prefix(3) +- if (prefix =3D=3D '---' or prefix =3D=3D '...') and srp(3) in= _THE_END_SPACE_TAB: +- return +- breaks =3D [] +- while srp() in ' \r\n\x85\u2028\u2029': +- if srp() =3D=3D ' ': +- srf() +- else: +- breaks.append(self.scan_line_break()) +- prefix =3D self.reader.prefix(3) +- if (prefix =3D=3D '---' or prefix =3D=3D '...') and s= rp(3) in _THE_END_SPACE_TAB: +- return +- if line_break !=3D '\n': +- chunks.append(line_break) +- elif not breaks: +- chunks.append(' ') +- chunks.extend(breaks) +- elif whitespaces: +- chunks.append(whitespaces) +- return chunks +- +- def scan_tag_handle(self, name, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- # For some strange reasons, the specification does not allow '_' = in +- # tag handles. I have allowed it anyway. +- srp =3D self.reader.peek +- ch =3D srp() +- if ch !=3D '!': +- raise ScannerError( +- 'while scanning a %s' % (name,), +- start_mark, +- "expected '!', but found %r" % utf8(ch), +- self.reader.get_mark(), +- ) +- length =3D 1 +- ch =3D srp(length) +- if ch !=3D ' ': +- while '0' <=3D ch <=3D '9' or 'A' <=3D ch <=3D 'Z' or 'a' <= =3D ch <=3D 'z' or ch in '-_': +- length +=3D 1 +- ch =3D srp(length) +- if ch !=3D '!': +- self.reader.forward(length) +- raise ScannerError( +- 'while scanning a %s' % (name,), +- start_mark, +- "expected '!', but found %r" % utf8(ch), +- self.reader.get_mark(), +- ) +- length +=3D 1 +- value =3D self.reader.prefix(length) +- self.reader.forward(length) +- return value +- +- def scan_tag_uri(self, name, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- # Note: we do not check if URI is well-formed. +- srp =3D self.reader.peek +- chunks =3D [] +- length =3D 0 +- ch =3D srp(length) +- while ( +- '0' <=3D ch <=3D '9' +- or 'A' <=3D ch <=3D 'Z' +- or 'a' <=3D ch <=3D 'z' +- or ch in "-;/?:@&=3D+$,_.!~*'()[]%" +- or ((self.scanner_processing_version > (1, 1)) and ch =3D=3D = '#') +- ): +- if ch =3D=3D '%': +- chunks.append(self.reader.prefix(length)) +- self.reader.forward(length) +- length =3D 0 +- chunks.append(self.scan_uri_escapes(name, start_mark)) +- else: +- length +=3D 1 +- ch =3D srp(length) +- if length !=3D 0: +- chunks.append(self.reader.prefix(length)) +- self.reader.forward(length) +- length =3D 0 +- if not chunks: +- raise ScannerError( +- 'while parsing a %s' % (name,), +- start_mark, +- 'expected URI, but found %r' % utf8(ch), +- self.reader.get_mark(), +- ) +- return "".join(chunks) +- +- def scan_uri_escapes(self, name, start_mark): +- # type: (Any, Any) -> Any +- # See the specification for details. +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- code_bytes =3D [] # type: List[Any] +- mark =3D self.reader.get_mark() +- while srp() =3D=3D '%': +- srf() +- for k in range(2): +- if srp(k) not in '0123456789ABCDEFabcdef': +- raise ScannerError( +- 'while scanning a %s' % (name,), +- start_mark, +- 'expected URI escape sequence of 2 hexdecimal num= bers,' +- ' but found %r' % utf8(srp(k)), +- self.reader.get_mark(), +- ) +- if PY3: +- code_bytes.append(int(self.reader.prefix(2), 16)) +- else: +- code_bytes.append(chr(int(self.reader.prefix(2), 16))) +- srf(2) +- try: +- if PY3: +- value =3D bytes(code_bytes).decode('utf-8') +- else: +- value =3D unicode(b"".join(code_bytes), 'utf-8') +- except UnicodeDecodeError as exc: +- raise ScannerError('while scanning a %s' % (name,), start_mar= k, str(exc), mark) +- return value +- +- def scan_line_break(self): +- # type: () -> Any +- # Transforms: +- # '\r\n' : '\n' +- # '\r' : '\n' +- # '\n' : '\n' +- # '\x85' : '\n' +- # '\u2028' : '\u2028' +- # '\u2029 : '\u2029' +- # default : '' +- ch =3D self.reader.peek() +- if ch in '\r\n\x85': +- if self.reader.prefix(2) =3D=3D '\r\n': +- self.reader.forward(2) +- else: +- self.reader.forward() +- return '\n' +- elif ch in '\u2028\u2029': +- self.reader.forward() +- return ch +- return "" +- +- +-class RoundTripScanner(Scanner): +- def check_token(self, *choices): +- # type: (Any) -> bool +- # Check if the next token is one of the given types. +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- self._gather_comments() +- if bool(self.tokens): +- if not choices: +- return True +- for choice in choices: +- if isinstance(self.tokens[0], choice): +- return True +- return False +- +- def peek_token(self): +- # type: () -> Any +- # Return the next token, but do not delete if from the queue. +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- self._gather_comments() +- if bool(self.tokens): +- return self.tokens[0] +- return None +- +- def _gather_comments(self): +- # type: () -> Any +- """combine multiple comment lines""" +- comments =3D [] # type: List[Any] +- if not self.tokens: +- return comments +- if isinstance(self.tokens[0], CommentToken): +- comment =3D self.tokens.pop(0) +- self.tokens_taken +=3D 1 +- comments.append(comment) +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- if not self.tokens: +- return comments +- if isinstance(self.tokens[0], CommentToken): +- self.tokens_taken +=3D 1 +- comment =3D self.tokens.pop(0) +- # nprint('dropping2', comment) +- comments.append(comment) +- if len(comments) >=3D 1: +- self.tokens[0].add_pre_comments(comments) +- # pull in post comment on e.g. ':' +- if not self.done and len(self.tokens) < 2: +- self.fetch_more_tokens() +- +- def get_token(self): +- # type: () -> Any +- # Return the next token. +- while self.need_more_tokens(): +- self.fetch_more_tokens() +- self._gather_comments() +- if bool(self.tokens): +- # nprint('tk', self.tokens) +- # only add post comment to single line tokens: +- # scalar, value token. FlowXEndToken, otherwise +- # hidden streamtokens could get them (leave them and they wil= l be +- # pre comments for the next map/seq +- if ( +- len(self.tokens) > 1 +- and isinstance( +- self.tokens[0], +- (ScalarToken, ValueToken, FlowSequenceEndToken, FlowM= appingEndToken), +- ) +- and isinstance(self.tokens[1], CommentToken) +- and self.tokens[0].end_mark.line =3D=3D self.tokens[1].st= art_mark.line +- ): +- self.tokens_taken +=3D 1 +- c =3D self.tokens.pop(1) +- self.fetch_more_tokens() +- while len(self.tokens) > 1 and isinstance(self.tokens[1],= CommentToken): +- self.tokens_taken +=3D 1 +- c1 =3D self.tokens.pop(1) +- c.value =3D c.value + (' ' * c1.start_mark.column) + = c1.value +- self.fetch_more_tokens() +- self.tokens[0].add_post_comment(c) +- elif ( +- len(self.tokens) > 1 +- and isinstance(self.tokens[0], ScalarToken) +- and isinstance(self.tokens[1], CommentToken) +- and self.tokens[0].end_mark.line !=3D self.tokens[1].star= t_mark.line +- ): +- self.tokens_taken +=3D 1 +- c =3D self.tokens.pop(1) +- c.value =3D ( +- '\n' * (c.start_mark.line - self.tokens[0].end_mark.l= ine) +- + (' ' * c.start_mark.column) +- + c.value +- ) +- self.tokens[0].add_post_comment(c) +- self.fetch_more_tokens() +- while len(self.tokens) > 1 and isinstance(self.tokens[1],= CommentToken): +- self.tokens_taken +=3D 1 +- c1 =3D self.tokens.pop(1) +- c.value =3D c.value + (' ' * c1.start_mark.column) + = c1.value +- self.fetch_more_tokens() +- self.tokens_taken +=3D 1 +- return self.tokens.pop(0) +- return None +- +- def fetch_comment(self, comment): +- # type: (Any) -> None +- value, start_mark, end_mark =3D comment +- while value and value[-1] =3D=3D ' ': +- # empty line within indented key context +- # no need to update end-mark, that is not used +- value =3D value[:-1] +- self.tokens.append(CommentToken(value, start_mark, end_mark)) +- +- # scanner +- +- def scan_to_next_token(self): +- # type: () -> Any +- # We ignore spaces, line breaks and comments. +- # If we find a line break in the block context, we set the flag +- # `allow_simple_key` on. +- # The byte order mark is stripped if it's the first character in = the +- # stream. We do not yet support BOM inside the stream as the +- # specification requires. Any such mark will be considered as a p= art +- # of the document. +- # +- # TODO: We need to make tab handling rules more sane. A good rule= is +- # Tabs cannot precede tokens +- # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, +- # KEY(block), VALUE(block), BLOCK-ENTRY +- # So the checking code is +- # if : +- # self.allow_simple_keys =3D False +- # We also need to add the check for `allow_simple_keys =3D=3D Tru= e` to +- # `unwind_indent` before issuing BLOCK-END. +- # Scanners for block, flow, and plain scalars need to be modified. +- +- srp =3D self.reader.peek +- srf =3D self.reader.forward +- if self.reader.index =3D=3D 0 and srp() =3D=3D '\uFEFF': +- srf() +- found =3D False +- while not found: +- while srp() =3D=3D ' ': +- srf() +- ch =3D srp() +- if ch =3D=3D '#': +- start_mark =3D self.reader.get_mark() +- comment =3D ch +- srf() +- while ch not in _THE_END: +- ch =3D srp() +- if ch =3D=3D '\0': # don't gobble the end-of-stream = character +- # but add an explicit newline as "YAML processors= should terminate +- # the stream with an explicit line break +- # https://yaml.org/spec/1.2/spec.html#id2780069 +- comment +=3D '\n' +- break +- comment +=3D ch +- srf() +- # gather any blank lines following the comment too +- ch =3D self.scan_line_break() +- while len(ch) > 0: +- comment +=3D ch +- ch =3D self.scan_line_break() +- end_mark =3D self.reader.get_mark() +- if not self.flow_level: +- self.allow_simple_key =3D True +- return comment, start_mark, end_mark +- if bool(self.scan_line_break()): +- start_mark =3D self.reader.get_mark() +- if not self.flow_level: +- self.allow_simple_key =3D True +- ch =3D srp() +- if ch =3D=3D '\n': # empty toplevel lines +- start_mark =3D self.reader.get_mark() +- comment =3D "" +- while ch: +- ch =3D self.scan_line_break(empty_line=3DTrue) +- comment +=3D ch +- if srp() =3D=3D '#': +- # empty line followed by indented real comment +- comment =3D comment.rsplit('\n', 1)[0] + '\n' +- end_mark =3D self.reader.get_mark() +- return comment, start_mark, end_mark +- else: +- found =3D True +- return None +- +- def scan_line_break(self, empty_line=3DFalse): +- # type: (bool) -> Text +- # Transforms: +- # '\r\n' : '\n' +- # '\r' : '\n' +- # '\n' : '\n' +- # '\x85' : '\n' +- # '\u2028' : '\u2028' +- # '\u2029 : '\u2029' +- # default : '' +- ch =3D self.reader.peek() # type: Text +- if ch in '\r\n\x85': +- if self.reader.prefix(2) =3D=3D '\r\n': +- self.reader.forward(2) +- else: +- self.reader.forward() +- return '\n' +- elif ch in '\u2028\u2029': +- self.reader.forward() +- return ch +- elif empty_line and ch in '\t ': +- self.reader.forward() +- return ch +- return "" +- +- def scan_block_scalar(self, style, rt=3DTrue): +- # type: (Any, Optional[bool]) -> Any +- return Scanner.scan_block_scalar(self, style, rt=3Drt) +- +- +-# try: +-# import psyco +-# psyco.bind(Scanner) +-# except ImportError: +-# pass +diff --git a/dynaconf/vendor_src/ruamel/yaml/serializer.py b/dynaconf/vend= or_src/ruamel/yaml/serializer.py +deleted file mode 100644 +index 0a28c60..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/serializer.py ++++ /dev/null +@@ -1,240 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import absolute_import +- +-from .error import YAMLError +-from .compat import nprint, DBG_NODE, dbg, string_types, nprintf # NOQA +-from .util import RegExp +- +-from .events import ( +- StreamStartEvent, +- StreamEndEvent, +- MappingStartEvent, +- MappingEndEvent, +- SequenceStartEvent, +- SequenceEndEvent, +- AliasEvent, +- ScalarEvent, +- DocumentStartEvent, +- DocumentEndEvent, +-) +-from .nodes import MappingNode, ScalarNode, SequenceNode +- +-if False: # MYPY +- from typing import Any, Dict, Union, Text, Optional # NOQA +- from .compat import VersionType # NOQA +- +-__all__ =3D ['Serializer', 'SerializerError'] +- +- +-class SerializerError(YAMLError): +- pass +- +- +-class Serializer(object): +- +- # 'id' and 3+ numbers, but not 000 +- ANCHOR_TEMPLATE =3D u'id%03d' +- ANCHOR_RE =3D RegExp(u'id(?!000$)\\d{3,}') +- +- def __init__( +- self, +- encoding=3DNone, +- explicit_start=3DNone, +- explicit_end=3DNone, +- version=3DNone, +- tags=3DNone, +- dumper=3DNone, +- ): +- # type: (Any, Optional[bool], Optional[bool], Optional[VersionTyp= e], Any, Any) -> None # NOQA +- self.dumper =3D dumper +- if self.dumper is not None: +- self.dumper._serializer =3D self +- self.use_encoding =3D encoding +- self.use_explicit_start =3D explicit_start +- self.use_explicit_end =3D explicit_end +- if isinstance(version, string_types): +- self.use_version =3D tuple(map(int, version.split('.'))) +- else: +- self.use_version =3D version # type: ignore +- self.use_tags =3D tags +- self.serialized_nodes =3D {} # type: Dict[Any, Any] +- self.anchors =3D {} # type: Dict[Any, Any] +- self.last_anchor_id =3D 0 +- self.closed =3D None # type: Optional[bool] +- self._templated_id =3D None +- +- @property +- def emitter(self): +- # type: () -> Any +- if hasattr(self.dumper, 'typ'): +- return self.dumper.emitter +- return self.dumper._emitter +- +- @property +- def resolver(self): +- # type: () -> Any +- if hasattr(self.dumper, 'typ'): +- self.dumper.resolver +- return self.dumper._resolver +- +- def open(self): +- # type: () -> None +- if self.closed is None: +- self.emitter.emit(StreamStartEvent(encoding=3Dself.use_encodi= ng)) +- self.closed =3D False +- elif self.closed: +- raise SerializerError('serializer is closed') +- else: +- raise SerializerError('serializer is already opened') +- +- def close(self): +- # type: () -> None +- if self.closed is None: +- raise SerializerError('serializer is not opened') +- elif not self.closed: +- self.emitter.emit(StreamEndEvent()) +- self.closed =3D True +- +- # def __del__(self): +- # self.close() +- +- def serialize(self, node): +- # type: (Any) -> None +- if dbg(DBG_NODE): +- nprint('Serializing nodes') +- node.dump() +- if self.closed is None: +- raise SerializerError('serializer is not opened') +- elif self.closed: +- raise SerializerError('serializer is closed') +- self.emitter.emit( +- DocumentStartEvent( +- explicit=3Dself.use_explicit_start, version=3Dself.use_ve= rsion, tags=3Dself.use_tags +- ) +- ) +- self.anchor_node(node) +- self.serialize_node(node, None, None) +- self.emitter.emit(DocumentEndEvent(explicit=3Dself.use_explicit_e= nd)) +- self.serialized_nodes =3D {} +- self.anchors =3D {} +- self.last_anchor_id =3D 0 +- +- def anchor_node(self, node): +- # type: (Any) -> None +- if node in self.anchors: +- if self.anchors[node] is None: +- self.anchors[node] =3D self.generate_anchor(node) +- else: +- anchor =3D None +- try: +- if node.anchor.always_dump: +- anchor =3D node.anchor.value +- except: # NOQA +- pass +- self.anchors[node] =3D anchor +- if isinstance(node, SequenceNode): +- for item in node.value: +- self.anchor_node(item) +- elif isinstance(node, MappingNode): +- for key, value in node.value: +- self.anchor_node(key) +- self.anchor_node(value) +- +- def generate_anchor(self, node): +- # type: (Any) -> Any +- try: +- anchor =3D node.anchor.value +- except: # NOQA +- anchor =3D None +- if anchor is None: +- self.last_anchor_id +=3D 1 +- return self.ANCHOR_TEMPLATE % self.last_anchor_id +- return anchor +- +- def serialize_node(self, node, parent, index): +- # type: (Any, Any, Any) -> None +- alias =3D self.anchors[node] +- if node in self.serialized_nodes: +- self.emitter.emit(AliasEvent(alias)) +- else: +- self.serialized_nodes[node] =3D True +- self.resolver.descend_resolver(parent, index) +- if isinstance(node, ScalarNode): +- # here check if the node.tag equals the one that would re= sult from parsing +- # if not equal quoting is necessary for strings +- detected_tag =3D self.resolver.resolve(ScalarNode, node.v= alue, (True, False)) +- default_tag =3D self.resolver.resolve(ScalarNode, node.va= lue, (False, True)) +- implicit =3D ( +- (node.tag =3D=3D detected_tag), +- (node.tag =3D=3D default_tag), +- node.tag.startswith('tag:yaml.org,2002:'), +- ) +- self.emitter.emit( +- ScalarEvent( +- alias, +- node.tag, +- implicit, +- node.value, +- style=3Dnode.style, +- comment=3Dnode.comment, +- ) +- ) +- elif isinstance(node, SequenceNode): +- implicit =3D node.tag =3D=3D self.resolver.resolve(Sequen= ceNode, node.value, True) +- comment =3D node.comment +- end_comment =3D None +- seq_comment =3D None +- if node.flow_style is True: +- if comment: # eol comment on flow style sequence +- seq_comment =3D comment[0] +- # comment[0] =3D None +- if comment and len(comment) > 2: +- end_comment =3D comment[2] +- else: +- end_comment =3D None +- self.emitter.emit( +- SequenceStartEvent( +- alias, +- node.tag, +- implicit, +- flow_style=3Dnode.flow_style, +- comment=3Dnode.comment, +- ) +- ) +- index =3D 0 +- for item in node.value: +- self.serialize_node(item, node, index) +- index +=3D 1 +- self.emitter.emit(SequenceEndEvent(comment=3D[seq_comment= , end_comment])) +- elif isinstance(node, MappingNode): +- implicit =3D node.tag =3D=3D self.resolver.resolve(Mappin= gNode, node.value, True) +- comment =3D node.comment +- end_comment =3D None +- map_comment =3D None +- if node.flow_style is True: +- if comment: # eol comment on flow style sequence +- map_comment =3D comment[0] +- # comment[0] =3D None +- if comment and len(comment) > 2: +- end_comment =3D comment[2] +- self.emitter.emit( +- MappingStartEvent( +- alias, +- node.tag, +- implicit, +- flow_style=3Dnode.flow_style, +- comment=3Dnode.comment, +- nr_items=3Dlen(node.value), +- ) +- ) +- for key, value in node.value: +- self.serialize_node(key, node, None) +- self.serialize_node(value, node, key) +- self.emitter.emit(MappingEndEvent(comment=3D[map_comment,= end_comment])) +- self.resolver.ascend_resolver() +- +- +-def templated_id(s): +- # type: (Text) -> Any +- return Serializer.ANCHOR_RE.match(s) +diff --git a/dynaconf/vendor_src/ruamel/yaml/setup.cfg b/dynaconf/vendor_s= rc/ruamel/yaml/setup.cfg +deleted file mode 100644 +index 8bfd5a1..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/setup.cfg ++++ /dev/null +@@ -1,4 +0,0 @@ +-[egg_info] +-tag_build =3D=20 +-tag_date =3D 0 +- +diff --git a/dynaconf/vendor_src/ruamel/yaml/setup.py b/dynaconf/vendor_sr= c/ruamel/yaml/setup.py +deleted file mode 100644 +index f22dceb..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/setup.py ++++ /dev/null +@@ -1,962 +0,0 @@ +-# # header +-# coding: utf-8 +-# dd: 20200125 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-# # __init__.py parser +- +-import sys +-import os +-import datetime +-import traceback +- +-sys.path =3D [path for path in sys.path if path not in [os.getcwd(), ""]] +-import platform # NOQA +-from _ast import * # NOQA +-from ast import parse # NOQA +- +-from setuptools import setup, Extension, Distribution # NOQA +-from setuptools.command import install_lib # NOQA +-from setuptools.command.sdist import sdist as _sdist # NOQA +- +-try: +- from setuptools.namespaces import Installer as NameSpaceInstaller # N= OQA +-except ImportError: +- msg =3D ('You should use the latest setuptools. The namespaces.py fil= e that this setup.py' +- ' uses was added in setuptools 28.7.0 (Oct 2016)') +- print(msg) +- sys.exit() +- +-if __name__ !=3D '__main__': +- raise NotImplementedError('should never include setup.py') +- +-# # definitions +- +-full_package_name =3D None +- +-if sys.version_info < (3,): +- string_type =3D basestring +-else: +- string_type =3D str +- +- +-if sys.version_info < (3, 4): +- +- class Bytes: +- pass +- +- class NameConstant: +- pass +- +- +-if sys.version_info >=3D (3, 8): +- from ast import Str, Num, Bytes, NameConstant # NOQA +- +- +-if sys.version_info < (3,): +- open_kw =3D dict() +-else: +- open_kw =3D dict(encoding=3D'utf-8') +- +- +-if sys.version_info < (2, 7) or platform.python_implementation() =3D=3D '= Jython': +- +- class Set: +- pass +- +- +-if os.environ.get('DVDEBUG', "") =3D=3D "": +- +- def debug(*args, **kw): +- pass +- +- +-else: +- +- def debug(*args, **kw): +- with open(os.environ['DVDEBUG'], 'a') as fp: +- kw1 =3D kw.copy() +- kw1['file'] =3D fp +- print('{:%Y-%d-%mT%H:%M:%S}'.format(datetime.datetime.now()),= file=3Dfp, end=3D' ') +- print(*args, **kw1) +- +- +-def literal_eval(node_or_string): +- """ +- Safely evaluate an expression node or a string containing a Python +- expression. The string or node provided may only consist of the foll= owing +- Python literal structures: strings, bytes, numbers, tuples, lists, di= cts, +- sets, booleans, and None. +- +- Even when passing in Unicode, the resulting Str types parsed are 'str= ' in Python 2. +- I don't now how to set 'unicode_literals' on parse -> Str is explicit= ly converted. +- """ +- _safe_names =3D {'None': None, 'True': True, 'False': False} +- if isinstance(node_or_string, string_type): +- node_or_string =3D parse(node_or_string, mode=3D'eval') +- if isinstance(node_or_string, Expression): +- node_or_string =3D node_or_string.body +- else: +- raise TypeError('only string or AST nodes supported') +- +- def _convert(node): +- if isinstance(node, Str): +- if sys.version_info < (3,) and not isinstance(node.s, unicode= ): +- return node.s.decode('utf-8') +- return node.s +- elif isinstance(node, Bytes): +- return node.s +- elif isinstance(node, Num): +- return node.n +- elif isinstance(node, Tuple): +- return tuple(map(_convert, node.elts)) +- elif isinstance(node, List): +- return list(map(_convert, node.elts)) +- elif isinstance(node, Set): +- return set(map(_convert, node.elts)) +- elif isinstance(node, Dict): +- return dict((_convert(k), _convert(v)) for k, v in zip(node.k= eys, node.values)) +- elif isinstance(node, NameConstant): +- return node.value +- elif sys.version_info < (3, 4) and isinstance(node, Name): +- if node.id in _safe_names: +- return _safe_names[node.id] +- elif ( +- isinstance(node, UnaryOp) +- and isinstance(node.op, (UAdd, USub)) +- and isinstance(node.operand, (Num, UnaryOp, BinOp)) +- ): # NOQA +- operand =3D _convert(node.operand) +- if isinstance(node.op, UAdd): +- return +operand +- else: +- return -operand +- elif ( +- isinstance(node, BinOp) +- and isinstance(node.op, (Add, Sub)) +- and isinstance(node.right, (Num, UnaryOp, BinOp)) +- and isinstance(node.left, (Num, UnaryOp, BinOp)) +- ): # NOQA +- left =3D _convert(node.left) +- right =3D _convert(node.right) +- if isinstance(node.op, Add): +- return left + right +- else: +- return left - right +- elif isinstance(node, Call): +- func_id =3D getattr(node.func, 'id', None) +- if func_id =3D=3D 'dict': +- return dict((k.arg, _convert(k.value)) for k in node.keyw= ords) +- elif func_id =3D=3D 'set': +- return set(_convert(node.args[0])) +- elif func_id =3D=3D 'date': +- return datetime.date(*[_convert(k) for k in node.args]) +- elif func_id =3D=3D 'datetime': +- return datetime.datetime(*[_convert(k) for k in node.args= ]) +- err =3D SyntaxError('malformed node or string: ' + repr(node)) +- err.filename =3D '' +- err.lineno =3D node.lineno +- err.offset =3D node.col_offset +- err.text =3D repr(node) +- err.node =3D node +- raise err +- +- return _convert(node_or_string) +- +- +-# parses python ( "=3D dict( )" ) or ( "=3D {" ) +-def _package_data(fn): +- data =3D {} +- with open(fn, **open_kw) as fp: +- parsing =3D False +- lines =3D [] +- for line in fp.readlines(): +- if sys.version_info < (3,): +- line =3D line.decode('utf-8') +- if line.startswith('_package_data'): +- if 'dict(' in line: +- parsing =3D 'python' +- lines.append('dict(\n') +- elif line.endswith('=3D {\n'): +- parsing =3D 'python' +- lines.append('{\n') +- else: +- raise NotImplementedError +- continue +- if not parsing: +- continue +- if parsing =3D=3D 'python': +- if line.startswith(')') or line.startswith('}'): +- lines.append(line) +- try: +- data =3D literal_eval("".join(lines)) +- except SyntaxError as e: +- context =3D 2 +- from_line =3D e.lineno - (context + 1) +- to_line =3D e.lineno + (context - 1) +- w =3D len(str(to_line)) +- for index, line in enumerate(lines): +- if from_line <=3D index <=3D to_line: +- print( +- '{0:{1}}: {2}'.format(index, w, line)= .encode('utf-8'), +- end=3D"", +- ) +- if index =3D=3D e.lineno - 1: +- print( +- '{0:{1}} {2}^--- {3}'.format( +- ' ', w, ' ' * e.offset, e.node +- ) +- ) +- raise +- break +- lines.append(line) +- else: +- raise NotImplementedError +- return data +- +- +-# make sure you can run "python ../some/dir/setup.py install" +-pkg_data =3D _package_data(__file__.replace('setup.py', '__init__.py')) +- +-exclude_files =3D ['setup.py'] +- +- +-# # helper +-def _check_convert_version(tup): +- """Create a PEP 386 pseudo-format conformant string from tuple tup.""" +- ret_val =3D str(tup[0]) # first is always digit +- next_sep =3D '.' # separator for next extension, can be "" or "." +- nr_digits =3D 0 # nr of adjacent digits in rest, to verify +- post_dev =3D False # are we processig post/dev +- for x in tup[1:]: +- if isinstance(x, int): +- nr_digits +=3D 1 +- if nr_digits > 2: +- raise ValueError('too many consecutive digits after ' + r= et_val) +- ret_val +=3D next_sep + str(x) +- next_sep =3D '.' +- continue +- first_letter =3D x[0].lower() +- next_sep =3D "" +- if first_letter in 'abcr': +- if post_dev: +- raise ValueError('release level specified after ' 'post/d= ev: ' + x) +- nr_digits =3D 0 +- ret_val +=3D 'rc' if first_letter =3D=3D 'r' else first_letter +- elif first_letter in 'pd': +- nr_digits =3D 1 # only one can follow +- post_dev =3D True +- ret_val +=3D '.post' if first_letter =3D=3D 'p' else '.dev' +- else: +- raise ValueError('First letter of "' + x + '" not recognised') +- # .dev and .post need a number otherwise setuptools normalizes and co= mplains +- if nr_digits =3D=3D 1 and post_dev: +- ret_val +=3D '0' +- return ret_val +- +- +-version_info =3D pkg_data['version_info'] +-version_str =3D _check_convert_version(version_info) +- +- +-class MyInstallLib(install_lib.install_lib): +- def install(self): +- fpp =3D pkg_data['full_package_name'].split('.') # full package = path +- full_exclude_files =3D [os.path.join(*(fpp + [x])) for x in exclu= de_files] +- alt_files =3D [] +- outfiles =3D install_lib.install_lib.install(self) +- for x in outfiles: +- for full_exclude_file in full_exclude_files: +- if full_exclude_file in x: +- os.remove(x) +- break +- else: +- alt_files.append(x) +- return alt_files +- +- +-class MySdist(_sdist): +- def initialize_options(self): +- _sdist.initialize_options(self) +- # see pep 527, new uploads should be tar.gz or .zip +- # fmt =3D getattr(self, 'tarfmt', None) +- # because of unicode_literals +- # self.formats =3D fmt if fmt else [b'bztar'] if sys.version_info= < (3, ) else ['bztar'] +- dist_base =3D os.environ.get('PYDISTBASE') +- fpn =3D getattr(getattr(self, 'nsp', self), 'full_package_name', = None) +- if fpn and dist_base: +- print('setting distdir {}/{}'.format(dist_base, fpn)) +- self.dist_dir =3D os.path.join(dist_base, fpn) +- +- +-# try except so this doesn't bomb when you don't have wheel installed, im= plies +-# generation of wheels in ./dist +-try: +- from wheel.bdist_wheel import bdist_wheel as _bdist_wheel # NOQA +- +- class MyBdistWheel(_bdist_wheel): +- def initialize_options(self): +- _bdist_wheel.initialize_options(self) +- dist_base =3D os.environ.get('PYDISTBASE') +- fpn =3D getattr(getattr(self, 'nsp', self), 'full_package_nam= e', None) +- if fpn and dist_base: +- print('setting distdir {}/{}'.format(dist_base, fpn)) +- self.dist_dir =3D os.path.join(dist_base, fpn) +- +- _bdist_wheel_available =3D True +- +-except ImportError: +- _bdist_wheel_available =3D False +- +- +-class NameSpacePackager(object): +- def __init__(self, pkg_data): +- assert isinstance(pkg_data, dict) +- self._pkg_data =3D pkg_data +- self.full_package_name =3D self.pn(self._pkg_data['full_package_n= ame']) +- self._split =3D None +- self.depth =3D self.full_package_name.count('.') +- self.nested =3D self._pkg_data.get('nested', False) +- if self.nested: +- NameSpaceInstaller.install_namespaces =3D lambda x: None +- self.command =3D None +- self.python_version() +- self._pkg =3D [None, None] # required and pre-installable packag= es +- if ( +- sys.argv[0] =3D=3D 'setup.py' +- and sys.argv[1] =3D=3D 'install' +- and '--single-version-externally-managed' not in sys.argv +- ): +- if os.environ.get('READTHEDOCS', None) =3D=3D 'True': +- os.system('pip install .') +- sys.exit(0) +- if not os.environ.get('RUAMEL_NO_PIP_INSTALL_CHECK', False): +- print('error: you have to install with "pip install ."') +- sys.exit(1) +- # If you only support an extension module on Linux, Windows think= s it +- # is pure. That way you would get pure python .whl files that take +- # precedence for downloading on Linux over source with compilable= C code +- if self._pkg_data.get('universal'): +- Distribution.is_pure =3D lambda *args: True +- else: +- Distribution.is_pure =3D lambda *args: False +- for x in sys.argv: +- if x[0] =3D=3D '-' or x =3D=3D 'setup.py': +- continue +- self.command =3D x +- break +- +- def pn(self, s): +- if sys.version_info < (3,) and isinstance(s, unicode): +- return s.encode('utf-8') +- return s +- +- @property +- def split(self): +- """split the full package name in list of compontents traditional= ly +- done by setuptools.find_packages. This routine skips any director= ies +- with __init__.py, for which the name starts with "_" or ".", or c= ontain a +- setup.py/tox.ini (indicating a subpackage) +- """ +- skip =3D [] +- if self._split is None: +- fpn =3D self.full_package_name.split('.') +- self._split =3D [] +- while fpn: +- self._split.insert(0, '.'.join(fpn)) +- fpn =3D fpn[:-1] +- for d in sorted(os.listdir('.')): +- if not os.path.isdir(d) or d =3D=3D self._split[0] or d[0= ] in '._': +- continue +- # prevent sub-packages in namespace from being included +- x =3D os.path.join(d, '__init__.py') +- if os.path.exists(x): +- pd =3D _package_data(x) +- if pd.get('nested', False): +- skip.append(d) +- continue +- self._split.append(self.full_package_name + '.' + d) +- if sys.version_info < (3,): +- self._split =3D [ +- (y.encode('utf-8') if isinstance(y, unicode) else y) = for y in self._split +- ] +- if skip: +- # this interferes with output checking +- # print('skipping sub-packages:', ', '.join(skip)) +- pass +- return self._split +- +- @property +- def namespace_packages(self): +- return self.split[: self.depth] +- +- def namespace_directories(self, depth=3DNone): +- """return list of directories where the namespace should be creat= ed / +- can be found +- """ +- res =3D [] +- for index, d in enumerate(self.split[:depth]): +- # toplevel gets a dot +- if index > 0: +- d =3D os.path.join(*d.split('.')) +- res.append('.' + d) +- return res +- +- @property +- def package_dir(self): +- d =3D { +- # don't specify empty dir, clashes with package_data spec +- self.full_package_name: '.' +- } +- if 'extra_packages' in self._pkg_data: +- return d +- if len(self.split) > 1: # only if package namespace +- d[self.split[0]] =3D self.namespace_directories(1)[0] +- return d +- +- def create_dirs(self): +- """create the directories necessary for namespace packaging""" +- directories =3D self.namespace_directories(self.depth) +- if not directories: +- return +- if not os.path.exists(directories[0]): +- for d in directories: +- os.mkdir(d) +- with open(os.path.join(d, '__init__.py'), 'w') as fp: +- fp.write( +- 'import pkg_resources\n' 'pkg_resources.declare_n= amespace(__name__)\n' +- ) +- +- def python_version(self): +- supported =3D self._pkg_data.get('supported') +- if supported is None: +- return +- if len(supported) =3D=3D 1: +- minimum =3D supported[0] +- else: +- for x in supported: +- if x[0] =3D=3D sys.version_info[0]: +- minimum =3D x +- break +- else: +- return +- if sys.version_info < minimum: +- print('minimum python version(s): ' + str(supported)) +- sys.exit(1) +- +- def check(self): +- try: +- from pip.exceptions import InstallationError +- except ImportError: +- return +- # arg is either develop (pip install -e) or install +- if self.command not in ['install', 'develop']: +- return +- +- # if hgi and hgi.base are both in namespace_packages matching +- # against the top (hgi.) it suffices to find minus-e and non-minu= s-e +- # installed packages. As we don't know the order in namespace_pac= kages +- # do some magic +- prefix =3D self.split[0] +- prefixes =3D set([prefix, prefix.replace('_', '-')]) +- for p in sys.path: +- if not p: +- continue # directory with setup.py +- if os.path.exists(os.path.join(p, 'setup.py')): +- continue # some linked in stuff might not be hgi based +- if not os.path.isdir(p): +- continue +- if p.startswith('/tmp/'): +- continue +- for fn in os.listdir(p): +- for pre in prefixes: +- if fn.startswith(pre): +- break +- else: +- continue +- full_name =3D os.path.join(p, fn) +- # not in prefixes the toplevel is never changed from _ to= - +- if fn =3D=3D prefix and os.path.isdir(full_name): +- # directory -> other, non-minus-e, install +- if self.command =3D=3D 'develop': +- raise InstallationError( +- 'Cannot mix develop (pip install -e),\nwith ' +- 'non-develop installs for package name {0}'.f= ormat(fn) +- ) +- elif fn =3D=3D prefix: +- raise InstallationError('non directory package {0} in= {1}'.format(fn, p)) +- for pre in [x + '.' for x in prefixes]: +- if fn.startswith(pre): +- break +- else: +- continue # hgiabc instead of hgi. +- if fn.endswith('-link') and self.command =3D=3D 'install': +- raise InstallationError( +- 'Cannot mix non-develop with develop\n(pip instal= l -e)' +- ' installs for package name {0}'.format(fn) +- ) +- +- def entry_points(self, script_name=3DNone, package_name=3DNone): +- """normally called without explicit script_name and package name +- the default console_scripts entry depends on the existence of __m= ain__.py: +- if that file exists then the function main() in there is used, ot= herwise +- the in __init__.py. +- +- the _package_data entry_points key/value pair can be explicitly s= pecified +- including a "=3D" character. If the entry is True or 1 the +- scriptname is the last part of the full package path (split on '.= ') +- if the ep entry is a simple string without "=3D", that is assumed= to be +- the name of the script. +- """ +- +- def pckg_entry_point(name): +- return '{0}{1}:main'.format( +- name, '.__main__' if os.path.exists('__main__.py') else "" +- ) +- +- ep =3D self._pkg_data.get('entry_points', True) +- if isinstance(ep, dict): +- return ep +- if ep is None: +- return None +- if ep not in [True, 1]: +- if '=3D' in ep: +- # full specification of the entry point like +- # entry_points=3D['yaml =3D ruamel.yaml.cmd:main'], +- return {'console_scripts': [ep]} +- # assume that it is just the script name +- script_name =3D ep +- if package_name is None: +- package_name =3D self.full_package_name +- if not script_name: +- script_name =3D package_name.split('.')[-1] +- return { +- 'console_scripts': [ +- '{0} =3D {1}'.format(script_name, pckg_entry_point(packag= e_name)) +- ] +- } +- +- @property +- def url(self): +- url =3D self._pkg_data.get('url') +- if url: +- return url +- sp =3D self.full_package_name +- for ch in '_.': +- sp =3D sp.replace(ch, '-') +- return 'https://sourceforge.net/p/{0}/code/ci/default/tree'.forma= t(sp) +- +- @property +- def author(self): +- return self._pkg_data['author'] # no get needs to be there +- +- @property +- def author_email(self): +- return self._pkg_data['author_email'] # no get needs to be there +- +- @property +- def license(self): +- """return the license field from _package_data, None means MIT""" +- lic =3D self._pkg_data.get('license') +- if lic is None: +- # lic_fn =3D os.path.join(os.path.dirname(__file__), 'LICENSE= ') +- # assert os.path.exists(lic_fn) +- return 'MIT license' +- return lic +- +- def has_mit_lic(self): +- return 'MIT' in self.license +- +- @property +- def description(self): +- return self._pkg_data['description'] # no get needs to be there +- +- @property +- def status(self): +- # =CE=B1=CE=B2 +- status =3D self._pkg_data.get('status', '=CE=B2').lower() +- if status in ['=CE=B1', 'alpha']: +- return (3, 'Alpha') +- elif status in ['=CE=B2', 'beta']: +- return (4, 'Beta') +- elif 'stable' in status.lower(): +- return (5, 'Production/Stable') +- raise NotImplementedError +- +- @property +- def classifiers(self): +- """this needs more intelligence, probably splitting the classifie= rs from _pkg_data +- and only adding defaults when no explicit entries were provided. +- Add explicit Python versions in sync with tox.env generation base= d on python_requires? +- """ +- attr =3D '_' + sys._getframe().f_code.co_name +- if not hasattr(self, attr): +- setattr(self, attr, self._setup_classifiers()) +- return getattr(self, attr) +- +- def _setup_classifiers(self): +- return sorted( +- set( +- [ +- 'Development Status :: {0} - {1}'.format(*self.status= ), +- 'Intended Audience :: Developers', +- 'License :: ' +- + ('OSI Approved :: MIT' if self.has_mit_lic() else '= Other/Proprietary') +- + ' License', +- 'Operating System :: OS Independent', +- 'Programming Language :: Python', +- ] +- + [self.pn(x) for x in self._pkg_data.get('classifiers', = [])] +- ) +- ) +- +- @property +- def keywords(self): +- return self.pn(self._pkg_data.get('keywords', [])) +- +- @property +- def install_requires(self): +- """list of packages required for installation""" +- return self._analyse_packages[0] +- +- @property +- def install_pre(self): +- """list of packages required for installation""" +- return self._analyse_packages[1] +- +- @property +- def _analyse_packages(self): +- """gather from configuration, names starting with * need +- to be installed explicitly as they are not on PyPI +- install_requires should be dict, with keys 'any', 'py27' etc +- or a list (which is as if only 'any' was defined +- +- ToDo: update with: pep508 conditional dependencies +- """ +- if self._pkg[0] is None: +- self._pkg[0] =3D [] +- self._pkg[1] =3D [] +- +- ir =3D self._pkg_data.get('install_requires') +- if ir is None: +- return self._pkg # these will be both empty at this point +- if isinstance(ir, list): +- self._pkg[0] =3D ir +- return self._pkg +- # 'any' for all builds, 'py27' etc for specifics versions +- packages =3D ir.get('any', []) +- if isinstance(packages, string_type): +- packages =3D packages.split() # assume white space separated= string +- if self.nested: +- # parent dir is also a package, make sure it is installed (ne= ed its .pth file) +- parent_pkg =3D self.full_package_name.rsplit('.', 1)[0] +- if parent_pkg not in packages: +- packages.append(parent_pkg) +- implementation =3D platform.python_implementation() +- if implementation =3D=3D 'CPython': +- pyver =3D 'py{0}{1}'.format(*sys.version_info) +- elif implementation =3D=3D 'PyPy': +- pyver =3D 'pypy' if sys.version_info < (3,) else 'pypy3' +- elif implementation =3D=3D 'Jython': +- pyver =3D 'jython' +- packages.extend(ir.get(pyver, [])) +- for p in packages: +- # package name starting with * means use local source tree, = non-published +- # to PyPi or maybe not latest version on PyPI -> pre-install +- if p[0] =3D=3D '*': +- p =3D p[1:] +- self._pkg[1].append(p) +- self._pkg[0].append(p) +- return self._pkg +- +- @property +- def extras_require(self): +- """dict of conditions -> extra packages informaton required for i= nstallation +- as of setuptools 33 doing `package ; python_version<=3D2.7' in in= stall_requires +- still doesn't work +- +- https://www.python.org/dev/peps/pep-0508/ +- https://wheel.readthedocs.io/en/latest/index.html#defining-condit= ional-dependencies +- https://hynek.me/articles/conditional-python-dependencies/ +- """ +- ep =3D self._pkg_data.get('extras_require') +- return ep +- +- # @property +- # def data_files(self): +- # df =3D self._pkg_data.get('data_files', []) +- # if self.has_mit_lic(): +- # df.append('LICENSE') +- # if not df: +- # return None +- # return [('.', df)] +- +- @property +- def package_data(self): +- df =3D self._pkg_data.get('data_files', []) +- if self.has_mit_lic(): +- # include the file +- df.append('LICENSE') +- # but don't install it +- exclude_files.append('LICENSE') +- if self._pkg_data.get('binary_only', False): +- exclude_files.append('__init__.py') +- debug('testing<<<<<') +- if 'Typing :: Typed' in self.classifiers: +- debug('appending') +- df.append('py.typed') +- pd =3D self._pkg_data.get('package_data', {}) +- if df: +- pd[self.full_package_name] =3D df +- if sys.version_info < (3,): +- # python2 doesn't seem to like unicode package names as keys +- # maybe only when the packages themselves are non-unicode +- for k in pd: +- if isinstance(k, unicode): +- pd[str(k)] =3D pd.pop(k) +- # for k in pd: +- # pd[k] =3D [e.encode('utf-8') for e in pd[k]] # de-unic= ode +- return pd +- +- @property +- def packages(self): +- s =3D self.split +- # fixed this in package_data, the keys there must be non-unicode = for py27 +- # if sys.version_info < (3, 0): +- # s =3D [x.encode('utf-8') for x in self.split] +- return s + self._pkg_data.get('extra_packages', []) +- +- @property +- def python_requires(self): +- return self._pkg_data.get('python_requires', None) +- +- @property +- def ext_modules(self): +- """ +- Check if all modules specified in the value for 'ext_modules' can= be build. +- That value (if not None) is a list of dicts with 'name', 'src', '= lib' +- Optional 'test' can be used to make sure trying to compile will w= ork on the host +- +- creates and return the external modules as Extensions, unless that +- is not necessary at all for the action (like --version) +- +- test existence of compiler by using export CC=3Dnonexistent; expo= rt CXX=3Dnonexistent +- """ +- +- if hasattr(self, '_ext_modules'): +- return self._ext_modules +- if '--version' in sys.argv: +- return None +- if platform.python_implementation() =3D=3D 'Jython': +- return None +- try: +- plat =3D sys.argv.index('--plat-name') +- if 'win' in sys.argv[plat + 1]: +- return None +- except ValueError: +- pass +- self._ext_modules =3D [] +- no_test_compile =3D False +- if '--restructuredtext' in sys.argv: +- no_test_compile =3D True +- elif 'sdist' in sys.argv: +- no_test_compile =3D True +- if no_test_compile: +- for target in self._pkg_data.get('ext_modules', []): +- ext =3D Extension( +- self.pn(target['name']), +- sources=3D[self.pn(x) for x in target['src']], +- libraries=3D[self.pn(x) for x in target.get('lib')], +- ) +- self._ext_modules.append(ext) +- return self._ext_modules +- +- print('sys.argv', sys.argv) +- import tempfile +- import shutil +- from textwrap import dedent +- +- import distutils.sysconfig +- import distutils.ccompiler +- from distutils.errors import CompileError, LinkError +- +- for target in self._pkg_data.get('ext_modules', []): # list of d= icts +- ext =3D Extension( +- self.pn(target['name']), +- sources=3D[self.pn(x) for x in target['src']], +- libraries=3D[self.pn(x) for x in target.get('lib')], +- ) +- # debug('test1 in target', 'test' in target, target) +- if 'test' not in target: # no test, just hope it works +- self._ext_modules.append(ext) +- continue +- if sys.version_info[:2] =3D=3D (3, 4) and platform.system() = =3D=3D 'Windows': +- # this is giving problems on appveyor, so skip +- if 'FORCE_C_BUILD_TEST' not in os.environ: +- self._ext_modules.append(ext) +- continue +- # write a temporary .c file to compile +- c_code =3D dedent(target['test']) +- try: +- tmp_dir =3D tempfile.mkdtemp(prefix=3D'tmp_ruamel_') +- bin_file_name =3D 'test' + self.pn(target['name']) +- print('test compiling', bin_file_name) +- file_name =3D os.path.join(tmp_dir, bin_file_name + '.c') +- with open(file_name, 'w') as fp: # write source +- fp.write(c_code) +- # and try to compile it +- compiler =3D distutils.ccompiler.new_compiler() +- assert isinstance(compiler, distutils.ccompiler.CCompiler) +- # do any platform specific initialisations +- distutils.sysconfig.customize_compiler(compiler) +- # make sure you can reach header files because compile do= es change dir +- compiler.add_include_dir(os.getcwd()) +- if sys.version_info < (3,): +- tmp_dir =3D tmp_dir.encode('utf-8') +- # used to be a different directory, not necessary +- compile_out_dir =3D tmp_dir +- try: +- compiler.link_executable( +- compiler.compile([file_name], output_dir=3Dcompil= e_out_dir), +- bin_file_name, +- output_dir=3Dtmp_dir, +- libraries=3Dext.libraries, +- ) +- except CompileError: +- debug('compile error:', file_name) +- print('compile error:', file_name) +- continue +- except LinkError: +- debug('link error', file_name) +- print('link error', file_name) +- continue +- self._ext_modules.append(ext) +- except Exception as e: # NOQA +- debug('Exception:', e) +- print('Exception:', e) +- if sys.version_info[:2] =3D=3D (3, 4) and platform.system= () =3D=3D 'Windows': +- traceback.print_exc() +- finally: +- shutil.rmtree(tmp_dir) +- return self._ext_modules +- +- @property +- def test_suite(self): +- return self._pkg_data.get('test_suite') +- +- def wheel(self, kw, setup): +- """temporary add setup.cfg if creating a wheel to include LICENSE= file +- https://bitbucket.org/pypa/wheel/issues/47 +- """ +- if 'bdist_wheel' not in sys.argv: +- return False +- file_name =3D 'setup.cfg' +- if os.path.exists(file_name): # add it if not in there? +- return False +- with open(file_name, 'w') as fp: +- if os.path.exists('LICENSE'): +- fp.write('[metadata]\nlicense-file =3D LICENSE\n') +- else: +- print('\n\n>>>>>> LICENSE file not found <<<<<\n\n') +- if self._pkg_data.get('universal'): +- fp.write('[bdist_wheel]\nuniversal =3D 1\n') +- try: +- setup(**kw) +- except Exception: +- raise +- finally: +- os.remove(file_name) +- return True +- +- +-# # call setup +-def main(): +- dump_kw =3D '--dump-kw' +- if dump_kw in sys.argv: +- import wheel +- import distutils +- import setuptools +- +- print('python: ', sys.version) +- print('setuptools:', setuptools.__version__) +- print('distutils: ', distutils.__version__) +- print('wheel: ', wheel.__version__) +- nsp =3D NameSpacePackager(pkg_data) +- nsp.check() +- nsp.create_dirs() +- MySdist.nsp =3D nsp +- if pkg_data.get('tarfmt'): +- MySdist.tarfmt =3D pkg_data.get('tarfmt') +- +- cmdclass =3D dict(install_lib=3DMyInstallLib, sdist=3DMySdist) +- if _bdist_wheel_available: +- MyBdistWheel.nsp =3D nsp +- cmdclass['bdist_wheel'] =3D MyBdistWheel +- +- kw =3D dict( +- name=3Dnsp.full_package_name, +- namespace_packages=3Dnsp.namespace_packages, +- version=3Dversion_str, +- packages=3Dnsp.packages, +- python_requires=3Dnsp.python_requires, +- url=3Dnsp.url, +- author=3Dnsp.author, +- author_email=3Dnsp.author_email, +- cmdclass=3Dcmdclass, +- package_dir=3Dnsp.package_dir, +- entry_points=3Dnsp.entry_points(), +- description=3Dnsp.description, +- install_requires=3Dnsp.install_requires, +- extras_require=3Dnsp.extras_require, # available since setuptool= s 18.0 / 2015-06 +- license=3Dnsp.license, +- classifiers=3Dnsp.classifiers, +- keywords=3Dnsp.keywords, +- package_data=3Dnsp.package_data, +- ext_modules=3Dnsp.ext_modules, +- test_suite=3Dnsp.test_suite, +- ) +- +- if '--version' not in sys.argv and ('--verbose' in sys.argv or dump_k= w in sys.argv): +- for k in sorted(kw): +- v =3D kw[k] +- print(' "{0}": "{1}",'.format(k, v)) +- # if '--record' in sys.argv: +- # return +- if dump_kw in sys.argv: +- sys.argv.remove(dump_kw) +- try: +- with open('README.rst') as fp: +- kw['long_description'] =3D fp.read() +- kw['long_description_content_type'] =3D 'text/x-rst' +- except Exception: +- pass +- +- if nsp.wheel(kw, setup): +- return +- for x in ['-c', 'egg_info', '--egg-base', 'pip-egg-info']: +- if x not in sys.argv: +- break +- else: +- # we're doing a tox setup install any starred package by searchin= g up the source tree +- # until you match your/package/name for your.package.name +- for p in nsp.install_pre: +- import subprocess +- +- # search other source +- setup_path =3D os.path.join(*p.split('.') + ['setup.py']) +- try_dir =3D os.path.dirname(sys.executable) +- while len(try_dir) > 1: +- full_path_setup_py =3D os.path.join(try_dir, setup_path) +- if os.path.exists(full_path_setup_py): +- pip =3D sys.executable.replace('python', 'pip') +- cmd =3D [pip, 'install', os.path.dirname(full_path_se= tup_py)] +- # with open('/var/tmp/notice', 'a') as fp: +- # print('installing', cmd, file=3Dfp) +- subprocess.check_output(cmd) +- break +- try_dir =3D os.path.dirname(try_dir) +- setup(**kw) +- +- +-main() +diff --git a/dynaconf/vendor_src/ruamel/yaml/timestamp.py b/dynaconf/vendo= r_src/ruamel/yaml/timestamp.py +deleted file mode 100644 +index 374e4c0..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/timestamp.py ++++ /dev/null +@@ -1,28 +0,0 @@ +-# coding: utf-8 +- +-from __future__ import print_function, absolute_import, division, unicode= _literals +- +-import datetime +-import copy +- +-# ToDo: at least on PY3 you could probably attach the tzinfo correctly to= the object +-# a more complete datetime might be used by safe loading as well +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List # NOQA +- +- +-class TimeStamp(datetime.datetime): +- def __init__(self, *args, **kw): +- # type: (Any, Any) -> None +- self._yaml =3D dict(t=3DFalse, tz=3DNone, delta=3D0) # type: Dic= t[Any, Any] +- +- def __new__(cls, *args, **kw): # datetime is immutable +- # type: (Any, Any) -> Any +- return datetime.datetime.__new__(cls, *args, **kw) # type: ignore +- +- def __deepcopy__(self, memo): +- # type: (Any) -> Any +- ts =3D TimeStamp(self.year, self.month, self.day, self.hour, self= .minute, self.second) +- ts._yaml =3D copy.deepcopy(self._yaml) +- return ts +diff --git a/dynaconf/vendor_src/ruamel/yaml/tokens.py b/dynaconf/vendor_s= rc/ruamel/yaml/tokens.py +deleted file mode 100644 +index 5f5a663..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/tokens.py ++++ /dev/null +@@ -1,286 +0,0 @@ +-# # header +-# coding: utf-8 +- +-from __future__ import unicode_literals +- +-if False: # MYPY +- from typing import Text, Any, Dict, Optional, List # NOQA +- from .error import StreamMark # NOQA +- +-SHOWLINES =3D True +- +- +-class Token(object): +- __slots__ =3D 'start_mark', 'end_mark', '_comment' +- +- def __init__(self, start_mark, end_mark): +- # type: (StreamMark, StreamMark) -> None +- self.start_mark =3D start_mark +- self.end_mark =3D end_mark +- +- def __repr__(self): +- # type: () -> Any +- # attributes =3D [key for key in self.__slots__ if not key.endswi= th('_mark') and +- # hasattr('self', key)] +- attributes =3D [key for key in self.__slots__ if not key.endswith= ('_mark')] +- attributes.sort() +- arguments =3D ', '.join(['%s=3D%r' % (key, getattr(self, key)) fo= r key in attributes]) +- if SHOWLINES: +- try: +- arguments +=3D ', line: ' + str(self.start_mark.line) +- except: # NOQA +- pass +- try: +- arguments +=3D ', comment: ' + str(self._comment) +- except: # NOQA +- pass +- return '{}({})'.format(self.__class__.__name__, arguments) +- +- def add_post_comment(self, comment): +- # type: (Any) -> None +- if not hasattr(self, '_comment'): +- self._comment =3D [None, None] +- self._comment[0] =3D comment +- +- def add_pre_comments(self, comments): +- # type: (Any) -> None +- if not hasattr(self, '_comment'): +- self._comment =3D [None, None] +- assert self._comment[1] is None +- self._comment[1] =3D comments +- +- def get_comment(self): +- # type: () -> Any +- return getattr(self, '_comment', None) +- +- @property +- def comment(self): +- # type: () -> Any +- return getattr(self, '_comment', None) +- +- def move_comment(self, target, empty=3DFalse): +- # type: (Any, bool) -> Any +- """move a comment from this token to target (normally next token) +- used to combine e.g. comments before a BlockEntryToken to the +- ScalarToken that follows it +- empty is a special for empty values -> comment after key +- """ +- c =3D self.comment +- if c is None: +- return +- # don't push beyond last element +- if isinstance(target, (StreamEndToken, DocumentStartToken)): +- return +- delattr(self, '_comment') +- tc =3D target.comment +- if not tc: # target comment, just insert +- # special for empty value in key: value issue 25 +- if empty: +- c =3D [c[0], c[1], None, None, c[0]] +- target._comment =3D c +- # nprint('mco2:', self, target, target.comment, empty) +- return self +- if c[0] and tc[0] or c[1] and tc[1]: +- raise NotImplementedError('overlap in comment %r %r' % (c, tc= )) +- if c[0]: +- tc[0] =3D c[0] +- if c[1]: +- tc[1] =3D c[1] +- return self +- +- def split_comment(self): +- # type: () -> Any +- """ split the post part of a comment, and return it +- as comment to be added. Delete second part if [None, None] +- abc: # this goes to sequence +- # this goes to first element +- - first element +- """ +- comment =3D self.comment +- if comment is None or comment[0] is None: +- return None # nothing to do +- ret_val =3D [comment[0], None] +- if comment[1] is None: +- delattr(self, '_comment') +- return ret_val +- +- +-# class BOMToken(Token): +-# id =3D '' +- +- +-class DirectiveToken(Token): +- __slots__ =3D 'name', 'value' +- id =3D '' +- +- def __init__(self, name, value, start_mark, end_mark): +- # type: (Any, Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.name =3D name +- self.value =3D value +- +- +-class DocumentStartToken(Token): +- __slots__ =3D () +- id =3D '' +- +- +-class DocumentEndToken(Token): +- __slots__ =3D () +- id =3D '' +- +- +-class StreamStartToken(Token): +- __slots__ =3D ('encoding',) +- id =3D '' +- +- def __init__(self, start_mark=3DNone, end_mark=3DNone, encoding=3DNon= e): +- # type: (Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.encoding =3D encoding +- +- +-class StreamEndToken(Token): +- __slots__ =3D () +- id =3D '' +- +- +-class BlockSequenceStartToken(Token): +- __slots__ =3D () +- id =3D '' +- +- +-class BlockMappingStartToken(Token): +- __slots__ =3D () +- id =3D '' +- +- +-class BlockEndToken(Token): +- __slots__ =3D () +- id =3D '' +- +- +-class FlowSequenceStartToken(Token): +- __slots__ =3D () +- id =3D '[' +- +- +-class FlowMappingStartToken(Token): +- __slots__ =3D () +- id =3D '{' +- +- +-class FlowSequenceEndToken(Token): +- __slots__ =3D () +- id =3D ']' +- +- +-class FlowMappingEndToken(Token): +- __slots__ =3D () +- id =3D '}' +- +- +-class KeyToken(Token): +- __slots__ =3D () +- id =3D '?' +- +- # def x__repr__(self): +- # return 'KeyToken({})'.format( +- # self.start_mark.buffer[self.start_mark.index:].split(None, = 1)[0]) +- +- +-class ValueToken(Token): +- __slots__ =3D () +- id =3D ':' +- +- +-class BlockEntryToken(Token): +- __slots__ =3D () +- id =3D '-' +- +- +-class FlowEntryToken(Token): +- __slots__ =3D () +- id =3D ',' +- +- +-class AliasToken(Token): +- __slots__ =3D ('value',) +- id =3D '' +- +- def __init__(self, value, start_mark, end_mark): +- # type: (Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.value =3D value +- +- +-class AnchorToken(Token): +- __slots__ =3D ('value',) +- id =3D '' +- +- def __init__(self, value, start_mark, end_mark): +- # type: (Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.value =3D value +- +- +-class TagToken(Token): +- __slots__ =3D ('value',) +- id =3D '' +- +- def __init__(self, value, start_mark, end_mark): +- # type: (Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.value =3D value +- +- +-class ScalarToken(Token): +- __slots__ =3D 'value', 'plain', 'style' +- id =3D '' +- +- def __init__(self, value, plain, start_mark, end_mark, style=3DNone): +- # type: (Any, Any, Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.value =3D value +- self.plain =3D plain +- self.style =3D style +- +- +-class CommentToken(Token): +- __slots__ =3D 'value', 'pre_done' +- id =3D '' +- +- def __init__(self, value, start_mark, end_mark): +- # type: (Any, Any, Any) -> None +- Token.__init__(self, start_mark, end_mark) +- self.value =3D value +- +- def reset(self): +- # type: () -> None +- if hasattr(self, 'pre_done'): +- delattr(self, 'pre_done') +- +- def __repr__(self): +- # type: () -> Any +- v =3D '{!r}'.format(self.value) +- if SHOWLINES: +- try: +- v +=3D ', line: ' + str(self.start_mark.line) +- v +=3D ', col: ' + str(self.start_mark.column) +- except: # NOQA +- pass +- return 'CommentToken({})'.format(v) +- +- def __eq__(self, other): +- # type: (Any) -> bool +- if self.start_mark !=3D other.start_mark: +- return False +- if self.end_mark !=3D other.end_mark: +- return False +- if self.value !=3D other.value: +- return False +- return True +- +- def __ne__(self, other): +- # type: (Any) -> bool +- return not self.__eq__(other) +diff --git a/dynaconf/vendor_src/ruamel/yaml/util.py b/dynaconf/vendor_src= /ruamel/yaml/util.py +deleted file mode 100644 +index 3eb7d76..0000000 +--- a/dynaconf/vendor_src/ruamel/yaml/util.py ++++ /dev/null +@@ -1,190 +0,0 @@ +-# coding: utf-8 +- +-""" +-some helper functions that might be generally useful +-""" +- +-from __future__ import absolute_import, print_function +- +-from functools import partial +-import re +- +-from .compat import text_type, binary_type +- +-if False: # MYPY +- from typing import Any, Dict, Optional, List, Text # NOQA +- from .compat import StreamTextType # NOQA +- +- +-class LazyEval(object): +- """ +- Lightweight wrapper around lazily evaluated func(*args, **kwargs). +- +- func is only evaluated when any attribute of its return value is acce= ssed. +- Every attribute access is passed through to the wrapped value. +- (This only excludes special cases like method-wrappers, e.g., __hash_= _.) +- The sole additional attribute is the lazy_self function which holds t= he +- return value (or, prior to evaluation, func and arguments), in its cl= osure. +- """ +- +- def __init__(self, func, *args, **kwargs): +- # type: (Any, Any, Any) -> None +- def lazy_self(): +- # type: () -> Any +- return_value =3D func(*args, **kwargs) +- object.__setattr__(self, 'lazy_self', lambda: return_value) +- return return_value +- +- object.__setattr__(self, 'lazy_self', lazy_self) +- +- def __getattribute__(self, name): +- # type: (Any) -> Any +- lazy_self =3D object.__getattribute__(self, 'lazy_self') +- if name =3D=3D 'lazy_self': +- return lazy_self +- return getattr(lazy_self(), name) +- +- def __setattr__(self, name, value): +- # type: (Any, Any) -> None +- setattr(self.lazy_self(), name, value) +- +- +-RegExp =3D partial(LazyEval, re.compile) +- +- +-# originally as comment +-# https://github.com/pre-commit/pre-commit/pull/211#issuecomment-186466605 +-# if you use this in your code, I suggest adding a test in your test suite +-# that check this routines output against a known piece of your YAML +-# before upgrades to this code break your round-tripped YAML +-def load_yaml_guess_indent(stream, **kw): +- # type: (StreamTextType, Any) -> Any +- """guess the indent and block sequence indent of yaml stream/string +- +- returns round_trip_loaded stream, indent level, block sequence indent +- - block sequence indent is the number of spaces before a dash relativ= e to previous indent +- - if there are no block sequences, indent is taken from nested mappin= gs, block sequence +- indent is unset (None) in that case +- """ +- from .main import round_trip_load +- +- # load a yaml file guess the indentation, if you use TABs ... +- def leading_spaces(l): +- # type: (Any) -> int +- idx =3D 0 +- while idx < len(l) and l[idx] =3D=3D ' ': +- idx +=3D 1 +- return idx +- +- if isinstance(stream, text_type): +- yaml_str =3D stream # type: Any +- elif isinstance(stream, binary_type): +- # most likely, but the Reader checks BOM for this +- yaml_str =3D stream.decode('utf-8') +- else: +- yaml_str =3D stream.read() +- map_indent =3D None +- indent =3D None # default if not found for some reason +- block_seq_indent =3D None +- prev_line_key_only =3D None +- key_indent =3D 0 +- for line in yaml_str.splitlines(): +- rline =3D line.rstrip() +- lline =3D rline.lstrip() +- if lline.startswith('- '): +- l_s =3D leading_spaces(line) +- block_seq_indent =3D l_s - key_indent +- idx =3D l_s + 1 +- while line[idx] =3D=3D ' ': # this will end as we rstripped +- idx +=3D 1 +- if line[idx] =3D=3D '#': # comment after - +- continue +- indent =3D idx - key_indent +- break +- if map_indent is None and prev_line_key_only is not None and rlin= e: +- idx =3D 0 +- while line[idx] in ' -': +- idx +=3D 1 +- if idx > prev_line_key_only: +- map_indent =3D idx - prev_line_key_only +- if rline.endswith(':'): +- key_indent =3D leading_spaces(line) +- idx =3D 0 +- while line[idx] =3D=3D ' ': # this will end on ':' +- idx +=3D 1 +- prev_line_key_only =3D idx +- continue +- prev_line_key_only =3D None +- if indent is None and map_indent is not None: +- indent =3D map_indent +- return round_trip_load(yaml_str, **kw), indent, block_seq_indent +- +- +-def configobj_walker(cfg): +- # type: (Any) -> Any +- """ +- walks over a ConfigObj (INI file with comments) generating +- corresponding YAML output (including comments +- """ +- from configobj import ConfigObj # type: ignore +- +- assert isinstance(cfg, ConfigObj) +- for c in cfg.initial_comment: +- if c.strip(): +- yield c +- for s in _walk_section(cfg): +- if s.strip(): +- yield s +- for c in cfg.final_comment: +- if c.strip(): +- yield c +- +- +-def _walk_section(s, level=3D0): +- # type: (Any, int) -> Any +- from configobj import Section +- +- assert isinstance(s, Section) +- indent =3D u' ' * level +- for name in s.scalars: +- for c in s.comments[name]: +- yield indent + c.strip() +- x =3D s[name] +- if u'\n' in x: +- i =3D indent + u' ' +- x =3D u'|\n' + i + x.strip().replace(u'\n', u'\n' + i) +- elif ':' in x: +- x =3D u"'" + x.replace(u"'", u"''") + u"'" +- line =3D u'{0}{1}: {2}'.format(indent, name, x) +- c =3D s.inline_comments[name] +- if c: +- line +=3D u' ' + c +- yield line +- for name in s.sections: +- for c in s.comments[name]: +- yield indent + c.strip() +- line =3D u'{0}{1}:'.format(indent, name) +- c =3D s.inline_comments[name] +- if c: +- line +=3D u' ' + c +- yield line +- for val in _walk_section(s[name], level=3Dlevel + 1): +- yield val +- +- +-# def config_obj_2_rt_yaml(cfg): +-# from .comments import CommentedMap, CommentedSeq +-# from configobj import ConfigObj +-# assert isinstance(cfg, ConfigObj) +-# #for c in cfg.initial_comment: +-# # if c.strip(): +-# # pass +-# cm =3D CommentedMap() +-# for name in s.sections: +-# cm[name] =3D d =3D CommentedMap() +-# +-# +-# #for c in cfg.final_comment: +-# # if c.strip(): +-# # yield c +-# return cm +diff --git a/dynaconf/vendor_src/toml/README.md b/dynaconf/vendor_src/toml= /README.md +deleted file mode 100644 +index cbe16fd..0000000 +--- a/dynaconf/vendor_src/toml/README.md ++++ /dev/null +@@ -1,5 +0,0 @@ +-## python-toml +- +-Vendored dep taken from: https://github.com/uiri/toml +-Licensed under BSD: https://github.com/uiri/toml/blob/master/LICENSE +-Current version: 0.10.8 +diff --git a/dynaconf/vendor_src/toml/__init__.py b/dynaconf/vendor_src/to= ml/__init__.py +deleted file mode 100644 +index 338d74c..0000000 +--- a/dynaconf/vendor_src/toml/__init__.py ++++ /dev/null +@@ -1,25 +0,0 @@ +-"""Python module which parses and emits TOML. +- +-Released under the MIT license. +-""" +- +-from . import encoder +-from . import decoder +- +-__version__ =3D "0.10.1" +-_spec_ =3D "0.5.0" +- +-load =3D decoder.load +-loads =3D decoder.loads +-TomlDecoder =3D decoder.TomlDecoder +-TomlDecodeError =3D decoder.TomlDecodeError +-TomlPreserveCommentDecoder =3D decoder.TomlPreserveCommentDecoder +- +-dump =3D encoder.dump +-dumps =3D encoder.dumps +-TomlEncoder =3D encoder.TomlEncoder +-TomlArraySeparatorEncoder =3D encoder.TomlArraySeparatorEncoder +-TomlPreserveInlineDictEncoder =3D encoder.TomlPreserveInlineDictEncoder +-TomlNumpyEncoder =3D encoder.TomlNumpyEncoder +-TomlPreserveCommentEncoder =3D encoder.TomlPreserveCommentEncoder +-TomlPathlibEncoder =3D encoder.TomlPathlibEncoder +diff --git a/dynaconf/vendor_src/toml/decoder.py b/dynaconf/vendor_src/tom= l/decoder.py +deleted file mode 100644 +index 9229733..0000000 +--- a/dynaconf/vendor_src/toml/decoder.py ++++ /dev/null +@@ -1,1052 +0,0 @@ +-import datetime +-import io +-from os import linesep +-import re +-import sys +- +-from .tz import TomlTz +- +-if sys.version_info < (3,): +- _range =3D xrange # noqa: F821 +-else: +- unicode =3D str +- _range =3D range +- basestring =3D str +- unichr =3D chr +- +- +-def _detect_pathlib_path(p): +- if (3, 4) <=3D sys.version_info: +- import pathlib +- if isinstance(p, pathlib.PurePath): +- return True +- return False +- +- +-def _ispath(p): +- if isinstance(p, (bytes, basestring)): +- return True +- return _detect_pathlib_path(p) +- +- +-def _getpath(p): +- if (3, 6) <=3D sys.version_info: +- import os +- return os.fspath(p) +- if _detect_pathlib_path(p): +- return str(p) +- return p +- +- +-try: +- FNFError =3D FileNotFoundError +-except NameError: +- FNFError =3D IOError +- +- +-TIME_RE =3D re.compile(r"([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3,6}))= ?") +- +- +-class TomlDecodeError(ValueError): +- """Base toml Exception / Error.""" +- +- def __init__(self, msg, doc, pos): +- lineno =3D doc.count('\n', 0, pos) + 1 +- colno =3D pos - doc.rfind('\n', 0, pos) +- emsg =3D '{} (line {} column {} char {})'.format(msg, lineno, col= no, pos) +- ValueError.__init__(self, emsg) +- self.msg =3D msg +- self.doc =3D doc +- self.pos =3D pos +- self.lineno =3D lineno +- self.colno =3D colno +- +- +-# Matches a TOML number, which allows underscores for readability +-_number_with_underscores =3D re.compile('([0-9])(_([0-9]))*') +- +- +-class CommentValue(object): +- def __init__(self, val, comment, beginline, _dict): +- self.val =3D val +- separator =3D "\n" if beginline else " " +- self.comment =3D separator + comment +- self._dict =3D _dict +- +- def __getitem__(self, key): +- return self.val[key] +- +- def __setitem__(self, key, value): +- self.val[key] =3D value +- +- def dump(self, dump_value_func): +- retstr =3D dump_value_func(self.val) +- if isinstance(self.val, self._dict): +- return self.comment + "\n" + unicode(retstr) +- else: +- return unicode(retstr) + self.comment +- +- +-def _strictly_valid_num(n): +- n =3D n.strip() +- if not n: +- return False +- if n[0] =3D=3D '_': +- return False +- if n[-1] =3D=3D '_': +- return False +- if "_." in n or "._" in n: +- return False +- if len(n) =3D=3D 1: +- return True +- if n[0] =3D=3D '0' and n[1] not in ['.', 'o', 'b', 'x']: +- return False +- if n[0] =3D=3D '+' or n[0] =3D=3D '-': +- n =3D n[1:] +- if len(n) > 1 and n[0] =3D=3D '0' and n[1] !=3D '.': +- return False +- if '__' in n: +- return False +- return True +- +- +-def load(f, _dict=3Ddict, decoder=3DNone): +- """Parses named file or files as toml and returns a dictionary +- +- Args: +- f: Path to the file to open, array of files to read into single d= ict +- or a file descriptor +- _dict: (optional) Specifies the class of the returned toml dictio= nary +- decoder: The decoder to use +- +- Returns: +- Parsed toml file represented as a dictionary +- +- Raises: +- TypeError -- When f is invalid type +- TomlDecodeError: Error while decoding toml +- IOError / FileNotFoundError -- When an array with no valid (exist= ing) +- (Python 2 / Python 3) file paths is passed +- """ +- +- if _ispath(f): +- with io.open(_getpath(f), encoding=3D'utf-8') as ffile: +- return loads(ffile.read(), _dict, decoder) +- elif isinstance(f, list): +- from os import path as op +- from warnings import warn +- if not [path for path in f if op.exists(path)]: +- error_msg =3D "Load expects a list to contain filenames only." +- error_msg +=3D linesep +- error_msg +=3D ("The list needs to contain the path of at lea= st one " +- "existing file.") +- raise FNFError(error_msg) +- if decoder is None: +- decoder =3D TomlDecoder(_dict) +- d =3D decoder.get_empty_table() +- for l in f: # noqa: E741 +- if op.exists(l): +- d.update(load(l, _dict, decoder)) +- else: +- warn("Non-existent filename in list with at least one val= id " +- "filename") +- return d +- else: +- try: +- return loads(f.read(), _dict, decoder) +- except AttributeError: +- raise TypeError("You can only load a file descriptor, filenam= e or " +- "list") +- +- +-_groupname_re =3D re.compile(r'^[A-Za-z0-9_-]+$') +- +- +-def loads(s, _dict=3Ddict, decoder=3DNone): +- """Parses string as toml +- +- Args: +- s: String to be parsed +- _dict: (optional) Specifies the class of the returned toml dictio= nary +- +- Returns: +- Parsed toml file represented as a dictionary +- +- Raises: +- TypeError: When a non-string is passed +- TomlDecodeError: Error while decoding toml +- """ +- +- implicitgroups =3D [] +- if decoder is None: +- decoder =3D TomlDecoder(_dict) +- retval =3D decoder.get_empty_table() +- currentlevel =3D retval +- if not isinstance(s, basestring): +- raise TypeError("Expecting something like a string") +- +- if not isinstance(s, unicode): +- s =3D s.decode('utf8') +- +- original =3D s +- sl =3D list(s) +- openarr =3D 0 +- openstring =3D False +- openstrchar =3D "" +- multilinestr =3D False +- arrayoftables =3D False +- beginline =3D True +- keygroup =3D False +- dottedkey =3D False +- keyname =3D 0 +- key =3D '' +- prev_key =3D '' +- line_no =3D 1 +- +- for i, item in enumerate(sl): +- if item =3D=3D '\r' and sl[i + 1] =3D=3D '\n': +- sl[i] =3D ' ' +- continue +- if keyname: +- key +=3D item +- if item =3D=3D '\n': +- raise TomlDecodeError("Key name found without value." +- " Reached end of line.", original, = i) +- if openstring: +- if item =3D=3D openstrchar: +- oddbackslash =3D False +- k =3D 1 +- while i >=3D k and sl[i - k] =3D=3D '\\': +- oddbackslash =3D not oddbackslash +- k +=3D 1 +- if not oddbackslash: +- keyname =3D 2 +- openstring =3D False +- openstrchar =3D "" +- continue +- elif keyname =3D=3D 1: +- if item.isspace(): +- keyname =3D 2 +- continue +- elif item =3D=3D '.': +- dottedkey =3D True +- continue +- elif item.isalnum() or item =3D=3D '_' or item =3D=3D '-': +- continue +- elif (dottedkey and sl[i - 1] =3D=3D '.' and +- (item =3D=3D '"' or item =3D=3D "'")): +- openstring =3D True +- openstrchar =3D item +- continue +- elif keyname =3D=3D 2: +- if item.isspace(): +- if dottedkey: +- nextitem =3D sl[i + 1] +- if not nextitem.isspace() and nextitem !=3D '.': +- keyname =3D 1 +- continue +- if item =3D=3D '.': +- dottedkey =3D True +- nextitem =3D sl[i + 1] +- if not nextitem.isspace() and nextitem !=3D '.': +- keyname =3D 1 +- continue +- if item =3D=3D '=3D': +- keyname =3D 0 +- prev_key =3D key[:-1].rstrip() +- key =3D '' +- dottedkey =3D False +- else: +- raise TomlDecodeError("Found invalid character in key nam= e: '" + +- item + "'. Try quoting the key name= .", +- original, i) +- if item =3D=3D "'" and openstrchar !=3D '"': +- k =3D 1 +- try: +- while sl[i - k] =3D=3D "'": +- k +=3D 1 +- if k =3D=3D 3: +- break +- except IndexError: +- pass +- if k =3D=3D 3: +- multilinestr =3D not multilinestr +- openstring =3D multilinestr +- else: +- openstring =3D not openstring +- if openstring: +- openstrchar =3D "'" +- else: +- openstrchar =3D "" +- if item =3D=3D '"' and openstrchar !=3D "'": +- oddbackslash =3D False +- k =3D 1 +- tripquote =3D False +- try: +- while sl[i - k] =3D=3D '"': +- k +=3D 1 +- if k =3D=3D 3: +- tripquote =3D True +- break +- if k =3D=3D 1 or (k =3D=3D 3 and tripquote): +- while sl[i - k] =3D=3D '\\': +- oddbackslash =3D not oddbackslash +- k +=3D 1 +- except IndexError: +- pass +- if not oddbackslash: +- if tripquote: +- multilinestr =3D not multilinestr +- openstring =3D multilinestr +- else: +- openstring =3D not openstring +- if openstring: +- openstrchar =3D '"' +- else: +- openstrchar =3D "" +- if item =3D=3D '#' and (not openstring and not keygroup and +- not arrayoftables): +- j =3D i +- comment =3D "" +- try: +- while sl[j] !=3D '\n': +- comment +=3D s[j] +- sl[j] =3D ' ' +- j +=3D 1 +- except IndexError: +- break +- if not openarr: +- decoder.preserve_comment(line_no, prev_key, comment, begi= nline) +- if item =3D=3D '[' and (not openstring and not keygroup and +- not arrayoftables): +- if beginline: +- if len(sl) > i + 1 and sl[i + 1] =3D=3D '[': +- arrayoftables =3D True +- else: +- keygroup =3D True +- else: +- openarr +=3D 1 +- if item =3D=3D ']' and not openstring: +- if keygroup: +- keygroup =3D False +- elif arrayoftables: +- if sl[i - 1] =3D=3D ']': +- arrayoftables =3D False +- else: +- openarr -=3D 1 +- if item =3D=3D '\n': +- if openstring or multilinestr: +- if not multilinestr: +- raise TomlDecodeError("Unbalanced quotes", original, = i) +- if ((sl[i - 1] =3D=3D "'" or sl[i - 1] =3D=3D '"') and ( +- sl[i - 2] =3D=3D sl[i - 1])): +- sl[i] =3D sl[i - 1] +- if sl[i - 3] =3D=3D sl[i - 1]: +- sl[i - 3] =3D ' ' +- elif openarr: +- sl[i] =3D ' ' +- else: +- beginline =3D True +- line_no +=3D 1 +- elif beginline and sl[i] !=3D ' ' and sl[i] !=3D '\t': +- beginline =3D False +- if not keygroup and not arrayoftables: +- if sl[i] =3D=3D '=3D': +- raise TomlDecodeError("Found empty keyname. ", origin= al, i) +- keyname =3D 1 +- key +=3D item +- if keyname: +- raise TomlDecodeError("Key name found without value." +- " Reached end of file.", original, len(s)) +- if openstring: # reached EOF and have an unterminated string +- raise TomlDecodeError("Unterminated string found." +- " Reached end of file.", original, len(s)) +- s =3D ''.join(sl) +- s =3D s.split('\n') +- multikey =3D None +- multilinestr =3D "" +- multibackslash =3D False +- pos =3D 0 +- for idx, line in enumerate(s): +- if idx > 0: +- pos +=3D len(s[idx - 1]) + 1 +- +- decoder.embed_comments(idx, currentlevel) +- +- if not multilinestr or multibackslash or '\n' not in multilinestr: +- line =3D line.strip() +- if line =3D=3D "" and (not multikey or multibackslash): +- continue +- if multikey: +- if multibackslash: +- multilinestr +=3D line +- else: +- multilinestr +=3D line +- multibackslash =3D False +- closed =3D False +- if multilinestr[0] =3D=3D '[': +- closed =3D line[-1] =3D=3D ']' +- elif len(line) > 2: +- closed =3D (line[-1] =3D=3D multilinestr[0] and +- line[-2] =3D=3D multilinestr[0] and +- line[-3] =3D=3D multilinestr[0]) +- if closed: +- try: +- value, vtype =3D decoder.load_value(multilinestr) +- except ValueError as err: +- raise TomlDecodeError(str(err), original, pos) +- currentlevel[multikey] =3D value +- multikey =3D None +- multilinestr =3D "" +- else: +- k =3D len(multilinestr) - 1 +- while k > -1 and multilinestr[k] =3D=3D '\\': +- multibackslash =3D not multibackslash +- k -=3D 1 +- if multibackslash: +- multilinestr =3D multilinestr[:-1] +- else: +- multilinestr +=3D "\n" +- continue +- if line[0] =3D=3D '[': +- arrayoftables =3D False +- if len(line) =3D=3D 1: +- raise TomlDecodeError("Opening key group bracket on line = by " +- "itself.", original, pos) +- if line[1] =3D=3D '[': +- arrayoftables =3D True +- line =3D line[2:] +- splitstr =3D ']]' +- else: +- line =3D line[1:] +- splitstr =3D ']' +- i =3D 1 +- quotesplits =3D decoder._get_split_on_quotes(line) +- quoted =3D False +- for quotesplit in quotesplits: +- if not quoted and splitstr in quotesplit: +- break +- i +=3D quotesplit.count(splitstr) +- quoted =3D not quoted +- line =3D line.split(splitstr, i) +- if len(line) < i + 1 or line[-1].strip() !=3D "": +- raise TomlDecodeError("Key group not on a line by itself.= ", +- original, pos) +- groups =3D splitstr.join(line[:-1]).split('.') +- i =3D 0 +- while i < len(groups): +- groups[i] =3D groups[i].strip() +- if len(groups[i]) > 0 and (groups[i][0] =3D=3D '"' or +- groups[i][0] =3D=3D "'"): +- groupstr =3D groups[i] +- j =3D i + 1 +- while not groupstr[0] =3D=3D groupstr[-1]: +- j +=3D 1 +- if j > len(groups) + 2: +- raise TomlDecodeError("Invalid group name '" + +- groupstr + "' Something= " + +- "went wrong.", original= , pos) +- groupstr =3D '.'.join(groups[i:j]).strip() +- groups[i] =3D groupstr[1:-1] +- groups[i + 1:j] =3D [] +- else: +- if not _groupname_re.match(groups[i]): +- raise TomlDecodeError("Invalid group name '" + +- groups[i] + "'. Try quoting= it.", +- original, pos) +- i +=3D 1 +- currentlevel =3D retval +- for i in _range(len(groups)): +- group =3D groups[i] +- if group =3D=3D "": +- raise TomlDecodeError("Can't have a keygroup with an = empty " +- "name", original, pos) +- try: +- currentlevel[group] +- if i =3D=3D len(groups) - 1: +- if group in implicitgroups: +- implicitgroups.remove(group) +- if arrayoftables: +- raise TomlDecodeError("An implicitly defi= ned " +- "table can't be an = array", +- original, pos) +- elif arrayoftables: +- currentlevel[group].append(decoder.get_empty_= table() +- ) +- else: +- raise TomlDecodeError("What? " + group + +- " already exists?" + +- str(currentlevel), +- original, pos) +- except TypeError: +- currentlevel =3D currentlevel[-1] +- if group not in currentlevel: +- currentlevel[group] =3D decoder.get_empty_table() +- if i =3D=3D len(groups) - 1 and arrayoftables: +- currentlevel[group] =3D [decoder.get_empty_ta= ble()] +- except KeyError: +- if i !=3D len(groups) - 1: +- implicitgroups.append(group) +- currentlevel[group] =3D decoder.get_empty_table() +- if i =3D=3D len(groups) - 1 and arrayoftables: +- currentlevel[group] =3D [decoder.get_empty_table(= )] +- currentlevel =3D currentlevel[group] +- if arrayoftables: +- try: +- currentlevel =3D currentlevel[-1] +- except KeyError: +- pass +- elif line[0] =3D=3D "{": +- if line[-1] !=3D "}": +- raise TomlDecodeError("Line breaks are not allowed in inl= ine" +- "objects", original, pos) +- try: +- decoder.load_inline_object(line, currentlevel, multikey, +- multibackslash) +- except ValueError as err: +- raise TomlDecodeError(str(err), original, pos) +- elif "=3D" in line: +- try: +- ret =3D decoder.load_line(line, currentlevel, multikey, +- multibackslash) +- except ValueError as err: +- raise TomlDecodeError(str(err), original, pos) +- if ret is not None: +- multikey, multilinestr, multibackslash =3D ret +- return retval +- +- +-def _load_date(val): +- microsecond =3D 0 +- tz =3D None +- try: +- if len(val) > 19: +- if val[19] =3D=3D '.': +- if val[-1].upper() =3D=3D 'Z': +- subsecondval =3D val[20:-1] +- tzval =3D "Z" +- else: +- subsecondvalandtz =3D val[20:] +- if '+' in subsecondvalandtz: +- splitpoint =3D subsecondvalandtz.index('+') +- subsecondval =3D subsecondvalandtz[:splitpoint] +- tzval =3D subsecondvalandtz[splitpoint:] +- elif '-' in subsecondvalandtz: +- splitpoint =3D subsecondvalandtz.index('-') +- subsecondval =3D subsecondvalandtz[:splitpoint] +- tzval =3D subsecondvalandtz[splitpoint:] +- else: +- tzval =3D None +- subsecondval =3D subsecondvalandtz +- if tzval is not None: +- tz =3D TomlTz(tzval) +- microsecond =3D int(int(subsecondval) * +- (10 ** (6 - len(subsecondval)))) +- else: +- tz =3D TomlTz(val[19:]) +- except ValueError: +- tz =3D None +- if "-" not in val[1:]: +- return None +- try: +- if len(val) =3D=3D 10: +- d =3D datetime.date( +- int(val[:4]), int(val[5:7]), +- int(val[8:10])) +- else: +- d =3D datetime.datetime( +- int(val[:4]), int(val[5:7]), +- int(val[8:10]), int(val[11:13]), +- int(val[14:16]), int(val[17:19]), microsecond, tz) +- except ValueError: +- return None +- return d +- +- +-def _load_unicode_escapes(v, hexbytes, prefix): +- skip =3D False +- i =3D len(v) - 1 +- while i > -1 and v[i] =3D=3D '\\': +- skip =3D not skip +- i -=3D 1 +- for hx in hexbytes: +- if skip: +- skip =3D False +- i =3D len(hx) - 1 +- while i > -1 and hx[i] =3D=3D '\\': +- skip =3D not skip +- i -=3D 1 +- v +=3D prefix +- v +=3D hx +- continue +- hxb =3D "" +- i =3D 0 +- hxblen =3D 4 +- if prefix =3D=3D "\\U": +- hxblen =3D 8 +- hxb =3D ''.join(hx[i:i + hxblen]).lower() +- if hxb.strip('0123456789abcdef'): +- raise ValueError("Invalid escape sequence: " + hxb) +- if hxb[0] =3D=3D "d" and hxb[1].strip('01234567'): +- raise ValueError("Invalid escape sequence: " + hxb + +- ". Only scalar unicode points are allowed.") +- v +=3D unichr(int(hxb, 16)) +- v +=3D unicode(hx[len(hxb):]) +- return v +- +- +-# Unescape TOML string values. +- +-# content after the \ +-_escapes =3D ['0', 'b', 'f', 'n', 'r', 't', '"'] +-# What it should be replaced by +-_escapedchars =3D ['\0', '\b', '\f', '\n', '\r', '\t', '\"'] +-# Used for substitution +-_escape_to_escapedchars =3D dict(zip(_escapes, _escapedchars)) +- +- +-def _unescape(v): +- """Unescape characters in a TOML string.""" +- i =3D 0 +- backslash =3D False +- while i < len(v): +- if backslash: +- backslash =3D False +- if v[i] in _escapes: +- v =3D v[:i - 1] + _escape_to_escapedchars[v[i]] + v[i + 1= :] +- elif v[i] =3D=3D '\\': +- v =3D v[:i - 1] + v[i:] +- elif v[i] =3D=3D 'u' or v[i] =3D=3D 'U': +- i +=3D 1 +- else: +- raise ValueError("Reserved escape sequence used") +- continue +- elif v[i] =3D=3D '\\': +- backslash =3D True +- i +=3D 1 +- return v +- +- +-class InlineTableDict(object): +- """Sentinel subclass of dict for inline tables.""" +- +- +-class TomlDecoder(object): +- +- def __init__(self, _dict=3Ddict): +- self._dict =3D _dict +- +- def get_empty_table(self): +- return self._dict() +- +- def get_empty_inline_table(self): +- class DynamicInlineTableDict(self._dict, InlineTableDict): +- """Concrete sentinel subclass for inline tables. +- It is a subclass of _dict which is passed in dynamically at l= oad +- time +- +- It is also a subclass of InlineTableDict +- """ +- +- return DynamicInlineTableDict() +- +- def load_inline_object(self, line, currentlevel, multikey=3DFalse, +- multibackslash=3DFalse): +- candidate_groups =3D line[1:-1].split(",") +- groups =3D [] +- if len(candidate_groups) =3D=3D 1 and not candidate_groups[0].str= ip(): +- candidate_groups.pop() +- while len(candidate_groups) > 0: +- candidate_group =3D candidate_groups.pop(0) +- try: +- _, value =3D candidate_group.split('=3D', 1) +- except ValueError: +- raise ValueError("Invalid inline table encountered") +- value =3D value.strip() +- if ((value[0] =3D=3D value[-1] and value[0] in ('"', "'")) or= ( +- value[0] in '-0123456789' or +- value in ('true', 'false') or +- (value[0] =3D=3D "[" and value[-1] =3D=3D "]") or +- (value[0] =3D=3D '{' and value[-1] =3D=3D '}'))): +- groups.append(candidate_group) +- elif len(candidate_groups) > 0: +- candidate_groups[0] =3D (candidate_group + "," + +- candidate_groups[0]) +- else: +- raise ValueError("Invalid inline table value encountered") +- for group in groups: +- status =3D self.load_line(group, currentlevel, multikey, +- multibackslash) +- if status is not None: +- break +- +- def _get_split_on_quotes(self, line): +- doublequotesplits =3D line.split('"') +- quoted =3D False +- quotesplits =3D [] +- if len(doublequotesplits) > 1 and "'" in doublequotesplits[0]: +- singlequotesplits =3D doublequotesplits[0].split("'") +- doublequotesplits =3D doublequotesplits[1:] +- while len(singlequotesplits) % 2 =3D=3D 0 and len(doublequote= splits): +- singlequotesplits[-1] +=3D '"' + doublequotesplits[0] +- doublequotesplits =3D doublequotesplits[1:] +- if "'" in singlequotesplits[-1]: +- singlequotesplits =3D (singlequotesplits[:-1] + +- singlequotesplits[-1].split("'")) +- quotesplits +=3D singlequotesplits +- for doublequotesplit in doublequotesplits: +- if quoted: +- quotesplits.append(doublequotesplit) +- else: +- quotesplits +=3D doublequotesplit.split("'") +- quoted =3D not quoted +- return quotesplits +- +- def load_line(self, line, currentlevel, multikey, multibackslash): +- i =3D 1 +- quotesplits =3D self._get_split_on_quotes(line) +- quoted =3D False +- for quotesplit in quotesplits: +- if not quoted and '=3D' in quotesplit: +- break +- i +=3D quotesplit.count('=3D') +- quoted =3D not quoted +- pair =3D line.split('=3D', i) +- strictly_valid =3D _strictly_valid_num(pair[-1]) +- if _number_with_underscores.match(pair[-1]): +- pair[-1] =3D pair[-1].replace('_', '') +- while len(pair[-1]) and (pair[-1][0] !=3D ' ' and pair[-1][0] != =3D '\t' and +- pair[-1][0] !=3D "'" and pair[-1][0] != =3D '"' and +- pair[-1][0] !=3D '[' and pair[-1][0] != =3D '{' and +- pair[-1].strip() !=3D 'true' and +- pair[-1].strip() !=3D 'false'): +- try: +- float(pair[-1]) +- break +- except ValueError: +- pass +- if _load_date(pair[-1]) is not None: +- break +- if TIME_RE.match(pair[-1]): +- break +- i +=3D 1 +- prev_val =3D pair[-1] +- pair =3D line.split('=3D', i) +- if prev_val =3D=3D pair[-1]: +- raise ValueError("Invalid date or number") +- if strictly_valid: +- strictly_valid =3D _strictly_valid_num(pair[-1]) +- pair =3D ['=3D'.join(pair[:-1]).strip(), pair[-1].strip()] +- if '.' in pair[0]: +- if '"' in pair[0] or "'" in pair[0]: +- quotesplits =3D self._get_split_on_quotes(pair[0]) +- quoted =3D False +- levels =3D [] +- for quotesplit in quotesplits: +- if quoted: +- levels.append(quotesplit) +- else: +- levels +=3D [level.strip() for level in +- quotesplit.split('.')] +- quoted =3D not quoted +- else: +- levels =3D pair[0].split('.') +- while levels[-1] =3D=3D "": +- levels =3D levels[:-1] +- for level in levels[:-1]: +- if level =3D=3D "": +- continue +- if level not in currentlevel: +- currentlevel[level] =3D self.get_empty_table() +- currentlevel =3D currentlevel[level] +- pair[0] =3D levels[-1].strip() +- elif (pair[0][0] =3D=3D '"' or pair[0][0] =3D=3D "'") and \ +- (pair[0][-1] =3D=3D pair[0][0]): +- pair[0] =3D _unescape(pair[0][1:-1]) +- k, koffset =3D self._load_line_multiline_str(pair[1]) +- if k > -1: +- while k > -1 and pair[1][k + koffset] =3D=3D '\\': +- multibackslash =3D not multibackslash +- k -=3D 1 +- if multibackslash: +- multilinestr =3D pair[1][:-1] +- else: +- multilinestr =3D pair[1] + "\n" +- multikey =3D pair[0] +- else: +- value, vtype =3D self.load_value(pair[1], strictly_valid) +- try: +- currentlevel[pair[0]] +- raise ValueError("Duplicate keys!") +- except TypeError: +- raise ValueError("Duplicate keys!") +- except KeyError: +- if multikey: +- return multikey, multilinestr, multibackslash +- else: +- currentlevel[pair[0]] =3D value +- +- def _load_line_multiline_str(self, p): +- poffset =3D 0 +- if len(p) < 3: +- return -1, poffset +- if p[0] =3D=3D '[' and (p.strip()[-1] !=3D ']' and +- self._load_array_isstrarray(p)): +- newp =3D p[1:].strip().split(',') +- while len(newp) > 1 and newp[-1][0] !=3D '"' and newp[-1][0] = !=3D "'": +- newp =3D newp[:-2] + [newp[-2] + ',' + newp[-1]] +- newp =3D newp[-1] +- poffset =3D len(p) - len(newp) +- p =3D newp +- if p[0] !=3D '"' and p[0] !=3D "'": +- return -1, poffset +- if p[1] !=3D p[0] or p[2] !=3D p[0]: +- return -1, poffset +- if len(p) > 5 and p[-1] =3D=3D p[0] and p[-2] =3D=3D p[0] and p[-= 3] =3D=3D p[0]: +- return -1, poffset +- return len(p) - 1, poffset +- +- def load_value(self, v, strictly_valid=3DTrue): +- if not v: +- raise ValueError("Empty value is invalid") +- if v =3D=3D 'true': +- return (True, "bool") +- elif v =3D=3D 'false': +- return (False, "bool") +- elif v[0] =3D=3D '"' or v[0] =3D=3D "'": +- quotechar =3D v[0] +- testv =3D v[1:].split(quotechar) +- triplequote =3D False +- triplequotecount =3D 0 +- if len(testv) > 1 and testv[0] =3D=3D '' and testv[1] =3D=3D = '': +- testv =3D testv[2:] +- triplequote =3D True +- closed =3D False +- for tv in testv: +- if tv =3D=3D '': +- if triplequote: +- triplequotecount +=3D 1 +- else: +- closed =3D True +- else: +- oddbackslash =3D False +- try: +- i =3D -1 +- j =3D tv[i] +- while j =3D=3D '\\': +- oddbackslash =3D not oddbackslash +- i -=3D 1 +- j =3D tv[i] +- except IndexError: +- pass +- if not oddbackslash: +- if closed: +- raise ValueError("Found tokens after a closed= " + +- "string. Invalid TOML.") +- else: +- if not triplequote or triplequotecount > 1: +- closed =3D True +- else: +- triplequotecount =3D 0 +- if quotechar =3D=3D '"': +- escapeseqs =3D v.split('\\')[1:] +- backslash =3D False +- for i in escapeseqs: +- if i =3D=3D '': +- backslash =3D not backslash +- else: +- if i[0] not in _escapes and (i[0] !=3D 'u' and +- i[0] !=3D 'U' and +- not backslash): +- raise ValueError("Reserved escape sequence us= ed") +- if backslash: +- backslash =3D False +- for prefix in ["\\u", "\\U"]: +- if prefix in v: +- hexbytes =3D v.split(prefix) +- v =3D _load_unicode_escapes(hexbytes[0], hexbytes= [1:], +- prefix) +- v =3D _unescape(v) +- if len(v) > 1 and v[1] =3D=3D quotechar and (len(v) < 3 or +- v[1] =3D=3D v[2]): +- v =3D v[2:-2] +- return (v[1:-1], "str") +- elif v[0] =3D=3D '[': +- return (self.load_array(v), "array") +- elif v[0] =3D=3D '{': +- inline_object =3D self.get_empty_inline_table() +- self.load_inline_object(v, inline_object) +- return (inline_object, "inline_object") +- elif TIME_RE.match(v): +- h, m, s, _, ms =3D TIME_RE.match(v).groups() +- time =3D datetime.time(int(h), int(m), int(s), int(ms) if ms = else 0) +- return (time, "time") +- else: +- parsed_date =3D _load_date(v) +- if parsed_date is not None: +- return (parsed_date, "date") +- if not strictly_valid: +- raise ValueError("Weirdness with leading zeroes or " +- "underscores in your number.") +- itype =3D "int" +- neg =3D False +- if v[0] =3D=3D '-': +- neg =3D True +- v =3D v[1:] +- elif v[0] =3D=3D '+': +- v =3D v[1:] +- v =3D v.replace('_', '') +- lowerv =3D v.lower() +- if '.' in v or ('x' not in v and ('e' in v or 'E' in v)): +- if '.' in v and v.split('.', 1)[1] =3D=3D '': +- raise ValueError("This float is missing digits after " +- "the point") +- if v[0] not in '0123456789': +- raise ValueError("This float doesn't have a leading " +- "digit") +- v =3D float(v) +- itype =3D "float" +- elif len(lowerv) =3D=3D 3 and (lowerv =3D=3D 'inf' or lowerv = =3D=3D 'nan'): +- v =3D float(v) +- itype =3D "float" +- if itype =3D=3D "int": +- v =3D int(v, 0) +- if neg: +- return (0 - v, itype) +- return (v, itype) +- +- def bounded_string(self, s): +- if len(s) =3D=3D 0: +- return True +- if s[-1] !=3D s[0]: +- return False +- i =3D -2 +- backslash =3D False +- while len(s) + i > 0: +- if s[i] =3D=3D "\\": +- backslash =3D not backslash +- i -=3D 1 +- else: +- break +- return not backslash +- +- def _load_array_isstrarray(self, a): +- a =3D a[1:-1].strip() +- if a !=3D '' and (a[0] =3D=3D '"' or a[0] =3D=3D "'"): +- return True +- return False +- +- def load_array(self, a): +- atype =3D None +- retval =3D [] +- a =3D a.strip() +- if '[' not in a[1:-1] or "" !=3D a[1:-1].split('[')[0].strip(): +- strarray =3D self._load_array_isstrarray(a) +- if not a[1:-1].strip().startswith('{'): +- a =3D a[1:-1].split(',') +- else: +- # a is an inline object, we must find the matching parent= hesis +- # to define groups +- new_a =3D [] +- start_group_index =3D 1 +- end_group_index =3D 2 +- open_bracket_count =3D 1 if a[start_group_index] =3D=3D '= {' else 0 +- in_str =3D False +- while end_group_index < len(a[1:]): +- if a[end_group_index] =3D=3D '"' or a[end_group_index= ] =3D=3D "'": +- if in_str: +- backslash_index =3D end_group_index - 1 +- while (backslash_index > -1 and +- a[backslash_index] =3D=3D '\\'): +- in_str =3D not in_str +- backslash_index -=3D 1 +- in_str =3D not in_str +- if not in_str and a[end_group_index] =3D=3D '{': +- open_bracket_count +=3D 1 +- if in_str or a[end_group_index] !=3D '}': +- end_group_index +=3D 1 +- continue +- elif a[end_group_index] =3D=3D '}' and open_bracket_c= ount > 1: +- open_bracket_count -=3D 1 +- end_group_index +=3D 1 +- continue +- +- # Increase end_group_index by 1 to get the closing br= acket +- end_group_index +=3D 1 +- +- new_a.append(a[start_group_index:end_group_index]) +- +- # The next start index is at least after the closing +- # bracket, a closing bracket can be followed by a com= ma +- # since we are in an array. +- start_group_index =3D end_group_index + 1 +- while (start_group_index < len(a[1:]) and +- a[start_group_index] !=3D '{'): +- start_group_index +=3D 1 +- end_group_index =3D start_group_index + 1 +- a =3D new_a +- b =3D 0 +- if strarray: +- while b < len(a) - 1: +- ab =3D a[b].strip() +- while (not self.bounded_string(ab) or +- (len(ab) > 2 and +- ab[0] =3D=3D ab[1] =3D=3D ab[2] and +- ab[-2] !=3D ab[0] and +- ab[-3] !=3D ab[0])): +- a[b] =3D a[b] + ',' + a[b + 1] +- ab =3D a[b].strip() +- if b < len(a) - 2: +- a =3D a[:b + 1] + a[b + 2:] +- else: +- a =3D a[:b + 1] +- b +=3D 1 +- else: +- al =3D list(a[1:-1]) +- a =3D [] +- openarr =3D 0 +- j =3D 0 +- for i in _range(len(al)): +- if al[i] =3D=3D '[': +- openarr +=3D 1 +- elif al[i] =3D=3D ']': +- openarr -=3D 1 +- elif al[i] =3D=3D ',' and not openarr: +- a.append(''.join(al[j:i])) +- j =3D i + 1 +- a.append(''.join(al[j:])) +- for i in _range(len(a)): +- a[i] =3D a[i].strip() +- if a[i] !=3D '': +- nval, ntype =3D self.load_value(a[i]) +- if atype: +- if ntype !=3D atype: +- raise ValueError("Not a homogeneous array") +- else: +- atype =3D ntype +- retval.append(nval) +- return retval +- +- def preserve_comment(self, line_no, key, comment, beginline): +- pass +- +- def embed_comments(self, idx, currentlevel): +- pass +- +- +-class TomlPreserveCommentDecoder(TomlDecoder): +- +- def __init__(self, _dict=3Ddict): +- self.saved_comments =3D {} +- super(TomlPreserveCommentDecoder, self).__init__(_dict) +- +- def preserve_comment(self, line_no, key, comment, beginline): +- self.saved_comments[line_no] =3D (key, comment, beginline) +- +- def embed_comments(self, idx, currentlevel): +- if idx not in self.saved_comments: +- return +- +- key, comment, beginline =3D self.saved_comments[idx] +- currentlevel[key] =3D CommentValue(currentlevel[key], comment, be= ginline, +- self._dict) +diff --git a/dynaconf/vendor_src/toml/encoder.py b/dynaconf/vendor_src/tom= l/encoder.py +deleted file mode 100644 +index f908f27..0000000 +--- a/dynaconf/vendor_src/toml/encoder.py ++++ /dev/null +@@ -1,304 +0,0 @@ +-import datetime +-import re +-import sys +-from decimal import Decimal +- +-from .decoder import InlineTableDict +- +-if sys.version_info >=3D (3,): +- unicode =3D str +- +- +-def dump(o, f, encoder=3DNone): +- """Writes out dict as toml to a file +- +- Args: +- o: Object to dump into toml +- f: File descriptor where the toml should be stored +- encoder: The ``TomlEncoder`` to use for constructing the output s= tring +- +- Returns: +- String containing the toml corresponding to dictionary +- +- Raises: +- TypeError: When anything other than file descriptor is passed +- """ +- +- if not f.write: +- raise TypeError("You can only dump an object to a file descriptor= ") +- d =3D dumps(o, encoder=3Dencoder) +- f.write(d) +- return d +- +- +-def dumps(o, encoder=3DNone): +- """Stringifies input dict as toml +- +- Args: +- o: Object to dump into toml +- encoder: The ``TomlEncoder`` to use for constructing the output s= tring +- +- Returns: +- String containing the toml corresponding to dict +- +- Examples: +- ```python +- >>> import toml +- >>> output =3D { +- ... 'a': "I'm a string", +- ... 'b': ["I'm", "a", "list"], +- ... 'c': 2400 +- ... } +- >>> toml.dumps(output) +- 'a =3D "I\'m a string"\nb =3D [ "I\'m", "a", "list",]\nc =3D 2400= \n' +- ``` +- """ +- +- retval =3D "" +- if encoder is None: +- encoder =3D TomlEncoder(o.__class__) +- addtoretval, sections =3D encoder.dump_sections(o, "") +- retval +=3D addtoretval +- outer_objs =3D [id(o)] +- while sections: +- section_ids =3D [id(section) for section in sections] +- for outer_obj in outer_objs: +- if outer_obj in section_ids: +- raise ValueError("Circular reference detected") +- outer_objs +=3D section_ids +- newsections =3D encoder.get_empty_table() +- for section in sections: +- addtoretval, addtosections =3D encoder.dump_sections( +- sections[section], section) +- +- if addtoretval or (not addtoretval and not addtosections): +- if retval and retval[-2:] !=3D "\n\n": +- retval +=3D "\n" +- retval +=3D "[" + section + "]\n" +- if addtoretval: +- retval +=3D addtoretval +- for s in addtosections: +- newsections[section + "." + s] =3D addtosections[s] +- sections =3D newsections +- return retval +- +- +-def _dump_str(v): +- if sys.version_info < (3,) and hasattr(v, 'decode') and isinstance(v,= str): +- v =3D v.decode('utf-8') +- v =3D "%r" % v +- if v[0] =3D=3D 'u': +- v =3D v[1:] +- singlequote =3D v.startswith("'") +- if singlequote or v.startswith('"'): +- v =3D v[1:-1] +- if singlequote: +- v =3D v.replace("\\'", "'") +- v =3D v.replace('"', '\\"') +- v =3D v.split("\\x") +- while len(v) > 1: +- i =3D -1 +- if not v[0]: +- v =3D v[1:] +- v[0] =3D v[0].replace("\\\\", "\\") +- # No, I don't know why !=3D works and =3D=3D breaks +- joinx =3D v[0][i] !=3D "\\" +- while v[0][:i] and v[0][i] =3D=3D "\\": +- joinx =3D not joinx +- i -=3D 1 +- if joinx: +- joiner =3D "x" +- else: +- joiner =3D "u00" +- v =3D [v[0] + joiner + v[1]] + v[2:] +- return unicode('"' + v[0] + '"') +- +- +-def _dump_float(v): +- return "{}".format(v).replace("e+0", "e+").replace("e-0", "e-") +- +- +-def _dump_time(v): +- utcoffset =3D v.utcoffset() +- if utcoffset is None: +- return v.isoformat() +- # The TOML norm specifies that it's local time thus we drop the offset +- return v.isoformat()[:-6] +- +- +-class TomlEncoder(object): +- +- def __init__(self, _dict=3Ddict, preserve=3DFalse): +- self._dict =3D _dict +- self.preserve =3D preserve +- self.dump_funcs =3D { +- str: _dump_str, +- unicode: _dump_str, +- list: self.dump_list, +- bool: lambda v: unicode(v).lower(), +- int: lambda v: v, +- float: _dump_float, +- Decimal: _dump_float, +- datetime.datetime: lambda v: v.isoformat().replace('+00:00', = 'Z'), +- datetime.time: _dump_time, +- datetime.date: lambda v: v.isoformat() +- } +- +- def get_empty_table(self): +- return self._dict() +- +- def dump_list(self, v): +- retval =3D "[" +- for u in v: +- retval +=3D " " + unicode(self.dump_value(u)) + "," +- retval +=3D "]" +- return retval +- +- def dump_inline_table(self, section): +- """Preserve inline table in its compact syntax instead of expandi= ng +- into subsection. +- +- https://github.com/toml-lang/toml#user-content-inline-table +- """ +- retval =3D "" +- if isinstance(section, dict): +- val_list =3D [] +- for k, v in section.items(): +- val =3D self.dump_inline_table(v) +- val_list.append(k + " =3D " + val) +- retval +=3D "{ " + ", ".join(val_list) + " }\n" +- return retval +- else: +- return unicode(self.dump_value(section)) +- +- def dump_value(self, v): +- # Lookup function corresponding to v's type +- dump_fn =3D self.dump_funcs.get(type(v)) +- if dump_fn is None and hasattr(v, '__iter__'): +- dump_fn =3D self.dump_funcs[list] +- # Evaluate function (if it exists) else return v +- return dump_fn(v) if dump_fn is not None else self.dump_funcs[str= ](v) +- +- def dump_sections(self, o, sup): +- retstr =3D "" +- if sup !=3D "" and sup[-1] !=3D ".": +- sup +=3D '.' +- retdict =3D self._dict() +- arraystr =3D "" +- for section in o: +- section =3D unicode(section) +- qsection =3D section +- if not re.match(r'^[A-Za-z0-9_-]+$', section): +- qsection =3D _dump_str(section) +- if not isinstance(o[section], dict): +- arrayoftables =3D False +- if isinstance(o[section], list): +- for a in o[section]: +- if isinstance(a, dict): +- arrayoftables =3D True +- if arrayoftables: +- for a in o[section]: +- arraytabstr =3D "\n" +- arraystr +=3D "[[" + sup + qsection + "]]\n" +- s, d =3D self.dump_sections(a, sup + qsection) +- if s: +- if s[0] =3D=3D "[": +- arraytabstr +=3D s +- else: +- arraystr +=3D s +- while d: +- newd =3D self._dict() +- for dsec in d: +- s1, d1 =3D self.dump_sections(d[dsec], su= p + +- qsection + ".= " + +- dsec) +- if s1: +- arraytabstr +=3D ("[" + sup + qsectio= n + +- "." + dsec + "]\n") +- arraytabstr +=3D s1 +- for s1 in d1: +- newd[dsec + "." + s1] =3D d1[s1] +- d =3D newd +- arraystr +=3D arraytabstr +- else: +- if o[section] is not None: +- retstr +=3D (qsection + " =3D " + +- unicode(self.dump_value(o[section])) += '\n') +- elif self.preserve and isinstance(o[section], InlineTableDict= ): +- retstr +=3D (qsection + " =3D " + +- self.dump_inline_table(o[section])) +- else: +- retdict[qsection] =3D o[section] +- retstr +=3D arraystr +- return (retstr, retdict) +- +- +-class TomlPreserveInlineDictEncoder(TomlEncoder): +- +- def __init__(self, _dict=3Ddict): +- super(TomlPreserveInlineDictEncoder, self).__init__(_dict, True) +- +- +-class TomlArraySeparatorEncoder(TomlEncoder): +- +- def __init__(self, _dict=3Ddict, preserve=3DFalse, separator=3D","): +- super(TomlArraySeparatorEncoder, self).__init__(_dict, preserve) +- if separator.strip() =3D=3D "": +- separator =3D "," + separator +- elif separator.strip(' \t\n\r,'): +- raise ValueError("Invalid separator for arrays") +- self.separator =3D separator +- +- def dump_list(self, v): +- t =3D [] +- retval =3D "[" +- for u in v: +- t.append(self.dump_value(u)) +- while t !=3D []: +- s =3D [] +- for u in t: +- if isinstance(u, list): +- for r in u: +- s.append(r) +- else: +- retval +=3D " " + unicode(u) + self.separator +- t =3D s +- retval +=3D "]" +- return retval +- +- +-class TomlNumpyEncoder(TomlEncoder): +- +- def __init__(self, _dict=3Ddict, preserve=3DFalse): +- import numpy as np +- super(TomlNumpyEncoder, self).__init__(_dict, preserve) +- self.dump_funcs[np.float16] =3D _dump_float +- self.dump_funcs[np.float32] =3D _dump_float +- self.dump_funcs[np.float64] =3D _dump_float +- self.dump_funcs[np.int16] =3D self._dump_int +- self.dump_funcs[np.int32] =3D self._dump_int +- self.dump_funcs[np.int64] =3D self._dump_int +- +- def _dump_int(self, v): +- return "{}".format(int(v)) +- +- +-class TomlPreserveCommentEncoder(TomlEncoder): +- +- def __init__(self, _dict=3Ddict, preserve=3DFalse): +- from dynaconf.vendor.toml.decoder import CommentValue +- super(TomlPreserveCommentEncoder, self).__init__(_dict, preserve) +- self.dump_funcs[CommentValue] =3D lambda v: v.dump(self.dump_valu= e) +- +- +-class TomlPathlibEncoder(TomlEncoder): +- +- def _dump_pathlib_path(self, v): +- return _dump_str(str(v)) +- +- def dump_value(self, v): +- if (3, 4) <=3D sys.version_info: +- import pathlib +- if isinstance(v, pathlib.PurePath): +- v =3D str(v) +- return super(TomlPathlibEncoder, self).dump_value(v) +diff --git a/dynaconf/vendor_src/toml/ordered.py b/dynaconf/vendor_src/tom= l/ordered.py +deleted file mode 100644 +index 6b8d9c1..0000000 +--- a/dynaconf/vendor_src/toml/ordered.py ++++ /dev/null +@@ -1,15 +0,0 @@ +-from collections import OrderedDict +-from . import TomlEncoder +-from . import TomlDecoder +- +- +-class TomlOrderedDecoder(TomlDecoder): +- +- def __init__(self): +- super(self.__class__, self).__init__(_dict=3DOrderedDict) +- +- +-class TomlOrderedEncoder(TomlEncoder): +- +- def __init__(self): +- super(self.__class__, self).__init__(_dict=3DOrderedDict) +diff --git a/dynaconf/vendor_src/toml/tz.py b/dynaconf/vendor_src/toml/tz.= py +deleted file mode 100644 +index 93c3c8a..0000000 +--- a/dynaconf/vendor_src/toml/tz.py ++++ /dev/null +@@ -1,21 +0,0 @@ +-from datetime import tzinfo, timedelta +- +- +-class TomlTz(tzinfo): +- def __init__(self, toml_offset): +- if toml_offset =3D=3D "Z": +- self._raw_offset =3D "+00:00" +- else: +- self._raw_offset =3D toml_offset +- self._sign =3D -1 if self._raw_offset[0] =3D=3D '-' else 1 +- self._hours =3D int(self._raw_offset[1:3]) +- self._minutes =3D int(self._raw_offset[4:6]) +- +- def tzname(self, dt): +- return "UTC" + self._raw_offset +- +- def utcoffset(self, dt): +- return self._sign * timedelta(hours=3Dself._hours, minutes=3Dself= ._minutes) +- +- def dst(self, dt): +- return timedelta(0) +diff --git a/dynaconf/vendor_src/vendor.txt b/dynaconf/vendor_src/vendor.t= xt +index add308d..daa2b60 100644 +--- a/dynaconf/vendor_src/vendor.txt ++++ b/dynaconf/vendor_src/vendor.txt +@@ -1,5 +1 @@ + python-box=3D=3D4.2.3 +-toml=3D=3D0.10.8 +-click=3D=3D7.1.x +-python-dotenv=3D=3D0.13.0 +-ruamel.yaml=3D=3D0.16.10 +diff --git a/tests/test_cli.py b/tests/test_cli.py +index 9338851..726b009 100644 +--- a/tests/test_cli.py ++++ b/tests/test_cli.py +@@ -11,7 +11,7 @@ from dynaconf.cli import main + from dynaconf.cli import read_file_in_root_directory + from dynaconf.cli import WRITERS + from dynaconf.utils.files import read_file +-from dynaconf.vendor.click.testing import CliRunner ++from click.testing import CliRunner +=20 +=20 + runner =3D CliRunner() +--=20 +2.32.0 + diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index c7f91dd977..d010956e7e 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -133,6 +133,7 @@ #:use-module (gnu packages crypto) #:use-module (gnu packages databases) #:use-module (gnu packages dbm) + #:use-module (gnu packages django) #:use-module (gnu packages djvu) #:use-module (gnu packages docker) #:use-module (gnu packages enchant) @@ -12507,6 +12508,16 @@ text.") (home-page "https://pypi.org/project/colorama/") (license license:bsd-3))) =20 +(define-public python-colorama-0.4.1 + (package (inherit python-colorama) + (version "0.4.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "colorama" version)) + (sha256 + (base32 "0ba247bx5pc60hcpbf3rjsqk0whilg241i9qdfnlcwij5qgdgvh5"))))= )) + (define-public python2-colorama (package-with-python2 python-colorama)) =20 @@ -26145,6 +26156,18 @@ representing paths or filenames.") read key-value pairs from a .env file and set them as environment variable= s") (license license:bsd-3))) =20 +(define-public python-dotenv-0.13.0 + (package (inherit python-dotenv) + (name "python-dotenv") + (version "0.13.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "python-dotenv" version)) + (sha256 + (base32 + "0x5dagmfn31phrbxlwacw3s4w5vibv8fxqc62nqcdvdhjsy0k69v")))))) + (define-public python-box (package (name "python-box") @@ -26168,3 +26191,67 @@ read key-value pairs from a .env file and set them= as environment variables") "This package provides the @code{python-box} Python module. It implements advanced Python dictionaries with dot notation access.") (license license:expat))) + +(define-public dynaconf + (package + (name "dynaconf") + (version "3.1.4") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://github.com/rochacbruno/dynaconf") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0dafd7hb691g6s3yjfvl5gph5md73n6g9j44kjpbnbbilr5pc85g")) + (patches (search-patches "dynaconf-Unvendor-dependencies.patch")))) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? outputs #:allow-other-keys) + (when tests? + (setenv "PATH" + (string-append (assoc-ref outputs "out") "/bin:" + (getenv "PATH"))) + ;; These tests depend on hvac and a + ;; live Vault process. + (delete-file "tests/test_vault.py") + (invoke "make" "test_only")) + #t))))) + (propagated-inputs + `(("python-click" ,python-click) + ("python-dotenv" ,python-dotenv-0.13.0) + ("python-ruamel.yaml" ,python-ruamel.yaml) + ("python-toml" ,python-toml))) + (native-inputs + `(("make" ,gnu-make) + ("python-codecov" ,python-codecov) + ("python-configobj" ,python-configobj) + ("python-colorama" ,python-colorama-0.4.1) + ("python-django" ,python-django) + ("python-flake8" ,python-flake8) + ("python-flake8-debugger" ,python-flake8-debugger) + ("python-flake8-print" ,python-flake8-print) + ("python-flake8-todo" ,python-flake8-todo) + ("python-flask" ,python-flask) + ("python-future" ,python-future) + ("python-pep8-naming" ,python-pep8-naming) + ("python-pytest" ,python-pytest-6) + ("python-pytest-cov" ,python-pytest-cov) + ("python-pytest-forked" ,python-pytest-forked) + ("python-pytest-mock" ,python-pytest-mock) + ("python-pytest-xdist" ,python-pytest-xdist) + ("python-radon" ,python-radon))) + (home-page + "https://github.com/rochacbruno/dynaconf") + (synopsis + "The dynamic configurator for your Python Project") + (description + "This package provides @code{dynaconf} the dynamic configurator for +your Python Project.") + (license license:expat))) --=20 2.32.0