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

[pre-commit.ci] pre-commit autoupdate #2081

Merged
merged 4 commits into from
Dec 19, 2022
Merged

Conversation

@lafrech
Copy link
Member

lafrech commented Dec 14, 2022

flake8 issues can be fixed by using an annotation rather than a comment:

class MarshmallowHook:
    __marshmallow_hook__: Dict[Tuple[str, bool] | str, Any] | None = None

mypy issue should be silenced according to the comment above

    def _bind_field(self, field_name: str, field_obj: ma_fields.Field) -> None:
        """Bind field to the schema, setting any necessary attributes on the
        field (e.g. parent and name).

        Also set field load_only and dump_only values if field_name was
        specified in ``class Meta``.
        """
        if field_name in self.load_only:
            field_obj.load_only = True
        if field_name in self.dump_only:
            field_obj.dump_only = True
        try:
            field_obj._bind_to_schema(field_name, self)
        except TypeError as error:
            # Field declared as a class, not an instance. Ignore type checking because
            # we handle unsupported arg types, i.e. this is dead code from
            # the type checker's perspective.
            if isinstance(field_obj, type) and issubclass(field_obj, base.FieldABC):
                msg = (
                    'Field for "{}" must be declared as a '
                    "Field instance, not a class. "
                    'Did you mean "fields.{}()"?'.format(field_name, field_obj.__name__)
                )
                raise TypeError(msg) from error
            raise error
        self.on_bind_field(field_name, field_obj)

@lafrech
Copy link
Member

lafrech commented Dec 15, 2022

Type checking is not the area I'm most confident with, but tests pass, so unless anyone objects, I'll merge this with my fixes.

updates:
- [github.com/asottile/pyupgrade: v2.37.3 → v3.3.1](asottile/pyupgrade@v2.37.3...v3.3.1)
- https://github.com/python/blackhttps://github.com/psf/black
- [github.com/psf/black: 22.8.0 → 22.12.0](psf/black@22.8.0...22.12.0)
- [github.com/pycqa/flake8: 5.0.4 → 6.0.0](PyCQA/flake8@5.0.4...6.0.0)
- [github.com/pre-commit/mirrors-mypy: v0.971 → v0.991](pre-commit/mirrors-mypy@v0.971...v0.991)
@lafrech lafrech merged commit 0b0bdd3 into dev Dec 19, 2022
@lafrech lafrech deleted the pre-commit-ci-update-config branch December 19, 2022 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant