Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pre-commit autoupdate #724

Merged
merged 3 commits into from
Aug 22, 2024
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:
skip: [poetry-lock]
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.6.1
hooks:
- id: ruff
args:
Expand Down Expand Up @@ -65,7 +65,7 @@ repos:
stages: [commit-msg]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.0"
rev: "v1.11.1"
hooks:
- id: mypy
args:
Expand Down
1 change: 1 addition & 0 deletions docs/src_snippets/howto/python_api/b_create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def create_from_pandas() -> SummaryStatistics:
"""Create a dataset from a path with Pandas files."""
# --8<-- [start:create_from_pandas_import]
import pyspark.pandas as ps

from gentropy.dataset.summary_statistics import SummaryStatistics

# --8<-- [end:create_from_pandas_import]
Expand Down
3 changes: 2 additions & 1 deletion src/airflow/dags/common_airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

import pendulum
import yaml
from google.cloud import batch_v1, dataproc_v1, storage

from airflow.providers.google.cloud.operators.dataproc import (
ClusterGenerator,
DataprocCreateClusterOperator,
DataprocDeleteClusterOperator,
DataprocSubmitJobOperator,
)
from airflow.utils.trigger_rule import TriggerRule
from google.cloud import batch_v1, dataproc_v1, storage

if TYPE_CHECKING:
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/eqtl_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.dataflow import (
DataflowTemplatedJobStartOperator,
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/finngen_harmonisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Any

import common_airflow as common

from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.gcs import GCSListObjectsOperator
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/finngen_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG
from airflow.utils.task_group import TaskGroup
from airflow.utils.trigger_rule import TriggerRule
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/genetics_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG
from airflow.operators.python import ShortCircuitOperator
from airflow.providers.google.cloud.transfers.gcs_to_gcs import GCSToGCSOperator
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/gnomad_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG

CLUSTER_NAME = "gnomad-preprocess"
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/gwas_catalog_harmonisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Any

import common_airflow as common

from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.gcs import GCSListObjectsOperator
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/gwas_catalog_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG
from airflow.operators.python import PythonOperator
from airflow.providers.google.cloud.hooks.gcs import GCSHook
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/gwas_curation_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG

CLUSTER_NAME = "otg-gwascatalog-curation"
Expand Down
1 change: 1 addition & 0 deletions src/airflow/dags/ukb_ppp_eur.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import common_airflow as common

from airflow.models.dag import DAG

CLUSTER_NAME = "otg-ukb-ppp-eur"
Expand Down
15 changes: 8 additions & 7 deletions src/airflow/dags/variant_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
from pathlib import Path
from typing import Any

from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.cloud_batch import (
CloudBatchSubmitJobOperator,
)
from airflow.providers.google.cloud.operators.gcs import GCSListObjectsOperator
from airflow.utils.trigger_rule import TriggerRule
from common_airflow import (
create_batch_job,
create_cluster,
Expand All @@ -28,6 +21,14 @@
)
from google.cloud import batch_v1

from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.cloud_batch import (
CloudBatchSubmitJobOperator,
)
from airflow.providers.google.cloud.operators.gcs import GCSListObjectsOperator
from airflow.utils.trigger_rule import TriggerRule

PROJECT_ID = "open-targets-genetics-dev"
REGION = "europe-west1"
CONFIG_FILE_PATH = Path(__file__).parent / "configs" / "variant_sources.yaml"
Expand Down
1 change: 1 addition & 0 deletions tests/airflow/test_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import pytest

from airflow.models import DagBag


Expand Down
7 changes: 4 additions & 3 deletions tests/gentropy/common/test_spark_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from __future__ import annotations

import pytest
from pyspark.sql import Column, SparkSession
from pyspark.sql import functions as f
from pyspark.sql import types as t

from gentropy.common.spark_helpers import (
enforce_schema,
order_array_of_structs_by_field,
)
from pyspark.sql import Column, SparkSession
from pyspark.sql import functions as f
from pyspark.sql import types as t


def test_order_array_of_structs_by_field(spark: SparkSession) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/gentropy/common/test_version_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import pytest

from gentropy.common.version_engine import GnomADVersionSeeker, VersionEngine


Expand Down
4 changes: 2 additions & 2 deletions tests/gentropy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import numpy as np
import pandas as pd
import pytest
from pyspark.sql import DataFrame, SparkSession

from gentropy.common.Liftover import LiftOverSpark
from gentropy.common.session import Session
from gentropy.dataset.colocalisation import Colocalisation
Expand All @@ -28,8 +30,6 @@
from gentropy.datasource.eqtl_catalogue.study_index import EqtlCatalogueStudyIndex
from gentropy.datasource.gwas_catalog.associations import StudyLocusGWASCatalog
from gentropy.datasource.gwas_catalog.study_index import StudyIndexGWASCatalog
from pyspark.sql import DataFrame, SparkSession

from utils.spark import get_spark_testing_conf


Expand Down
5 changes: 3 additions & 2 deletions tests/gentropy/dataset/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import numpy as np
import pyspark.sql.functions as f
import pytest
from gentropy.dataset.dataset import Dataset
from gentropy.dataset.study_index import StudyIndex
from pyspark.sql import SparkSession
from pyspark.sql.types import (
DoubleType,
Expand All @@ -15,6 +13,9 @@
StructType,
)

from gentropy.dataset.dataset import Dataset
from gentropy.dataset.study_index import StudyIndex


class MockDataset(Dataset):
"""Concrete subclass of Dataset for testing. Necessary because Dataset is abstract."""
Expand Down
3 changes: 2 additions & 1 deletion tests/gentropy/dataset/test_gene_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from __future__ import annotations

from gentropy.dataset.gene_index import GeneIndex
from pyspark.sql import DataFrame

from gentropy.dataset.gene_index import GeneIndex


def test_gene_index_creation(mock_gene_index: GeneIndex) -> None:
"""Test gene index creation with mock gene index."""
Expand Down
1 change: 1 addition & 0 deletions tests/gentropy/dataset/test_l2g.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import TYPE_CHECKING

import pytest

from gentropy.dataset.l2g_feature_matrix import L2GFeatureMatrix
from gentropy.dataset.l2g_gold_standard import L2GGoldStandard
from gentropy.dataset.l2g_prediction import L2GPrediction
Expand Down
3 changes: 2 additions & 1 deletion tests/gentropy/dataset/test_pairwise_ld.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

import numpy as np
import pytest
from gentropy.dataset.pairwise_ld import PairwiseLD
from pyspark.sql import functions as f
from pyspark.sql.window import Window

from gentropy.dataset.pairwise_ld import PairwiseLD

if TYPE_CHECKING:
from pyspark.sql import SparkSession

Expand Down
5 changes: 3 additions & 2 deletions tests/gentropy/dataset/test_study_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from __future__ import annotations

import pytest
from gentropy.dataset.gene_index import GeneIndex
from gentropy.dataset.study_index import StudyIndex
from pyspark.sql import DataFrame, SparkSession
from pyspark.sql import functions as f

from gentropy.dataset.gene_index import GeneIndex
from gentropy.dataset.study_index import StudyIndex


def test_study_index_creation(mock_study_index: StudyIndex) -> None:
"""Test study index creation with mock data."""
Expand Down
19 changes: 10 additions & 9 deletions tests/gentropy/dataset/test_study_locus.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
import pyspark.sql.functions as f
import pyspark.sql.types as t
import pytest
from gentropy.dataset.ld_index import LDIndex
from gentropy.dataset.study_index import StudyIndex
from gentropy.dataset.study_locus import (
CredibleInterval,
StudyLocus,
StudyLocusQualityCheck,
)
from gentropy.dataset.study_locus_overlap import StudyLocusOverlap
from gentropy.dataset.summary_statistics import SummaryStatistics
from pyspark.sql import Column, Row, SparkSession
from pyspark.sql.types import (
ArrayType,
Expand All @@ -27,6 +18,16 @@
StructType,
)

from gentropy.dataset.ld_index import LDIndex
from gentropy.dataset.study_index import StudyIndex
from gentropy.dataset.study_locus import (
CredibleInterval,
StudyLocus,
StudyLocusQualityCheck,
)
from gentropy.dataset.study_locus_overlap import StudyLocusOverlap
from gentropy.dataset.summary_statistics import SummaryStatistics


@pytest.mark.parametrize(
"has_overlap, expected",
Expand Down
3 changes: 2 additions & 1 deletion tests/gentropy/dataset/test_study_locus_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from __future__ import annotations

from gentropy.dataset.study_locus_overlap import StudyLocusOverlap
from pyspark.sql import SparkSession

from gentropy.dataset.study_locus_overlap import StudyLocusOverlap


def test_study_locus_overlap_creation(
mock_study_locus_overlap: StudyLocusOverlap,
Expand Down
4 changes: 3 additions & 1 deletion tests/gentropy/dataset/test_study_locus_overlaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

import pyspark.sql.types as t
import pytest

from gentropy.dataset.study_locus import StudyLocus
from gentropy.dataset.study_locus_overlap import StudyLocusOverlap

if TYPE_CHECKING:
from gentropy.dataset.study_index import StudyIndex
from pyspark.sql import SparkSession

from gentropy.dataset.study_index import StudyIndex


def test_study_locus_overlap_creation(
mock_study_locus_overlap: StudyLocusOverlap,
Expand Down
3 changes: 2 additions & 1 deletion tests/gentropy/dataset/test_summary_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from typing import TYPE_CHECKING

from pyspark.sql import types as t

from gentropy.dataset.study_locus import StudyLocus
from gentropy.dataset.summary_statistics import SummaryStatistics
from pyspark.sql import types as t

if TYPE_CHECKING:
from pyspark.sql import SparkSession
Expand Down
5 changes: 3 additions & 2 deletions tests/gentropy/dataset/test_variant_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from typing import TYPE_CHECKING

import pytest
from pyspark.sql import functions as f
from pyspark.sql import types as t

from gentropy.dataset.gene_index import GeneIndex
from gentropy.dataset.v2g import V2G
from gentropy.dataset.variant_index import VariantIndex
from pyspark.sql import functions as f
from pyspark.sql import types as t

if TYPE_CHECKING:
from pyspark.sql import SparkSession
Expand Down
5 changes: 3 additions & 2 deletions tests/gentropy/datasource/ensembl/test_vep_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from typing import TYPE_CHECKING

import pytest
from gentropy.dataset.variant_index import VariantIndex
from gentropy.datasource.ensembl.vep_parser import VariantEffectPredictorParser
from pyspark.sql import DataFrame
from pyspark.sql import functions as f

from gentropy.dataset.variant_index import VariantIndex
from gentropy.datasource.ensembl.vep_parser import VariantEffectPredictorParser

if TYPE_CHECKING:
from pyspark.sql import SparkSession

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from __future__ import annotations

import pytest
from pyspark.sql import DataFrame

from gentropy.dataset.study_index import StudyIndex
from gentropy.dataset.study_locus import StudyLocus
from gentropy.datasource.eqtl_catalogue.finemapping import EqtlCatalogueFinemapping
from gentropy.datasource.eqtl_catalogue.study_index import EqtlCatalogueStudyIndex
from pyspark.sql import DataFrame


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from __future__ import annotations

from pyspark.sql import SparkSession

from gentropy.dataset.study_locus import StudyLocus
from gentropy.datasource.finngen.finemapping import FinnGenFinemapping
from pyspark.sql import SparkSession


def test_finngen_finemapping_from_finngen_susie_finemapping(
Expand Down
Loading