# Buggy code
def expand_params(self, wildcards, input, output, resources, omit_callable=False):
    def concretize_param(p, wildcards, is_from_callable):
        if not is_from_callable:
            if isinstance(p, str):
                return apply_wildcards(p, wildcards)
            if isinstance(p, list):
                return [
                    (apply_wildcards(v, wildcards) if isinstance(v, str) else v)
                    for v in p
                ]
        return p

    params = Params()
    try:
        # When applying wildcards to params, the return type need not be
        # a string, so the check is disabled.
        self._apply_wildcards(
            params,
            self.params,
            wildcards,
            concretize=concretize_param,
            check_return_type=False,
            omit_callable=omit_callable,
            allow_unpack=False,
            no_flattening=True,
            apply_default_remote=False,
            aux_params={
                "input": input.plainstrings(),
                "resources": resources,
                "output": output.plainstrings(),
                "threads": resources._cores,
            },
            incomplete_checkpoint_func=lambda e: "<incomplete checkpoint>",
        )
    except WildcardError as e:
        raise WildcardError(
            "Wildcards in params cannot be "
            "determined from output files. Note that you have "
            "to use a function to deactivate automatic wildcard expansion "
            "in params strings, e.g., `lambda wildcards: '{test}'`. Also "
            "see https://snakemake.readthedocs.io/en/stable/snakefiles/"
            "rules.html#non-file-parameters-for-rules:",
            str(e),
            rule=self,
        )
    return params


# Traceback (TypeError)
snakemake  --report
Building DAG of jobs...
Creating report...
Adding foo.rst (0 MB).
Could not detect mimetype for foo.rst, assuming text/plain.
Traceback (most recent call last):
File "/mnt/work/Qc.py375.venv/lib/python3.7/site-packages/snakemake/__init__.py", line 618, in snakemake
batch=batch,
File "/mnt/work/Qc.py375.venv/lib/python3.7/site-packages/snakemake/workflow.py", line 617, in execute
auto_report(dag, report)
File "/mnt/work/Qc.py375.venv/lib/python3.7/site-packages/snakemake/report/__init__.py", line 552, in auto_report
FileRecord(f, job, report_obj.caption, env, category)
File "/mnt/work/Qc.py375.venv/lib/python3.7/site-packages/snakemake/report/__init__.py", line 326, in __init__
self.params = logging.format_dict(job.params)
File "/mnt/work/Qc.py375.venv/lib/python3.7/site-packages/snakemake/logging.py", line 384, in format_dict
for name, value in dict.items()
TypeError: 'str' object is not callable

# Fixed code
def expand_params(self, wildcards, input, output, resources, omit_callable=False):
    def concretize_param(p, wildcards, is_from_callable):
        if not is_from_callable:
            if isinstance(p, str):
                return apply_wildcards(p, wildcards)
            if isinstance(p, list):
                return [
                    (apply_wildcards(v, wildcards) if isinstance(v, str) else v)
                    for v in p
                ]
        return p

    params = Params()
    try:
        # When applying wildcards to params, the return type need not be
        # a string, so the check is disabled.
        self._apply_wildcards(
            params,
            self.params,
            wildcards,
            concretize=concretize_param,
            check_return_type=False,
            omit_callable=omit_callable,
            allow_unpack=False,
            no_flattening=True,
            apply_default_remote=False,
            aux_params={
                "input": input._plainstrings(),
                "resources": resources,
                "output": output._plainstrings(),
                "threads": resources._cores,
            },
            incomplete_checkpoint_func=lambda e: "<incomplete checkpoint>",
        )
    except WildcardError as e:
        raise WildcardError(
            "Wildcards in params cannot be "
            "determined from output files. Note that you have "
            "to use a function to deactivate automatic wildcard expansion "
            "in params strings, e.g., `lambda wildcards: '{test}'`. Also "
            "see https://snakemake.readthedocs.io/en/stable/snakefiles/"
            "rules.html#non-file-parameters-for-rules:",
            str(e),
            rule=self,
        )
    return params