Skip to content
Snippets Groups Projects
Commit 6b062ea0 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

STY: style cleanups

parent 97970d8f
No related branches found
No related tags found
1 merge request!53Release 0.1
...@@ -21,3 +21,6 @@ python_requires = >=3.6 ...@@ -21,3 +21,6 @@ python_requires = >=3.6
[options.packages.find] [options.packages.find]
where = src where = src
[flake8]
per-file-ignores = __init__.py:F401
\ No newline at end of file
...@@ -76,13 +76,10 @@ class IdentifiableAdapter(object): ...@@ -76,13 +76,10 @@ class IdentifiableAdapter(object):
for p in ident.get_properties(): for p in ident.get_properties():
if p.datatype is not None and p.datatype.startswith("LIST<"): if p.datatype is not None and p.datatype.startswith("LIST<"):
for v in p.value: for v in p.value:
query_string += ("references " query_string += ("references " + str(v.id if isinstance(v, db.Entity)
+ str(v.id if isinstance(v, db.Entity) else v) + " AND ")
else v)
+ " AND ")
else: else:
query_string += ("'" + p.name + "'='" + str(get_value(p)) query_string += ("'" + p.name + "'='" + str(get_value(p)) + "' AND ")
+ "' AND ")
# remove the last AND # remove the last AND
return query_string[:-4] return query_string[:-4]
...@@ -120,8 +117,8 @@ class IdentifiableAdapter(object): ...@@ -120,8 +117,8 @@ class IdentifiableAdapter(object):
# check for multi properties in the record: # check for multi properties in the record:
for prop in property_name_list_A: for prop in property_name_list_A:
property_name_list_B.append(prop) property_name_list_B.append(prop)
if (len(set(property_name_list_B)) != len(property_name_list_B) or if (len(set(property_name_list_B)) != len(property_name_list_B) or len(
len(set(property_name_list_A)) != len(property_name_list_A)): set(property_name_list_A)) != len(property_name_list_A)):
raise RuntimeError("Multi properties used in identifiables can cause unpredictable results.") raise RuntimeError("Multi properties used in identifiables can cause unpredictable results.")
return identifiable return identifiable
...@@ -154,8 +151,6 @@ class IdentifiableAdapter(object): ...@@ -154,8 +151,6 @@ class IdentifiableAdapter(object):
return identified_record return identified_record
class LocalStorageIdentifiableAdapter(IdentifiableAdapter): class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
""" """
Identifiable adapter which can be used for unit tests. Identifiable adapter which can be used for unit tests.
...@@ -235,5 +230,3 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter): ...@@ -235,5 +230,3 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
if len(candidates) == 0: if len(candidates) == 0:
return None return None
return candidates[0] return candidates[0]
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
# ** end header # ** end header
# #
import caosdb as db
from collections import defaultdict from collections import defaultdict
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
# ** end header # ** end header
# #
from abc import abstractmethod
class StructureElement(object): class StructureElement(object):
""" base class for elements in the hierarchical data structure """ """ base class for elements in the hierarchical data structure """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment