Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernaciak committed Nov 27, 2023
1 parent 2734589 commit 0584c6a
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions fusion/fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,18 @@ def list_products(
df["category"] = df.category.str.join(", ")
df["region"] = df.region.str.join(", ")
if not display_all_columns:
df = df[df.columns.intersection(
["identifier", "title", "region", "category", "status", "description"]
)]
df = df[
df.columns.intersection(
[
"identifier",
"title",
"region",
"category",
"status",
"description",
]
)
]

if max_results > -1:
df = df[0:max_results]
Expand Down Expand Up @@ -422,7 +431,18 @@ def list_dataset_attributes(
)

if not display_all_columns:
df = df[df.columns.intersection(["identifier", "title", "dataType", "isDatasetKey", "description", "source"])]
df = df[
df.columns.intersection(
[
"identifier",
"title",
"dataType",
"isDatasetKey",
"description",
"source",
]
)
]

if output:
print(tabulate(df, headers="keys", tablefmt="psql", maxcolwidths=30))
Expand Down Expand Up @@ -619,19 +639,20 @@ def download(

n_par = cpu_count(n_par)

valid_date_range = re.compile(r"^(\d{4}\d{2}\d{2})$|^((\d{4}\d{2}\d{2})?([:])(\d{4}\d{2}\d{2})?)$")
valid_date_range = re.compile(
r"^(\d{4}\d{2}\d{2})$|^((\d{4}\d{2}\d{2})?([:])(\d{4}\d{2}\d{2})?)$"
)

if valid_date_range.match(dt_str) or dt_str == 'latest':
if valid_date_range.match(dt_str) or dt_str == "latest":
required_series = self._resolve_distro_tuples(
dataset, dt_str, dataset_format, catalog
)
else:
#sample data is limited to csv
if dt_str == 'sample':
dataset_format = 'csv'
# sample data is limited to csv
if dt_str == "sample":
dataset_format = "csv"
required_series = [(catalog, dataset, dt_str, dataset_format)]


if not download_folder:
download_folder = self.download_folder

Expand Down Expand Up @@ -736,9 +757,9 @@ def to_df(
"""
catalog = self.__use_catalog(catalog)

#sample data is limited to csv
if dt_str == 'sample':
dataset_format = 'csv'
# sample data is limited to csv
if dt_str == "sample":
dataset_format = "csv"

n_par = cpu_count(n_par)
if not download_folder:
Expand Down Expand Up @@ -1076,7 +1097,11 @@ def listen_to_events(
kwargs = {"headers": {"Last-Event-ID": last_event_id}}

async def async_events():
""" Events sync function. """
"""Events sync function.
Returns:
None
"""
timeout = 1e100
session = await get_client(self.credentials, timeout=timeout)
async with sse_client.EventSource(
Expand Down Expand Up @@ -1104,7 +1129,7 @@ async def async_events():
def get_events(
self, last_event_id: str = None, catalog: str = None, in_background: bool = True
) -> Union[None, pd.DataFrame]:
""" Run server sent event listener and print out the new events. Keyboard terminate to stop.
"""Run server sent event listener and print out the new events. Keyboard terminate to stop.
Args:
last_event_id (str): id of the last event.
Expand Down

0 comments on commit 0584c6a

Please sign in to comment.