diff options
-rw-r--r-- | bsie/__init__.py | 2 | ||||
-rw-r--r-- | bsie/apps/index.py | 28 | ||||
-rw-r--r-- | bsie/extractor/generic/constant.py | 2 | ||||
-rw-r--r-- | bsie/extractor/generic/path.py | 3 | ||||
-rw-r--r-- | bsie/extractor/generic/stat.py | 2 | ||||
-rw-r--r-- | test/apps/test_info.py | 1 |
6 files changed, 16 insertions, 22 deletions
diff --git a/bsie/__init__.py b/bsie/__init__.py index 96e6953..8d2308c 100644 --- a/bsie/__init__.py +++ b/bsie/__init__.py @@ -9,7 +9,7 @@ import collections import typing # constants -T_VERSION_INFO = collections.namedtuple('T_VERSION_INFO', ('major', 'minor', 'micro')) +T_VERSION_INFO = collections.namedtuple('T_VERSION_INFO', ('major', 'minor', 'micro')) # pylint: disable=invalid-name version_info = T_VERSION_INFO(0, 0, 1) # exports diff --git a/bsie/apps/index.py b/bsie/apps/index.py index e37684b..1dbfdd8 100644 --- a/bsie/apps/index.py +++ b/bsie/apps/index.py @@ -98,23 +98,17 @@ def main(argv): walk(print) return None - else: - # initialize bsfs - # NOTE: With presistent storages, the schema migration will be a seaparte operation. - # Here, we'd simply examine the schema and potentially discard more predicates. - store = bsfs.Open({ - 'Graph': { - 'user': args.user, - 'backend': { - 'SparqlStore': {}}, - }}) - store.migrate(bsie.schema) - # process files - def handle(node, pred, value): - store.node(node.node_type, node.uri).set(pred.uri, value) - walk(handle) - # return store - return store + # initialize bsfs + # NOTE: With presistent storages, the schema migration will be a seaparte operation. + # Here, we'd simply examine the schema and potentially discard more predicates. + store = bsfs.Open(bsfs.init_sparql_store(args.user)) + store.migrate(bsie.schema) + # process files + def handle(node, pred, value): + store.node(node.node_type, node.uri).set(pred.uri, value) + walk(handle) + # return store + return store diff --git a/bsie/extractor/generic/constant.py b/bsie/extractor/generic/constant.py index cdb2ef6..11384e6 100644 --- a/bsie/extractor/generic/constant.py +++ b/bsie/extractor/generic/constant.py @@ -35,7 +35,7 @@ class Constant(extractor.Extractor): super().__init__(bsfs.schema.Schema.from_string(extractor.SCHEMA_PREAMBLE + schema)) # NOTE: Raises a KeyError if the predicate is not part of the schema self._tuples = tuple((self.schema.predicate(p_uri), value) for p_uri, value in tuples) - # FIXME: use schema instance for value checking + # TODO: use schema instance for value checking def __eq__(self, other: typing.Any) -> bool: return super().__eq__(other) \ diff --git a/bsie/extractor/generic/path.py b/bsie/extractor/generic/path.py index 23ae80b..7018e12 100644 --- a/bsie/extractor/generic/path.py +++ b/bsie/extractor/generic/path.py @@ -62,7 +62,8 @@ class Path(extractor.Extractor): def __filename(self, path: str) -> typing.Optional[str]: try: return os.path.basename(path) - except Exception: # some error, skip. + except Exception: # pylint: disable=broad-except # we explicitly want to catch everything + # some error, skip # FIXME: some kind of error reporting (e.g. logging)? # Options: (a) Fail silently (current); (b) Skip and report to log; # (c) Raise ExtractorError (aborts extraction); (d) separate content type diff --git a/bsie/extractor/generic/stat.py b/bsie/extractor/generic/stat.py index 1dcfedf..0b9ce29 100644 --- a/bsie/extractor/generic/stat.py +++ b/bsie/extractor/generic/stat.py @@ -63,7 +63,7 @@ class Stat(extractor.Extractor): """Return the file size.""" try: return content.st_size - except Exception: + except Exception: # pylint: disable=broad-except # we explicitly want to catch everything # FIXME: some kind of error reporting (e.g. logging) return None diff --git a/test/apps/test_info.py b/test/apps/test_info.py index ad39c64..6f4d98f 100644 --- a/test/apps/test_info.py +++ b/test/apps/test_info.py @@ -8,7 +8,6 @@ Author: Matthias Baumgartner, 2022 import argparse import contextlib import io -import os import unittest # objects to test |