wemake-services/wemake-python-styleguide

WPS210: must not count variables in nested functions / classes

Closed this issue · 0 comments

@pytest.fixture
def querybuilder_form_data_factory(  # noqa: WPS210
    querybuilder_consts: HHConsts,
    faker_seed: int,
) -> type[QueryBuilderFormFactory]:
    """Create context-aware fixture for the form data."""
    consts = querybuilder_hh_consts

    def factory(field: Mapping[str, HHMetadata]) -> Callable[[], str]:
        return lambda: QueryBuilderFormFactory.__random__.choice(
            list(field.keys()),
        )

    @final
    class InnerFactory(QueryBuilderFormFactory):  # noqa: WPS431
        __random_seed__ = faker_seed

        area = Use(factory(consts.areas))
        country = Use(factory(consts.countries))
        citizenship = Use(factory(consts.countries))
        professional_role = Use(factory(consts.professional_roles))
        gender = Use(factory(consts.gender))
        employment = Use(factory(consts.employment))
        schedule = Use(factory(consts.schedule))

    return InnerFactory