Skip to content

Commit

Permalink
Delete unused code (a dataclass and related test fixtures)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-uoa committed Jul 3, 2024
1 parent 0368b96 commit fd9282b
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 211 deletions.
1 change: 0 additions & 1 deletion src/blueprints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
RawProject,
RefinedProject,
)
from src.blueprints.storage_boxes import StorageBox

# Define __all__ to specify which attributes are exported
__all__ = [
Expand Down
15 changes: 0 additions & 15 deletions src/blueprints/storage_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
""" Pydantic model to hold storage box from MyTardis"""

from enum import Enum
from pathlib import Path

from pydantic import BaseModel

from src.mytardis_client.data_types import URI


class StorageTypesEnum(Enum):
Expand All @@ -15,13 +10,3 @@ class StorageTypesEnum(Enum):

FILE_SYSTEM = "file_system"
S3 = "s3"


class StorageBox(BaseModel):
"""A storage box class to hold the name, location, uri and description
of a MyTardis storage box object"""

name: str
description: str
uri: URI
location: Path
22 changes: 0 additions & 22 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from pytest import FixtureRequest, fixture

import tests.fixtures.fixtures_archive_app as arch
import tests.fixtures.fixtures_config_from_env as cfg
import tests.fixtures.fixtures_constants as const
import tests.fixtures.fixtures_data_classification_app as dclass
Expand Down Expand Up @@ -155,9 +154,6 @@ def datadir(tmpdir: str, request: FixtureRequest) -> Path:
#
# ==============================

storage_box = dcls.storage_box
datafile_replica = dcls.datafile_replica
archive_replica = dcls.archive_replica
raw_project_parameterset = dcls.raw_project_parameterset
raw_project = dcls.raw_project
raw_experiment_parameterset = dcls.raw_experiment_parameterset
Expand Down Expand Up @@ -591,24 +587,6 @@ def preconditioned_datafile_dictionary() -> Dict[str, Any]:
factory = ingestion_classes.factory


# ========================================
#
# Archive in X days app
#
# =========================================

archive_in_days = arch.archive_in_days
delete_in_days = arch.delete_in_days
storage_options = arch.storage_options
storage_options_reduced = arch.storage_options_reduced
archive_options = arch.archive_options
archive_options_reduced = arch.archive_options_reduced
s3_bucket = arch.s3_bucket
target_key = arch.target_key
project_archive_box_name = arch.project_archive_box_name
project_storage_box_name = arch.project_storage_box_name


# ========================================
#
# Data Classification app
Expand Down
84 changes: 0 additions & 84 deletions tests/fixtures/fixtures_archive_app.py

This file was deleted.

59 changes: 0 additions & 59 deletions tests/fixtures/fixtures_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,10 @@
from src.blueprints.dataset import Dataset, RawDataset, RefinedDataset
from src.blueprints.experiment import Experiment, RawExperiment, RefinedExperiment
from src.blueprints.project import Project, RawProject, RefinedProject
from src.blueprints.storage_boxes import StorageBox
from src.mytardis_client.data_types import URI
from src.mytardis_client.enumerators import DataClassification


@fixture
def archive_box(
archive_box_name: str,
archive_box_dir: str,
archive_box_uri: str,
archive_box_description: str,
) -> StorageBox:
return StorageBox(
name=archive_box_name,
location=Path(archive_box_dir),
uri=URI(archive_box_uri),
description=archive_box_description,
)


@fixture
def storage_box(
storage_box_name: str,
storage_box_dir: str,
storage_box_uri: str,
storage_box_description: str,
) -> StorageBox:
return StorageBox(
name=storage_box_name,
location=Path(storage_box_dir),
uri=URI(storage_box_uri),
description=storage_box_description,
)


@fixture
def datafile_replica(
storage_box: StorageBox,
dataset_dir: Path,
filename: str,
target_dir: Path,
) -> DatafileReplica:
return DatafileReplica(
uri=Path(target_dir / dataset_dir / filename).as_posix(),
location=storage_box.name,
protocol="file",
)


@fixture
def archive_replica(
archive_box: StorageBox,
dataset_dir: Path,
filename: str,
target_dir: Path,
) -> DatafileReplica:
return DatafileReplica(
uri=Path(target_dir / dataset_dir / filename).as_posix(),
location=archive_box.name,
protocol="file",
)


@fixture
def raw_project_parameterset(
project_schema: str,
Expand Down
30 changes: 0 additions & 30 deletions tests/fixtures/fixtures_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from pytest import fixture

from src.blueprints.project import Project
from src.blueprints.storage_boxes import StorageBox
from src.mytardis_client.data_types import URI


Expand Down Expand Up @@ -162,35 +161,6 @@ def datafile_get_response_paginated_second() -> dict[str, Any]:
}


@fixture
def autoarchive_details(
autoarchive_offset: int,
delete_offset: int,
archive_box: StorageBox,
storage_box: StorageBox,
) -> Dict[str, Any]:
return {
"offset": autoarchive_offset,
"delete_offset": delete_offset,
"archives": [
{
"name": archive_box.name,
"description": archive_box.description,
"uri": archive_box.uri,
"location": archive_box.location.as_posix(),
}
],
"active_stores": [
{
"name": storage_box.name,
"description": storage_box.description,
"uri": storage_box.uri,
"location": storage_box.location.as_posix(),
}
],
}


@fixture
def get_project_details(
project_ids: list[str],
Expand Down

0 comments on commit fd9282b

Please sign in to comment.