Skip to content
Snippets Groups Projects
Commit 34763f48 authored by John Swinbank's avatar John Swinbank
Browse files

Replace warning() with warnings.warn()

parent 1822ae15
No related branches found
No related tags found
1 merge request!4Replace warning() with warnings.warn()
...@@ -5,6 +5,7 @@ import getpass ...@@ -5,6 +5,7 @@ import getpass
import pandas as pd import pandas as pd
from typing import Union, Optional from typing import Union, Optional
from warnings import warn
class shopping_client: class shopping_client:
...@@ -124,7 +125,7 @@ class shopping_client: ...@@ -124,7 +125,7 @@ class shopping_client:
name: data.to_frame().T if data.ndim < 2 else data.T name: data.to_frame().T if data.ndim < 2 else data.T
for name, data in converted_basket.items() for name, data in converted_basket.items()
} }
warning( warn(
"No archive connectors specified - could not convert any basket items to Pandas DataFrame" "No archive connectors specified - could not convert any basket items to Pandas DataFrame"
) )
return self.basket return self.basket
......
...@@ -5,6 +5,7 @@ import getpass ...@@ -5,6 +5,7 @@ import getpass
import pandas as pd import pandas as pd
from typing import Union, Optional from typing import Union, Optional
from warnings import warn
from panoptes_client import Panoptes, Project, Workflow from panoptes_client import Panoptes, Project, Workflow
from panoptes_client.panoptes import PanoptesAPIException from panoptes_client.panoptes import PanoptesAPIException
...@@ -135,7 +136,7 @@ class zooniverse: ...@@ -135,7 +136,7 @@ class zooniverse:
) )
else: else:
if not generate: if not generate:
warning( warn(
"Requested resource is not available and you have specified generate==False" "Requested resource is not available and you have specified generate==False"
) )
return None return None
...@@ -143,7 +144,7 @@ class zooniverse: ...@@ -143,7 +144,7 @@ class zooniverse:
print("Generating requested export...") print("Generating requested export...")
response = self.generate(item, wait) response = self.generate(item, wait)
if response is None: if response is None:
warning("No data immediately available. Returning NoneType") warn("No data immediately available. Returning NoneType")
return None return None
if response.ok: if response.ok:
if convert_to_pandas: if convert_to_pandas:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment