core: bump pylint from 2.15.10 to 2.16.0 (#4600)
* core: bump pylint from 2.15.10 to 2.16.0 Bumps [pylint](https://github.com/PyCQA/pylint) from 2.15.10 to 2.16.0. - [Release notes](https://github.com/PyCQA/pylint/releases) - [Commits](https://github.com/PyCQA/pylint/compare/v2.15.10...v2.16.0) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix lint Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -235,8 +235,7 @@ class Importer: | |||||||
|                     raise IntegrityError |                     raise IntegrityError | ||||||
|         except IntegrityError: |         except IntegrityError: | ||||||
|             return False |             return False | ||||||
|         else: |         self.logger.debug("Committing changes") | ||||||
|             self.logger.debug("Committing changes") |  | ||||||
|         return True |         return True | ||||||
|  |  | ||||||
|     def _apply_models(self) -> bool: |     def _apply_models(self) -> bool: | ||||||
|  | |||||||
| @ -27,10 +27,9 @@ def redirect_with_qs( | |||||||
|             return redirect(view) |             return redirect(view) | ||||||
|         LOGGER.warning("redirect target is not a valid view", view=view) |         LOGGER.warning("redirect target is not a valid view", view=view) | ||||||
|         raise |         raise | ||||||
|     else: |     if get_query_set: | ||||||
|         if get_query_set: |         target += "?" + urlencode(get_query_set.items()) | ||||||
|             target += "?" + urlencode(get_query_set.items()) |     return redirect(target) | ||||||
|         return redirect(target) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def reverse_with_qs(view: str, query: Optional[QueryDict] = None, **kwargs) -> str: | def reverse_with_qs(view: str, query: Optional[QueryDict] = None, **kwargs) -> str: | ||||||
|  | |||||||
| @ -73,8 +73,7 @@ class KubernetesObjectReconciler(Generic[T]): | |||||||
|                     raise NeedsRecreate from exc |                     raise NeedsRecreate from exc | ||||||
|                 self.logger.debug("Other unhandled error", exc=exc) |                 self.logger.debug("Other unhandled error", exc=exc) | ||||||
|                 raise exc |                 raise exc | ||||||
|             else: |             self.reconcile(current, reference) | ||||||
|                 self.reconcile(current, reference) |  | ||||||
|         except NeedsUpdate: |         except NeedsUpdate: | ||||||
|             try: |             try: | ||||||
|                 self.update(current, reference) |                 self.update(current, reference) | ||||||
|  | |||||||
| @ -260,7 +260,7 @@ class OAuth2Provider(Provider): | |||||||
|             return private_key, JWTAlgorithms.RS256 |             return private_key, JWTAlgorithms.RS256 | ||||||
|         if isinstance(private_key, EllipticCurvePrivateKey): |         if isinstance(private_key, EllipticCurvePrivateKey): | ||||||
|             return private_key, JWTAlgorithms.ES256 |             return private_key, JWTAlgorithms.ES256 | ||||||
|         raise Exception(f"Invalid private key type: {type(private_key)}") |         raise ValueError(f"Invalid private key type: {type(private_key)}") | ||||||
|  |  | ||||||
|     def get_issuer(self, request: HttpRequest) -> Optional[str]: |     def get_issuer(self, request: HttpRequest) -> Optional[str]: | ||||||
|         """Get issuer, based on request""" |         """Get issuer, based on request""" | ||||||
|  | |||||||
| @ -45,8 +45,7 @@ class BaseOAuthClient: | |||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             self.logger.warning("Unable to fetch user profile", exc=exc, body=response.text) |             self.logger.warning("Unable to fetch user profile", exc=exc, body=response.text) | ||||||
|             return None |             return None | ||||||
|         else: |         return response.json() | ||||||
|             return response.json() |  | ||||||
|  |  | ||||||
|     def get_redirect_args(self) -> dict[str, str]: |     def get_redirect_args(self) -> dict[str, str]: | ||||||
|         """Get request parameters for redirect url.""" |         """Get request parameters for redirect url.""" | ||||||
|  | |||||||
| @ -43,8 +43,7 @@ class OAuthClient(BaseOAuthClient): | |||||||
|             except RequestException as exc: |             except RequestException as exc: | ||||||
|                 LOGGER.warning("Unable to fetch access token", exc=exc) |                 LOGGER.warning("Unable to fetch access token", exc=exc) | ||||||
|                 return None |                 return None | ||||||
|             else: |             return self.parse_raw_token(response.text) | ||||||
|                 return self.parse_raw_token(response.text) |  | ||||||
|         return None |         return None | ||||||
|  |  | ||||||
|     def get_request_token(self) -> str: |     def get_request_token(self) -> str: | ||||||
| @ -63,8 +62,7 @@ class OAuthClient(BaseOAuthClient): | |||||||
|             response.raise_for_status() |             response.raise_for_status() | ||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             raise OAuthSourceException from exc |             raise OAuthSourceException from exc | ||||||
|         else: |         return response.text | ||||||
|             return response.text |  | ||||||
|  |  | ||||||
|     def get_redirect_args(self) -> dict[str, Any]: |     def get_redirect_args(self) -> dict[str, Any]: | ||||||
|         """Get request parameters for redirect url.""" |         """Get request parameters for redirect url.""" | ||||||
|  | |||||||
| @ -86,8 +86,7 @@ class OAuth2Client(BaseOAuthClient): | |||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             LOGGER.warning("Unable to fetch access token", exc=exc) |             LOGGER.warning("Unable to fetch access token", exc=exc) | ||||||
|             return None |             return None | ||||||
|         else: |         return response.json() | ||||||
|             return response.json() |  | ||||||
|  |  | ||||||
|     def get_redirect_args(self) -> dict[str, str]: |     def get_redirect_args(self) -> dict[str, str]: | ||||||
|         """Get request parameters for redirect url.""" |         """Get request parameters for redirect url.""" | ||||||
| @ -111,8 +110,7 @@ class OAuth2Client(BaseOAuthClient): | |||||||
|             token_data = loads(raw_token) |             token_data = loads(raw_token) | ||||||
|         except ValueError: |         except ValueError: | ||||||
|             return dict(parse_qsl(raw_token)) |             return dict(parse_qsl(raw_token)) | ||||||
|         else: |         return token_data | ||||||
|             return token_data |  | ||||||
|  |  | ||||||
|     def do_request(self, method: str, url: str, **kwargs) -> Response: |     def do_request(self, method: str, url: str, **kwargs) -> Response: | ||||||
|         """Build remote url request. Constructs necessary auth.""" |         """Build remote url request. Constructs necessary auth.""" | ||||||
| @ -151,5 +149,4 @@ class UserprofileHeaderAuthClient(OAuth2Client): | |||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             LOGGER.warning("Unable to fetch user profile", exc=exc, body=response.text) |             LOGGER.warning("Unable to fetch user profile", exc=exc, body=response.text) | ||||||
|             return None |             return None | ||||||
|         else: |         return response.json() | ||||||
|             return response.json() |  | ||||||
|  | |||||||
| @ -33,8 +33,7 @@ class GitHubOAuth2Client(OAuth2Client): | |||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             self.logger.warning("Unable to fetch github emails", exc=exc) |             self.logger.warning("Unable to fetch github emails", exc=exc) | ||||||
|             return [] |             return [] | ||||||
|         else: |         return response.json() | ||||||
|             return response.json() |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class GitHubOAuth2Callback(OAuthCallback): | class GitHubOAuth2Callback(OAuthCallback): | ||||||
|  | |||||||
| @ -38,8 +38,7 @@ class MailcowOAuth2Client(OAuth2Client): | |||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             LOGGER.warning("Unable to fetch user profile", exc=exc, body=response.text) |             LOGGER.warning("Unable to fetch user profile", exc=exc, body=response.text) | ||||||
|             return None |             return None | ||||||
|         else: |         return response.json() | ||||||
|             return response.json() |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class MailcowOAuth2Callback(OAuthCallback): | class MailcowOAuth2Callback(OAuthCallback): | ||||||
|  | |||||||
| @ -36,15 +36,14 @@ class OAuthRedirect(OAuthClientMixin, RedirectView): | |||||||
|             source: OAuthSource = OAuthSource.objects.get(slug=slug) |             source: OAuthSource = OAuthSource.objects.get(slug=slug) | ||||||
|         except OAuthSource.DoesNotExist: |         except OAuthSource.DoesNotExist: | ||||||
|             raise Http404(f"Unknown OAuth source '{slug}'.") |             raise Http404(f"Unknown OAuth source '{slug}'.") | ||||||
|         else: |         if not source.enabled: | ||||||
|             if not source.enabled: |             raise Http404(f"source {slug} is not enabled.") | ||||||
|                 raise Http404(f"source {slug} is not enabled.") |         client = self.get_client(source, callback=self.get_callback_url(source)) | ||||||
|             client = self.get_client(source, callback=self.get_callback_url(source)) |         params = self.get_additional_parameters(source) | ||||||
|             params = self.get_additional_parameters(source) |         params.setdefault("scope", []) | ||||||
|             params.setdefault("scope", []) |         if source.additional_scopes != "": | ||||||
|             if source.additional_scopes != "": |             if source.additional_scopes.startswith("*"): | ||||||
|                 if source.additional_scopes.startswith("*"): |                 params["scope"] = source.additional_scopes[1:].split(" ") | ||||||
|                     params["scope"] = source.additional_scopes[1:].split(" ") |             else: | ||||||
|                 else: |                 params["scope"] += source.additional_scopes.split(" ") | ||||||
|                     params["scope"] += source.additional_scopes.split(" ") |         return client.get_redirect_url(params) | ||||||
|             return client.get_redirect_url(params) |  | ||||||
|  | |||||||
| @ -85,13 +85,12 @@ class PlexAuth: | |||||||
|         except RequestException as exc: |         except RequestException as exc: | ||||||
|             LOGGER.warning("Unable to fetch user resources", exc=exc) |             LOGGER.warning("Unable to fetch user resources", exc=exc) | ||||||
|             raise Http404 |             raise Http404 | ||||||
|         else: |         for resource in resources: | ||||||
|             for resource in resources: |             if resource["provides"] != "server": | ||||||
|                 if resource["provides"] != "server": |                 continue | ||||||
|                     continue |             if resource["clientIdentifier"] in self._source.allowed_servers: | ||||||
|                 if resource["clientIdentifier"] in self._source.allowed_servers: |                 LOGGER.info("Plex allowed access from server", name=resource["name"]) | ||||||
|                     LOGGER.info("Plex allowed access from server", name=resource["name"]) |                 return True | ||||||
|                     return True |  | ||||||
|         return False |         return False | ||||||
|  |  | ||||||
|     def check_friends_overlap(self, user_ident: int) -> bool: |     def check_friends_overlap(self, user_ident: int) -> bool: | ||||||
|  | |||||||
| @ -151,15 +151,14 @@ class PasswordStageView(ChallengeStageView): | |||||||
|             # (most likely LDAP) |             # (most likely LDAP) | ||||||
|             self.logger.debug("Validation error from signal", exc=exc, **auth_kwargs) |             self.logger.debug("Validation error from signal", exc=exc, **auth_kwargs) | ||||||
|             return self.executor.stage_invalid() |             return self.executor.stage_invalid() | ||||||
|         else: |         if not user: | ||||||
|             if not user: |             # No user was found -> invalid credentials | ||||||
|                 # No user was found -> invalid credentials |             self.logger.info("Invalid credentials") | ||||||
|                 self.logger.info("Invalid credentials") |             # Manually inject error into form | ||||||
|                 # Manually inject error into form |             response._errors.setdefault("password", []) | ||||||
|                 response._errors.setdefault("password", []) |             response._errors["password"].append(ErrorDetail(_("Invalid password"), "invalid")) | ||||||
|                 response._errors["password"].append(ErrorDetail(_("Invalid password"), "invalid")) |             return self.challenge_invalid(response) | ||||||
|                 return self.challenge_invalid(response) |         # User instance returned from authenticate() has .backend property set | ||||||
|             # User instance returned from authenticate() has .backend property set |         self.executor.plan.context[PLAN_CONTEXT_PENDING_USER] = user | ||||||
|             self.executor.plan.context[PLAN_CONTEXT_PENDING_USER] = user |         self.executor.plan.context[PLAN_CONTEXT_AUTHENTICATION_BACKEND] = user.backend | ||||||
|             self.executor.plan.context[PLAN_CONTEXT_AUTHENTICATION_BACKEND] = user.backend |         return self.executor.stage_ok() | ||||||
|             return self.executor.stage_ok() |  | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								poetry.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								poetry.lock
									
									
									
										generated
									
									
									
								
							| @ -189,14 +189,14 @@ files = [ | |||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "astroid" | name = "astroid" | ||||||
| version = "2.12.13" | version = "2.14.1" | ||||||
| description = "An abstract syntax tree for Python with inference support." | description = "An abstract syntax tree for Python with inference support." | ||||||
| category = "dev" | category = "dev" | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7.2" | python-versions = ">=3.7.2" | ||||||
| files = [ | files = [ | ||||||
|     {file = "astroid-2.12.13-py3-none-any.whl", hash = "sha256:10e0ad5f7b79c435179d0d0f0df69998c4eef4597534aae44910db060baeb907"}, |     {file = "astroid-2.14.1-py3-none-any.whl", hash = "sha256:23c718921acab5f08cbbbe9293967f1f8fec40c336d19cd75dc12a9ea31d2eb2"}, | ||||||
|     {file = "astroid-2.12.13.tar.gz", hash = "sha256:1493fe8bd3dfd73dc35bd53c9d5b6e49ead98497c47b2307662556a5692d29d7"}, |     {file = "astroid-2.14.1.tar.gz", hash = "sha256:bd1aa4f9915c98e8aaebcd4e71930154d4e8c9aaf05d35ac0a63d1956091ae3f"}, | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [package.dependencies] | [package.dependencies] | ||||||
| @ -2452,18 +2452,18 @@ tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"] | |||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "pylint" | name = "pylint" | ||||||
| version = "2.15.10" | version = "2.16.0" | ||||||
| description = "python code static checker" | description = "python code static checker" | ||||||
| category = "dev" | category = "dev" | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7.2" | python-versions = ">=3.7.2" | ||||||
| files = [ | files = [ | ||||||
|     {file = "pylint-2.15.10-py3-none-any.whl", hash = "sha256:9df0d07e8948a1c3ffa3b6e2d7e6e63d9fb457c5da5b961ed63106594780cc7e"}, |     {file = "pylint-2.16.0-py3-none-any.whl", hash = "sha256:55e5cf00601c4cfe2e9404355c743a14e63be85df7409da7e482ebde5f9f14a1"}, | ||||||
|     {file = "pylint-2.15.10.tar.gz", hash = "sha256:b3dc5ef7d33858f297ac0d06cc73862f01e4f2e74025ec3eff347ce0bc60baf5"}, |     {file = "pylint-2.16.0.tar.gz", hash = "sha256:43ee36c9b690507ef9429ce1802bdc4dcde49454c3d665e39c23791567019c0a"}, | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [package.dependencies] | [package.dependencies] | ||||||
| astroid = ">=2.12.13,<=2.14.0-dev0" | astroid = ">=2.14.1,<=2.16.0-dev0" | ||||||
| colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} | colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} | ||||||
| dill = {version = ">=0.3.6", markers = "python_version >= \"3.11\""} | dill = {version = ">=0.3.6", markers = "python_version >= \"3.11\""} | ||||||
| isort = ">=4.2.5,<6" | isort = ">=4.2.5,<6" | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	![49699333+dependabot[bot]@users.noreply.github.com](/assets/img/avatar_default.png) dependabot[bot]
					dependabot[bot]