IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit e72b452e authored by Emi Simpson's avatar Emi Simpson
Browse files

Update _validate_source_types to work with parameterized sources

parent 84afc747
......@@ -74,11 +74,20 @@ class Dashboard(ABC):
It's recommended to use this method in the implementation of :func:`produce_for`
in order to validate a project.
"""
# TODO update the documentation to explain what's going on here
def match_types(subject: str, pattern: str) -> bool:
type1_parts = subject.split(':')
type2_parts = pattern.split(':')
print(type1_parts, type2_parts)
return type1_parts[0] == type2_parts[0] and\
set(type1_parts[1:]) >= set(type2_parts[1:])
return any(
True
for parent_source in project.get_data_sources(c)
for source in parent_source.expand_source()
if source.source_type in required_types
for pattern in required_types
if match_types(source.source_type, pattern)
)
def load(self, es: Elasticsearch, query_machine: QueryMachine) -> None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment