def main(fp=sys.stderr, argv=None):
    if argv is None:
        argv = sys.argv[1:]
    try:
        log_idx = argv.index('--log')
    except ValueError:
        for i in argv:
            if i.startswith('--log='):
                logLevel = i[len('--log='):]
                break
        else:
            logLevel = 'INFO'
    else:
        logLevel = argv[log_idx + 1]
    logging.basicConfig(level=getattr(logging, logLevel),
                        format="%(levelname)s:%(module)s:%(lineno)d:%(message)s")
    d = tqdm.__doc__ + CLI_EXTRA_DOC
    opt_types = dict(RE_OPTS.findall(d))
    for o in UNSUPPORTED_OPTS:
        opt_types.pop(o)
    log.debug(sorted(opt_types.items()))
    split = RE_OPTS.split(d)
    opt_types_desc = zip(split[1::3], split[2::3], split[3::3])
    d = ''.join(('\n  --{0}  : {2}{3}' if otd[1] == 'bool' else
                 '\n  --{0}=<{1}>  : {2}{3}').format(
                     otd[0].replace('_', '-'), otd[0], *otd[1:])
                for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS)
    help_short = "Usage:\n  tqdm [--help | options]\n"
    d = help_short + """
Options:
  -h, --help     Print this help and exit.
  -v, --version  Print version and exit.
                if hasattr(resources, 'files'):
                    copyfile(str(resources.files('tqdm') / name), dst)
                else:
                    with resources.path('tqdm', name) as src:
                        copyfile(str(src), dst)
                log.info("written:%s", dst)
            if manpath is not None:
                cp('tqdm.1', path.join(manpath, 'tqdm.1'))
            if comppath is not None:
                cp('completion.sh', path.join(comppath, 'tqdm_completion.sh'))
            sys.exit(0)
        if tee:
            stdout_write = stdout.write
            fp_write = getattr(fp, 'buffer', fp).write
            class stdout(object):
                @staticmethod
                def write(x):
                    with tqdm.external_write_mode(file=fp):
                        fp_write(x)
                    stdout_write(x)
        if delim_per_char:
            tqdm_args.setdefault('unit', 'B')
            tqdm_args.setdefault('unit_scale', True)
            tqdm_args.setdefault('unit_divisor', 1024)
            log.debug(tqdm_args)
            with tqdm(**tqdm_args) as t:
                posix_pipe(stdin, stdout, '', buf_size, t.update)
        elif delim == b'\\n':
            log.debug(tqdm_args)
            write = stdout.write
            if update or update_to:
                with tqdm(**tqdm_args) as t:
                    if update:
                        def callback(i):
                            t.update(numeric(i.decode()))
                    else:
                        def callback(i):
                            t.update(numeric(i.decode()) - t.n)
                    for i in stdin:
                        write(i)
                        callback(i)
            else:
                for i in tqdm(stdin, **tqdm_args):
                    write(i)
        else:
            log.debug(tqdm_args)
            with tqdm(**tqdm_args) as t:
                callback_len = False
                if update:
                    def callback(i):
                        t.update(numeric(i.decode()))
                elif update_to:
                    def callback(i):
                        t.update(numeric(i.decode()) - t.n)
                else:
                    callback = t.update
                    callback_len = True
                posix_pipe(stdin, stdout, delim, buf_size, callback, callback_len)
main(fp=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, argv=None)

['--desc', 'Test CLI import', '--ascii', 'True', '--unit_scale', 'True']

['tqdm', 'desc', ' ', 'Test CLI import', 'ascii', ' ', 'True', 'unit_scale', ' ', 'True']

'\n    Decorate an iterable object, returning an iterator which acts exactly\n    like the original iterable, but prints a dynamically updating\n    progressbar every time a value is requested.\n\n    Parameters\n    ----------\n    iterable  : iterable, optional\n        Iterable to decorate with a progressbar.\n        Leave blank to manually manage the updates.\n    desc  : str, optional\n        Prefix for the progressbar.\n    total  : int or float, optional\n        The number of expected iterations. If unspecified,\n        len(iterable) is used if possible. If float("inf") or as a last\n        resort, only basic progress statistics are displayed\n        (no ETA, no progressbar).\n        If `gui` is True and this parameter needs subsequent updating,\n        specify an initial arbitrary large positive number,\n        e.g. 9e9.\n    leave  : bool, optional\n        If [default: True], keeps all traces of the progressbar\n        upon termination of iteration.\n        If `None`, will leave only if `position` is `0`.\n    file  : `io.TextIOWrapper` or `io.StringIO`, optional\n        Specifies where to output the progress messages\n        (default: sys.stderr). Uses `file.write(str)` and `file.flush()`\n        methods.  For encoding, see `write_bytes`.\n    ncols  : int, optional\n        The width of the entire output message. If specified,\n        dynamically resizes the progressbar to stay within this bound.\n        If unspecified, attempts to use environment width. The\n        fallback is a meter width of 10 and no limit for the counter and\n        statistics. If 0, will not print any meter (only stats).\n    mininterval  : float, optional\n        Minimum progress display update interval [default: 0.1] seconds.\n    maxinterval  : float, optional\n        Maximum progress display update interval [default: 10] seconds.\n        Automatically adjusts `miniters` to correspond to `mininterval`\n        after long display update lag. Only works if `dynamic_miniters`\n        or monitor thread is enabled.\n    miniters  : int or float, optional\n        Minimum progress display update interval, in iterations.\n        If 0 and `dynamic_miniters`, will automatically adjust to equal\n        `mininterval` (more CPU efficient, good for tight loops).\n        If > 0, will skip display of specified number of iterations.\n        Tweak this and `mininterval` to get very efficient loops.\n        If your progress is erratic with both fast and slow iterations\n        (network, skipping items, etc) you should set miniters=1.\n    ascii  : bool or str, optional\n        If unspecified or False, use unicode (smooth blocks) to fill\n        the meter. The fallback is to use ASCII characters " 123456789#".\n    disable  : bool, optional\n        Whether to disable the entire progressbar wrapper\n        [default: False]. If set to None, disable on non-TTY.\n    unit  : str, optional\n        String that will be used to define the unit of each iteration\n        [default: it].\n    unit_scale  : bool or int or float, optional\n        If 1 or True, the number of iterations will be reduced/scaled\n        automatically and a metric prefix following the\n        International System of Units standard will be added\n        (kilo, mega, etc.) [default: False]. If any other non-zero\n        number, will scale `total` and `n`.\n    dynamic_ncols  : bool, optional\n        If set, constantly alters `ncols` and `nrows` to the\n        environment (allowing for window resizes) [default: False].\n    smoothing  : float, optional\n        Exponential moving average smoothing factor for speed estimates\n        (ignored in GUI mode). Ranges from 0 (average speed) to 1\n        (current/instantaneous speed) [default: 0.3].\n    bar_format  : str, optional\n        Specify a custom bar string formatting. May impact performance.\n        [default: \'{l_bar}{bar}{r_bar}\'], where\n        l_bar=\'{desc}: {percentage:3.0f}%|\' and\n        r_bar=\'| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, \'\n            \'{rate_fmt}{postfix}]\'\n        Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,\n            percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,\n            rate, rate_fmt, rate_noinv, rate_noinv_fmt,\n            rate_inv, rate_inv_fmt, postfix, unit_divisor,\n            remaining, remaining_s, eta.\n        Note that a trailing ": " is automatically removed after {desc}\n        if the latter is empty.\n    initial  : int or float, optional\n        The initial counter value. Useful when restarting a progress\n        bar [default: 0]. If using float, consider specifying `{n:.3f}`\n        or similar in `bar_format`, or specifying `unit_scale`.\n    position  : int, optional\n        Specify the line offset to print this bar (starting from 0)\n        Automatic if unspecified.\n        Useful to manage multiple bars at once (eg, from threads).\n    postfix  : dict or *, optional\n        Specify additional stats to display at the end of the bar.\n        Calls `set_postfix(**postfix)` if possible (dict).\n    unit_divisor  : float, optional\n        [default: 1000], ignored unless `unit_scale` is True.\n    write_bytes  : bool, optional\n        Whether to write bytes. If (default: False) will write unicode.\n    lock_args  : tuple, optional\n        Passed to `refresh` for intermediate output\n        (initialisation, iterating, and updating).\n    nrows  : int, optional\n        The screen height. If specified, hides nested bars outside this\n        bound. If unspecified, attempts to use environment height.\n        The fallback is 20.\n    colour  : str, optional\n        Bar colour (e.g. \'green\', \'#00ff00\').\n    delay  : float, optional\n        Don\'t display until [default: 0] seconds have elapsed.\n    gui  : bool, optional\n        WARNING: internal parameter - do not use.\n        Use tqdm.gui.tqdm(...) instead. If set, will attempt to use\n        matplotlib animations for a graphical output [default: False].\n\n    Returns\n    -------\n    out  : decorated iterator.\n    \n    Extra CLI Options\n    -----------------\n    name  : type, optional\n        TODO: find out why this is needed.\n    delim  : chr, optional\n        Delimiting character [default: \'\\n\']. Use \'\\0\' for null.\n        N.B.: on Windows systems, Python converts \'\\n\' to \'\\r\\n\'.\n    buf_size  : int, optional\n        String buffer size in bytes [default: 256]\n        used when `delim` is specified.\n    bytes  : bool, optional\n        If true, will count bytes, ignore `delim`, and default\n        `unit_scale` to True, `unit_divisor` to 1024, and `unit` to \'B\'.\n    tee  : bool, optional\n        If true, passes `stdin` to both `stderr` and `stdout`.\n    update  : bool, optional\n        If true, will treat input as newly elapsed iterations,\n        i.e. numbers to pass to `update()`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.\n    update_to  : bool, optional\n        If true, will treat input as total elapsed iterations,\n        i.e. numbers to assign to `self.n`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.\n    null  : bool, optional\n        If true, will discard input (no stdout).\n    manpath  : str, optional\n        Directory in which to install tqdm man pages.\n    comppath  : str, optional\n        Directory in which to place tqdm completion.\n    log  : str, optional\n        CRITICAL|FATAL|ERROR|WARN(ING)|[default: \'INFO\']|DEBUG|NOTSET.\n'

'\n  --desc=<desc>  : str, optional\n        Prefix for the progressbar.\n  --total=<total>  : int or float, optional\n        The number of expected iterations. If unspecified,\n        len(iterable) is used if possible. If float("inf") or as a last\n        resort, only basic progress statistics are displayed\n        (no ETA, no progressbar).\n        If `gui` is True and this parameter needs subsequent updating,\n        specify an initial arbitrary large positive number,\n        e.g. 9e9.\n  --leave  : bool, optional\n        If [default: True], keeps all traces of the progressbar\n        upon termination of iteration.\n        If `None`, will leave only if `position` is `0`.\n  --ncols=<ncols>  : int, optional\n        The width of the entire output message. If specified,\n        dynamically resizes the progressbar to stay within this bound.\n        If unspecified, attempts to use environment width. The\n        fallback is a meter width of 10 and no limit for the counter and\n        statistics. If 0, will not print any meter (only stats).\n  --mininterval=<mininterval>  : float, optional\n        Minimum progress display update interval [default: 0.1] seconds.\n  --maxinterval=<maxinterval>  : float, optional\n        Maximum progress display update interval [default: 10] seconds.\n        Automatically adjusts `miniters` to correspond to `mininterval`\n        after long display update lag. Only works if `dynamic_miniters`\n        or monitor thread is enabled.\n  --miniters=<miniters>  : int or float, optional\n        Minimum progress display update interval, in iterations.\n        If 0 and `dynamic_miniters`, will automatically adjust to equal\n        `mininterval` (more CPU efficient, good for tight loops).\n        If > 0, will skip display of specified number of iterations.\n        Tweak this and `mininterval` to get very efficient loops.\n        If your progress is erratic with both fast and slow iterations\n        (network, skipping items, etc) you should set miniters=1.\n  --ascii=<ascii>  : bool or str, optional\n        If unspecified or False, use unicode (smooth blocks) to fill\n        the meter. The fallback is to use ASCII characters " 123456789#".\n  --disable  : bool, optional\n        Whether to disable the entire progressbar wrapper\n        [default: False]. If set to None, disable on non-TTY.\n  --unit=<unit>  : str, optional\n        String that will be used to define the unit of each iteration\n        [default: it].\n  --unit-scale=<unit_scale>  : bool or int or float, optional\n        If 1 or True, the number of iterations will be reduced/scaled\n        automatically and a metric prefix following the\n        International System of Units standard will be added\n        (kilo, mega, etc.) [default: False]. If any other non-zero\n        number, will scale `total` and `n`.\n  --dynamic-ncols  : bool, optional\n        If set, constantly alters `ncols` and `nrows` to the\n        environment (allowing for window resizes) [default: False].\n  --smoothing=<smoothing>  : float, optional\n        Exponential moving average smoothing factor for speed estimates\n        (ignored in GUI mode). Ranges from 0 (average speed) to 1\n        (current/instantaneous speed) [default: 0.3].\n  --bar-format=<bar_format>  : str, optional\n        Specify a custom bar string formatting. May impact performance.\n        [default: \'{l_bar}{bar}{r_bar}\'], where\n        l_bar=\'{desc}: {percentage:3.0f}%|\' and\n        r_bar=\'| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, \'\n            \'{rate_fmt}{postfix}]\'\n        Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,\n            percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,\n            rate, rate_fmt, rate_noinv, rate_noinv_fmt,\n            rate_inv, rate_inv_fmt, postfix, unit_divisor,\n            remaining, remaining_s, eta.\n        Note that a trailing ": " is automatically removed after {desc}\n        if the latter is empty.\n  --initial=<initial>  : int or float, optional\n        The initial counter value. Useful when restarting a progress\n        bar [default: 0]. If using float, consider specifying `{n:.3f}`\n        or similar in `bar_format`, or specifying `unit_scale`.\n  --position=<position>  : int, optional\n        Specify the line offset to print this bar (starting from 0)\n        Automatic if unspecified.\n        Useful to manage multiple bars at once (eg, from threads).\n  --postfix=<postfix>  : dict or *, optional\n        Specify additional stats to display at the end of the bar.\n        Calls `set_postfix(**postfix)` if possible (dict).\n  --unit-divisor=<unit_divisor>  : float, optional\n        [default: 1000], ignored unless `unit_scale` is True.\n  --write-bytes  : bool, optional\n        Whether to write bytes. If (default: False) will write unicode.\n  --lock-args=<lock_args>  : tuple, optional\n        Passed to `refresh` for intermediate output\n        (initialisation, iterating, and updating).\n  --nrows=<nrows>  : int, optional\n        The screen height. If specified, hides nested bars outside this\n        bound. If unspecified, attempts to use environment height.\n        The fallback is 20.\n  --colour=<colour>  : str, optional\n        Bar colour (e.g. \'green\', \'#00ff00\').\n  --delay=<delay>  : float, optional\n        Don\'t display until [default: 0] seconds have elapsed.\n  --delim=<delim>  : chr, optional\n        Delimiting character [default: \'\\n\']. Use \'\\0\' for null.\n        N.B.: on Windows systems, Python converts \'\\n\' to \'\\r\\n\'.\n  --buf-size=<buf_size>  : int, optional\n        String buffer size in bytes [default: 256]\n        used when `delim` is specified.\n  --bytes  : bool, optional\n        If true, will count bytes, ignore `delim`, and default\n        `unit_scale` to True, `unit_divisor` to 1024, and `unit` to \'B\'.\n  --tee  : bool, optional\n        If true, passes `stdin` to both `stderr` and `stdout`.\n  --update  : bool, optional\n        If true, will treat input as newly elapsed iterations,\n        i.e. numbers to pass to `update()`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.\n  --update-to  : bool, optional\n        If true, will treat input as total elapsed iterations,\n        i.e. numbers to assign to `self.n`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.\n  --null  : bool, optional\n        If true, will discard input (no stdout).\n  --manpath=<manpath>  : str, optional\n        Directory in which to install tqdm man pages.\n  --comppath=<comppath>  : str, optional\n        Directory in which to place tqdm completion.\n  --log=<log>  : str, optional\n        CRITICAL|FATAL|ERROR|WARN(ING)|[default: \'INFO\']|DEBUG|NOTSET.\n'

'Usage:\n  tqdm [--help | options]\n\nOptions:\n  -h, --help     Print this help and exit.\n  -v, --version  Print version and exit.\n  --desc=<desc>  : str, optional\n        Prefix for the progressbar.\n  --total=<total>  : int or float, optional\n        The number of expected iterations. If unspecified,\n        len(iterable) is used if possible. If float("inf") or as a last\n        resort, only basic progress statistics are displayed\n        (no ETA, no progressbar).\n        If `gui` is True and this parameter needs subsequent updating,\n        specify an initial arbitrary large positive number,\n        e.g. 9e9.\n  --leave  : bool, optional\n        If [default: True], keeps all traces of the progressbar\n        upon termination of iteration.\n        If `None`, will leave only if `position` is `0`.\n  --ncols=<ncols>  : int, optional\n        The width of the entire output message. If specified,\n        dynamically resizes the progressbar to stay within this bound.\n        If unspecified, attempts to use environment width. The\n        fallback is a meter width of 10 and no limit for the counter and\n        statistics. If 0, will not print any meter (only stats).\n  --mininterval=<mininterval>  : float, optional\n        Minimum progress display update interval [default: 0.1] seconds.\n  --maxinterval=<maxinterval>  : float, optional\n        Maximum progress display update interval [default: 10] seconds.\n        Automatically adjusts `miniters` to correspond to `mininterval`\n        after long display update lag. Only works if `dynamic_miniters`\n        or monitor thread is enabled.\n  --miniters=<miniters>  : int or float, optional\n        Minimum progress display update interval, in iterations.\n        If 0 and `dynamic_miniters`, will automatically adjust to equal\n        `mininterval` (more CPU efficient, good for tight loops).\n        If > 0, will skip display of specified number of iterations.\n        Tweak this and `mininterval` to get very efficient loops.\n        If your progress is erratic with both fast and slow iterations\n        (network, skipping items, etc) you should set miniters=1.\n  --ascii=<ascii>  : bool or str, optional\n        If unspecified or False, use unicode (smooth blocks) to fill\n        the meter. The fallback is to use ASCII characters " 123456789#".\n  --disable  : bool, optional\n        Whether to disable the entire progressbar wrapper\n        [default: False]. If set to None, disable on non-TTY.\n  --unit=<unit>  : str, optional\n        String that will be used to define the unit of each iteration\n        [default: it].\n  --unit-scale=<unit_scale>  : bool or int or float, optional\n        If 1 or True, the number of iterations will be reduced/scaled\n        automatically and a metric prefix following the\n        International System of Units standard will be added\n        (kilo, mega, etc.) [default: False]. If any other non-zero\n        number, will scale `total` and `n`.\n  --dynamic-ncols  : bool, optional\n        If set, constantly alters `ncols` and `nrows` to the\n        environment (allowing for window resizes) [default: False].\n  --smoothing=<smoothing>  : float, optional\n        Exponential moving average smoothing factor for speed estimates\n        (ignored in GUI mode). Ranges from 0 (average speed) to 1\n        (current/instantaneous speed) [default: 0.3].\n  --bar-format=<bar_format>  : str, optional\n        Specify a custom bar string formatting. May impact performance.\n        [default: \'{l_bar}{bar}{r_bar}\'], where\n        l_bar=\'{desc}: {percentage:3.0f}%|\' and\n        r_bar=\'| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, \'\n            \'{rate_fmt}{postfix}]\'\n        Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,\n            percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,\n            rate, rate_fmt, rate_noinv, rate_noinv_fmt,\n            rate_inv, rate_inv_fmt, postfix, unit_divisor,\n            remaining, remaining_s, eta.\n        Note that a trailing ": " is automatically removed after {desc}\n        if the latter is empty.\n  --initial=<initial>  : int or float, optional\n        The initial counter value. Useful when restarting a progress\n        bar [default: 0]. If using float, consider specifying `{n:.3f}`\n        or similar in `bar_format`, or specifying `unit_scale`.\n  --position=<position>  : int, optional\n        Specify the line offset to print this bar (starting from 0)\n        Automatic if unspecified.\n        Useful to manage multiple bars at once (eg, from threads).\n  --postfix=<postfix>  : dict or *, optional\n        Specify additional stats to display at the end of the bar.\n        Calls `set_postfix(**postfix)` if possible (dict).\n  --unit-divisor=<unit_divisor>  : float, optional\n        [default: 1000], ignored unless `unit_scale` is True.\n  --write-bytes  : bool, optional\n        Whether to write bytes. If (default: False) will write unicode.\n  --lock-args=<lock_args>  : tuple, optional\n        Passed to `refresh` for intermediate output\n        (initialisation, iterating, and updating).\n  --nrows=<nrows>  : int, optional\n        The screen height. If specified, hides nested bars outside this\n        bound. If unspecified, attempts to use environment height.\n        The fallback is 20.\n  --colour=<colour>  : str, optional\n        Bar colour (e.g. \'green\', \'#00ff00\').\n  --delay=<delay>  : float, optional\n        Don\'t display until [default: 0] seconds have elapsed.\n  --delim=<delim>  : chr, optional\n        Delimiting character [default: \'\\n\']. Use \'\\0\' for null.\n        N.B.: on Windows systems, Python converts \'\\n\' to \'\\r\\n\'.\n  --buf-size=<buf_size>  : int, optional\n        String buffer size in bytes [default: 256]\n        used when `delim` is specified.\n  --bytes  : bool, optional\n        If true, will count bytes, ignore `delim`, and default\n        `unit_scale` to True, `unit_divisor` to 1024, and `unit` to \'B\'.\n  --tee  : bool, optional\n        If true, passes `stdin` to both `stderr` and `stdout`.\n  --update  : bool, optional\n        If true, will treat input as newly elapsed iterations,\n        i.e. numbers to pass to `update()`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.\n  --update-to  : bool, optional\n        If true, will treat input as total elapsed iterations,\n        i.e. numbers to assign to `self.n`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.\n  --null  : bool, optional\n        If true, will discard input (no stdout).\n  --manpath=<manpath>  : str, optional\n        Directory in which to install tqdm man pages.\n  --comppath=<comppath>  : str, optional\n        Directory in which to place tqdm completion.\n  --log=<log>  : str, optional\n        CRITICAL|FATAL|ERROR|WARN(ING)|[default: \'INFO\']|DEBUG|NOTSET.\n'

{'iterable': 'iterable', 'desc': 'str', 'total': 'int or float', 'leave': 'bool', 'file': '`io.TextIOWrapper` or `io.StringIO`', 'ncols': 'int', 'mininterval': 'float', 'maxinterval': 'float', 'miniters': 'int or float', 'ascii': 'bool or str', 'disable': 'bool', 'unit': 'str', 'unit_scale': 'bool or int or float', 'dynamic_ncols': 'bool', 'smoothing': 'float', 'bar_format': 'str', 'initial': 'int or float', 'position': 'int', 'postfix': 'dict or *', 'unit_divisor': 'float', 'write_bytes': 'bool', 'lock_args': 'tuple', 'nrows': 'int', 'colour': 'str', 'delay': 'float', 'gui': 'bool', 'out': 'decorated iterator.\n    \n    Extra CLI Options\n    -----------------\n    name  : type', 'delim': 'chr', 'buf_size': 'int', 'bytes': 'bool', 'tee': 'bool', 'update': 'bool', 'update_to': 'bool', 'null': 'bool', 'manpath': 'str', 'comppath': 'str', 'log': 'str'}

{'desc': 'str', 'total': 'int or float', 'leave': 'bool', 'file': '`io.TextIOWrapper` or `io.StringIO`', 'ncols': 'int', 'mininterval': 'float', 'maxinterval': 'float', 'miniters': 'int or float', 'ascii': 'bool or str', 'disable': 'bool', 'unit': 'str', 'unit_scale': 'bool or int or float', 'dynamic_ncols': 'bool', 'smoothing': 'float', 'bar_format': 'str', 'initial': 'int or float', 'position': 'int', 'postfix': 'dict or *', 'unit_divisor': 'float', 'write_bytes': 'bool', 'lock_args': 'tuple', 'nrows': 'int', 'colour': 'str', 'delay': 'float', 'gui': 'bool', 'out': 'decorated iterator.\n    \n    Extra CLI Options\n    -----------------\n    name  : type', 'delim': 'chr', 'buf_size': 'int', 'bytes': 'bool', 'tee': 'bool', 'update': 'bool', 'update_to': 'bool', 'null': 'bool', 'manpath': 'str', 'comppath': 'str', 'log': 'str'}

{'desc': 'str', 'total': 'int or float', 'leave': 'bool', 'file': '`io.TextIOWrapper` or `io.StringIO`', 'ncols': 'int', 'mininterval': 'float', 'maxinterval': 'float', 'miniters': 'int or float', 'ascii': 'bool or str', 'disable': 'bool', 'unit': 'str', 'unit_scale': 'bool or int or float', 'dynamic_ncols': 'bool', 'smoothing': 'float', 'bar_format': 'str', 'initial': 'int or float', 'position': 'int', 'postfix': 'dict or *', 'unit_divisor': 'float', 'write_bytes': 'bool', 'lock_args': 'tuple', 'nrows': 'int', 'colour': 'str', 'delay': 'float', 'out': 'decorated iterator.\n    \n    Extra CLI Options\n    -----------------\n    name  : type', 'delim': 'chr', 'buf_size': 'int', 'bytes': 'bool', 'tee': 'bool', 'update': 'bool', 'update_to': 'bool', 'null': 'bool', 'manpath': 'str', 'comppath': 'str', 'log': 'str'}

{'desc': 'str', 'total': 'int or float', 'leave': 'bool', 'file': '`io.TextIOWrapper` or `io.StringIO`', 'ncols': 'int', 'mininterval': 'float', 'maxinterval': 'float', 'miniters': 'int or float', 'ascii': 'bool or str', 'disable': 'bool', 'unit': 'str', 'unit_scale': 'bool or int or float', 'dynamic_ncols': 'bool', 'smoothing': 'float', 'bar_format': 'str', 'initial': 'int or float', 'position': 'int', 'postfix': 'dict or *', 'unit_divisor': 'float', 'write_bytes': 'bool', 'lock_args': 'tuple', 'nrows': 'int', 'colour': 'str', 'delay': 'float', 'delim': 'chr', 'buf_size': 'int', 'bytes': 'bool', 'tee': 'bool', 'update': 'bool', 'update_to': 'bool', 'null': 'bool', 'manpath': 'str', 'comppath': 'str', 'log': 'str'}

{'desc': 'str', 'total': 'int or float', 'leave': 'bool', 'ncols': 'int', 'mininterval': 'float', 'maxinterval': 'float', 'miniters': 'int or float', 'ascii': 'bool or str', 'disable': 'bool', 'unit': 'str', 'unit_scale': 'bool or int or float', 'dynamic_ncols': 'bool', 'smoothing': 'float', 'bar_format': 'str', 'initial': 'int or float', 'position': 'int', 'postfix': 'dict or *', 'unit_divisor': 'float', 'write_bytes': 'bool', 'lock_args': 'tuple', 'nrows': 'int', 'colour': 'str', 'delay': 'float', 'delim': 'chr', 'buf_size': 'int', 'bytes': 'bool', 'tee': 'bool', 'update': 'bool', 'update_to': 'bool', 'null': 'bool', 'manpath': 'str', 'comppath': 'str', 'log': 'str'}

['\n    Decorate an iterable object, returning an iterator which acts exactly\n    like the original iterable, but prints a dynamically updating\n    progressbar every time a value is requested.\n\n    Parameters\n    ----------', 'iterable', 'iterable', ', optional\n        Iterable to decorate with a progressbar.\n        Leave blank to manually manage the updates.', 'desc', 'str', ', optional\n        Prefix for the progressbar.', 'total', 'int or float', ', optional\n        The number of expected iterations. If unspecified,\n        len(iterable) is used if possible. If float("inf") or as a last\n        resort, only basic progress statistics are displayed\n        (no ETA, no progressbar).\n        If `gui` is True and this parameter needs subsequent updating,\n        specify an initial arbitrary large positive number,\n        e.g. 9e9.', 'leave', 'bool', ', optional\n        If [default: True], keeps all traces of the progressbar\n        upon termination of iteration.\n        If `None`, will leave only if `position` is `0`.', 'file', '`io.TextIOWrapper` or `io.StringIO`', ', optional\n        Specifies where to output the progress messages\n        (default: sys.stderr). Uses `file.write(str)` and `file.flush()`\n        methods.  For encoding, see `write_bytes`.', 'ncols', 'int', ', optional\n        The width of the entire output message. If specified,\n        dynamically resizes the progressbar to stay within this bound.\n        If unspecified, attempts to use environment width. The\n        fallback is a meter width of 10 and no limit for the counter and\n        statistics. If 0, will not print any meter (only stats).', 'mininterval', 'float', ', optional\n        Minimum progress display update interval [default: 0.1] seconds.', 'maxinterval', 'float', ', optional\n        Maximum progress display update interval [default: 10] seconds.\n        Automatically adjusts `miniters` to correspond to `mininterval`\n        after long display update lag. Only works if `dynamic_miniters`\n        or monitor thread is enabled.', 'miniters', 'int or float', ', optional\n        Minimum progress display update interval, in iterations.\n        If 0 and `dynamic_miniters`, will automatically adjust to equal\n        `mininterval` (more CPU efficient, good for tight loops).\n        If > 0, will skip display of specified number of iterations.\n        Tweak this and `mininterval` to get very efficient loops.\n        If your progress is erratic with both fast and slow iterations\n        (network, skipping items, etc) you should set miniters=1.', 'ascii', 'bool or str', ', optional\n        If unspecified or False, use unicode (smooth blocks) to fill\n        the meter. The fallback is to use ASCII characters " 123456789#".', 'disable', 'bool', ', optional\n        Whether to disable the entire progressbar wrapper\n        [default: False]. If set to None, disable on non-TTY.', 'unit', 'str', ', optional\n        String that will be used to define the unit of each iteration\n        [default: it].', 'unit_scale', 'bool or int or float', ', optional\n        If 1 or True, the number of iterations will be reduced/scaled\n        automatically and a metric prefix following the\n        International System of Units standard will be added\n        (kilo, mega, etc.) [default: False]. If any other non-zero\n        number, will scale `total` and `n`.', 'dynamic_ncols', 'bool', ', optional\n        If set, constantly alters `ncols` and `nrows` to the\n        environment (allowing for window resizes) [default: False].', 'smoothing', 'float', ', optional\n        Exponential moving average smoothing factor for speed estimates\n        (ignored in GUI mode). Ranges from 0 (average speed) to 1\n        (current/instantaneous speed) [default: 0.3].', 'bar_format', 'str', ', optional\n        Specify a custom bar string formatting. May impact performance.\n        [default: \'{l_bar}{bar}{r_bar}\'], where\n        l_bar=\'{desc}: {percentage:3.0f}%|\' and\n        r_bar=\'| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, \'\n            \'{rate_fmt}{postfix}]\'\n        Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,\n            percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,\n            rate, rate_fmt, rate_noinv, rate_noinv_fmt,\n            rate_inv, rate_inv_fmt, postfix, unit_divisor,\n            remaining, remaining_s, eta.\n        Note that a trailing ": " is automatically removed after {desc}\n        if the latter is empty.', 'initial', 'int or float', ', optional\n        The initial counter value. Useful when restarting a progress\n        bar [default: 0]. If using float, consider specifying `{n:.3f}`\n        or similar in `bar_format`, or specifying `unit_scale`.', 'position', 'int', ', optional\n        Specify the line offset to print this bar (starting from 0)\n        Automatic if unspecified.\n        Useful to manage multiple bars at once (eg, from threads).', 'postfix', 'dict or *', ', optional\n        Specify additional stats to display at the end of the bar.\n        Calls `set_postfix(**postfix)` if possible (dict).', 'unit_divisor', 'float', ', optional\n        [default: 1000], ignored unless `unit_scale` is True.', 'write_bytes', 'bool', ', optional\n        Whether to write bytes. If (default: False) will write unicode.', 'lock_args', 'tuple', ', optional\n        Passed to `refresh` for intermediate output\n        (initialisation, iterating, and updating).', 'nrows', 'int', ', optional\n        The screen height. If specified, hides nested bars outside this\n        bound. If unspecified, attempts to use environment height.\n        The fallback is 20.', 'colour', 'str', ", optional\n        Bar colour (e.g. 'green', '#00ff00').", 'delay', 'float', ", optional\n        Don't display until [default: 0] seconds have elapsed.", 'gui', 'bool', ', optional\n        WARNING: internal parameter - do not use.\n        Use tqdm.gui.tqdm(...) instead. If set, will attempt to use\n        matplotlib animations for a graphical output [default: False].\n\n    Returns\n    -------', 'out', 'decorated iterator.\n    \n    Extra CLI Options\n    -----------------\n    name  : type', ', optional\n        TODO: find out why this is needed.', 'delim', 'chr', ", optional\n        Delimiting character [default: '\\n']. Use '\\0' for null.\n        N.B.: on Windows systems, Python converts '\\n' to '\\r\\n'.", 'buf_size', 'int', ', optional\n        String buffer size in bytes [default: 256]\n        used when `delim` is specified.', 'bytes', 'bool', ", optional\n        If true, will count bytes, ignore `delim`, and default\n        `unit_scale` to True, `unit_divisor` to 1024, and `unit` to 'B'.", 'tee', 'bool', ', optional\n        If true, passes `stdin` to both `stderr` and `stdout`.', 'update', 'bool', ', optional\n        If true, will treat input as newly elapsed iterations,\n        i.e. numbers to pass to `update()`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.', 'update_to', 'bool', ', optional\n        If true, will treat input as total elapsed iterations,\n        i.e. numbers to assign to `self.n`. Note that this is slow\n        (~2e5 it/s) since every input must be decoded as a number.', 'null', 'bool', ', optional\n        If true, will discard input (no stdout).', 'manpath', 'str', ', optional\n        Directory in which to install tqdm man pages.', 'comppath', 'str', ', optional\n        Directory in which to place tqdm completion.', 'log', 'str', ", optional\n        CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET.\n"]

{'desc': 'Test CLI import', 'ascii': 'True', 'unit_scale': 'True'}

{'file': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>}

{'file': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, 'desc': 'Test CLI import'}

{'file': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, 'desc': 'Test CLI import', 'ascii': True}

{'file': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, 'desc': 'Test CLI import', 'ascii': True, 'unit_scale': True}

<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>

<built-in method write of _io.BufferedWriter object at 0x7fde143c1720>


def make_context(headers):
    headers = {k.lower(): v for k, v in headers.items()}
    if not all(h in headers for h in (
            TRACE_ID_HEADER.lower(), SPAN_ID_HEADER.lower())):
        return None
    context = TraceContext(
        trace_id=headers.get(TRACE_ID_HEADER.lower()),
        parent_id=headers.get(PARENT_ID_HEADER.lower(), None),
        span_id=headers.get(SPAN_ID_HEADER.lower()),
        sampled=parse_sampled(headers),
        shared=False,
        debug=parse_debug(headers),
    )
    return context
make_context(headers={'X-B3-Flags': '0', 'X-B3-ParentSpanId': None, 'X-B3-Sampled': '1', 'X-B3-SpanId': '41baf1be2fb9bfc5', 'X-B3-TraceId': '6f9a20b5092fa5e144fd15cc31141cd4'})

{'x-b3-flags': '0', 'x-b3-parentspanid': None, 'x-b3-sampled': '1', 'x-b3-spanid': '41baf1be2fb9bfc5', 'x-b3-traceid': '6f9a20b5092fa5e144fd15cc31141cd4'}

Context: TraceContext(trace_id='6f9a20b5092fa5e144fd15cc31141cd4', parent_id=None, span_id='41baf1be2fb9bfc5', sampled=True, debug=False, shared=False)


def make_timestamp(ts=None):
    ts = ts if ts is not None else time.time()
    return int(ts * 1000 * 1000)
make_timestamp(ts=None)


def start(self, ts):
        self._timestamp = ts
        return self
start(self=<aiozipkin.record.Record object at 0x7f2c661f09a0>, ts=0, self._annotations=[], self._context=TraceContext(trace_id='string', parent_id='string', span_id='string', sampled=True, debug=True, shared=True), self._duration=None, self._finished=False, self._kind=None, self._local_endpoint={'serviceName': 'string', 'ipv4': 'string', 'ipv6': 'string', 'port': 0}, self._name='unknown', self._remote_endpoint=None, self._tags={}, self._timestamp=None)


def set_tag(self, key, value):
        self._tags[key] = value
        return self
set_tag(self=<aiozipkin.record.Record object at 0x7f2c661f09a0>, key='additionalProp1', value='string', self._annotations=[], self._context=TraceContext(trace_id='string', parent_id='string', span_id='string', sampled=True, debug=True, shared=True), self._duration=None, self._finished=False, self._kind=None, self._local_endpoint={'serviceName': 'string', 'ipv4': 'string', 'ipv6': 'string', 'port': 0}, self._name='string', self._remote_endpoint=None, self._tags={}, self._timestamp=0)


def kind(self, kind):
        self._kind = kind
        return self
kind(self=<aiozipkin.record.Record object at 0x7f2c661f09a0>, kind='CLIENT', self._annotations=[], self._context=TraceContext(trace_id='string', parent_id='string', span_id='string', sampled=True, debug=True, shared=True), self._duration=None, self._finished=False, self._kind=None, self._local_endpoint={'serviceName': 'string', 'ipv4': 'string', 'ipv6': 'string', 'port': 0}, self._name='string', self._remote_endpoint=None, self._tags={'additionalProp1': 'string', 'additionalProp2': 'string', 'additionalProp3': 'string'}, self._timestamp=0)


def remote_endpoint(self, endpoint):
        self._remote_endpoint = endpoint._asdict()
        return self
remote_endpoint(self=<aiozipkin.record.Record object at 0x7f2c661f09a0>, endpoint=Endpoint(serviceName='string', ipv4='string', ipv6='string', port=0), self._annotations=[{'value': 'string', 'timestamp': 0}], self._context=TraceContext(trace_id='string', parent_id='string', span_id='string', sampled=True, debug=True, shared=True), self._duration=None, self._finished=False, self._kind='CLIENT', self._local_endpoint={'serviceName': 'string', 'ipv4': 'string', 'ipv6': 'string', 'port': 0}, self._name='string', self._remote_endpoint=None, self._tags={'additionalProp1': 'string', 'additionalProp2': 'string', 'additionalProp3': 'string'}, self._timestamp=0)


def finish(self, ts):
        if self._finished:
            return self
        if ts is not None and self._kind not in (PRODUCER, CONSUMER):
            self._duration = max(ts - self._timestamp, 1)
        return self
finish(self=<aiozipkin.record.Record object at 0x7f2c661f09a0>, ts=0, self._annotations=[{'value': 'string', 'timestamp': 0}], self._context=TraceContext(trace_id='string', parent_id='string', span_id='string', sampled=True, debug=True, shared=True), self._duration=None, self._finished=False, self._kind='CLIENT', self._local_endpoint={'serviceName': 'string', 'ipv4': 'string', 'ipv6': 'string', 'port': 0}, self._name='string', self._remote_endpoint={'serviceName': 'string', 'ipv4': 'string', 'ipv6': 'string', 'port': 0}, self._tags={'additionalProp1': 'string', 'additionalProp2': 'string', 'additionalProp3': 'string'}, self._timestamp=0)


def new_trace(self, sampled=None, debug=False):
        context = self._next_context(None, sampled=None, debug=False)
        return self.to_span(context)
new_trace(self=<aiozipkin.tracer.Tracer object at 0x7f2c66315370>, sampled=None, debug=False, self._local_endpoint=Endpoint(serviceName='test_service', ipv4='127.0.0.1', ipv6=None, port=8080), self._records={}, self._sampler=<aiozipkin.sampler.Sampler object at 0x7f2c66315970>, self._transport=<conftest.FakeTransport object at 0x7f2c661f0c70>)

{TraceContext(trace_id='15cbcc98ae50640b07868c479d9bbfc4', parent_id=None, span_id='3660667ac5c682ed', sampled=True, debug=False, shared=False): <aiozipkin.record.Record object at 0x7f2c661f04c0>}


def _next_context(self, context=None, sampled=None, debug=False):
        span_id = generate_random_64bit_string()
        if context is not None:
            new_context = context._replace(
                span_id=span_id,
                parent_id=context.span_id,
                shared=False)
            return new_context
        trace_id = generate_random_128bit_string()
        if sampled is None:
            sampled = self._sampler.is_sampled(trace_id)
        new_context = TraceContext(
            trace_id=trace_id,
            parent_id=None,
            span_id=span_id,
            sampled=sampled,
            debug=debug,
            shared=False)
        return new_context
_next_context(self=<aiozipkin.tracer.Tracer object at 0x7f2c66315370>, context=None, sampled=None, debug=False, self._local_endpoint=Endpoint(serviceName='test_service', ipv4='127.0.0.1', ipv6=None, port=8080), self._records={}, self._sampler=<aiozipkin.sampler.Sampler object at 0x7f2c66315970>, self._transport=<conftest.FakeTransport object at 0x7f2c661f0c70>)

TraceContext(trace_id='15cbcc98ae50640b07868c479d9bbfc4', parent_id=None, span_id='3660667ac5c682ed', sampled=True, debug=False, shared=False)


def to_span(self, context):
        if not context.sampled:
            return NoopSpan(self, context)
        record = Record(context, self._local_endpoint)
        self._records[context] = record
        return Span(self, context, record)
to_span(self=<aiozipkin.tracer.Tracer object at 0x7f2c66315370>, context=TraceContext(trace_id='15cbcc98ae50640b07868c479d9bbfc4', parent_id=None, span_id='3660667ac5c682ed', sampled=True, debug=False, shared=False), self._local_endpoint=Endpoint(serviceName='test_service', ipv4='127.0.0.1', ipv6=None, port=8080), self._records={}, self._sampler=<aiozipkin.sampler.Sampler object at 0x7f2c66315970>, self._transport=<conftest.FakeTransport object at 0x7f2c661f0c70>)

{_context=TraceContext(trace_id='15cbcc98ae50640b07868c479d9bbfc4', parent_id=None, span_id='3660667ac5c682ed', sampled=True, debug=False, shared=False), _local_endpoint={'serviceName': 'test_service', 'ipv4': '127.0.0.1', 'ipv6': None, 'port': 8080}, _finished=False, _name='unknown', _kind=None, _timestamp=None, _duration=None, _remote_endpoint=None, _annotations=[], _tags={}}


def _send(self, record):
        self._records.pop(record._context, None)
        self._transport.send(record)
_send(self=<aiozipkin.tracer.Tracer object at 0x7f2c66315370>, record={_context=TraceContext(trace_id='15cbcc98ae50640b07868c479d9bbfc4', parent_id=None, span_id='3660667ac5c682ed', sampled=True, debug=False, shared=False), _local_endpoint={'serviceName': 'test_service', 'ipv4': '127.0.0.1', 'ipv6': None, 'port': 8080}, _finished=False, _name='root_span', _kind='CLIENT', _timestamp=1712184656174123, _duration=20563, _remote_endpoint={'serviceName': 'service_a', 'ipv4': '127.0.0.1', 'ipv6': None, 'port': 8080}, _annotations=[{'value': 'start:sql', 'timestamp': 1506970524000000}, {'value': 'end:sql', 'timestamp': 1506970524000000}], _tags={'span_type': 'root'}}, self._local_endpoint=Endpoint(serviceName='test_service', ipv4='127.0.0.1', ipv6=None, port=8080), self._records={TraceContext(trace_id='15cbcc98ae50640b07868c479d9bbfc4', parent_id=None, span_id='3660667ac5c682ed', sampled=True, debug=False, shared=False): <aiozipkin.record.Record object at 0x7f2c661f04c0>}, self._sampler=<aiozipkin.sampler.Sampler object at 0x7f2c66315970>, self._transport=<conftest.FakeTransport object at 0x7f2c661f0c70>)


def new_child(self, context):
        new_context = self._next_context(context)
        if not context.sampled:
            return NoopSpan(self, new_context)
        return self.to_span(new_context)
new_child(self=<aiozipkin.tracer.Tracer object at 0x7f2c661f0850>, context=TraceContext(trace_id='6f9a20b5092fa5e144fd15cc31141cd4', parent_id=None, span_id='41baf1be2fb9bfc5', sampled=False, debug=False, shared=True), self._local_endpoint=Endpoint(serviceName='test_service', ipv4='127.0.0.1', ipv6=None, port=8080), self._records={}, self._sampler=<aiozipkin.sampler.Sampler object at 0x7f2c661f0070>, self._transport=<conftest.FakeTransport object at 0x7f2c661f0970>)

TraceContext(trace_id='6f9a20b5092fa5e144fd15cc31141cd4', parent_id='41baf1be2fb9bfc5', span_id='800adeecfc3c86e8', sampled=False, debug=False, shared=False)


def join_span(self, context):
        new_context = context
        if context.sampled is None:
            sampled = self._sampler.is_sampled(context.trace_id)
            new_context = new_context._replace(sampled=sampled)
        else:
            new_context = new_context._replace(shared=True)
        return self.to_span(new_context)
join_span(self=<aiozipkin.tracer.Tracer object at 0x7f2c661f0b50>, context=TraceContext(trace_id='6f9a20b5092fa5e144fd15cc31141cd4', parent_id=None, span_id='41baf1be2fb9bfc5', sampled=True, debug=False, shared=True), self._local_endpoint=Endpoint(serviceName='test_service', ipv4='127.0.0.1', ipv6=None, port=8080), self._records={}, self._sampler=<aiozipkin.sampler.Sampler object at 0x7f2c661f04c0>, self._transport=<conftest.FakeTransport object at 0x7f2c661f0430>)

{TraceContext(trace_id='6f9a20b5092fa5e144fd15cc31141cd4', parent_id=None, span_id='41baf1be2fb9bfc5', sampled=True, debug=False, shared=True): <aiozipkin.record.Record object at 0x7f2c661f0700>}


def pytest_generate_tests(metafunc):
    rule_id = metafunc.config.getoption("rule_id")
    ids, test_cases = load_test_cases(
        test_cases_path=os.path.join(
            "test/fixtures/rules/std_rule_cases", f"{rule_id}.yml"
        )
    )
    if "test_case" in metafunc.fixturenames:
        metafunc.parametrize("test_case", test_cases, ids=ids)
pytest_generate_tests(metafunc={definition=<FunctionDefinition test__rule_test_case>, config=<_pytest.config.Config object at 0x7fd1895e3e20>, fixturenames=['fail_on_parse_error_after_fix', 'test_verbosity_level', 'test_case', 'caplog', 'monkeypatch', 'request'], cls=None, _arg2fixturedefs={'fail_on_parse_error_after_fix': (<FixtureDef argname='fail_on_parse_error_after_fix' scope='function' baseid='test'>,), 'test_verbosity_level': (<FixtureDef argname='test_verbosity_level' scope='function' baseid='test'>,), 'caplog': (<FixtureDef argname='caplog' scope='function' baseid=''>,), 'monkeypatch': (<FixtureDef argname='monkeypatch' scope='function' baseid=''>,)}, _calls=[]})

{definition=<FunctionDefinition test__rule_test_case>, config=<_pytest.config.Config object at 0x7fd1895e3e20>, fixturenames=['fail_on_parse_error_after_fix', 'test_verbosity_level', 'test_case', 'caplog', 'monkeypatch', 'request'], cls=None, _arg2fixturedefs={'fail_on_parse_error_after_fix': (<FixtureDef argname='fail_on_parse_error_after_fix' scope='function' baseid='test'>,), 'test_verbosity_level': (<FixtureDef argname='test_verbosity_level' scope='function' baseid='test'>,), 'caplog': (<FixtureDef argname='caplog' scope='function' baseid=''>,), 'monkeypatch': (<FixtureDef argname='monkeypatch' scope='function' baseid=''>,), 'test_case': [<FixtureDef argname='test_case' scope='function' baseid=''>]}, _calls=[CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from table1 foo', violations=None, fix_str='select foo.bar from table1 AS foo', violations_after_fix=None, configs=None, skip=None, line_numbers=[])}, indices={'test_case': 0}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_default_explicit'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from table1 foo', violations=None, fix_str='select foo.bar from table1 AS foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'explicit'}}}, skip=None, line_numbers=[])}, indices={'test_case': 1}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_explicit'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from table1 AS foo', violations=None, fix_str='select foo.bar from table1 foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[])}, indices={'test_case': 2}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_implicit'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar)foo', violations=None, fix_str='select foo.bar from (select 1 as bar) AS foo', violations_after_fix=None, configs=None, skip=None, line_numbers=[])}, indices={'test_case': 3}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_implicit_alias'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) foo', violations=None, fix_str='select foo.bar from (select 1 as bar) AS foo', violations_after_fix=None, configs=None, skip=None, line_numbers=[])}, indices={'test_case': 4}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_implicit_alias_space'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) foo', violations=None, fix_str='select foo.bar from (select 1 as bar) AS foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'explicit'}}}, skip=None, line_numbers=[])}, indices={'test_case': 5}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_implicit_alias_explicit'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) AS foo', violations=None, fix_str='select foo.bar from (select 1 as bar) foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[])}, indices={'test_case': 6}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['AL01_test_fail_implicit_alias_implicit'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) AS bar, (select 1 as foo) AS foo', violations=None, fix_str='select foo.bar from (select 1 as bar) bar, (select 1 as foo) foo', violations_after_fix=None, configs={'rules'...oo\n        left join bar\n            on foo.a = bar.a\n    )\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[])}, indices={'test_case': 1470}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['ST09_test_fail_later_table_first_brackets_after_from'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='ST09', desc=None, pass_str=None, fail_str='select\n    "foo"."a",\n    "bar"."b"\nfrom "foo"\nleft join "bar"\n    on "bar"."a" = "foo"."a"\n', violations=None, fix_str='select\n    "foo"."a",\n    "bar"."b"\nfrom "foo"\nleft join "bar"\n    on "foo"."a" = "bar"."a"\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[])}, indices={'test_case': 1471}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['ST09_test_fail_later_table_first_quoted_table_and_column'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str=None, fail_str='CREATE PROCEDURE dbo.sp_pull_data\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1472}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_fail_sp_prefix_1'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str=None, fail_str='CREATE PROCEDURE dbo.[sp_pull_data]\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1473}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_fail_sp_prefix_2'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str=None, fail_str='CREATE PROCEDURE dbo."sp_pull_data"\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1474}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_fail_sp_prefix_3'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo.pull_data\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1475}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_pass_non_sp_prefix_1'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo.usp_pull_data\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1476}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_pass_non_sp_prefix_2'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo.[usp_pull_data]\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1477}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_pass_non_sp_prefix_3'], marks=[]), CallSpec2(params={'test_case': RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo."usp_pull_data"\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])}, indices={'test_case': 1478}, _arg2scope={'test_case': <Scope.Function: 'function'>}, _idlist=['TQ01_test_pass_non_sp_prefix_4'], marks=[])]}

[RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from table1 foo', violations=None, fix_str='select foo.bar from table1 AS foo', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from table1 foo', violations=None, fix_str='select foo.bar from table1 AS foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'explicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from table1 AS foo', violations=None, fix_str='select foo.bar from table1 foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar)foo', violations=None, fix_str='select foo.bar from (select 1 as bar) AS foo', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) foo', violations=None, fix_str='select foo.bar from (select 1 as bar) AS foo', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) foo', violations=None, fix_str='select foo.bar from (select 1 as bar) AS foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'explicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) AS foo', violations=None, fix_str='select foo.bar from (select 1 as bar) foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar) AS bar, (select 1 as foo) AS foo', violations=None, fix_str='select foo.bar from (select 1 as bar) bar, (select 1 as foo) foo', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='select foo.bar from (select 1 as bar)\nAS foo\n', violations=None, fix_str='select foo.bar from (select 1 as bar)\nfoo\n', violations_after_fix=None, configs={'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='MERGE dataset.inventory t\nUSING dataset.newarrivals s\n    ON t.product = s.product\nWHEN MATCHED THEN\n    UPDATE SET quantity = t.quantity + s.quantity;\n', violations=None, fix_str='MERGE dataset.inventory AS t\nUSING dataset.newarrivals AS s\n    ON t.product = s.product\nWHEN MATCHED THEN\n    UPDATE SET quantity = t.quantity + s.quantity;\n', violations_after_fix=None, configs={'core': {'dialect': 'bigquery'}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='MERGE dataset.inventory t\nUSING dataset.newarrivals s\n    ON t.product = s.product\nWHEN MATCHED THEN\n    UPDATE SET quantity = t.quantity + s.quantity;\n', violations=None, fix_str='MERGE dataset.inventory AS t\nUSING dataset.newarrivals AS s\n    ON t.product = s.product\nWHEN MATCHED THEN\n    UPDATE SET quantity = t.quantity + s.quantity;\n', violations_after_fix=None, configs={'core': {'dialect': 'bigquery'}, 'rules': {'aliasing.table': {'aliasing': 'explicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str='MERGE dataset.inventory t\nUSING dataset.newarrivals s\n    ON t.product = s.product\nWHEN MATCHED THEN\n    UPDATE SET quantity = t.quantity + s.quantity;\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'bigquery'}, 'rules': {'aliasing.table': {'aliasing': 'implicit'}}}, skip=None, line_numbers=[]), RuleTestCase(rule='AL01', desc=None, pass_str=None, fail_str='SELECT v...\n    foo.a,\n    bar.b\nfrom foo\nleft join bar\n    on foo.a = bar.a\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='ST09', desc=None, pass_str=None, fail_str='with foo as (\n    select * from bar\n)\nselect\n    foo.a,\n    baz.b\nfrom foo\nleft join baz\n    on baz.a = foo.a\n', violations=None, fix_str='with foo as (\n    select * from bar\n)\nselect\n    foo.a,\n    baz.b\nfrom foo\nleft join baz\n    on foo.a = baz.a\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='ST09', desc=None, pass_str=None, fail_str='with foo as (\n    select\n        bar.b\n    from bar\n    left join baz\n        on baz.a = bar.a\n)\nselect\n    b\nfrom foo\n', violations=None, fix_str='with foo as (\n    select\n        bar.b\n    from bar\n    left join baz\n        on bar.a = baz.a\n)\nselect\n    b\nfrom foo\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='ST09', desc=None, pass_str=None, fail_str='select\n    foo.a,\n    bar.b\nfrom foo\nleft join bar\n    on (bar.a = foo.a)\n', violations=None, fix_str='select\n    foo.a,\n    bar.b\nfrom foo\nleft join bar\n    on (foo.a = bar.a)\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='ST09', desc=None, pass_str=None, fail_str='select\n    foo.a,\n    bar.b\nfrom\n    (\n        foo\n        left join bar\n            on bar.a = foo.a\n    )\n', violations=None, fix_str='select\n    foo.a,\n    bar.b\nfrom\n    (\n        foo\n        left join bar\n            on foo.a = bar.a\n    )\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='ST09', desc=None, pass_str=None, fail_str='select\n    "foo"."a",\n    "bar"."b"\nfrom "foo"\nleft join "bar"\n    on "bar"."a" = "foo"."a"\n', violations=None, fix_str='select\n    "foo"."a",\n    "bar"."b"\nfrom "foo"\nleft join "bar"\n    on "foo"."a" = "bar"."a"\n', violations_after_fix=None, configs=None, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str=None, fail_str='CREATE PROCEDURE dbo.sp_pull_data\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str=None, fail_str='CREATE PROCEDURE dbo.[sp_pull_data]\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str=None, fail_str='CREATE PROCEDURE dbo."sp_pull_data"\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo.pull_data\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo.usp_pull_data\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo.[usp_pull_data]\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[]), RuleTestCase(rule='TQ01', desc=None, pass_str='CREATE PROCEDURE dbo."usp_pull_data"\nAS\nSELECT\n    ID,\n    DataDate,\n    CaseOutput\nFROM table1\n', fail_str=None, violations=None, fix_str=None, violations_after_fix=None, configs={'core': {'dialect': 'tsql'}}, skip=None, line_numbers=[])]


def test_project_generation(cookies, context, context_override):
    result = cookies.bake(extra_context={**context, **context_override})
    assert result.exit_code == 0
    assert result.exception is None
    assert result.project_path.name == context["project_slug"]
    assert result.project_path.is_dir()
    paths = build_files_list(str(result.project_path))
    assert paths
    check_paths(paths)
test_project_generation(cookies={_default_template='/local/rcs/XXX/code/pytrace-collector/logs/self_collected/tried/cookiecutter+cookiecutter-django/cookiecutter+cookiecutter-django', _config_file=local('/tmp/pytest-of-XXX/pytest-202/user_dir0/config'), _counter=0}, context={'project_name': 'My Test Project', 'project_slug': 'my_test_project', 'author_name': 'Test Author', 'email': 'test@example.com', 'description': 'A short description of the project.', 'domain_name': 'example.com', 'version': '0.1.0', 'timezone': 'UTC'}, context_override={'username_type': 'username'})


assert result.project_path.name == context["project_slug"]