Skip to content

Commit

Permalink
refactor: file formats are updated with isort and black.
Browse files Browse the repository at this point in the history
  • Loading branch information
oyurekten committed Dec 6, 2024
1 parent 428b7ff commit 187b100
Show file tree
Hide file tree
Showing 57 changed files with 400 additions and 424 deletions.
12 changes: 2 additions & 10 deletions metabolights_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,8 @@
# MetabolightsHashUtils,
# )
# from metabolights_utils.utils.search_utils import MetabolightsSearchUtils
from metabolights_utils import (
isatab,
commands,
models,
provider,
tsv,
utils,
common,
isa_file_utils,
)
from metabolights_utils import (commands, common, isa_file_utils, isatab,
models, provider, tsv, utils)

__VERSION__ = "1.3.7"

Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/commands/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from metabolights_utils import __VERSION__
from metabolights_utils.commands.model.model_cli import model_cli
from metabolights_utils.commands.public.public_cli import public_cli
from metabolights_utils.commands.submission.submission_cli import submission_cli
from metabolights_utils.commands.submission.submission_cli import \
submission_cli


@click.group()
Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/commands/public/public_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from metabolights_utils.commands.utils import print_study_model_summary
from metabolights_utils.models.parser.enums import ParserMessageType
from metabolights_utils.provider import definitions
from metabolights_utils.provider.ftp_repository import MetabolightsFtpRepository
from metabolights_utils.provider.ftp_repository import \
MetabolightsFtpRepository


@click.command(no_args_is_help=True, name="describe")
Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/commands/public/public_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from metabolights_utils.provider import definitions
from metabolights_utils.provider.ftp.model import LocalDirectory
from metabolights_utils.provider.ftp_repository import MetabolightsFtpRepository
from metabolights_utils.provider.ftp_repository import \
MetabolightsFtpRepository
from metabolights_utils.provider.utils import is_metadata_filename_pattern


Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/commands/public/public_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from metabolights_utils.common import sort_by_study_id
from metabolights_utils.models.enums import GenericMessageType
from metabolights_utils.provider import definitions
from metabolights_utils.provider.ftp_repository import MetabolightsFtpRepository
from metabolights_utils.provider.ftp_repository import \
MetabolightsFtpRepository


@click.command(name="list")
Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/commands/public/public_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import click

from metabolights_utils.commands.utils import convert_html_to_plain_text, split_to_lines
from metabolights_utils.commands.utils import (convert_html_to_plain_text,
split_to_lines)
from metabolights_utils.provider import definitions
from metabolights_utils.provider.utils import rest_api_post

Expand Down
34 changes: 16 additions & 18 deletions metabolights_utils/commands/submission/submission_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@

import click

from metabolights_utils.commands.submission.submission_create_assay import (
submission_create_assay,
)
from metabolights_utils.commands.submission.submission_delete_assay import (
submission_delete_assay,
)
from metabolights_utils.commands.submission.submission_describe import (
submission_describe,
)
from metabolights_utils.commands.submission.submission_download import (
submission_download,
)
from metabolights_utils.commands.submission.submission_list import submission_list
from metabolights_utils.commands.submission.submission_login import submission_login
from metabolights_utils.commands.submission.submission_upload import submission_upload
from metabolights_utils.commands.submission.submission_validate import (
submission_validate,
)
from metabolights_utils.commands.submission.submission_create_assay import \
submission_create_assay
from metabolights_utils.commands.submission.submission_delete_assay import \
submission_delete_assay
from metabolights_utils.commands.submission.submission_describe import \
submission_describe
from metabolights_utils.commands.submission.submission_download import \
submission_download
from metabolights_utils.commands.submission.submission_list import \
submission_list
from metabolights_utils.commands.submission.submission_login import \
submission_login
from metabolights_utils.commands.submission.submission_upload import \
submission_upload
from metabolights_utils.commands.submission.submission_validate import \
submission_validate


@click.group(name="submission")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import click

from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository

VALID_PARAMETERS = {
"LC-MS": (
Expand Down Expand Up @@ -82,9 +81,9 @@ def submission_create_assay(
study_id: MetaboLights study accession number (MTBLSxxxx).
assay_technique: Valid assay techniques: NMR, LC-MS, LC-DAD, GC-MS, GCxGC-MS, GC-FID, DI-MS, FIA-MS, CE-MS, MALDI-MS, MSImaging
Acronyms: Diode array detection (LC-DAD), Tandem MS (GCxGC-MS), Flame ionisation detector (GC-FID),
Acronyms: Diode array detection (LC-DAD), Tandem MS (GCxGC-MS), Flame ionisation detector (GC-FID),
Direct infusion (DI-MS), Flow injection analysis (FIA-MS), Capillary electrophoresis (CE-MS),
Matrix-assisted laser desorption-ionisation imaging mass spectrometry (MALDI-MS),
Matrix-assisted laser desorption-ionisation imaging mass spectrometry (MALDI-MS),
Nuclear magnetic resonance (NMR), Mass spec spectrometry (MSImaging)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import click

from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository


@click.command(no_args_is_help=True, name="delete-assay")
Expand Down
5 changes: 2 additions & 3 deletions metabolights_utils/commands/submission/submission_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

from metabolights_utils.commands.utils import print_study_model_summary
from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository


@click.command(no_args_is_help=True, name="describe")
Expand Down
5 changes: 2 additions & 3 deletions metabolights_utils/commands/submission/submission_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import click

from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository


@click.command(no_args_is_help=True, name="download")
Expand Down
12 changes: 5 additions & 7 deletions metabolights_utils/commands/submission/submission_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
import click

from metabolights_utils.commands.submission.model import (
StudyResponse,
SubmittedStudySummary,
)
from metabolights_utils.commands.utils import convert_html_to_plain_text, split_to_lines
StudyResponse, SubmittedStudySummary)
from metabolights_utils.commands.utils import (convert_html_to_plain_text,
split_to_lines)
from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository


def print_submitted_study(study: SubmittedStudySummary, log):
Expand Down
8 changes: 3 additions & 5 deletions metabolights_utils/commands/submission/submission_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

import click

from metabolights_utils.commands.submission.model import (
FtpLoginCredentials,
LoginCredentials,
RestApiCredentials,
)
from metabolights_utils.commands.submission.model import (FtpLoginCredentials,
LoginCredentials,
RestApiCredentials)
from metabolights_utils.provider import definitions


Expand Down
5 changes: 2 additions & 3 deletions metabolights_utils/commands/submission/submission_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import click

from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository


@click.command(no_args_is_help=True, name="upload")
Expand Down
5 changes: 2 additions & 3 deletions metabolights_utils/commands/submission/submission_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import click

from metabolights_utils.provider import definitions
from metabolights_utils.provider.submission_repository import (
MetabolightsSubmissionRepository,
)
from metabolights_utils.provider.submission_repository import \
MetabolightsSubmissionRepository


@click.command(no_args_is_help=True, name="validate")
Expand Down
8 changes: 3 additions & 5 deletions metabolights_utils/commands/submission/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
import os
from typing import Union

from metabolights_utils.commands.submission.model import (
FtpLoginCredentials,
LoginCredentials,
RestApiCredentials,
)
from metabolights_utils.commands.submission.model import (FtpLoginCredentials,
LoginCredentials,
RestApiCredentials)


def get_submission_private_ftp_credentials(
Expand Down
5 changes: 3 additions & 2 deletions metabolights_utils/isa_file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from typing import Any, List, Tuple, Union

from metabolights_utils.isatab import Writer
from metabolights_utils.models.metabolights.model import MetabolightsStudyModel
from metabolights_utils.models.isa.common import IsaTable, IsaTableColumn, IsaTableFile
from metabolights_utils.models.isa.common import (IsaTable, IsaTableColumn,
IsaTableFile)
from metabolights_utils.models.isa.enums import ColumnsStructure
from metabolights_utils.models.metabolights.model import MetabolightsStudyModel

logger = logging.getLogger(__name__)

Expand Down
23 changes: 8 additions & 15 deletions metabolights_utils/isatab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
from functools import lru_cache

from metabolights_utils.isatab.default.factory import (
DefaultIsaTabReaderFactory,
DefaultIsaTabWriterFactory,
)
from metabolights_utils.isatab.reader import (
InvestigationFileReader,
IsaTableFileReader,
IsaTabReaderFactory,
)
from metabolights_utils.isatab.writer import (
InvestigationFileWriter,
IsaTableFileWriter,
IsaTabWriterFactory,
)

from metabolights_utils.isatab import default, reader, writer
from metabolights_utils.isatab.default.factory import (
DefaultIsaTabReaderFactory, DefaultIsaTabWriterFactory)
from metabolights_utils.isatab.reader import (InvestigationFileReader,
IsaTableFileReader,
IsaTabReaderFactory)
from metabolights_utils.isatab.writer import (InvestigationFileWriter,
IsaTableFileWriter,
IsaTabWriterFactory)


@lru_cache
Expand Down
16 changes: 5 additions & 11 deletions metabolights_utils/isatab/default/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
from metabolights_utils.isatab.default import (
parser,
assay_file,
assignment_file,
base_isa_table_file,
base_isa_file,
factory,
investigation_file,
sample_file,
writer,
)
from metabolights_utils.isatab.default import (assay_file, assignment_file,
base_isa_file,
base_isa_table_file, factory,
investigation_file, parser,
sample_file, writer)

__all__ = [
"parser",
Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/isatab/default/assay_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List

from metabolights_utils.isatab.default.base_isa_table_file import BaseIsaTableFileReader
from metabolights_utils.isatab.default.base_isa_table_file import \
BaseIsaTableFileReader


class DefaultAssayFileReader(BaseIsaTableFileReader):
Expand Down
3 changes: 2 additions & 1 deletion metabolights_utils/isatab/default/assignment_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List

from metabolights_utils.isatab.default.base_isa_table_file import BaseIsaTableFileReader
from metabolights_utils.isatab.default.base_isa_table_file import \
BaseIsaTableFileReader


class DefaultAssignmentFileReader(BaseIsaTableFileReader):
Expand Down
12 changes: 6 additions & 6 deletions metabolights_utils/isatab/default/base_isa_table_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
from typing import List, Union

from metabolights_utils.isatab.default.base_isa_file import BaseIsaFile
from metabolights_utils.isatab.default.parser.isa_table_parser import get_isa_table_file
from metabolights_utils.isatab.reader import (
IsaTableFileReader,
IsaTableFileReaderResult,
)
from metabolights_utils.isatab.default.parser.isa_table_parser import \
get_isa_table_file
from metabolights_utils.isatab.reader import (IsaTableFileReader,
IsaTableFileReaderResult)
from metabolights_utils.models.isa.common import IsaTable, IsaTableFile
from metabolights_utils.models.parser.common import ParserMessage, ParserReport
from metabolights_utils.models.parser.enums import ParserMessageType
from metabolights_utils.tsv.filter import TsvFileFilterOption
from metabolights_utils.tsv.sort import TsvFileSortOption
from metabolights_utils.utils.hash_utils import MetabolightsHashUtils as HashUtils
from metabolights_utils.utils.hash_utils import \
MetabolightsHashUtils as HashUtils

logger = logging.getLogger(__name__)

Expand Down
28 changes: 11 additions & 17 deletions metabolights_utils/isatab/default/factory.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import logging

from metabolights_utils.isatab.default.assay_file import DefaultAssayFileReader
from metabolights_utils.isatab.default.assignment_file import (
DefaultAssignmentFileReader,
)
from metabolights_utils.isatab.default.assignment_file import \
DefaultAssignmentFileReader
from metabolights_utils.isatab.default.investigation_file import (
DefaultInvestigationFileReader,
DefaultInvestigationFileWriter,
)
from metabolights_utils.isatab.default.sample_file import DefaultSampleFileReader
DefaultInvestigationFileReader, DefaultInvestigationFileWriter)
from metabolights_utils.isatab.default.sample_file import \
DefaultSampleFileReader
from metabolights_utils.isatab.default.writer import DefaultIsaTableFileWriter
from metabolights_utils.isatab.reader import (
InvestigationFileReader,
IsaTableFileReader,
IsaTabReaderFactory,
)
from metabolights_utils.isatab.writer import (
InvestigationFileWriter,
IsaTableFileWriter,
IsaTabWriterFactory,
)
from metabolights_utils.isatab.reader import (InvestigationFileReader,
IsaTableFileReader,
IsaTabReaderFactory)
from metabolights_utils.isatab.writer import (InvestigationFileWriter,
IsaTableFileWriter,
IsaTabWriterFactory)

logger = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit 187b100

Please sign in to comment.