aboutsummaryrefslogtreecommitdiffstats
path: root/bsie/utils
diff options
context:
space:
mode:
Diffstat (limited to 'bsie/utils')
-rw-r--r--bsie/utils/__init__.py4
-rw-r--r--bsie/utils/bsfs.py4
-rw-r--r--bsie/utils/errors.py6
-rw-r--r--bsie/utils/filematcher/__init__.py5
-rw-r--r--bsie/utils/filematcher/matcher.py5
-rw-r--r--bsie/utils/filematcher/parser.py5
-rw-r--r--bsie/utils/loading.py9
-rw-r--r--bsie/utils/namespaces.py32
-rw-r--r--bsie/utils/node.py4
9 files changed, 23 insertions, 51 deletions
diff --git a/bsie/utils/__init__.py b/bsie/utils/__init__.py
index 9cb60ed..18c8db7 100644
--- a/bsie/utils/__init__.py
+++ b/bsie/utils/__init__.py
@@ -1,8 +1,4 @@
"""Common tools and definitions.
-
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
"""
# standard imports
import typing
diff --git a/bsie/utils/bsfs.py b/bsie/utils/bsfs.py
index ef5db31..fc045cc 100644
--- a/bsie/utils/bsfs.py
+++ b/bsie/utils/bsfs.py
@@ -1,8 +1,4 @@
"""BSFS bridge, provides BSFS bindings for BSIE.
-
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
"""
# standard imports
import typing
diff --git a/bsie/utils/errors.py b/bsie/utils/errors.py
index 8133cd4..7c7e6ed 100644
--- a/bsie/utils/errors.py
+++ b/bsie/utils/errors.py
@@ -1,8 +1,4 @@
"""Common BSIE exceptions.
-
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
"""
# standard imports
import typing
@@ -42,7 +38,7 @@ class UnreachableError(ProgrammingError):
class ParserError(_BSIEError):
"""Failed to parse due to invalid syntax or structures."""
-class UnsupportedFileFormatError(ReaderError):
+class UnsupportedFileFormatError(_BSIEError):
"""Failed to read a file format."""
## EOF ##
diff --git a/bsie/utils/filematcher/__init__.py b/bsie/utils/filematcher/__init__.py
index 1e23e4e..908de78 100644
--- a/bsie/utils/filematcher/__init__.py
+++ b/bsie/utils/filematcher/__init__.py
@@ -1,9 +1,4 @@
-"""
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
-"""
# standard imports
import typing
diff --git a/bsie/utils/filematcher/matcher.py b/bsie/utils/filematcher/matcher.py
index a279a4b..1fa308e 100644
--- a/bsie/utils/filematcher/matcher.py
+++ b/bsie/utils/filematcher/matcher.py
@@ -1,9 +1,4 @@
-"""
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2021
-"""
# standard imports
from collections.abc import Callable, Collection, Hashable
import abc
diff --git a/bsie/utils/filematcher/parser.py b/bsie/utils/filematcher/parser.py
index 2f82875..dc28a0d 100644
--- a/bsie/utils/filematcher/parser.py
+++ b/bsie/utils/filematcher/parser.py
@@ -1,9 +1,4 @@
-"""
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2021
-"""
# standard imports
import typing
diff --git a/bsie/utils/loading.py b/bsie/utils/loading.py
index eb05c35..58202d1 100644
--- a/bsie/utils/loading.py
+++ b/bsie/utils/loading.py
@@ -1,9 +1,4 @@
-"""
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
-"""
# standard imports
import importlib
import typing
@@ -27,14 +22,14 @@ def safe_load(module_name: str, class_name: str):
module = importlib.import_module(module_name)
except Exception as err:
# cannot import module
- raise errors.LoaderError(f'cannot load module {module_name}') from err
+ raise errors.LoaderError(f'cannot load module {module_name} ({err})') from err
try:
# get the class from the module
cls = getattr(module, class_name)
except Exception as err:
# cannot find the class
- raise errors.LoaderError(f'cannot load class {class_name} from module {module_name}') from err
+ raise errors.LoaderError(f'cannot load class {class_name} from module {module_name} ({err})') from err
return cls
diff --git a/bsie/utils/namespaces.py b/bsie/utils/namespaces.py
index 0af8ece..4a66048 100644
--- a/bsie/utils/namespaces.py
+++ b/bsie/utils/namespaces.py
@@ -1,8 +1,4 @@
"""Default namespaces used throughout BSIE.
-
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
"""
# standard imports
import typing
@@ -10,19 +6,31 @@ import typing
# inner-module imports
from . import bsfs as _bsfs
-# constants
-bse = _bsfs.Namespace('http://bsfs.ai/schema/Entity')
-bsf = _bsfs.Namespace('http://ie.bsfs.ai/schema/Feature')
-bsfs = _bsfs.Namespace('http://bsfs.ai/schema', fsep='/')
-bsm = _bsfs.Namespace('http://bsfs.ai/schema/Meta')
-bsp = _bsfs.Namespace('http://bsfs.ai/schema/Preview')
-xsd = _bsfs.Namespace('http://www.w3.org/2001/XMLSchema')
+# generic namespaces
+xsd = _bsfs.Namespace('http://www.w3.org/2001/XMLSchema')()
+
+# core bsfs/bsie namespaces
+bsfs = _bsfs.Namespace('https://schema.bsfs.io/core')
+bsie = _bsfs.Namespace('https://schema.bsfs.io/ie')
+
+# auxiliary namespaces
+bsd = bsie.distance()
+bse = bsie.Node.Entity()
+bsf = bsie.Literal.Array.Feature
+bsl = bsfs.Literal
+bsn = bsie.Node
+bsp = bsie.Node.Preview()
# export
__all__: typing.Sequence[str] = (
+ 'bsd',
'bse',
+ 'bsf',
'bsfs',
- 'bsm',
+ 'bsie',
+ 'bsl',
+ 'bsl',
+ 'bsn',
'bsp',
'xsd',
)
diff --git a/bsie/utils/node.py b/bsie/utils/node.py
index aa62c06..fa34b2e 100644
--- a/bsie/utils/node.py
+++ b/bsie/utils/node.py
@@ -1,8 +1,4 @@
"""Lighweight Node to bridge to BSFS.
-
-Part of the bsie module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
"""
# standard imports
import typing