Skip to content

Commit

Permalink
[DATALAD RUNCMD] Run black to harmonize formatting -- we should use p…
Browse files Browse the repository at this point in the history
…re-commit

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "black tributors",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic committed May 16, 2024
1 parent b2c8151 commit 1b5cda9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions tributors/main/orcid.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,15 @@ def record_search(url, email, interactive=False, search_type=""):
skip_choices = ["s", "S", "skip"]
enter_choices = ["e", "E", "enter"]
quit_choices = ["q"]
choices = [str(i) for i, _ in enumerate(results, 1)] + skip_choices + enter_choices + quit_choices
prefix = "1:%s or s to skip, e to enter, q to quit the loop" % min(10, len(results))
choices = (
[str(i) for i, _ in enumerate(results, 1)]
+ skip_choices
+ enter_choices
+ quit_choices
)
prefix = "1:%s or s to skip, e to enter, q to quit the loop" % min(
10, len(results)
)
choice = choice_prompt(
"Please enter a choice, or s to skip, e to enter.",
choices=choices,
Expand All @@ -210,7 +217,7 @@ def record_search(url, email, interactive=False, search_type=""):
if choice in enter_choices:
return entry_prompt(
f"Please enter the ORCID for {email}.",
regex='[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$',
regex="[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$",
)

if not choice or choice in skip_choices:
Expand Down
2 changes: 1 addition & 1 deletion tributors/utils/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def entry_prompt(prompt, regex=None):
if entry and regex is not None and not re.match(regex, entry):
entry = None
message = r"Please enter a valid response. Should match regex {regex!r}"
return entry
return entry

0 comments on commit 1b5cda9

Please sign in to comment.