Skip to content

Commit

Permalink
chore: restructure repository (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Nov 13, 2023
1 parent 7f98045 commit 8a05b2c
Show file tree
Hide file tree
Showing 125 changed files with 264 additions and 284 deletions.
33 changes: 17 additions & 16 deletions pyproject.toml
Expand Up @@ -77,6 +77,8 @@ check-links = """
darglint = """
find . -name "*.py" \
-not -path "./src/dsp_tools/models/*" \
-not -path "./src/dsp_tools/commands/xmlupload/models/*" \
-not -path "./src/dsp_tools/commands/project/models/*" \
-not -path "./.git/*" \
| xargs poetry run darglint -v 2\
"""
Expand Down Expand Up @@ -104,25 +106,24 @@ pythonpath = [".", "src", "test"]


[tool.mypy]
ignore_missing_imports = true # TODO: deactivate this
ignore_missing_imports = true # TODO: deactivate this
show_column_numbers = true
strict = true
exclude = [
"src/dsp_tools/import_scripts", # TODO: activate this
"src/dsp_tools/models/group.py", # TODO: activate this
"src/dsp_tools/models/helpers.py ", # TODO: activate this
"src/dsp_tools/models/langstring.py", # TODO: activate this
"src/dsp_tools/models/listnode.py", # TODO: activate this
"src/dsp_tools/models/ontology.py", # TODO: activate this
"src/dsp_tools/models/permission.py", # TODO: activate this
"src/dsp_tools/models/project.py", # TODO: activate this
"src/dsp_tools/models/projectContext.py", # TODO: activate this
"src/dsp_tools/models/propertyclass.py", # TODO: activate this
"src/dsp_tools/models/resource.py", # TODO: activate this
"src/dsp_tools/models/resourceclass.py", # TODO: activate this
"src/dsp_tools/models/user.py", # TODO: activate this
"src/dsp_tools/models/value.py", # TODO: activate this
"src/dsp_tools/models/xmlresource.py", # TODO: activate this
"src/dsp_tools/commands/xmlupload/models/value.py", # TODO: activate this
"src/dsp_tools/commands/xmlupload/models/permission.py", # TODO: activate this
"src/dsp_tools/commands/xmlupload/models/xmlresource.py", # TODO: activate this
"src/dsp_tools/models/helpers.py", # TODO: activate this
"src/dsp_tools/models/langstring.py", # TODO: activate this
"src/dsp_tools/commands/project/models/group.py", # TODO: activate this
"src/dsp_tools/commands/project/models/listnode.py", # TODO: activate this
"src/dsp_tools/commands/project/models/ontology.py", # TODO: activate this
"src/dsp_tools/commands/project/models/project.py", # TODO: activate this
"src/dsp_tools/models/projectContext.py", # TODO: activate this
"src/dsp_tools/commands/project/models/propertyclass.py", # TODO: activate this
"src/dsp_tools/commands/project/models/resourceclass.py", # TODO: activate this
"src/dsp_tools/commands/project/models/user.py", # TODO: activate this
"src/dsp_tools/import_scripts", # TODO: activate this
]


Expand Down
1 change: 1 addition & 0 deletions src/dsp_tools/__init__.py
@@ -0,0 +1 @@
from dsp_tools.commands import excel2xml
36 changes: 18 additions & 18 deletions src/dsp_tools/cli.py
Expand Up @@ -9,27 +9,27 @@

import regex

from dsp_tools.excel2xml import excel2xml
from dsp_tools.fast_xmlupload.process_files import process_files
from dsp_tools.fast_xmlupload.upload_files import upload_files
from dsp_tools.fast_xmlupload.upload_xml import fast_xmlupload
from dsp_tools.commands.excel2json.lists import excel2lists, 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
from dsp_tools.commands.excel2xml import excel2xml
from dsp_tools.commands.fast_xmlupload.process_files import process_files
from dsp_tools.commands.fast_xmlupload.upload_files import upload_files
from dsp_tools.commands.fast_xmlupload.upload_xml import fast_xmlupload
from dsp_tools.commands.id2iri import id2iri
from dsp_tools.commands.project.create.project_create import create_project
from dsp_tools.commands.project.create.project_create_lists import create_lists
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.template import generate_template_repo
from dsp_tools.commands.xmlupload.upload_config import DiagnosticsConfig, UploadConfig
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.create_logger import get_logger
from dsp_tools.utils.excel2json.lists import excel2lists, validate_lists_section_with_schema
from dsp_tools.utils.excel2json.project import excel2json
from dsp_tools.utils.excel2json.properties import excel2properties
from dsp_tools.utils.excel2json.resources import excel2resources
from dsp_tools.utils.generate_templates import generate_template_repo
from dsp_tools.utils.id2iri import id2iri
from dsp_tools.utils.project_create import create_project
from dsp_tools.utils.project_create_lists import create_lists
from dsp_tools.utils.project_get import get_project
from dsp_tools.utils.project_validate import validate_project
from dsp_tools.utils.rosetta import upload_rosetta
from dsp_tools.utils.shared import validate_xml_against_schema
from dsp_tools.utils.stack_handling import StackConfiguration, StackHandler
from dsp_tools.utils.xmlupload.upload_config import DiagnosticsConfig, UploadConfig
from dsp_tools.utils.xmlupload.xmlupload import xmlupload

logger = get_logger(__name__)

Expand Down
1 change: 1 addition & 0 deletions src/dsp_tools/commands/__init__.py
@@ -0,0 +1 @@
from . import excel2xml
File renamed without changes.
File renamed without changes.
Expand Up @@ -3,10 +3,10 @@

import regex

from dsp_tools.commands.excel2json.lists import excel2lists
from dsp_tools.commands.excel2json.properties import excel2properties
from dsp_tools.commands.excel2json.resources import excel2resources
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.excel2json.lists import excel2lists
from dsp_tools.utils.excel2json.properties import excel2properties
from dsp_tools.utils.excel2json.resources import excel2resources


def excel2json(
Expand Down
Expand Up @@ -9,7 +9,7 @@
import pandas as pd
import regex

import dsp_tools.utils.excel2json.utils as utl
import dsp_tools.commands.excel2json.utils as utl
from dsp_tools.models.exceptions import UserError

languages = ["en", "de", "fr", "it", "rm"]
Expand Down
Expand Up @@ -8,7 +8,7 @@
import pandas as pd
import regex

import dsp_tools.utils.excel2json.utils as utl
import dsp_tools.commands.excel2json.utils as utl
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.shared import check_notna, prepare_dataframe

Expand Down
File renamed without changes.
Expand Up @@ -17,6 +17,7 @@
from lxml import etree
from lxml.builder import E # pylint: disable=no-name-in-module

from dsp_tools.commands.xmlupload.models.value import UriValue
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import DateTimeStamp

Expand All @@ -25,7 +26,6 @@
# doing this requires silencing the corresponding pylint warning
# (see https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/useless-import-alias.html)
from dsp_tools.models.propertyelement import PropertyElement as PropertyElement # pylint: disable=useless-import-alias
from dsp_tools.models.value import UriValue
from dsp_tools.utils.shared import check_notna as check_notna # pylint: disable=useless-import-alias
from dsp_tools.utils.shared import simplify_name as simplify_name # pylint: disable=useless-import-alias
from dsp_tools.utils.shared import validate_xml_against_schema
Expand Down
File renamed without changes.
Expand Up @@ -10,8 +10,8 @@
from regex import regex
from requests import JSONDecodeError

from dsp_tools.connection.connection import Connection
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.connection import Connection
from dsp_tools.utils.create_logger import get_logger
from dsp_tools.utils.shared import login

Expand Down
Expand Up @@ -5,11 +5,11 @@

from lxml import etree

from dsp_tools.fast_xmlupload.upload_files import get_pkl_files
from dsp_tools.commands.fast_xmlupload.upload_files import get_pkl_files
from dsp_tools.commands.xmlupload.upload_config import UploadConfig
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.create_logger import get_logger
from dsp_tools.utils.xmlupload.upload_config import UploadConfig
from dsp_tools.utils.xmlupload.xmlupload import xmlupload

logger = get_logger(__name__)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -5,20 +5,20 @@

import regex

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.excel2json.lists import expand_lists_from_excel
from dsp_tools.commands.project.create.project_create_lists import create_lists_on_server
from dsp_tools.commands.project.create.project_validate import validate_project
from dsp_tools.commands.project.models.group import Group
from dsp_tools.commands.project.models.ontology import Ontology
from dsp_tools.commands.project.models.project import Project
from dsp_tools.commands.project.models.propertyclass import PropertyClass
from dsp_tools.commands.project.models.resourceclass import ResourceClass
from dsp_tools.commands.project.models.user import User
from dsp_tools.models.exceptions import BaseError, UserError
from dsp_tools.models.group import Group
from dsp_tools.models.helpers import Cardinality, Context, DateTimeStamp
from dsp_tools.models.langstring import LangString
from dsp_tools.models.ontology import Ontology
from dsp_tools.models.project import Project
from dsp_tools.models.propertyclass import PropertyClass
from dsp_tools.models.resourceclass import ResourceClass
from dsp_tools.models.user import User
from dsp_tools.utils.connection import Connection
from dsp_tools.utils.create_logger import get_logger
from dsp_tools.utils.excel2json.lists import expand_lists_from_excel
from dsp_tools.utils.project_create_lists import create_lists_on_server
from dsp_tools.utils.project_validate import validate_project
from dsp_tools.utils.shared import login, parse_json_input, try_network_action

logger = get_logger(__name__)
Expand Down
@@ -1,12 +1,12 @@
from typing import Any, Optional, Union

from dsp_tools.connection.connection import Connection
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.listnode import ListNode
from dsp_tools.models.project import Project
from dsp_tools.utils.connection import Connection
from dsp_tools.utils.create_logger import get_logger
from dsp_tools.utils.excel2json.lists import expand_lists_from_excel
from dsp_tools.utils.project_validate import validate_project
from dsp_tools.utils.shared import login, parse_json_input, try_network_action

logger = get_logger(__name__)
Expand Down
Expand Up @@ -9,8 +9,8 @@
import networkx as nx
import regex

from dsp_tools.commands.excel2json.lists import expand_lists_from_excel
from dsp_tools.models.exceptions import BaseError
from dsp_tools.utils.excel2json.lists import expand_lists_from_excel


def _check_for_duplicate_names(project_definition: dict[str, Any]) -> bool:
Expand Down
Expand Up @@ -4,13 +4,13 @@

import regex

from dsp_tools.connection.connection_live import ConnectionLive
from dsp_tools.commands.project.models.group import Group
from dsp_tools.commands.project.models.listnode import ListNode
from dsp_tools.commands.project.models.ontology import Ontology
from dsp_tools.commands.project.models.project import Project
from dsp_tools.commands.project.models.user import User
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.group import Group
from dsp_tools.models.listnode import ListNode
from dsp_tools.models.ontology import Ontology
from dsp_tools.models.project import Project
from dsp_tools.models.user import User
from dsp_tools.utils.connection_live import ConnectionLive


def get_project(
Expand Down
File renamed without changes.
Expand Up @@ -29,12 +29,12 @@
from typing import Any, Optional, Union
from urllib.parse import quote_plus

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.project import Project
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import Actions
from dsp_tools.models.langstring import LangString
from dsp_tools.models.model import Model
from dsp_tools.models.project import Project
from dsp_tools.utils.connection import Connection


class Group(Model): # pylint: disable=too-many-instance-attributes
Expand Down
Expand Up @@ -28,13 +28,13 @@
from typing import Any, Optional, Union
from urllib.parse import quote_plus

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.project import Project
from dsp_tools.commands.project.models.set_encoder import SetEncoder
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import Actions
from dsp_tools.models.langstring import LangString, Languages
from dsp_tools.models.model import Model
from dsp_tools.models.project import Project
from dsp_tools.models.set_encoder import SetEncoder
from dsp_tools.utils.connection import Connection


def list_creator(con: Connection, project: Project, parent_node: "ListNode", nodes: list[dict]) -> list["ListNode"]:
Expand Down
@@ -1,4 +1,4 @@
from dsp_tools.connection.connection import Connection
from dsp_tools.utils.connection import Connection


class Model: # pylint: disable=too-few-public-methods
Expand Down
Expand Up @@ -35,14 +35,14 @@

import regex

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.project import Project
from dsp_tools.commands.project.models.propertyclass import PropertyClass
from dsp_tools.commands.project.models.resourceclass import ResourceClass
from dsp_tools.commands.project.models.set_encoder import SetEncoder
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import Actions, Context, DateTimeStamp, WithId
from dsp_tools.models.model import Model
from dsp_tools.models.project import Project
from dsp_tools.models.propertyclass import PropertyClass
from dsp_tools.models.resourceclass import ResourceClass
from dsp_tools.models.set_encoder import SetEncoder
from dsp_tools.utils.connection import Connection


class Ontology(Model): # pylint: disable=too-many-instance-attributes
Expand Down
Expand Up @@ -30,12 +30,12 @@
from typing import Any, Optional, Union
from urllib.parse import quote_plus

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.set_encoder import SetEncoder
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import Actions
from dsp_tools.models.langstring import LangString, Languages
from dsp_tools.models.model import Model
from dsp_tools.models.set_encoder import SetEncoder
from dsp_tools.utils.connection import Connection


class Project(Model): # pylint: disable=too-many-instance-attributes,too-many-public-methods
Expand Down
Expand Up @@ -6,13 +6,13 @@

import regex

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.listnode import ListNode
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.set_encoder import SetEncoder
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import Actions, Context, DateTimeStamp, WithId
from dsp_tools.models.langstring import LangString, Languages
from dsp_tools.models.listnode import ListNode
from dsp_tools.models.model import Model
from dsp_tools.models.set_encoder import SetEncoder
from dsp_tools.utils.connection import Connection


class PropertyClass(Model): # pylint: disable=too-many-instance-attributes,too-many-public-methods
Expand Down
Expand Up @@ -16,12 +16,12 @@

import regex

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.set_encoder import SetEncoder
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import Actions, Cardinality, Context, DateTimeStamp
from dsp_tools.models.langstring import LangString, Languages
from dsp_tools.models.model import Model
from dsp_tools.models.set_encoder import SetEncoder
from dsp_tools.utils.connection import Connection


class HasProperty(Model):
Expand Down
File renamed without changes.
Expand Up @@ -29,13 +29,13 @@
from typing import Any, Optional, Union
from urllib.parse import quote_plus

from dsp_tools.connection.connection import Connection
from dsp_tools.commands.project.models.group import Group
from dsp_tools.commands.project.models.model import Model
from dsp_tools.commands.project.models.project import Project
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.group import Group
from dsp_tools.models.helpers import Actions
from dsp_tools.models.langstring import Languages
from dsp_tools.models.model import Model
from dsp_tools.models.project import Project
from dsp_tools.utils.connection import Connection


class User(Model): # pylint: disable=too-many-instance-attributes,too-many-public-methods
Expand Down
Expand Up @@ -2,10 +2,10 @@
import subprocess
from pathlib import Path

from dsp_tools.commands.project.create.project_create import create_project
from dsp_tools.commands.xmlupload.upload_config import UploadConfig
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
from dsp_tools.models.exceptions import UserError
from dsp_tools.utils.project_create import create_project
from dsp_tools.utils.xmlupload.upload_config import UploadConfig
from dsp_tools.utils.xmlupload.xmlupload import xmlupload


def _update_possibly_existing_repo(rosetta_folder: Path) -> bool:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8a05b2c

Please sign in to comment.