Skip to content

Possible B020 false positive for iteration with lambda #256

@horpto

Description

@horpto
class IndexDashboard(Dashboard):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        for app in sorted(apps.get_app_configs(), key=lambda app: app.name): # here is error
            self.children.append(
                modules.AppList(
                    title=app.verbose_name,
                    column=1,
                    collapsible=True,
                    models=(f"{app.name}.*",),
                    css_classes=("grp-closed",),
                ),
            )

As you can see there is no error actually. app in lambda function is local to lambda, not for init

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions