diff options
Diffstat (limited to 'bsfs/graph')
-rw-r--r-- | bsfs/graph/nodes.py | 2 | ||||
-rw-r--r-- | bsfs/graph/resolve.py | 1 | ||||
-rw-r--r-- | bsfs/graph/result.py | 2 | ||||
-rw-r--r-- | bsfs/graph/walk.py | 4 |
4 files changed, 7 insertions, 2 deletions
diff --git a/bsfs/graph/nodes.py b/bsfs/graph/nodes.py index 9990714..bc71a32 100644 --- a/bsfs/graph/nodes.py +++ b/bsfs/graph/nodes.py @@ -199,6 +199,7 @@ class Nodes(): """Get values or nodes at *paths*. Return an iterator (view=list) or a dict (view=dict) over the results. """ + # FIXME: user-provided Fetch query AST? # check args if len(paths) == 0: raise AttributeError('expected at least one path, found none') @@ -345,6 +346,7 @@ class Nodes(): elif isinstance(pred.range, bsc.Node): # check value type + # FIXME: value could be a set of Nodes if not isinstance(value, Nodes): raise TypeError(value) # value's node_type must be a subclass of the predicate's range diff --git a/bsfs/graph/resolve.py b/bsfs/graph/resolve.py index 00b778b..4677401 100644 --- a/bsfs/graph/resolve.py +++ b/bsfs/graph/resolve.py @@ -41,6 +41,7 @@ class Filter(): self.schema = schema def __call__(self, root_type: bsc.Node, node: ast.filter.FilterExpression): + # FIXME: node can be None! return self._parse_filter_expression(root_type, node) def _parse_filter_expression( diff --git a/bsfs/graph/result.py b/bsfs/graph/result.py index 00607f4..31822f1 100644 --- a/bsfs/graph/result.py +++ b/bsfs/graph/result.py @@ -109,10 +109,12 @@ def to_dict_view( # FIXME: Combine multiple Nodes instances into one? # convert defaultdict to ordinary dict + # pylint: disable=too-many-boolean-expressions if not node and not path and not value \ and len(unique_paths) > 0 and one_node and one_path \ and len(data) == 0: return default + # pylint: enable=too-many-boolean-expressions if not node and not path: return data if node ^ path: diff --git a/bsfs/graph/walk.py b/bsfs/graph/walk.py index 63ef5e9..1b1cfa0 100644 --- a/bsfs/graph/walk.py +++ b/bsfs/graph/walk.py @@ -88,9 +88,9 @@ class Walk(abc.Hashable, abc.Callable): # type: ignore [misc] # invalid base cla if pred.uri.get('fragment', None) == name ) if len(predicates) == 0: # no fragment found for name - raise ValueError(f'no available predicate matches {name}') + raise ValueError(f'no available predicate matches {name}') # FIXME: Custom exception if len(predicates) > 1: # ambiguous name - raise ValueError(f'{name} matches multiple predicates') + raise ValueError(f'{name} matches multiple predicates') # FIXME: Custom exception # append predicate to walk return predicates # type: ignore [return-value] # size is one |