Skip to content

chore: get rid of type/pylint ignore statements#41

Merged
regisb merged 1 commit intomasterfrom
regisb/type-ignores
Aug 15, 2024
Merged

chore: get rid of type/pylint ignore statements#41
regisb merged 1 commit intomasterfrom
regisb/type-ignores

Conversation

@regisb
Copy link
Copy Markdown
Contributor

@regisb regisb commented Aug 15, 2024

  1. Child model classes inherited the insert and update methods, but with a different signature. This violated the Liskov principle, which is explained here: https://stackoverflow.com/a/54359797/356528 To bypass this, we migrated most of the Content class to a separate base class, and insert/update methods are no longer inherited.

  2. We removed type ignores in serializers, which were simply missing a generic type definition.

  3. We also updated the APIClient, but we failed to properly type it, because we don't know how to use "_MonkeyPatchedWSGIResponse".

@regisb regisb force-pushed the regisb/type-ignores branch 2 times, most recently from 9185dd1 to c4b5f3d Compare August 15, 2024 14:07
@regisb regisb requested a review from Ali-Salman29 August 15, 2024 14:09
Comment thread tests/conftest.py Outdated
@regisb regisb force-pushed the regisb/type-ignores branch from c4b5f3d to 9966dc8 Compare August 15, 2024 14:17
Comment thread tests/test_views/test_flags.py Outdated
Copy link
Copy Markdown
Contributor

@Faraz32123 Faraz32123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👌

1. Child model classes inherited the insert and update methods, but with a
different signature. This violated the Liskov principle, which is
explained here: https://stackoverflow.com/a/54359797/356528
To bypass this, we migrated most of the Content class to a separate base
class, and insert/update methods are no longer inherited.

2. We removed type ignores in serializers, which were simply missing a
   generic type definition.

3. We also updated the APIClient, but we failed to properly type it,
   because we don't know how to use "_MonkeyPatchedWSGIResponse".
@regisb regisb force-pushed the regisb/type-ignores branch from 9966dc8 to 1be488e Compare August 15, 2024 14:29
@regisb regisb merged commit 012ed74 into master Aug 15, 2024
@regisb regisb deleted the regisb/type-ignores branch August 15, 2024 14:31
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.

3 participants