Skip to content
This repository was archived by the owner on Oct 2, 2021. It is now read-only.

Commit 4979da0

Browse files
committed
Remove unused Pyre ignores
After upgrading to Pyre 0.0.48, these `pyre-ignore` comments are no longer needed.
1 parent 94968e9 commit 4979da0

16 files changed

Lines changed: 9 additions & 79 deletions

File tree

src/applications/forms.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ class FinancialAidApplicationForm(ApplicationForm):
1717
type = Application.Type.FINANCIAL_AID
1818

1919
travel_requested = forms.BooleanField(
20-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
21-
label=_("Do you need assistance with travel?"),
22-
required=False,
20+
label=_("Do you need assistance with travel?"), required=False,
2321
)
2422

2523
class Meta:
@@ -32,13 +30,9 @@ class Meta:
3230
"lodging_requested",
3331
)
3432
labels = {
35-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
3633
"background": _("Tell us a little bit more about yourself"),
37-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
3834
"lodging_requested": _("Do you need assistance with lodging?"),
39-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
4035
"reason_to_attend": _("Why are you interested in attending PyGotham?"),
41-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
4236
"travel_amount": _("What is the estimated cost (USD)?"),
4337
}
4438
widgets = {
@@ -51,20 +45,14 @@ def clean(self) -> Dict[str, Any]:
5145
travel_amount = cleaned_data.get("travel_amount") or 0
5246
if travel_amount < 0:
5347
raise forms.ValidationError(
54-
{
55-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
56-
"travel_amount": _(
57-
"Your estimated travel costs cannot be negative."
58-
)
59-
}
48+
{"travel_amount": _("Your estimated travel costs cannot be negative.")}
6049
)
6150

6251
travel_requested = cleaned_data.get("travel_requested")
6352
if travel_requested:
6453
if not travel_amount:
6554
raise forms.ValidationError(
6655
{
67-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
6856
"travel_amount": _(
6957
"Your estimated travel costs must be greater than $0.00."
7058
)
@@ -73,7 +61,6 @@ def clean(self) -> Dict[str, Any]:
7361
elif travel_amount:
7462
raise forms.ValidationError(
7563
{
76-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
7764
"travel_requested": _(
7865
"You must request travel assistance before providing an estimated cost."
7966
)
@@ -83,7 +70,6 @@ def clean(self) -> Dict[str, Any]:
8370
return cleaned_data
8471

8572
def clean_lodging_requested(self) -> bool:
86-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/261.
8773
return bool(self.cleaned_data.get("lodging_requested"))
8874

8975

@@ -94,9 +80,7 @@ class Meta:
9480
model = Application
9581
fields = ("background", "reason_to_attend")
9682
labels = {
97-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
9883
"background": _("Tell us a little bit about yourself"),
99-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
10084
"reason_to_attend": _("Why are you interested in attending PyGotham?"),
10185
}
10286

src/applications/migrations/0003_auto_20200507_0125.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class Migration(migrations.Migration):
1818
migrations.AddField(
1919
model_name="application",
2020
name="travel_amount",
21-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/260.
2221
field=models.DecimalField(
2322
blank=True, decimal_places=2, max_digits=10, null=True
2423
),

src/applications/models.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,33 @@
44
from django.db import models
55
from django.utils.translation import ugettext_lazy as _
66

7-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
87
User = get_user_model()
98

109

1110
class Application(models.Model):
12-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1311
class Status(models.TextChoices):
1412
PENDING = "pending"
1513

16-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1714
class Type(models.TextChoices):
1815
FINANCIAL_AID = "finaid"
1916
SCHOLARSHIP = "scholarship"
2017

21-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
18+
# pyre-ignore[16]: Determine why this ignore is needed.
2219
applicant = models.ForeignKey(User, on_delete=models.DO_NOTHING)
2320
background = models.TextField(_("applicant background"))
2421
reason_to_attend = models.TextField(_("reason the applicant wishes to attend"))
2522
status = models.CharField(
26-
max_length=20,
27-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
28-
choices=Status.choices,
29-
default=Status.PENDING,
23+
max_length=20, choices=Status.choices, default=Status.PENDING,
3024
)
3125
type = models.CharField(
32-
max_length=11,
33-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
34-
choices=Type.choices,
35-
default=Type.SCHOLARSHIP,
26+
max_length=11, choices=Type.choices, default=Type.SCHOLARSHIP,
3627
)
37-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/260.
3828
travel_amount = models.DecimalField(
3929
max_digits=10, decimal_places=2, blank=True, null=True
4030
)
4131
lodging_requested = models.BooleanField(null=True)
4232

4333
def __str__(self) -> str:
44-
# pyre-ignore[19]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
4534
type_ = Application.Type(self.type)
46-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
35+
# pyre-ignore[16]: Determine why this ignore is needed.
4736
return f"{type_.label} application for {self.applicant}"

src/applications/test_forms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ def test_financial_aid_lodging_requested_is_treated_as_boolean() -> None:
66

77
form = FinancialAidApplicationForm(other_fields)
88
assert form.is_valid()
9-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/261.
109
assert form.cleaned_data["lodging_requested"] is False
1110

1211

src/applications/test_views.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ class Meta:
2424

2525
class UserFactory(DjangoModelFactory):
2626
class Meta:
27-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2827
model = get_user_model()
2928
django_get_or_create = ("email",)
3029

3130
email = "user@example.org"
3231

3332

3433
@pytest.mark.django_db
35-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
3634
def test_that_one_of_form_type_and_pk_is_required_by_apply(client: Client) -> None:
3735
user = UserFactory()
3836
qs = get_query_string(user)
@@ -46,7 +44,6 @@ def test_that_one_of_form_type_and_pk_is_required_by_apply(client: Client) -> No
4644

4745

4846
@pytest.mark.django_db
49-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
5047
def test_user_can_edit_their_application(client: Client) -> None:
5148
user = UserFactory()
5249
qs = get_query_string(user)
@@ -67,7 +64,6 @@ def test_user_can_edit_their_application(client: Client) -> None:
6764

6865

6966
@pytest.mark.django_db
70-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
7167
def test_user_can_view_their_application(client: Client) -> None:
7268
user = UserFactory()
7369
qs = get_query_string(user)
@@ -80,7 +76,6 @@ def test_user_can_view_their_application(client: Client) -> None:
8076

8177

8278
@pytest.mark.django_db
83-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
8479
def test_user_cant_view_someone_elses_application(client: Client) -> None:
8580
user = UserFactory()
8681
other = UserFactory(email=f"other+{user.email}")

src/applications/urls.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@
99
app_name = "applications"
1010

1111
urlpatterns = [
12-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1312
path("edit/<int:pk>", apply, name="edit"),
14-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1513
path(
1614
"financial-aid",
1715
apply,
1816
{"form_type": FinancialAidApplicationForm},
1917
name="financial_aid",
2018
),
21-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2219
path(
2320
"ticket", apply, {"form_type": ScholarshipApplicationForm}, name="scholarship"
2421
),
25-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2622
path("view/<int:pk>", view, name="view"),
2723
]

src/awards/urls.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,28 @@
77
from users.views import login, magic_login
88

99
urlpatterns = [
10-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1110
path(
1211
"", TemplateView.as_view(template_name="homepage/index.html"), name="homepage"
1312
),
14-
# pyre doesn't include stubs for the Django admin.
15-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1613
path(
1714
"admin/login/",
1815
RedirectView.as_view(
1916
pattern_name=settings.LOGIN_URL, permanent=True, query_string=True
2017
),
2118
),
22-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
19+
# pyre doesn't include stubs for the Django admin.
2320
path("admin/", admin.site.urls), # type: ignore
24-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2521
path("apply/", include("applications.urls", namespace="applications")),
26-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2722
path("login", login, name="login"),
28-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2923
path("login/magic", magic_login, name="magic-login"),
30-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
24+
# pyre-ignore[16]: Determine why this ignore is needed.
3125
path("logout", LogoutView.as_view(), name="logout"),
32-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
3326
path("users/", include("users.urls", namespace="users")),
3427
]
3528

3629
if settings.DEBUG:
3730
import debug_toolbar
3831

3932
urlpatterns = [
40-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
4133
path("__debug__/", include(debug_toolbar.urls)),
4234
] + urlpatterns

src/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from django.test import Client
22

33

4-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
54
def client() -> Client:
6-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
75
return Client()

src/homepage/test_views.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99

1010
class UserFactory(DjangoModelFactory):
1111
class Meta:
12-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
1312
model = get_user_model()
1413
django_get_or_create = ("email",)
1514

1615
email = "user@example.org"
1716

1817

1918
@pytest.mark.django_db
20-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
2119
def test_login_link_is_not_shown_to_logged_in_users(client: Client) -> None:
2220
user = UserFactory()
2321
qs = get_query_string(user)
@@ -27,7 +25,6 @@ def test_login_link_is_not_shown_to_logged_in_users(client: Client) -> None:
2725
assert b"log in" not in response.content.lower()
2826

2927

30-
# pyre-ignore[11]: This is fixed by https://github.com/facebook/pyre-check/pull/256.
3128
def test_login_link_is_shown_to_guests(client: Client) -> None:
3229
response = client.get("/")
3330
assert b"log in" in response.content.lower()

src/users/forms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44

55
class LoginForm(forms.Form):
66
email = forms.EmailField(
7-
# pyre-ignore[16]: This is fixed by https://github.com/facebook/pyre-check/pull/262.
87
widget=forms.EmailInput(attrs={"placeholder": _("Email address")})
98
)

0 commit comments

Comments
 (0)