(value_source, counter0)
Substitutes "{counter0}" and "{counter1}" in value_source.jsonpath.

    counter0 is a 0-indexed counter and counter1 is a 1-indexed counter.
    They are used for incrementing indices.

    >>> vs = as_value_source({
    ...     'case_property': 'name',
    ...     'jsonpath': '$.name[{counter0}].text',
    ... })
    >>> _subs_counters(vs, 3)
    >>> vs.jsonpath
    '$.name[3].text'
Substitutes "{counter0}" and "{counter1}" in value_source.jsonpath.
Substitutes { counter0 } and { counter1 } in value_source . jsonpath .
def _subs_counters(value_source, counter0):
    """
    Substitutes "{counter0}" and "{counter1}" in value_source.jsonpath.

    counter0 is a 0-indexed counter and counter1 is a 1-indexed counter.
    They are used for incrementing indices.

    >>> vs = as_value_source({
    ...     'case_property': 'name',
    ...     'jsonpath': '$.name[{counter0}].text',
    ... })
    >>> _subs_counters(vs, 3)
    >>> vs.jsonpath
    '$.name[3].text'

    """
    if counter0 is None:
        return
    if value_source.jsonpath and (
        '{counter0}' in value_source.jsonpath
        or '{counter1}' in value_source.jsonpath
    ):
        value_source.jsonpath = value_source.jsonpath.format(
            counter0=counter0,
            counter1=counter0 + 1,
        )
def _subs_counters ( value_source , counter0 ) : if counter0 is None : return if value_source . jsonpath and ( '{counter0}' in value_source . jsonpath or '{counter1}' in value_source . jsonpath ) : value_source . jsonpath = value_source . jsonpath . format ( counter0 = counter0 , counter1 = counter0 + 1 , )