Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPS210: must not count variables in nested functions / classes #3108

Closed
sobolevn opened this issue Dec 5, 2024 · 0 comments
Closed

WPS210: must not count variables in nested functions / classes #3108

sobolevn opened this issue Dec 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sobolevn
Copy link
Member

sobolevn commented Dec 5, 2024

@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
@sobolevn sobolevn added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant