Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–1516 unchanged (1516 lines)
1517
1518 if value_type is _jinja_common.VaultExceptionMarker:
1519 ciphertext = value._marker_undecryptable_ciphertext
1520 tags = AnsibleTagHelper.tags(ciphertext) # ciphertext has tags but value does not
1521 elif value_type is EncryptedString:
1522 ciphertext = value._ciphertext
1523 elif value_type in _jinja_common.Marker.concrete_subclasses: # avoid wasteful raise/except of Marker when calling get_tag below
1524 ciphertext = None
1525 elif vaulted_value := VaultedValue.get_tag(value):
1526 ciphertext = vaulted_value.ciphertext
1527 else:
1528 ciphertext = None
1529
…lines 1530–1537 unchanged (8 lines)

After

…lines 1–1516 unchanged (1516 lines)
1517
1518 if value_type is _jinja_common.VaultExceptionMarker:
1519 ciphertext = value._marker_undecryptable_ciphertext
1520 tags = AnsibleTagHelper.tags(ciphertext) # ciphertext has tags but value does not
1521 elif value_type is EncryptedString:
1522 ciphertext = value._ciphertext
1523 elif value_type in _jinja_common.Marker._concrete_subclasses: # avoid wasteful raise/except of Marker when calling get_tag below
1524 ciphertext = None
1525 elif vaulted_value := VaultedValue.get_tag(value):
1526 ciphertext = vaulted_value.ciphertext
1527 else:
1528 ciphertext = None
1529
…lines 1530–1537 unchanged (8 lines)

Before

module
comment "# (c) 2014, James Tanner <tanner.jc@gmail.com>"
comment "# (c) 2016, Adrian Likins <alikins@redhat.com>"
comment "# (c) 2016 Toshio Kuratomi <tkuratomi@ansible.com>"
comment "#"
comment "# Ansible is free software: you can redistribute it and/or m"...
comment "# it under the terms of the GNU General Public License as pu"...
comment "# the Free Software Foundation, either version 3 of the Lice"...
comment "# (at your option) any later version."
comment "#"
comment "# Ansible is distributed in the hope that it will be useful,"
comment "# but WITHOUT ANY WARRANTY; without even the implied warrant"...
comment "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See "...
comment "# GNU General Public License for more details."
comment "#"
comment "# You should have received a copy of the GNU General Public "...
comment "# along with Ansible. If not, see <http://www.gnu.org/licen"...
future_import_statement
from "from"
__future__ "__future__"
import "import"
dotted_name
identifier "annotations"
import_statement
import "import"
dotted_name
identifier "errno"
import_statement
import "import"
dotted_name
identifier "fcntl"
import_statement
import "import"
dotted_name
identifier "functools"
import_statement
import "import"
dotted_name
identifier "os"
import_statement
import "import"
dotted_name
identifier "random"
import_statement
import "import"
dotted_name
identifier "shlex"
import_statement
import "import"
dotted_name
identifier "shutil"
import_statement
import "import"
dotted_name
identifier "subprocess"
import_statement
import "import"
dotted_name
identifier "sys"
import_statement
import "import"
dotted_name
identifier "tempfile"
import_statement
import "import"
dotted_name
identifier "warnings"
import_statement
import "import"
aliased_import
dotted_name
identifier "typing"
as "as"
identifier "t"
import_from_statement
from "from"
dotted_name
identifier "binascii"
import "import"
dotted_name
identifier "hexlify"
import_from_statement
from "from"
dotted_name
identifier "binascii"
import "import"
dotted_name
identifier "unhexlify"
import_from_statement
from "from"
dotted_name
identifier "binascii"
import "import"
aliased_import
dotted_name
identifier "Error"
as "as"
identifier "BinasciiError"
import_from_statement (+28 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "_internal"
. "."
identifier "_templating"
import "import"
dotted_name
identifier "_jinja_common"
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "_internal"
. "."
identifier "_datatag"
. "."
identifier "_tags"
import "import"
dotted_name
identifier "Origin"
, ","
dotted_name
identifier "VaultedValue"
, ","
dotted_name
identifier "TrustedAsTemplate"
expression_statement
assignment
identifier "HAS_CRYPTOGRAPHY"
= "="
false "False"
expression_statement
assignment
identifier "CRYPTOGRAPHY_BACKEND"
= "="
none "None"
try_statement (+140 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "errors"
import "import"
dotted_name
identifier "AnsibleError"
, ","
dotted_name
identifier "AnsibleAssertionError"
import_from_statement
from "from"
dotted_name
identifier "ansible"
import "import"
aliased_import
dotted_name
identifier "constants"
as "as"
identifier "C"
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "module_utils"
. "."
identifier "six"
import "import"
dotted_name
identifier "binary_type"
import_from_statement (+21 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "utils"
. "."
identifier "display"
import "import"
dotted_name
identifier "Display"
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "utils"
. "."
identifier "path"
import "import"
dotted_name
identifier "makedirs_safe"
, ","
dotted_name
identifier "unfrackpath"
expression_statement
assignment
identifier "display"
= "="
call
identifier "Display"
argument_list
( "("
) ")"
expression_statement
assignment
identifier "b_HEADER"
= "="
string
string_start "b'"
string_content "$ANSIBLE_VAULT"
string_end "'"
expression_statement
assignment
identifier "CIPHER_ALLOWLIST"
= "="
call
identifier "frozenset"
argument_list
( "("
tuple
( "("
string
string_start "u'"
string_content "AES256"
string_end "'"
, ","
) ")"
) ")"
expression_statement
assignment
identifier "CIPHER_WRITE_ALLOWLIST"
= "="
call
identifier "frozenset"
argument_list
( "("
tuple
( "("
string
string_start "u'"
string_content "AES256"
string_end "'"
, ","
) ")"
) ")"
comment "# See also CIPHER_MAPPING at the bottom of the file which ma"...
comment "# (used in VaultFile header) to a cipher class"
expression_statement
assignment
identifier "NEED_CRYPTO_LIBRARY"
= "="
string
string_start "\""
string_content "ansible-vault requires the cryptography library in order to "...
string_end "\""
class_definition
class "class"
identifier "AnsibleVaultError"
argument_list
( "("
identifier "AnsibleError"
) ")"
: ":"
block
pass_statement
pass "pass"
class_definition
class "class"
identifier "AnsibleVaultPasswordError"
argument_list
( "("
identifier "AnsibleVaultError"
) ")"
: ":"
block
pass_statement
pass "pass"
class_definition
class "class"
identifier "AnsibleVaultFormatError"
argument_list
( "("
identifier "AnsibleError"
) ")"
: ":"
block
pass_statement
pass "pass"
function_definition (+110 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+178 nodes collapsed)
function_definition (+72 nodes collapsed)
function_definition (+274 nodes collapsed)
function_definition (+64 nodes collapsed)
function_definition (+71 nodes collapsed)
function_definition (+61 nodes collapsed)
function_definition (+45 nodes collapsed)
class_definition (+72 nodes collapsed)
class_definition (+359 nodes collapsed)
function_definition (+58 nodes collapsed)
function_definition (+231 nodes collapsed)
comment "# TODO: mv these classes to a separate file so we don't poll"...
class_definition (+389 nodes collapsed)
class_definition (+317 nodes collapsed)
class_definition (+440 nodes collapsed)
function_definition (+58 nodes collapsed)
function_definition (+44 nodes collapsed)
function_definition (+116 nodes collapsed)
function_definition (+93 nodes collapsed)
class_definition (+1066 nodes collapsed)
class_definition (+2633 nodes collapsed)
comment "########################################"
comment "# CIPHERS #"
comment "########################################"
class_definition (+1172 nodes collapsed)
comment "# Keys could be made bytes later if the code that gets the d"...
comment "# naturally byte-oriented"
expression_statement
assignment
identifier "CIPHER_MAPPING"
= "="
dictionary
{ "{"
pair
string
string_start "u'"
string_content "AES256"
string_end "'"
: ":"
identifier "VaultAES256"
, ","
} "}"
class_definition (+209 nodes collapsed)
decorated_definition (+1476 nodes collapsed)
class_definition
class "class"
identifier "VaultHelper"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "Vault specific utility methods."
string_end "\"\"\""
decorated_definition
decorator
@ "@"
identifier "staticmethod"
function_definition
def "def"
identifier "get_ciphertext"
parameters
( "("
typed_parameter
identifier "value"
: ":"
type
attribute
identifier "t"
. "."
identifier "Any"
, ","
keyword_separator
* "*"
, ","
typed_parameter
identifier "with_tags"
: ":"
type
identifier "bool"
) ")"
-> "->"
type
binary_operator
identifier "str"
| "|"
none "None"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n If the given value is an `EncryptedString`, `VaultE"...
string_end "\"\"\""
expression_statement
assignment
identifier "value_type"
= "="
call
identifier "type"
argument_list
( "("
identifier "value"
) ")"
expression_statement
assignment
identifier "ciphertext"
: ":"
type
binary_operator
identifier "str"
| "|"
none "None"
expression_statement
assignment
identifier "tags"
= "="
call
attribute
identifier "AnsibleTagHelper"
. "."
identifier "tags"
argument_list
( "("
identifier "value"
) ")"
if_statement
if "if"
comparison_operator
identifier "value_type"
is "is"
attribute
identifier "_jinja_common"
. "."
identifier "VaultExceptionMarker"
: ":"
block (+23 nodes collapsed)
elif_clause
elif "elif"
comparison_operator
identifier "value_type"
is "is"
identifier "EncryptedString"
: ":"
block
expression_statement
assignment
identifier "ciphertext"
= "="
attribute
identifier "value"
. "."
identifier "_ciphertext"
elif_clause
elif "elif"
comparison_operator
identifier "value_type"
in "in"
attribute
attribute
identifier "_jinja_common"
. "."
identifier "Marker"
. "."
identifier "concrete_subclasses"
: ":"
comment "# avoid wasteful raise/except of Marker when calling get_tag"...
block
expression_statement
assignment
identifier "ciphertext"
= "="
none "None"
elif_clause (+24 nodes collapsed)
else_clause
else "else"
: ":"
block
expression_statement
assignment
identifier "ciphertext"
= "="
none "None"
if_statement (+50 nodes collapsed)
return_statement
return "return"
identifier "ciphertext"

After

module
comment "# (c) 2014, James Tanner <tanner.jc@gmail.com>"
comment "# (c) 2016, Adrian Likins <alikins@redhat.com>"
comment "# (c) 2016 Toshio Kuratomi <tkuratomi@ansible.com>"
comment "#"
comment "# Ansible is free software: you can redistribute it and/or m"...
comment "# it under the terms of the GNU General Public License as pu"...
comment "# the Free Software Foundation, either version 3 of the Lice"...
comment "# (at your option) any later version."
comment "#"
comment "# Ansible is distributed in the hope that it will be useful,"
comment "# but WITHOUT ANY WARRANTY; without even the implied warrant"...
comment "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See "...
comment "# GNU General Public License for more details."
comment "#"
comment "# You should have received a copy of the GNU General Public "...
comment "# along with Ansible. If not, see <http://www.gnu.org/licen"...
future_import_statement
from "from"
__future__ "__future__"
import "import"
dotted_name
identifier "annotations"
import_statement
import "import"
dotted_name
identifier "errno"
import_statement
import "import"
dotted_name
identifier "fcntl"
import_statement
import "import"
dotted_name
identifier "functools"
import_statement
import "import"
dotted_name
identifier "os"
import_statement
import "import"
dotted_name
identifier "random"
import_statement
import "import"
dotted_name
identifier "shlex"
import_statement
import "import"
dotted_name
identifier "shutil"
import_statement
import "import"
dotted_name
identifier "subprocess"
import_statement
import "import"
dotted_name
identifier "sys"
import_statement
import "import"
dotted_name
identifier "tempfile"
import_statement
import "import"
dotted_name
identifier "warnings"
import_statement
import "import"
aliased_import
dotted_name
identifier "typing"
as "as"
identifier "t"
import_from_statement
from "from"
dotted_name
identifier "binascii"
import "import"
dotted_name
identifier "hexlify"
import_from_statement
from "from"
dotted_name
identifier "binascii"
import "import"
dotted_name
identifier "unhexlify"
import_from_statement
from "from"
dotted_name
identifier "binascii"
import "import"
aliased_import
dotted_name
identifier "Error"
as "as"
identifier "BinasciiError"
import_from_statement (+28 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "_internal"
. "."
identifier "_templating"
import "import"
dotted_name
identifier "_jinja_common"
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "_internal"
. "."
identifier "_datatag"
. "."
identifier "_tags"
import "import"
dotted_name
identifier "Origin"
, ","
dotted_name
identifier "VaultedValue"
, ","
dotted_name
identifier "TrustedAsTemplate"
expression_statement
assignment
identifier "HAS_CRYPTOGRAPHY"
= "="
false "False"
expression_statement
assignment
identifier "CRYPTOGRAPHY_BACKEND"
= "="
none "None"
try_statement (+140 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "errors"
import "import"
dotted_name
identifier "AnsibleError"
, ","
dotted_name
identifier "AnsibleAssertionError"
import_from_statement
from "from"
dotted_name
identifier "ansible"
import "import"
aliased_import
dotted_name
identifier "constants"
as "as"
identifier "C"
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "module_utils"
. "."
identifier "six"
import "import"
dotted_name
identifier "binary_type"
import_from_statement (+21 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "utils"
. "."
identifier "display"
import "import"
dotted_name
identifier "Display"
import_from_statement
from "from"
dotted_name
identifier "ansible"
. "."
identifier "utils"
. "."
identifier "path"
import "import"
dotted_name
identifier "makedirs_safe"
, ","
dotted_name
identifier "unfrackpath"
expression_statement
assignment
identifier "display"
= "="
call
identifier "Display"
argument_list
( "("
) ")"
expression_statement
assignment
identifier "b_HEADER"
= "="
string
string_start "b'"
string_content "$ANSIBLE_VAULT"
string_end "'"
expression_statement
assignment
identifier "CIPHER_ALLOWLIST"
= "="
call
identifier "frozenset"
argument_list
( "("
tuple
( "("
string
string_start "u'"
string_content "AES256"
string_end "'"
, ","
) ")"
) ")"
expression_statement
assignment
identifier "CIPHER_WRITE_ALLOWLIST"
= "="
call
identifier "frozenset"
argument_list
( "("
tuple
( "("
string
string_start "u'"
string_content "AES256"
string_end "'"
, ","
) ")"
) ")"
comment "# See also CIPHER_MAPPING at the bottom of the file which ma"...
comment "# (used in VaultFile header) to a cipher class"
expression_statement
assignment
identifier "NEED_CRYPTO_LIBRARY"
= "="
string
string_start "\""
string_content "ansible-vault requires the cryptography library in order to "...
string_end "\""
class_definition
class "class"
identifier "AnsibleVaultError"
argument_list
( "("
identifier "AnsibleError"
) ")"
: ":"
block
pass_statement
pass "pass"
class_definition
class "class"
identifier "AnsibleVaultPasswordError"
argument_list
( "("
identifier "AnsibleVaultError"
) ")"
: ":"
block
pass_statement
pass "pass"
class_definition
class "class"
identifier "AnsibleVaultFormatError"
argument_list
( "("
identifier "AnsibleError"
) ")"
: ":"
block
pass_statement
pass "pass"
function_definition (+110 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+178 nodes collapsed)
function_definition (+72 nodes collapsed)
function_definition (+274 nodes collapsed)
function_definition (+64 nodes collapsed)
function_definition (+71 nodes collapsed)
function_definition (+61 nodes collapsed)
function_definition (+45 nodes collapsed)
class_definition (+72 nodes collapsed)
class_definition (+359 nodes collapsed)
function_definition (+58 nodes collapsed)
function_definition (+231 nodes collapsed)
comment "# TODO: mv these classes to a separate file so we don't poll"...
class_definition (+389 nodes collapsed)
class_definition (+317 nodes collapsed)
class_definition (+440 nodes collapsed)
function_definition (+58 nodes collapsed)
function_definition (+44 nodes collapsed)
function_definition (+116 nodes collapsed)
function_definition (+93 nodes collapsed)
class_definition (+1066 nodes collapsed)
class_definition (+2633 nodes collapsed)
comment "########################################"
comment "# CIPHERS #"
comment "########################################"
class_definition (+1172 nodes collapsed)
comment "# Keys could be made bytes later if the code that gets the d"...
comment "# naturally byte-oriented"
expression_statement
assignment
identifier "CIPHER_MAPPING"
= "="
dictionary
{ "{"
pair
string
string_start "u'"
string_content "AES256"
string_end "'"
: ":"
identifier "VaultAES256"
, ","
} "}"
class_definition (+209 nodes collapsed)
decorated_definition (+1476 nodes collapsed)
class_definition
class "class"
identifier "VaultHelper"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "Vault specific utility methods."
string_end "\"\"\""
decorated_definition
decorator
@ "@"
identifier "staticmethod"
function_definition
def "def"
identifier "get_ciphertext"
parameters
( "("
typed_parameter
identifier "value"
: ":"
type
attribute
identifier "t"
. "."
identifier "Any"
, ","
keyword_separator
* "*"
, ","
typed_parameter
identifier "with_tags"
: ":"
type
identifier "bool"
) ")"
-> "->"
type
binary_operator
identifier "str"
| "|"
none "None"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "\n If the given value is an `EncryptedString`, `VaultE"...
string_end "\"\"\""
expression_statement
assignment
identifier "value_type"
= "="
call
identifier "type"
argument_list
( "("
identifier "value"
) ")"
expression_statement
assignment
identifier "ciphertext"
: ":"
type
binary_operator
identifier "str"
| "|"
none "None"
expression_statement
assignment
identifier "tags"
= "="
call
attribute
identifier "AnsibleTagHelper"
. "."
identifier "tags"
argument_list
( "("
identifier "value"
) ")"
if_statement
if "if"
comparison_operator
identifier "value_type"
is "is"
attribute
identifier "_jinja_common"
. "."
identifier "VaultExceptionMarker"
: ":"
block (+23 nodes collapsed)
elif_clause
elif "elif"
comparison_operator
identifier "value_type"
is "is"
identifier "EncryptedString"
: ":"
block
expression_statement
assignment
identifier "ciphertext"
= "="
attribute
identifier "value"
. "."
identifier "_ciphertext"
elif_clause
elif "elif"
comparison_operator
identifier "value_type"
in "in"
attribute
attribute
identifier "_jinja_common"
. "."
identifier "Marker"
. "."
identifier "_concrete_subclasses"
: ":"
comment "# avoid wasteful raise/except of Marker when calling get_tag"...
block
expression_statement
assignment
identifier "ciphertext"
= "="
none "None"
elif_clause (+24 nodes collapsed)
else_clause
else "else"
: ":"
block
expression_statement
assignment
identifier "ciphertext"
= "="
none "None"
if_statement (+50 nodes collapsed)
return_statement
return "return"
identifier "ciphertext"