Skip to content

Commit

Permalink
fix pycodestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssarah committed Oct 26, 2023
1 parent df9b1f1 commit db7a865
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kgforge/core/archetypes/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _build_resolving_query(text, query_template, deprecated_property, filters, s
target_query_statements, target_query_filters = query_builder.build(
None, None, resolving_context, configured_target_filters
)

target_query_statements = ";\n ".join(target_query_statements)
target_query_filters = "\n ".join(target_query_filters)
first_filters = f"{first_filters} ; \n {target_query_statements}"
Expand Down
6 changes: 3 additions & 3 deletions kgforge/core/commons/sparql_query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class CategoryDataType(Enum):
LITERAL = "literal"

# FIXME: need to find a comprehensive way (different than list) to get all SPARQL reserved clauses


SPARQL_CLAUSES = [
"where",
"filter",
Expand Down Expand Up @@ -116,7 +118,6 @@ class CategoryDataType(Enum):

class SPARQLQueryBuilder(QueryBuilder):


@staticmethod
def build(
schema: Dict,
Expand Down Expand Up @@ -287,8 +288,7 @@ def replace(match: Match) -> str:
else:
v = (
ctx.get(m4, ":" + m4 if context.has_vocab() else None)
if str(m4).lower() not in SPARQL_CLAUSES
and not str(m4).startswith("https")
if str(m4).lower() not in SPARQL_CLAUSES and not str(m4).startswith("https")
else m4
)
if v is None:
Expand Down
2 changes: 1 addition & 1 deletion kgforge/specializations/models/demo_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def mapping(self, entity: str, source: str, type: Type[Mapping]) -> Mapping:
filename = f"{entity}.hjson"
filepath = Path(self.source, "mappings", source, type.__name__, filename)
if filepath.is_file():
return type.load(filepath) # TODO should be str
return type.load(filepath) # TODO should be str

raise ValueError("unrecognized entity type or source")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ def lookup_shape_from_node(self, node: URIRef) -> Optional[ShapeWrapper]:
# if not hasattr(shape_wrapper, "traverse"):
# shape_wrapper.traverse = types.MethodType(traverse, shape_wrapper)
# return shape_wrapper
return None
return None
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,3 @@ def _load_shape_and_reload_shapes_graph(self, resource_id: str):
self._load_shape(resource_id)
# reloads the shapes graph
self._shapes_graph = ShapesGraphWrapper(self._graph)

0 comments on commit db7a865

Please sign in to comment.