Skip to content

Commit

Permalink
#141: Remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Apr 12, 2021
1 parent 9a6d7bc commit 0322a99
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions datagateway_api/common/icat/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from icat.exception import ICATInternalError, ICATValidationError
from icat.query import Query

from datagateway_api.common.constants import Constants
from datagateway_api.common.date_handler import DateHandler
from datagateway_api.common.exceptions import FilterError, PythonICATError
from datagateway_api.common.exceptions import PythonICATError


log = logging.getLogger()
Expand Down Expand Up @@ -141,36 +140,6 @@ def execute_query(self, client, return_json_formattable=False):
def get_distinct_attributes(self):
return self.query.attributes

def iterate_query_conditions_for_distinctiveness(self):
distinct_attributes = []
for attribute_name, where_statement in self.query.conditions.items():
if isinstance(where_statement, list):
for sub_value in where_statement:
self.check_attribute_name_for_distinct(
distinct_attributes, attribute_name, sub_value,
)
elif isinstance(where_statement, str):
self.check_attribute_name_for_distinct(
distinct_attributes, attribute_name, where_statement,
)

return distinct_attributes

def check_attribute_name_for_distinct(self, attribute_list, key, value):
"""
Check the attribute name to see if its associated value is used to signify the
attribute is requested in a distinct filter and if so, append it to the list of
attribute names
:param key: Name of an attribute
:type key: :class:`str`
:param value: Expression that should be applied to the associated attribute
e.g. "= 'Metadata'"
:type value: :class:`str`
"""
if value == Constants.PYTHON_ICAT_DISTNCT_CONDITION:
attribute_list.append(key)

def entity_to_dict(self, entity, includes, distinct_fields=None):
"""
This expands on Python ICAT's implementation of `icat.entity.Entity.as_dict()`
Expand Down

0 comments on commit 0322a99

Please sign in to comment.