-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb70023
commit cb9057f
Showing
5 changed files
with
45 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
"""Helper functions for the Connect module.""" | ||
|
||
from itertools import product | ||
|
||
def flatten_dict(**d): | ||
"""Flatten a dictionary (one level).""" | ||
"""Flatten a dictionary (one level).""" | ||
|
||
keys, values = zip(*d.items()) | ||
for instance in product(*(x if isinstance(x, list) else [x] for x in values)): | ||
yield dict(list(zip(keys, instance))) | ||
keys, values = zip(*d.items()) | ||
for instance in product(*(x if isinstance(x, list) else [x] for x in values)): | ||
yield dict(list(zip(keys, instance))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
"""Parsing methods for different data types""" | ||
|
||
import xmltodict | ||
|
||
def parse_xml(xml): | ||
def parse_xml(xml: str) -> dict: | ||
"""Parses xml string to dict""" | ||
try: | ||
obj = xmltodict.parse(xml) | ||
except: | ||
print("Warning: Could not parse xml. Check returned xml string in response cache.") | ||
return obj | ||
|
||
def parse_html(html): | ||
return html | ||
def parse_html(html: str) -> str: | ||
"""Returns html as string""" | ||
return html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
supabase | ||
supabase | ||
xmltodict |