Skip to content

Commit

Permalink
dev: add isort rules for ruff and fix (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-sentry authored May 20, 2024
1 parent 18722b4 commit 7fe50b4
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/public/v2/compare/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from distutils.util import strtobool
from inspect import Parameter

from distutils.util import strtobool
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema
from rest_framework import mixins
Expand Down
15 changes: 8 additions & 7 deletions api/shared/permissions.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import logging

from typing import Any, Tuple

from asgiref.sync import async_to_sync
from django.conf import settings
from django.http import Http404
from rest_framework.permissions import SAFE_METHODS # ['GET', 'HEAD', 'OPTIONS']
from rest_framework.permissions import BasePermission
from django.http import HttpRequest
from django.http import Http404, HttpRequest
from rest_framework.permissions import (
SAFE_METHODS, # ['GET', 'HEAD', 'OPTIONS']
BasePermission,
)

from codecov_auth.models import Owner
from core.models import Repository
import services.self_hosted as self_hosted
from api.shared.mixins import InternalPermissionsMixin, SuperPermissionsMixin
from api.shared.repo.repository_accessors import RepoAccessors
from codecov_auth.models import Owner
from core.models import Repository
from services.activation import try_auto_activate
from services.decorators import torngit_safe
from services.repo_providers import get_generic_adapter_params, get_provider
Expand Down
2 changes: 1 addition & 1 deletion billing/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from datetime import datetime, timedelta
from unittest.mock import patch

from pytest import raises
import stripe
from django.conf import settings
from freezegun import freeze_time
from pytest import raises
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APIRequestFactory, APITestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from distutils.util import execute
from unittest.mock import patch

import pytest
from asgiref.sync import async_to_sync
from distutils.util import execute
from django.test import TransactionTestCase, override_settings

from codecov_auth.tests.factories import GetAdminProviderAdapter, OwnerFactory
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/types/config/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from distutils.util import strtobool
from typing import List

from ariadne import ObjectType
from distutils.util import strtobool
from django.conf import settings

import services.self_hosted as self_hosted
Expand Down
6 changes: 4 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ indent-width = 4
target-version = "py312"

[lint]
# Currently only enabled F541: https://docs.astral.sh/ruff/rules/
select = ["F541"]
# Currently only enabled for F541 and I: https://docs.astral.sh/ruff/rules/
select = ["F541", "I"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
# The preferred method (for now) w.r.t. fixable rules is to manually update the makefile
# with --fix and re-run 'make lint'
fixable = ["ALL"]
unfixable = []

Expand Down
1 change: 1 addition & 0 deletions upload/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from utils.config import get_config
from utils.encryption import encryptor
from utils.github import get_github_integration_token

from .constants import ci, global_upload_token_providers

is_pull_noted_in_branch = re.compile(r".*(pull|pr)\/(\d+).*")
Expand Down
3 changes: 2 additions & 1 deletion upload/views/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
from rest_framework.permissions import BasePermission
from rest_framework.response import Response
from rest_framework.views import APIView
from shared.bundle_analysis.storage import StoragePaths, get_bucket_name
from sentry_sdk import metrics as sentry_metrics
from shared.bundle_analysis.storage import StoragePaths, get_bucket_name

from codecov_auth.authentication.repo_auth import (
GitHubOIDCTokenAuthentication,
OrgLevelTokenAuthentication,
Expand Down
1 change: 1 addition & 0 deletions upload/views/commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rest_framework.exceptions import ValidationError
from rest_framework.generics import ListCreateAPIView
from sentry_sdk import metrics as sentry_metrics

from codecov_auth.authentication.repo_auth import (
GitHubOIDCTokenAuthentication,
GlobalTokenAuthentication,
Expand Down
5 changes: 3 additions & 2 deletions upload/views/empty_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
from rest_framework.exceptions import NotFound
from rest_framework.generics import CreateAPIView
from rest_framework.response import Response
from shared.torngit.exceptions import TorngitClientError, TorngitClientGeneralError
from sentry_sdk import metrics as sentry_metrics
from shared.torngit.exceptions import TorngitClientError, TorngitClientGeneralError

from codecov_auth.authentication.repo_auth import (
GitHubOIDCTokenAuthentication,
GlobalTokenAuthentication,
Expand All @@ -21,8 +22,8 @@
from services.task import TaskService
from services.yaml import final_commit_yaml
from upload.helpers import (
try_to_get_best_possible_bot_token,
generate_upload_sentry_metrics_tags,
try_to_get_best_possible_bot_token,
)
from upload.views.base import GetterMixin
from upload.views.uploads import CanDoCoverageUploadsPermission
Expand Down
1 change: 1 addition & 0 deletions upload/views/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from rest_framework.exceptions import ValidationError
from rest_framework.generics import CreateAPIView, ListCreateAPIView, RetrieveAPIView
from sentry_sdk import metrics as sentry_metrics

from codecov_auth.authentication.repo_auth import (
GitHubOIDCTokenAuthentication,
GlobalTokenAuthentication,
Expand Down
1 change: 1 addition & 0 deletions upload/views/upload_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from rest_framework.generics import CreateAPIView
from rest_framework.response import Response
from sentry_sdk import metrics as sentry_metrics

from codecov_auth.authentication.repo_auth import (
GitHubOIDCTokenAuthentication,
GlobalTokenAuthentication,
Expand Down

0 comments on commit 7fe50b4

Please sign in to comment.