Replace flake8 and black with ruff#14271
Conversation
There was a problem hiding this comment.
Code Review
This pull request performs a large-scale code formatting and import sorting cleanup across various modules of the GeoNode codebase, including base, layers, maps, documents, and harvesting. The review feedback highlights several minor issues resulting from collapsing multi-line implicitly concatenated strings into single lines, which caused missing spaces (such as 'bedeprecated', 'at least{min_digits}', and run-together log messages). Additionally, the reviewer pointed out a spelling typo ('asyncronous') and a duplicate word ('size size') in a document upload form error message along with its corresponding test. All of these comments are highly actionable and include precise code suggestions.
| ) | ||
| if not _errors: | ||
| _message = f'The asyncronous permissions {form.cleaned_data.get("mode")} request for {", ".join(users_usernames or groups_names)} has been sent' | ||
| _message = f"The asyncronous permissions {form.cleaned_data.get('mode')} request for {', '.join(users_usernames or groups_names)} has been sent" |
There was a problem hiding this comment.
There is a typo in the success message: 'asyncronous' should be spelled 'asynchronous'.
| _message = f"The asyncronous permissions {form.cleaned_data.get('mode')} request for {', '.join(users_usernames or groups_names)} has been sent" | |
| _message = f"The asynchronous permissions {form.cleaned_data.get('mode')} request for {', '.join(users_usernames or groups_names)} has been sent" |
| OAuth2Error( | ||
| "Invalid profile_url, falling back to id_token checks..." | ||
| ) |
| @@ -158,7 +196,11 @@ | |||
| def moderator_contacted(request, inactive_user=None): | |||
| """Used when a user signs up.""" | |||
| user = get_user_model().objects.get(id=inactive_user) | |||
| return TemplateResponse(request, template="account/admin_approval_sent.html", context={"email": user.email}) | |||
| return TemplateResponse( | |||
| request, | |||
| except Exception as e: | ||
| return HttpResponse(json.dumps({"error": str(e)}), status=403, content_type="application/json") | ||
| return HttpResponse( | ||
| json.dumps({"error": str(e)}), |
|
|
||
| content = response.content or response.reason | ||
| status = response.status_code | ||
| response_headers = response.headers | ||
| content_type = response.headers.get("Content-Type") | ||
|
|
||
| if status >= 400: | ||
| _response = HttpResponse(content=content, reason=content, status=status, content_type=content_type) | ||
| _response = HttpResponse( | ||
| content=content, reason=content, status=status, content_type=content_type |
| json.dumps( | ||
| {"success": "false", "message": f'Exception occurred: "{str(e)}"'} | ||
| ), |
| @@ -238,12 +250,16 @@ | |||
|
|
|||
| except Exception as e: | |||
| logger.exception("XLSX Pre-processing failed") | |||
| raise InvalidInputFileException(detail=f"Failed to securely parse Excel: {str(e)}") | |||
| raise InvalidInputFileException( | |||
| detail=f"Failed to securely parse Excel: {str(e)}" | |||
| @@ -94,14 +101,18 @@ | |||
| with open(files.get("base_file")) as _xml: | |||
| dlxml.fromstring(_xml.read().encode()) | |||
| except Exception as err: | |||
| raise InvalidXmlException(f"Uploaded document is not XML or is invalid: {str(err)}") | |||
| raise InvalidXmlException( | |||
| f"Uploaded document is not XML or is invalid: {str(err)}" | |||
| @@ -95,7 +121,9 @@ | |||
|
|
|||
| def err403(request, exception): | |||
| if not request.user.is_authenticated: | |||
| return HttpResponseRedirect(f"{reverse('account_login')}?next={request.get_full_path()}") | |||
| return HttpResponseRedirect( | |||
| f"{reverse('account_login')}?next={request.get_full_path()}" | |||
| ("java_path=", "j", "Full path to java install for Windows"), | ||
| ("force_exec=", "", "Force GeoServer Start."), | ||
| ] | ||
| ) |
| ("java_path=", "j", "Full path to java install for Windows"), | ||
| ("force_exec=", "", "Force GeoServer Start."), | ||
| ] | ||
| ) |
Checklist
For all pull requests:
The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):
Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.