Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BEA data analysis utils
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Philipp Niedermayer
BEA data analysis utils
Commits
c153e93a
Commit
c153e93a
authored
1 year ago
by
Philipp Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
skip_missing during compare
parent
c61010e3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exciter.py
+5
-4
5 additions, 4 deletions
exciter.py
with
5 additions
and
4 deletions
exciter.py
+
5
−
4
View file @
c153e93a
...
...
@@ -302,11 +302,12 @@ def load_opti_log(logfile):
# Functions to compare metadata for two or more saved data files
def
compare
(
dicts
):
def
compare
(
dicts
,
skip_missing
=
True
):
differences
=
[]
keys
=
{
k
for
dic
in
dicts
for
k
in
dic
}
for
key
in
keys
:
values
=
[
dic
[
key
]
for
dic
in
dicts
]
values
=
[
dic
.
get
(
key
)
for
dic
in
dicts
]
if
skip_missing
and
None
in
values
:
continue
if
type
(
values
[
0
])
is
dict
:
for
diff
in
compare
(
values
):
differences
.
append
([
key
+
"
:
"
+
diff
[
0
],
*
diff
[
1
:]])
...
...
@@ -327,13 +328,13 @@ def _load_yml(fname):
raw
=
raw
.
replace
(
'
(
'
,
'
[
'
).
replace
(
'
)
'
,
'
]
'
)
return
yaml
.
safe_load
(
raw
)
def
yml_diff
(
fnames
):
def
yml_diff
(
fnames
,
skip_missing
=
True
):
meta
=
{}
for
fname
in
fnames
:
meta
[
fname
]
=
_load_yml
(
find_file
(
fname
,
yml
=
True
))
# compare
diff
=
compare
(
meta
.
values
())
diff
=
compare
(
meta
.
values
()
,
skip_missing
=
skip_missing
)
diff
.
append
([
""
,
*
fnames
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment