forked from man-c/pycoingecko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
304 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
def list_args_to_comma_separated(func): | ||
"""Return function that converts list input arguments to comma-separated strings""" | ||
def input_args(*args,**kwargs): | ||
for v in kwargs: | ||
# check in **kwargs for lists and convert to comma-separated string | ||
if isinstance(kwargs[v], list): kwargs[v]=','.join(kwargs[v]) | ||
# check in *args for lists and convert to comma-separated string | ||
args=[','.join(v) if isinstance(v, list) else v for v in args] | ||
return func(*args, **kwargs) | ||
return input_args | ||
|
||
|
||
def get_comma_separated_values(values): | ||
"""Return the values as a comma-separated string""" | ||
|
||
# Make sure values is a list or tuple | ||
if not isinstance(values, list) and not isinstance(values, tuple): | ||
values = [values] | ||
return ','.join(values) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.