mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-22 01:28:29 +08:00
Fix invalid noqa comments and poorly formatted type ignores (#11497)
This commit is contained in:
@@ -35,11 +35,11 @@ field.process(None, extra_filters=[Filter1(), Filter2()])
|
||||
|
||||
# but if we pass in some callables with an incompatible param spec
|
||||
# then we should get type errors
|
||||
Field(filters=(str.upper, str.lower, int, not_a_filter)) # type:ignore
|
||||
Field(filters=(Filter1(), Filter2(), also_not_a_filter)) # type:ignore
|
||||
Field(filters=[str.upper, str.lower, int, also_not_a_filter]) # type:ignore
|
||||
Field(filters=[Filter1(), Filter2(), not_a_filter]) # type:ignore
|
||||
field.process(None, extra_filters=(str.upper, str.lower, int, not_a_filter)) # type:ignore
|
||||
field.process(None, extra_filters=(Filter1(), Filter2(), also_not_a_filter)) # type:ignore
|
||||
field.process(None, extra_filters=[str.upper, str.lower, int, also_not_a_filter]) # type:ignore
|
||||
field.process(None, extra_filters=[Filter1(), Filter2(), not_a_filter]) # type:ignore
|
||||
Field(filters=(str.upper, str.lower, int, not_a_filter)) # type: ignore
|
||||
Field(filters=(Filter1(), Filter2(), also_not_a_filter)) # type: ignore
|
||||
Field(filters=[str.upper, str.lower, int, also_not_a_filter]) # type: ignore
|
||||
Field(filters=[Filter1(), Filter2(), not_a_filter]) # type: ignore
|
||||
field.process(None, extra_filters=(str.upper, str.lower, int, not_a_filter)) # type: ignore
|
||||
field.process(None, extra_filters=(Filter1(), Filter2(), also_not_a_filter)) # type: ignore
|
||||
field.process(None, extra_filters=[str.upper, str.lower, int, also_not_a_filter]) # type: ignore
|
||||
field.process(None, extra_filters=[Filter1(), Filter2(), not_a_filter]) # type: ignore
|
||||
|
||||
@@ -14,16 +14,16 @@ string_field = StringField(validators=(Optional(), Email()))
|
||||
string_field.validate(form, (Optional(), Email()))
|
||||
|
||||
# but not on Field
|
||||
field = Field(validators=(Optional(), Email())) # type:ignore
|
||||
field.validate(form, (Optional(), Email())) # type:ignore
|
||||
field = Field(validators=(Optional(), Email())) # type: ignore
|
||||
field.validate(form, (Optional(), Email())) # type: ignore
|
||||
|
||||
# unless we only pass the Field validator
|
||||
Field(validators=(Optional(),))
|
||||
field.validate(form, (Optional(),))
|
||||
|
||||
# DateField should accept Field validators but not StringField validators
|
||||
date_field = DateField(validators=(Optional(), Email())) # type:ignore
|
||||
date_field.validate(form, (Optional(), Email())) # type:ignore
|
||||
date_field = DateField(validators=(Optional(), Email())) # type: ignore
|
||||
date_field.validate(form, (Optional(), Email())) # type: ignore
|
||||
DateField(validators=(Optional(),))
|
||||
|
||||
# for lists we can't be as strict so we won't get type errors here
|
||||
|
||||
@@ -5,8 +5,8 @@ from wtforms.widgets import Input, ListWidget, Option, Select, TableWidget, Text
|
||||
|
||||
# more specific widgets should only work on more specific fields
|
||||
Field(widget=Input())
|
||||
Field(widget=TextArea()) # type:ignore
|
||||
Field(widget=Select()) # type:ignore
|
||||
Field(widget=TextArea()) # type: ignore
|
||||
Field(widget=Select()) # type: ignore
|
||||
|
||||
# less specific widgets are fine, even if they're often not what you want
|
||||
StringField(widget=Input())
|
||||
@@ -15,7 +15,7 @@ StringField(widget=TextArea())
|
||||
SelectField(widget=Input(), option_widget=Input())
|
||||
SelectField(widget=Select(), option_widget=Option())
|
||||
# a more specific type other than Option widget is not allowed
|
||||
SelectField(widget=Select(), option_widget=TextArea()) # type:ignore
|
||||
SelectField(widget=Select(), option_widget=TextArea()) # type: ignore
|
||||
|
||||
# we should be able to pass Field() even though it wants an unbound_field
|
||||
# this gets around __new__ not working in type checking
|
||||
|
||||
Reference in New Issue
Block a user