Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/internal/feature/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from rest_framework.response import Response
from rest_framework.views import APIView
from shared.django_apps.rollouts.models import FeatureFlag
from shared.helpers.redis import get_redis_connection
from shared.rollouts import Feature

from api.internal.feature.helpers import get_flag_cache_redis_key, get_identifier
from services.redis_configuration import get_redis_connection
from utils.config import get_config

from .serializers import FeatureRequestSerializer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Optional

from asgiref.sync import sync_to_async
from shared.helpers.redis import get_redis_connection
from shared.plan.service import PlanService
from shared.upload.utils import query_monthly_coverage_measurements

from codecov.commands.base import BaseInteractor
from codecov_auth.models import Owner
from services.redis_configuration import get_redis_connection

redis = get_redis_connection()

Expand Down
2 changes: 1 addition & 1 deletion codecov_auth/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
from django.utils.timezone import now
from shared.encryption.token import encode_token
from shared.events.amplitude import AmplitudeEventPublisher
from shared.helpers.redis import get_redis_connection
from shared.license import LICENSE_ERRORS_MESSAGES, get_current_license

from codecov_auth.models import Owner, OwnerProfile, Session, User
from services.analytics import AnalyticsService
from services.redis_configuration import get_redis_connection
from services.refresh import RefreshService
from utils.config import get_config
from utils.encryption import encryptor
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def codecov_vcr(request):

@pytest.fixture
def mock_redis(mocker):
m = mocker.patch("services.redis_configuration._get_redis_instance_from_url")
m = mocker.patch("shared.helpers.redis._get_redis_instance_from_url")
redis_server = fakeredis.FakeStrictRedis()
m.return_value = redis_server
yield redis_server
Expand Down
5 changes: 2 additions & 3 deletions core/apps.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import logging

from django.apps import AppConfig
from shared.helpers.cache import RedisBackend
from shared.helpers.cache import RedisBackend, cache
from shared.helpers.redis import get_redis_connection

from services.redis_configuration import get_redis_connection
from utils.cache import cache
from utils.config import RUN_ENV

logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions core/management/commands/delete_rate_limit_keys.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.core.management.base import BaseCommand, CommandParser

from services.redis_configuration import get_redis_connection
from shared.helpers.redis import get_redis_connection


class Command(BaseCommand):
Expand Down
3 changes: 1 addition & 2 deletions core/tests/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from shared.config import ConfigHelper
from shared.django_apps.codecov_auth.models import Plan, Tier
from shared.django_apps.core.tests.factories import OwnerFactory, RepositoryFactory

from services.redis_configuration import get_redis_connection
from shared.helpers.redis import get_redis_connection


@pytest.mark.django_db
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/tests/test_test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from shared.django_apps.codecov_auth.tests.factories import OwnerFactory
from shared.django_apps.core.tests.factories import RepositoryFactory
from shared.helpers.redis import get_redis_connection
from shared.storage.exceptions import BucketAlreadyExistsError
from shared.storage.memory import MemoryStorageService

Expand All @@ -20,7 +21,6 @@
generate_test_results,
get_results,
)
from services.redis_configuration import get_redis_connection
from utils.test_results import dedup_table

from .helper import GraphQLTestHelper
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/types/owner/owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from asgiref.sync import sync_to_async
from django.conf import settings
from graphql import GraphQLResolveInfo
from shared.helpers.redis import get_redis_connection
from shared.plan.constants import DEFAULT_FREE_PLAN
from shared.plan.service import PlanService

Expand Down Expand Up @@ -43,7 +44,6 @@
from graphql_api.types.errors.errors import NotFoundError
from graphql_api.types.repository.repository import TOKEN_UNAVAILABLE
from services.billing import BillingService
from services.redis_configuration import get_redis_connection
from timeseries.helpers import fill_sparse_measurements
from timeseries.models import Interval
from utils.config import get_config
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/types/repository/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from asgiref.sync import sync_to_async
from django.conf import settings
from graphql.type.definition import GraphQLResolveInfo
from shared.helpers.redis import get_redis_connection

from codecov_auth.models import SERVICE_GITHUB, SERVICE_GITHUB_ENTERPRISE, Owner
from core.models import Branch, Commit, Pull, Repository
Expand All @@ -22,7 +23,6 @@
from graphql_api.types.enums import OrderingDirection
from graphql_api.types.enums.enum_types import PullRequestState
from graphql_api.types.errors.errors import NotFoundError, OwnerNotActivatedError
from services.redis_configuration import get_redis_connection

TOKEN_UNAVAILABLE = "Token Unavailable. Please contact your admin."

Expand Down
2 changes: 1 addition & 1 deletion graphql_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
)
from graphql import DocumentNode
from sentry_sdk import capture_exception
from shared.helpers.redis import get_redis_connection
from shared.metrics import Counter, Histogram, inc_counter

from codecov.commands.exceptions import BaseException
from codecov.commands.executor import get_executor_from_request
from services import ServiceException
from services.redis_configuration import get_redis_connection

from .schema import schema
from .validation import (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ dev-dependencies = [
]

[tool.uv.sources]
shared = { git = "https://github.com/codecov/shared", rev = "d591317cb558fa499e81e52d9eacf61a2ff52744" }
shared = { git = "https://github.com/codecov/shared", rev = "ece4366f3bce7fab2216704f85e365fbbe0f147d" }
2 changes: 1 addition & 1 deletion services/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.db.models import Prefetch, QuerySet
from django.utils.functional import cached_property
from shared.api_archive.archive import ArchiveService
from shared.helpers.redis import get_redis_connection
from shared.helpers.yaml import walk
from shared.reports.types import ReportTotals
from shared.torngit.base import TorngitBaseAdapter
Expand All @@ -23,7 +24,6 @@
from core.models import Commit, Pull
from reports.models import CommitReport
from services import ServiceException
from services.redis_configuration import get_redis_connection
from services.repo_providers import RepoProviderService
from utils.config import get_config

Expand Down
21 changes: 0 additions & 21 deletions services/redis_configuration.py

This file was deleted.

2 changes: 1 addition & 1 deletion services/refresh.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from json import dumps, loads

from celery.result import result_from_tuple
from shared.helpers.redis import get_redis_connection

from services.redis_configuration import get_redis_connection
from services.task import TaskService, celery_app


Expand Down
6 changes: 3 additions & 3 deletions services/tests/test_redis_configuration.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from services.redis_configuration import get_redis_connection
from shared.helpers.redis import get_redis_connection


def test_get_redis_connection(mocker):
mocker.patch("services.redis_configuration.get_config", return_value=None)
mocked = mocker.patch("services.redis_configuration.Redis.from_url")
mocker.patch("shared.helpers.redis.get_config", return_value=None)
mocked = mocker.patch("shared.helpers.redis.Redis.from_url")
res = get_redis_connection()
assert res is not None
mocked.assert_called_with("redis://redis:6379")
4 changes: 1 addition & 3 deletions services/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import sentry_sdk
from asgiref.sync import async_to_sync
from shared.helpers.cache import OurOwnCache
from shared.helpers.cache import cache
from shared.yaml import UserYaml, fetch_current_yaml_from_provider_via_reference
from shared.yaml.validation import validate_yaml
from yaml import safe_load
Expand All @@ -13,8 +13,6 @@
from core.models import Commit
from services.repo_providers import RepoProviderService

cache = OurOwnCache()


class YamlStates(enum.Enum):
DEFAULT = "default"
Expand Down
5 changes: 2 additions & 3 deletions upload/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from jwt import PyJWKClient, PyJWTError
from redis import Redis
from rest_framework.exceptions import NotFound, Throttled, ValidationError
from shared.github import InvalidInstallationError
from shared.github import InvalidInstallationError, get_github_integration_token
from shared.helpers.redis import get_redis_connection
from shared.plan.service import PlanService
from shared.reports.enums import UploadType
from shared.torngit.base import TorngitBaseAdapter
Expand All @@ -34,14 +35,12 @@
from core.models import Commit, Repository
from reports.models import CommitReport, ReportSession
from services.analytics import AnalyticsService
from services.redis_configuration import get_redis_connection
from services.repo_providers import RepoProviderService
from services.task import TaskService
from upload.tokenless.tokenless import TokenlessUploadHandler
from utils import is_uuid
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

Expand Down
2 changes: 1 addition & 1 deletion upload/tests/test_throttles.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
RepositoryFactory,
)
from shared.django_apps.reports.models import ReportType
from shared.helpers.redis import get_redis_connection
from shared.plan.constants import DEFAULT_FREE_PLAN
from shared.upload.utils import UploaderType, insert_coverage_measurement

from billing.helpers import mock_all_plans_and_tiers
from reports.tests.factories import CommitReportFactory, UploadFactory
from services.redis_configuration import get_redis_connection
from upload.throttles import UploadsPerCommitThrottle, UploadsPerWindowThrottle


Expand Down
2 changes: 1 addition & 1 deletion upload/tests/views/test_bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
)
from shared.django_apps.core.tests.factories import CommitFactory, RepositoryFactory
from shared.events.amplitude import UNKNOWN_USER_OWNERID
from shared.helpers.redis import get_redis_connection

from core.models import Commit
from services.redis_configuration import get_redis_connection
from services.task import TaskService
from timeseries.models import Dataset, MeasurementName

Expand Down
2 changes: 1 addition & 1 deletion upload/tests/views/test_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
RepositoryFactory,
)
from shared.events.amplitude import UNKNOWN_USER_OWNERID
from shared.helpers.redis import get_redis_connection

from services.redis_configuration import get_redis_connection
from services.task import TaskService


Expand Down
2 changes: 1 addition & 1 deletion upload/throttles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from rest_framework.exceptions import ValidationError
from rest_framework.throttling import BaseThrottle
from rest_framework.views import APIView
from shared.helpers.redis import get_redis_connection
from shared.plan.service import PlanService
from shared.reports.enums import UploadType
from shared.upload.utils import query_monthly_coverage_measurements

from reports.models import ReportSession
from services.redis_configuration import get_redis_connection
from upload.helpers import _determine_responsible_owner

log = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion upload/views/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from shared.api_archive.archive import ArchiveService
from shared.bundle_analysis.storage import StoragePaths, get_bucket_name
from shared.events.amplitude import UNKNOWN_USER_OWNERID, AmplitudeEventPublisher
from shared.helpers.redis import get_redis_connection
from shared.metrics import Counter, inc_counter

from codecov_auth.authentication.repo_auth import (
Expand All @@ -26,7 +27,6 @@
from codecov_auth.models import Owner, Service
from core.models import Commit
from reports.models import CommitReport
from services.redis_configuration import get_redis_connection
from timeseries.models import Dataset, MeasurementName
from upload.helpers import (
dispatch_upload_task,
Expand Down
2 changes: 1 addition & 1 deletion upload/views/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
from rest_framework.permissions import AllowAny
from rest_framework.views import APIView
from shared.api_archive.archive import ArchiveService
from shared.helpers.redis import get_redis_connection
from shared.metrics import inc_counter

from codecov_auth.commands.owner import OwnerCommands
from core.commands.repository import RepositoryCommands
from services.analytics import AnalyticsService
from services.redis_configuration import get_redis_connection
from upload.helpers import (
check_commit_upload_constraints,
determine_repo_for_upload,
Expand Down
2 changes: 1 addition & 1 deletion upload/views/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from rest_framework.views import APIView
from shared.api_archive.archive import ArchiveService, MinioEndpoints
from shared.events.amplitude import UNKNOWN_USER_OWNERID, AmplitudeEventPublisher
from shared.helpers.redis import get_redis_connection
from shared.metrics import inc_counter

from codecov_auth.authentication.repo_auth import (
Expand All @@ -23,7 +24,6 @@
from codecov_auth.models import Owner, Service
from core.models import Commit
from reports.models import CommitReport
from services.redis_configuration import get_redis_connection
from upload.helpers import (
dispatch_upload_task,
generate_upload_prometheus_metrics_labels,
Expand Down
2 changes: 1 addition & 1 deletion upload/views/uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from rest_framework.views import APIView
from shared.api_archive.archive import ArchiveService, MinioEndpoints
from shared.events.amplitude import UNKNOWN_USER_OWNERID, AmplitudeEventPublisher
from shared.helpers.redis import get_redis_connection
from shared.metrics import inc_counter
from shared.upload.utils import UploaderType, insert_coverage_measurement

Expand All @@ -30,7 +31,6 @@
from core.models import Commit, Repository
from reports.models import CommitReport, ReportSession
from services.analytics import AnalyticsService
from services.redis_configuration import get_redis_connection
from upload.helpers import (
dispatch_upload_task,
generate_upload_prometheus_metrics_labels,
Expand Down
3 changes: 0 additions & 3 deletions utils/cache.py

This file was deleted.

8 changes: 0 additions & 8 deletions utils/github.py

This file was deleted.

2 changes: 1 addition & 1 deletion utils/test_results.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import polars as pl
from django.conf import settings
from shared.helpers.redis import get_redis_connection
from shared.storage import get_appropriate_storage_service
from shared.storage.exceptions import FileNotInStorageError

from services.redis_configuration import get_redis_connection
from services.task import TaskService


Expand Down
Loading
Loading