Skip to content

Commit

Permalink
chore: remove unused code (DEV-2950) (#638)
Browse files Browse the repository at this point in the history
Co-authored-by: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com>
  • Loading branch information
BalduinLandolt and jnussbaum committed Nov 15, 2023
1 parent 803c9f6 commit fbbafec
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 1,164 deletions.
3 changes: 0 additions & 3 deletions pyproject.toml
Expand Up @@ -110,9 +110,6 @@ ignore_missing_imports = true # TODO: deac
show_column_numbers = true
strict = true
exclude = [
"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
Expand Down
8 changes: 3 additions & 5 deletions src/dsp_tools/commands/excel2xml/excel2xml_lib.py
Expand Up @@ -16,10 +16,10 @@
from lxml.builder import E # pylint: disable=no-name-in-module

from dsp_tools.commands.excel2xml.propertyelement import PropertyElement
from dsp_tools.commands.xmlupload.models.value import UriValue
from dsp_tools.models.exceptions import BaseError
from dsp_tools.models.helpers import DateTimeStamp
from dsp_tools.utils.shared import check_notna, simplify_name, validate_xml_against_schema
from dsp_tools.utils.uri_util import is_uri

xml_namespace_map = {None: "https://dasch.swiss/schema", "xsi": "http://www.w3.org/2001/XMLSchema-instance"}

Expand Down Expand Up @@ -1419,13 +1419,11 @@ def make_uri_prop(

# check value type
for val in values:
try:
UriValue(str(val.value))
except BaseError:
if not is_uri(str(val.value)):
raise BaseError(
f"Failed validation in resource '{calling_resource}', property '{name}': "
f"'{val.value}' is not a valid URI."
) from None
)

# make xml structure of the valid values
prop_ = etree.Element(
Expand Down
9 changes: 5 additions & 4 deletions src/dsp_tools/commands/xmlupload/models/permission.py
@@ -1,4 +1,5 @@
# pylint: disable=missing-class-docstring,missing-function-docstring
from __future__ import annotations

from enum import Enum, unique
from typing import Optional, Union
Expand All @@ -14,7 +15,7 @@ class PermissionValue(Enum):
D = 8
CR = 16

def __str__(self):
def __str__(self) -> str:
tmp = {
1: "RV",
2: "V",
Expand All @@ -26,7 +27,7 @@ def __str__(self):


class Permissions:
_permissions: Union[dict[PermissionValue, list[str]], None]
_permissions: dict[PermissionValue, list[str]]

def __init__(self, permissions: Optional[dict[PermissionValue, list[str]]] = None):
if permissions is None:
Expand Down Expand Up @@ -57,7 +58,7 @@ def __str__(self) -> str:
tmpstr += str(permission) + " " + ",".join(groups)
return tmpstr

def add(self, key: PermissionValue, val: str):
def add(self, key: PermissionValue, val: str) -> None:
if self._permissions.get(key) is None:
self._permissions[key] = [val]
else:
Expand All @@ -72,7 +73,7 @@ def toJsonLdObj(self) -> str:
return tmpstr

@classmethod
def fromString(cls, permstr: str):
def fromString(cls, permstr: str) -> Permissions:
tmpstr = permstr.split("|")
permissions: dict[PermissionValue, list[str]] = {}
for s in tmpstr:
Expand Down

0 comments on commit fbbafec

Please sign in to comment.