cookiecutter / cookiecutter
Showing 1 of 3 files from the diff.
Other files ignored by Codecov

@@ -1,4 +1,5 @@
Loading
1 1
"""Functions for prompting the user for project info."""
2 +
import functools
2 3
import json
3 4
from collections import OrderedDict
4 5
@@ -78,11 +79,18 @@
Loading
78 79
    return choice_map[user_choice]
79 80
80 81
81 -
def process_json(user_value):
82 +
DEFAULT_DISPLAY = 'default'
83 +
84 +
85 +
def process_json(user_value, default_value=None):
82 86
    """Load user-supplied value as a JSON dict.
83 87
84 88
    :param str user_value: User-supplied value to load as a JSON dict
85 89
    """
90 +
    if user_value == DEFAULT_DISPLAY:
91 +
        # Return the given default w/o any processing
92 +
        return default_value
93 +
86 94
    try:
87 95
        user_dict = json.loads(user_value, object_pairs_hook=OrderedDict)
88 96
    except Exception:
@@ -107,15 +115,16 @@
Loading
107 115
    if not isinstance(default_value, dict):
108 116
        raise TypeError
109 117
110 -
    default_display = 'default'
111 -
112 118
    user_value = click.prompt(
113 -
        var_name, default=default_display, type=click.STRING, value_proc=process_json
119 +
        var_name,
120 +
        default=DEFAULT_DISPLAY,
121 +
        type=click.STRING,
122 +
        value_proc=functools.partial(process_json, default_value=default_value),
114 123
    )
115 124
116 -
    if user_value == default_display:
117 -
        # Return the given default w/o any processing
118 -
        return default_value
125 +
    if click.__version__.startswith("7.") and user_value == DEFAULT_DISPLAY:
126 +
        # click 7.x does not invoke value_proc on the default value.
127 +
        return default_value  # pragma: no cover
119 128
    return user_value
120 129
121 130
Files Coverage
cookiecutter 100.00%
Project Totals (18 files) 100.00%
940166549
PYTHON=3.8==3.8
OS=macos-latest==macos-latest
940166549
PYTHON=3.6==3.6
OS=windows-latest=Windows_NT=windows-latest
940166549
PYTHON=pypy3==pypy3
OS=macos-latest==macos-latest
940166549
PYTHON=pypy3==pypy3
OS=ubuntu-latest==ubuntu-latest
940166549
PYTHON=3.6==3.6
OS=ubuntu-latest==ubuntu-latest
940166549
PYTHON=3.9==3.9
OS=ubuntu-latest==ubuntu-latest
940166549
PYTHON=3.8==3.8
OS=ubuntu-latest==ubuntu-latest
940166549
PYTHON=3.7==3.7
OS=ubuntu-latest==ubuntu-latest
940166549
PYTHON=3.7==3.7
OS=macos-latest==macos-latest
940166549
PYTHON=3.9==3.9
OS=macos-latest==macos-latest
940166549
PYTHON=3.9==3.9
OS=windows-latest=Windows_NT=windows-latest
940166549
PYTHON=3.8==3.8
OS=windows-latest=Windows_NT=windows-latest
940166549
PYTHON=3.6==3.6
OS=macos-latest==macos-latest
940166549
PYTHON=3.7==3.7
OS=windows-latest=Windows_NT=windows-latest
1
# comment spam as user can always click the failed coverage check
2
comment: false
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading