Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.extension
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
bob
bob.extension
Merge requests
!129
[click] update to click 8 API
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[click] update to click 8 API
click-8
into
master
Overview
0
Commits
3
Pipelines
3
Changes
4
Merged
Amir MOHAMMADI
requested to merge
click-8
into
master
3 years ago
Overview
0
Commits
3
Pipelines
3
Changes
4
Expand
👍
0
👎
0
Merge request reports
Compare
master
version 2
a143cf44
3 years ago
version 1
34e179a2
3 years ago
master (base)
and
latest version
latest version
0f44a6b9
3 commits,
3 years ago
version 2
a143cf44
2 commits,
3 years ago
version 1
34e179a2
1 commit,
3 years ago
4 files
+
27
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
bob/extension/scripts/click_helper.py
+
20
−
3
Options
from
..log
import
set_verbosity_level
from
..config
import
load
,
mod_to_context
,
resource_keys
from
click.core
import
ParameterSource
import
time
import
click
import
logging
@@ -388,6 +389,9 @@ class ResourceOption(click.Option):
)
logger
.
debug
(
"
consuming resource option for %s
"
,
self
.
name
)
value
=
opts
.
get
(
self
.
name
)
source
=
ParameterSource
.
COMMANDLINE
# if value is not given from command line, lookup the config files given as
# arguments (not options).
if
value
is
None
:
@@ -399,13 +403,25 @@ class ResourceOption(click.Option):
# if not from config files, lookup the environment variables
if
value
is
None
:
value
=
self
.
value_from_envvar
(
ctx
)
source
=
ParameterSource
.
ENVIRONMENT
# if not from environment variables, lookup the default value
if
value
is
None
:
value
=
ctx
.
lookup_default
(
self
.
name
)
return
value
source
=
ParameterSource
.
DEFAULT_MAP
def
full_process_value
(
self
,
ctx
,
value
):
value
=
super
().
full_process_value
(
ctx
,
value
)
if
value
is
None
:
value
=
self
.
get_default
(
ctx
)
source
=
ParameterSource
.
DEFAULT
return
value
,
source
def
type_cast_value
(
self
,
ctx
,
value
):
"""
Convert and validate a value against the option
'
s
``type``, ``multiple``, and ``nargs``.
Furthermore, if the an entry_point_group is provided, it will load it.
"""
value
=
super
().
type_cast_value
(
ctx
,
value
)
# if the value is a string and an entry_point_group is provided, load it
if
self
.
entry_point_group
is
not
None
:
@@ -415,6 +431,7 @@ class ResourceOption(click.Option):
entry_point_group
=
self
.
entry_point_group
,
attribute_name
=
self
.
name
,
)
return
value
Loading