diff --git a/Users/forms.py b/Users/forms.py index b21fad9..6bc5de8 100644 --- a/Users/forms.py +++ b/Users/forms.py @@ -42,7 +42,7 @@ class PartialInput(TextInput): value = value[:len(''.join(self.suffixes)) * -1] return value - def get_context(self, name, value, attrs) -> dict: + def get_context(self, name, value, attrs) -> dict[str, object]: """ This function defines additional context to pass to the widget's template @@ -71,7 +71,7 @@ class PartialField(CharField): is_admin = False - def clean(self, value): + def clean(self, value) -> str: """ This function is run to convert the value to a string It adds the prefixes and suffixes to the value diff --git a/Users/ldap_auth.py b/Users/ldap_auth.py index cbd6966..70c6f22 100644 --- a/Users/ldap_auth.py +++ b/Users/ldap_auth.py @@ -27,7 +27,7 @@ class LDAPAuthentication(BaseBackend): server = None @classmethod - def setup_server(cls): + def setup_server(cls) -> None: """ This function gets the server to authenticate with """ @@ -224,7 +224,7 @@ class LDAPAuthentication(BaseBackend): except User.DoesNotExist: return None - def delete_old_users(self, username: str, password: str): + def delete_old_users(self, username: str, password: str) -> None: """ This function is used to delete any users that are no longer in the ActiveDirectory database. diff --git a/Users/ldap_mock.py b/Users/ldap_mock.py index 21aa396..cd97c2f 100644 --- a/Users/ldap_mock.py +++ b/Users/ldap_mock.py @@ -17,7 +17,7 @@ class LDAPMockAuthentication(LDAPAuthentication): """ @classmethod - def setup_server(cls): + def setup_server(cls) -> None: """ This function constructs a fake server to connect to """ @@ -62,7 +62,7 @@ class LDAPMockAuthentication(LDAPAuthentication): return user.get('ou') @classmethod - def create_fake_user(cls, conn: Connection, username: str, password: str, first: str, last: str, ou: str = None): + def create_fake_user(cls, conn: Connection, username: str, password: str, first: str, last: str, ou: str = None) -> None: """ This function creates a fake user to use in testing @@ -92,7 +92,7 @@ class LDAPMockAuthentication(LDAPAuthentication): }) @classmethod - def create_fake_users(cls, conn: Connection): + def create_fake_users(cls, conn: Connection) -> None: """ This function creates a series of fake users from a predefined list diff --git a/Users/views.py b/Users/views.py index 71f515c..08ecfea 100644 --- a/Users/views.py +++ b/Users/views.py @@ -32,7 +32,7 @@ class CompleteUserSetupView(LoginRequiredMixin, FormNameMixin, FormAlertMixin, U success_message = "User Setup Complete" success_url = reverse_lazy('home') - def get_queryset(self): + def get_queryset(self) -> QuerySet: """ This function defines what users a user can edit the student ids of We only want a user to be able to edit their own ids @@ -43,7 +43,7 @@ class CompleteUserSetupView(LoginRequiredMixin, FormNameMixin, FormAlertMixin, U return User.objects.filter(id=self.request.user.id) - def get_context_data(self, **kwargs) -> dict: + def get_context_data(self, **kwargs) -> dict[str, object]: """ This function defines additional data to pass to the template It disables placeholders as they mess up input groups @@ -71,7 +71,7 @@ class UserLoginView(FormAlertMixin, LoginView): success_message = None - def get_context_data(self, **kwargs) -> dict: + def get_context_data(self, **kwargs) -> dict[str, object]: """ This function defines additional context data to pass to the template It hides the back button and displays some help info