Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
esde
machine-learning
MLAir
Merge requests
!472
Resolve "proper boolean conversion"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "proper boolean conversion"
lukas_issue417_feat_proper-boolean-conversion
into
develop
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Ghost User
requested to merge
lukas_issue417_feat_proper-boolean-conversion
into
develop
2 years ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#417 (closed)
Edited
2 years ago
by
Ghost User
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
c0b520c2
1 commit,
2 years ago
1 file
+
15
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
mlair/helpers/helpers.py
+
15
−
0
Options
@@ -4,6 +4,7 @@ __date__ = '2019-10-21'
import
inspect
import
math
import
argparse
import
numpy
as
np
import
xarray
as
xr
@@ -266,6 +267,20 @@ def filter_dict_by_value(dictionary: dict, filter_val: Any, filter_cond: bool) -
return
dict
(
filter
(
lambda
x
:
(
x
[
1
]
==
filter_val
)
is
filter_cond
,
dictionary
.
items
()))
def
str2bool
(
v
):
if
isinstance
(
v
,
bool
):
return
v
elif
isinstance
(
v
,
str
):
if
v
.
lower
()
in
(
'
yes
'
,
'
true
'
,
'
t
'
,
'
y
'
,
'
1
'
):
return
True
elif
v
.
lower
()
in
(
'
no
'
,
'
false
'
,
'
f
'
,
'
n
'
,
'
0
'
):
return
False
else
:
raise
argparse
.
ArgumentTypeError
(
'
Boolean value expected.
'
)
else
:
raise
argparse
.
ArgumentTypeError
(
'
Boolean value expected.
'
)
# def convert_size(size_bytes):
# if size_bytes == 0:
# return "0B"
Loading