Skip to content

Commit

Permalink
chore: ruff.lint.isort: force-single-line (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nora-Olivia-Ammann committed Feb 29, 2024
1 parent d8531bd commit fb3c1d9
Show file tree
Hide file tree
Showing 90 changed files with 408 additions and 305 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -211,4 +211,5 @@ convention = "google"


[tool.ruff.lint.isort]
force-single-line = true
known-first-party = ["dsp_tools"]
9 changes: 6 additions & 3 deletions src/dsp_tools/cli/call_action.py
@@ -1,7 +1,8 @@
import argparse
from pathlib import Path

from dsp_tools.commands.excel2json.lists import excel2lists, validate_lists_section_with_schema
from dsp_tools.commands.excel2json.lists import excel2lists
from dsp_tools.commands.excel2json.lists import validate_lists_section_with_schema
from dsp_tools.commands.excel2json.project import excel2json
from dsp_tools.commands.excel2json.properties import excel2properties
from dsp_tools.commands.excel2json.resources import excel2resources
Expand All @@ -13,9 +14,11 @@
from dsp_tools.commands.project.create.project_validate import validate_project
from dsp_tools.commands.project.get import get_project
from dsp_tools.commands.rosetta import upload_rosetta
from dsp_tools.commands.start_stack import StackConfiguration, StackHandler
from dsp_tools.commands.start_stack import StackConfiguration
from dsp_tools.commands.start_stack import StackHandler
from dsp_tools.commands.template import generate_template_repo
from dsp_tools.commands.xmlupload.upload_config import DiagnosticsConfig, UploadConfig
from dsp_tools.commands.xmlupload.upload_config import DiagnosticsConfig
from dsp_tools.commands.xmlupload.upload_config import UploadConfig
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
from dsp_tools.utils.create_logger import get_logger
from dsp_tools.utils.xml_validation import validate_xml
Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/cli/create_parsers.py
@@ -1,7 +1,8 @@
from __future__ import annotations

import datetime
from argparse import ArgumentParser, _SubParsersAction
from argparse import ArgumentParser
from argparse import _SubParsersAction
from importlib.metadata import version

# help texts
Expand Down
4 changes: 3 additions & 1 deletion src/dsp_tools/cli/entry_point.py
Expand Up @@ -13,7 +13,9 @@

from dsp_tools.cli.call_action import call_requested_action
from dsp_tools.cli.create_parsers import make_parser
from dsp_tools.models.exceptions import BaseError, InternalError, UserError
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.exceptions import InternalError
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.create_logger import get_logger

logger = get_logger(__name__)
Expand Down
8 changes: 6 additions & 2 deletions src/dsp_tools/commands/excel2json/lists.py
Expand Up @@ -3,7 +3,9 @@
import json
from copy import deepcopy
from pathlib import Path
from typing import Any, Optional, Union
from typing import Any
from typing import Optional
from typing import Union

import jsonschema
import regex
Expand All @@ -13,7 +15,9 @@

from dsp_tools.commands.excel2json.models.input_error import MoreThanOneSheetProblem
from dsp_tools.commands.excel2json.models.list_node_name import ListNodeNames
from dsp_tools.models.exceptions import BaseError, InputError, UserError
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.exceptions import InputError
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.shared import simplify_name


Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/excel2json/models/input_error.py
@@ -1,5 +1,6 @@
from dataclasses import dataclass
from typing import Any, Protocol
from typing import Any
from typing import Protocol

separator = "\n "
list_separator = "\n - "
Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/excel2json/models/list_node_name.py
@@ -1,4 +1,5 @@
from dataclasses import dataclass, field
from dataclasses import dataclass
from dataclasses import field


@dataclass
Expand Down
37 changes: 17 additions & 20 deletions src/dsp_tools/commands/excel2json/properties.py
Expand Up @@ -3,33 +3,30 @@
import importlib.resources
import json
import warnings
from typing import Any, Optional
from typing import Any
from typing import Optional

import jsonpath_ng.ext
import jsonschema
import numpy as np
import pandas as pd
import regex

from dsp_tools.commands.excel2json.models.input_error import (
InvalidExcelContentProblem,
JsonValidationPropertyProblem,
MissingValuesInRowProblem,
MoreThanOneSheetProblem,
PositionInExcel,
Problem,
)
from dsp_tools.commands.excel2json.utils import (
check_column_for_duplicate,
check_contains_required_columns,
check_required_values,
col_must_or_not_empty_based_on_other_col,
find_one_full_cell_in_cols,
get_comments,
get_labels,
get_wrong_row_numbers,
read_and_clean_all_sheets,
)
from dsp_tools.commands.excel2json.models.input_error import InvalidExcelContentProblem
from dsp_tools.commands.excel2json.models.input_error import JsonValidationPropertyProblem
from dsp_tools.commands.excel2json.models.input_error import MissingValuesInRowProblem
from dsp_tools.commands.excel2json.models.input_error import MoreThanOneSheetProblem
from dsp_tools.commands.excel2json.models.input_error import PositionInExcel
from dsp_tools.commands.excel2json.models.input_error import Problem
from dsp_tools.commands.excel2json.utils import check_column_for_duplicate
from dsp_tools.commands.excel2json.utils import check_contains_required_columns
from dsp_tools.commands.excel2json.utils import check_required_values
from dsp_tools.commands.excel2json.utils import col_must_or_not_empty_based_on_other_col
from dsp_tools.commands.excel2json.utils import find_one_full_cell_in_cols
from dsp_tools.commands.excel2json.utils import get_comments
from dsp_tools.commands.excel2json.utils import get_labels
from dsp_tools.commands.excel2json.utils import get_wrong_row_numbers
from dsp_tools.commands.excel2json.utils import read_and_clean_all_sheets
from dsp_tools.models.exceptions import InputError

languages = ["en", "de", "fr", "it", "rm"]
Expand Down
21 changes: 11 additions & 10 deletions src/dsp_tools/commands/excel2json/resources.py
@@ -1,23 +1,24 @@
import importlib.resources
import json
import warnings
from typing import Any, Optional
from typing import Any
from typing import Optional

import jsonpath_ng.ext
import jsonschema
import pandas as pd
import regex

from dsp_tools.commands.excel2json.models.input_error import (
JsonValidationResourceProblem,
MissingValuesInRowProblem,
PositionInExcel,
Problem,
ResourcesSheetsNotAsExpected,
)
from dsp_tools.commands.excel2json.utils import check_column_for_duplicate, read_and_clean_all_sheets
from dsp_tools.commands.excel2json.models.input_error import JsonValidationResourceProblem
from dsp_tools.commands.excel2json.models.input_error import MissingValuesInRowProblem
from dsp_tools.commands.excel2json.models.input_error import PositionInExcel
from dsp_tools.commands.excel2json.models.input_error import Problem
from dsp_tools.commands.excel2json.models.input_error import ResourcesSheetsNotAsExpected
from dsp_tools.commands.excel2json.utils import check_column_for_duplicate
from dsp_tools.commands.excel2json.utils import read_and_clean_all_sheets
from dsp_tools.models.exceptions import InputError
from dsp_tools.utils.shared import check_notna, prepare_dataframe
from dsp_tools.utils.shared import check_notna
from dsp_tools.utils.shared import prepare_dataframe

languages = ["en", "de", "fr", "it", "rm"]

Expand Down
8 changes: 3 additions & 5 deletions src/dsp_tools/commands/excel2json/utils.py
Expand Up @@ -7,11 +7,9 @@
import pandas as pd
import regex

from dsp_tools.commands.excel2json.models.input_error import (
DuplicatesInColumnProblem,
InvalidSheetNameProblem,
RequiredColumnMissingProblem,
)
from dsp_tools.commands.excel2json.models.input_error import DuplicatesInColumnProblem
from dsp_tools.commands.excel2json.models.input_error import InvalidSheetNameProblem
from dsp_tools.commands.excel2json.models.input_error import RequiredColumnMissingProblem
from dsp_tools.models.exceptions import InputError

languages = ["en", "de", "fr", "it", "rm"]
Expand Down
46 changes: 23 additions & 23 deletions src/dsp_tools/commands/excel2xml/excel2xml_cli.py
Expand Up @@ -2,34 +2,34 @@

import warnings
from pathlib import Path
from typing import Callable, Optional, Union
from typing import Callable
from typing import Optional
from typing import Union

import pandas as pd
import regex
from lxml import etree

from dsp_tools.commands.excel2xml.excel2xml_lib import (
append_permissions,
make_annotation,
make_bitstream_prop,
make_boolean_prop,
make_color_prop,
make_date_prop,
make_decimal_prop,
make_geometry_prop,
make_geoname_prop,
make_integer_prop,
make_interval_prop,
make_link,
make_list_prop,
make_region,
make_resource,
make_resptr_prop,
make_root,
make_text_prop,
make_uri_prop,
write_xml,
)
from dsp_tools.commands.excel2xml.excel2xml_lib import append_permissions
from dsp_tools.commands.excel2xml.excel2xml_lib import make_annotation
from dsp_tools.commands.excel2xml.excel2xml_lib import make_bitstream_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_boolean_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_color_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_date_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_decimal_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_geometry_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_geoname_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_integer_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_interval_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_link
from dsp_tools.commands.excel2xml.excel2xml_lib import make_list_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_region
from dsp_tools.commands.excel2xml.excel2xml_lib import make_resource
from dsp_tools.commands.excel2xml.excel2xml_lib import make_resptr_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_root
from dsp_tools.commands.excel2xml.excel2xml_lib import make_text_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import make_uri_prop
from dsp_tools.commands.excel2xml.excel2xml_lib import write_xml
from dsp_tools.commands.excel2xml.propertyelement import PropertyElement
from dsp_tools.models.exceptions import BaseError
from dsp_tools.utils.shared import check_notna
Expand Down
8 changes: 6 additions & 2 deletions src/dsp_tools/commands/excel2xml/excel2xml_lib.py
Expand Up @@ -6,7 +6,10 @@
import uuid
import warnings
from pathlib import Path
from typing import Any, Iterable, Optional, Union
from typing import Any
from typing import Iterable
from typing import Optional
from typing import Union

import regex
from lxml import etree
Expand All @@ -17,7 +20,8 @@
from dsp_tools.models.datetimestamp import DateTimeStamp
from dsp_tools.models.exceptions import BaseError
from dsp_tools.utils.date_util import is_full_date
from dsp_tools.utils.shared import check_notna, simplify_name
from dsp_tools.utils.shared import check_notna
from dsp_tools.utils.shared import simplify_name
from dsp_tools.utils.uri_util import is_uri
from dsp_tools.utils.xml_validation import validate_xml

Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/excel2xml/propertyelement.py
@@ -1,5 +1,6 @@
from dataclasses import dataclass
from typing import Optional, Union
from typing import Optional
from typing import Union

from dsp_tools.models.exceptions import BaseError

Expand Down
6 changes: 2 additions & 4 deletions src/dsp_tools/commands/ingest_xmlupload/upload_xml.py
Expand Up @@ -4,10 +4,8 @@

from lxml import etree

from dsp_tools.commands.ingest_xmlupload.apply_ingest_id import (
get_mapping_dict_from_file,
replace_filepath_with_sipi_id,
)
from dsp_tools.commands.ingest_xmlupload.apply_ingest_id import get_mapping_dict_from_file
from dsp_tools.commands.ingest_xmlupload.apply_ingest_id import replace_filepath_with_sipi_id
from dsp_tools.commands.xmlupload.upload_config import UploadConfig
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
from dsp_tools.models.exceptions import InputError
Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/ingest_xmlupload/user_information.py
@@ -1,4 +1,5 @@
from dataclasses import dataclass, field
from dataclasses import dataclass
from dataclasses import field
from pathlib import Path

import pandas as pd
Expand Down
8 changes: 6 additions & 2 deletions src/dsp_tools/commands/project/create/project_create.py
Expand Up @@ -2,7 +2,10 @@
of the project, the creation of groups, users, lists, resource classes, properties and cardinalities."""

from pathlib import Path
from typing import Any, Optional, Union, cast
from typing import Any
from typing import Optional
from typing import Union
from typing import cast

import regex

Expand All @@ -19,7 +22,8 @@
from dsp_tools.commands.project.models.resourceclass import ResourceClass
from dsp_tools.commands.project.models.user import User
from dsp_tools.models.datetimestamp import DateTimeStamp
from dsp_tools.models.exceptions import BaseError, UserError
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.exceptions import UserError
from dsp_tools.models.langstring import LangString
from dsp_tools.utils.connection import Connection
from dsp_tools.utils.connection_live import ConnectionLive
Expand Down
7 changes: 5 additions & 2 deletions src/dsp_tools/commands/project/create/project_create_lists.py
@@ -1,10 +1,13 @@
from typing import Any, Optional, Union
from typing import Any
from typing import Optional
from typing import Union

from dsp_tools.commands.excel2json.lists import expand_lists_from_excel
from dsp_tools.commands.project.create.project_validate import validate_project
from dsp_tools.commands.project.models.listnode import ListNode
from dsp_tools.commands.project.models.project import Project
from dsp_tools.models.exceptions import BaseError, UserError
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.connection import Connection
from dsp_tools.utils.connection_live import ConnectionLive
from dsp_tools.utils.create_logger import get_logger
Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/project/create/project_validate.py
@@ -1,7 +1,8 @@
import importlib.resources
import json
from pathlib import Path
from typing import Any, Union
from typing import Any
from typing import Union

import jsonpath_ng
import jsonpath_ng.ext
Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/project/models/context.py
Expand Up @@ -4,7 +4,8 @@

import regex

from dsp_tools.commands.project.models.helpers import ContextType, OntoIri
from dsp_tools.commands.project.models.helpers import ContextType
from dsp_tools.commands.project.models.helpers import OntoIri
from dsp_tools.models.exceptions import BaseError
from dsp_tools.utils.iri_util import is_iri

Expand Down
4 changes: 3 additions & 1 deletion src/dsp_tools/commands/project/models/group.py
Expand Up @@ -23,7 +23,9 @@

from __future__ import annotations

from typing import Any, Optional, Union
from typing import Any
from typing import Optional
from typing import Union
from urllib.parse import quote_plus

from dsp_tools.commands.project.models.model import Model
Expand Down
3 changes: 2 additions & 1 deletion src/dsp_tools/commands/project/models/helpers.py
@@ -1,7 +1,8 @@
from __future__ import annotations

from dataclasses import dataclass
from enum import Enum, unique
from enum import Enum
from enum import unique
from typing import Optional


Expand Down
4 changes: 3 additions & 1 deletion src/dsp_tools/commands/project/models/listnode.py
Expand Up @@ -12,7 +12,9 @@
"""
from __future__ import annotations

from typing import Any, Optional, Union
from typing import Any
from typing import Optional
from typing import Union
from urllib.parse import quote_plus

from dsp_tools.commands.project.models.model import Model
Expand Down
4 changes: 3 additions & 1 deletion src/dsp_tools/commands/project/models/ontology.py
Expand Up @@ -18,7 +18,9 @@
from __future__ import annotations

import copy
from typing import Any, Optional, Union
from typing import Any
from typing import Optional
from typing import Union
from urllib.parse import quote_plus

import regex
Expand Down

0 comments on commit fb3c1d9

Please sign in to comment.