Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
bob
bob.bio.base
Commits
97691ddb
There was a problem fetching the pipeline summary.
Commit
97691ddb
authored
8 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Fixed issue
#53
. The default resource is not working
parent
356e71a6
No related branches found
No related tags found
1 merge request
!53
Fixed issue #53 . The default resource is not working
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/tools/command_line.py
+9
-5
9 additions, 5 deletions
bob/bio/base/tools/command_line.py
with
9 additions
and
5 deletions
bob/bio/base/tools/command_line.py
+
9
−
5
View file @
97691ddb
...
@@ -154,10 +154,10 @@ def command_line_parser(description=__doc__, exclude_resources_from=[]):
...
@@ -154,10 +154,10 @@ def command_line_parser(description=__doc__, exclude_resources_from=[]):
def
_take_from_config_or_command_line
(
args
,
config
,
keyword
,
default
,
required
=
True
,
is_resource
=
True
):
def
_take_from_config_or_command_line
(
args
,
config
,
keyword
,
default
,
required
=
True
,
is_resource
=
True
):
if
getattr
(
args
,
keyword
)
!=
default
:
if
getattr
(
args
,
keyword
)
!=
default
:
if
is_resource
:
if
is_resource
:
setattr
(
args
,
keyword
,
utils
.
load_resource
(
'
'
.
join
(
getattr
(
args
,
keyword
)),
keyword
,
imports
=
args
.
imports
,
preferred_package
=
args
.
preferred_package
))
setattr
(
args
,
keyword
,
utils
.
load_resource
(
'
'
.
join
(
getattr
(
args
,
keyword
)),
keyword
,
imports
=
args
.
imports
,
preferred_package
=
args
.
preferred_package
))
elif
config
is
not
None
and
hasattr
(
config
,
keyword
):
elif
config
is
not
None
and
hasattr
(
config
,
keyword
):
...
@@ -165,6 +165,10 @@ def _take_from_config_or_command_line(args, config, keyword, default, required=T
...
@@ -165,6 +165,10 @@ def _take_from_config_or_command_line(args, config, keyword, default, required=T
if
isinstance
(
val
,
str
)
and
is_resource
:
if
isinstance
(
val
,
str
)
and
is_resource
:
val
=
utils
.
load_resource
(
val
,
keyword
,
imports
=
args
.
imports
,
preferred_package
=
args
.
preferred_package
)
val
=
utils
.
load_resource
(
val
,
keyword
,
imports
=
args
.
imports
,
preferred_package
=
args
.
preferred_package
)
setattr
(
args
,
keyword
,
val
)
setattr
(
args
,
keyword
,
val
)
elif
default
is
not
None
:
if
is_resource
:
setattr
(
args
,
keyword
,
utils
.
load_resource
(
'
'
.
join
(
default
),
keyword
,
imports
=
args
.
imports
,
preferred_package
=
args
.
preferred_package
))
elif
required
:
elif
required
:
raise
ValueError
(
"
Please specify a %s either on command line (via --%s) or in a configuration file
"
%
(
keyword
,
keyword
))
raise
ValueError
(
"
Please specify a %s either on command line (via --%s) or in a configuration file
"
%
(
keyword
,
keyword
))
...
@@ -222,13 +226,13 @@ def initialize(parsers, command_line_parameters = None, skips = []):
...
@@ -222,13 +226,13 @@ def initialize(parsers, command_line_parameters = None, skips = []):
parser
.
get_default
(
keyword
))
parser
.
get_default
(
keyword
))
_take_from_config_or_command_line
(
args
,
config
,
"
grid
"
,
_take_from_config_or_command_line
(
args
,
config
,
"
grid
"
,
parser
.
get_default
(
keyword
),
required
=
False
)
parser
.
get_default
(
'
grid
'
),
required
=
False
)
_take_from_config_or_command_line
(
args
,
config
,
"
sub_directory
"
,
_take_from_config_or_command_line
(
args
,
config
,
"
sub_directory
"
,
parser
.
get_default
(
keyword
),
is_resource
=
False
)
parser
.
get_default
(
"
sub_directory
"
),
is_resource
=
False
)
skip_keywords
=
tuple
([
'
skip_
'
+
k
.
replace
(
'
-
'
,
'
_
'
)
for
k
in
skips
])
skip_keywords
=
tuple
([
'
skip_
'
+
k
.
replace
(
'
-
'
,
'
_
'
)
for
k
in
skips
])
for
keyword
in
(
for
keyword
in
(
"
protocol
"
,
"
protocol
"
,
"
groups
"
,
"
groups
"
,
...
...
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