iLO-manager first main commitgit status
This commit is contained in:
1 parent
e6f4cc04ca
commit
599d8da562
3271 files changed
+550655
No files matched your search
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
# file generated by setuptools_scm
|
||||
# don't change, don't track in version control
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from typing import Tuple, Union
|
||||
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
||||
else:
|
||||
VERSION_TUPLE = object
|
||||
|
||||
version: str
|
||||
__version__: str
|
||||
__version_tuple__: VERSION_TUPLE
|
||||
version_tuple: VERSION_TUPLE
|
||||
|
||||
__version__ = version = '2.2.1'
|
||||
__version_tuple__ = version_tuple = (2, 2, 1)
|
||||
@@ -0,0 +1,60 @@
|
||||
import argparse
|
||||
import jsondiff
|
||||
import sys
|
||||
|
||||
def load_file(serializer, file_path):
|
||||
with open(file_path) as f:
|
||||
parsed = None
|
||||
try:
|
||||
parsed = serializer.deserialize_file(f)
|
||||
except ValueError:
|
||||
print(f"{file_path} is not valid {serializer.file_format}")
|
||||
except FileNotFoundError:
|
||||
print(f"{file_path} does not exist")
|
||||
return parsed
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
|
||||
parser.add_argument("first")
|
||||
parser.add_argument("second")
|
||||
parser.add_argument("-p", "--patch", action="store_true", default=False)
|
||||
parser.add_argument("-s", "--syntax", choices=(jsondiff.builtin_syntaxes.keys()), default="compact",
|
||||
help="Diff syntax controls how differences are rendered")
|
||||
parser.add_argument("-i", "--indent", action="store", type=int, default=None,
|
||||
help="Number of spaces to indent. None is compact, no indentation.")
|
||||
parser.add_argument("-f", "--format", choices=("json", "yaml"), default="json",
|
||||
help="Specify file format for input and dump")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
serializer = jsondiff.Serializer(args.format, args.indent)
|
||||
|
||||
parsed_first = load_file(serializer, args.first)
|
||||
parsed_second = load_file(serializer, args.second)
|
||||
|
||||
if not (parsed_first and parsed_second):
|
||||
return 1
|
||||
|
||||
if args.patch:
|
||||
x = jsondiff.patch(
|
||||
parsed_first,
|
||||
parsed_second,
|
||||
marshal=True,
|
||||
syntax=args.syntax
|
||||
)
|
||||
else:
|
||||
x = jsondiff.diff(
|
||||
parsed_first,
|
||||
parsed_second,
|
||||
marshal=True,
|
||||
syntax=args.syntax
|
||||
)
|
||||
|
||||
serializer.serialize_data(x, sys.stdout)
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
ret = main()
|
||||
sys.exit(ret)
|
||||
@@ -0,0 +1,83 @@
|
||||
class Symbol:
|
||||
"""
|
||||
Symbol Usage Explanation:
|
||||
|
||||
$add: Indicates keys or indices where new elements have been added.
|
||||
$discard: Indicates elements that have been removed from a set.
|
||||
$delete: Indicates keys or indices where elements have been deleted.
|
||||
$insert: Used in lists to specify new elements inserted at specific indices.
|
||||
$update: Used to indicate that the value of an existing key has changed.
|
||||
$replace: Used to completely replace the value at a given location.
|
||||
|
||||
These symbols are used within the diff structures returned by methods of JsonDiffer classes to represent different
|
||||
types of changes between two JSON structures. For example:
|
||||
|
||||
- In a dictionary, $add might be used to show new keys added, $delete to show keys that were removed, and $update
|
||||
for keys whose values have changed.
|
||||
- In a list, $insert could indicate new items added at specific positions, and $delete could show items removed
|
||||
from specific positions.
|
||||
- The $replace symbol is generally used when an entire section of the JSON (be it a list, dict, or value)
|
||||
is replaced with another.
|
||||
|
||||
These symbols help in succinctly representing changes in a structured way, making it easier to apply or revert
|
||||
changes programmatically.
|
||||
"""
|
||||
def __init__(self, label):
|
||||
self._label = label
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
return self._label
|
||||
|
||||
def __repr__(self):
|
||||
return self.label
|
||||
|
||||
def __str__(self):
|
||||
return "$" + self.label
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Symbol):
|
||||
return False
|
||||
return self.label == other.label
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.label)
|
||||
|
||||
|
||||
missing = Symbol('missing')
|
||||
identical = Symbol('identical')
|
||||
delete = Symbol('delete')
|
||||
insert = Symbol('insert')
|
||||
update = Symbol('update')
|
||||
add = Symbol('add')
|
||||
discard = Symbol('discard')
|
||||
replace = Symbol('replace')
|
||||
left = Symbol('left')
|
||||
right = Symbol('right')
|
||||
|
||||
_all_symbols_ = [
|
||||
missing,
|
||||
identical,
|
||||
delete,
|
||||
insert,
|
||||
update,
|
||||
add,
|
||||
discard,
|
||||
replace,
|
||||
left,
|
||||
right
|
||||
]
|
||||
|
||||
__all__ = [
|
||||
'missing',
|
||||
'identical',
|
||||
'delete',
|
||||
'insert',
|
||||
'update',
|
||||
'add',
|
||||
'discard',
|
||||
'replace',
|
||||
'left',
|
||||
'right',
|
||||
'_all_symbols_'
|
||||
]
|
||||
Reference in new issue
Block a user