diff
dev_tool.tools.diff
DiffResult
Bases: TypedDict
added
instance-attribute
removed
instance-attribute
modified
instance-attribute
MergeChoice
Bases: StrEnum
An enum class for the ways a downloaded environment can be applied.
Ours is the local file and theirs is the portal, as in git.
CANCEL = 'cancel'
class-attribute
instance-attribute
OURS = 'ours'
class-attribute
instance-attribute
OVERWRITE = 'overwrite'
class-attribute
instance-attribute
THEIRS = 'theirs'
class-attribute
instance-attribute
EnvironmentDiff
A class for comparing and displaying environment variable differences.
This class provides static methods for parsing, comparing, and displaying differences between local and remote environment configurations.
compare
staticmethod
A method that compares local and remote environment variables.
Parameters:
-
local(dict[str, str]) –The local environment variables.
-
remote(dict[str, str]) –The remote environment variables.
Returns:
-
DiffResult–A dictionary with added, removed, and modified variables.
Source code in dev_tool/tools/diff.py
display
staticmethod
A method that displays differences between local and remote environment variables.
Parameters:
-
terminal(Terminal) –The blessed Terminal instance.
-
local(dict[str, str]) –The local environment variables.
-
remote(dict[str, str]) –The remote environment variables.
Source code in dev_tool/tools/diff.py
has_differences
staticmethod
A method that checks if there are differences between environments.
Parameters:
-
local(dict[str, str]) –The local environment variables.
-
remote(dict[str, str]) –The remote environment variables.
Returns:
-
bool–True if differences exist, False otherwise.
Source code in dev_tool/tools/diff.py
merge
staticmethod
A method that merges local environment variables into the portal's text.
The portal's ordering, comments, and blank lines are kept. A key both sides define with different values takes the local value when local is preferred and the portal's value otherwise. Keys only the local file defines are appended at the end.
Parameters:
-
remote_values(str) –The environment values string from the portal.
-
local(dict[str, str]) –The local environment variables.
-
prefer_local(bool) –Whether the local value wins where the two differ.
Returns:
-
str–The merged environment values string.
Source code in dev_tool/tools/diff.py
parse_file
staticmethod
A method that parses an environment file into a dictionary.
Parameters:
-
path(Path) –The path to the environment file.
Returns:
Source code in dev_tool/tools/diff.py
parse_string
staticmethod
A method that parses environment variable values from a string.
Parameters:
-
values(str) –The environment values string with newline-separated key=value pairs.
Returns: