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

chore: Remove unnecessary asserts or convert to exception #430

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions backend/events/cosvision2023/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
7 changes: 3 additions & 4 deletions backend/events/desucon2018/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="desucon2018", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/desucon2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="desucon2019", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/desucon2020/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="desucon2020", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/desucon2022/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="desucon2022", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/desucon2023/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="desucon2023", public=False) & ~Q(slug="vastaava")

Expand Down
4 changes: 1 addition & 3 deletions backend/events/finncon2018/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/finncon2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/finncon2020/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/finncon2022/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/finncon2023/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
7 changes: 3 additions & 4 deletions backend/events/frostbite2018/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="frostbite2018", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/frostbite2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="frostbite2019", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/frostbite2020/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if admin:
raise AssertionError()

return Q(event__slug="frostbite2020", public=False) & ~Q(slug="vastaava")

Expand Down
7 changes: 3 additions & 4 deletions backend/events/frostbite2023/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -145,7 +143,8 @@ def get_excluded_field_defaults(self):

class SpecialistSignupForm(SignupForm, AlternativeFormMixin):
def get_job_categories_query(self, event, admin=False):
assert not admin
if not admin:
raise AssertionError()

return Q(event__slug="frostbite2023", public=False) & ~Q(slug="vastaava")

Expand Down
4 changes: 1 addition & 3 deletions backend/events/hitpoint2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def clean_certificate_delivery_address(self):
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/hitpoint2020/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def clean_certificate_delivery_address(self):
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/hitpoint2023/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def clean_certificate_delivery_address(self):
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/hypecon2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/hypecon2020/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/kuplii2018/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/kuplii2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/kuplii2020/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/kuplii2021/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/kuplii2022/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/kuplii2023/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/matsucon2018/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
4 changes: 1 addition & 3 deletions backend/events/matsucon2019/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class Meta:
class OrganizerSignupForm(forms.ModelForm, AlternativeFormMixin):
def __init__(self, *args, **kwargs):
kwargs.pop("event")
admin = kwargs.pop("admin")

assert not admin
kwargs.pop("admin")

super().__init__(*args, **kwargs)

Expand Down
Loading
Loading