mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Refactor exporter into Export class
This commit is contained in:
parent
ca06154805
commit
7eedb14834
3 changed files with 1285 additions and 1081 deletions
|
@ -1267,15 +1267,11 @@ def flatten_tree(obj, key=''):
|
|||
# https://stackoverflow.com/a/14692747
|
||||
def get_by_path(root, items):
|
||||
"""Access a nested object in root by item sequence."""
|
||||
if isinstance(items, str):
|
||||
items = items.split('.')
|
||||
return reduce(operator.getitem, items, root)
|
||||
|
||||
|
||||
def set_by_path(root, items, value):
|
||||
"""Set a value in a nested object in root by item sequence."""
|
||||
if isinstance(items, str):
|
||||
items = items.split('.')
|
||||
get_by_path(root, items[:-1])[items[-1]] = value
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue