-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API cleanup #63
API cleanup #63
Conversation
Fixes #55 |
quest/util/misc.py
Outdated
@@ -19,32 +19,67 @@ | |||
from uuid import uuid4, UUID | |||
import quest | |||
|
|||
the_providers = None | |||
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'LineString' from line 1
F811 redefinition of unused 'Point' from line 1
F811 redefinition of unused 'Polygon' from line 1
F811 redefinition of unused 'Feature' from line 1
F811 redefinition of unused 'FeatureCollection' from line 1
F811 redefinition of unused 'MultiPolygon' from line 1
quest/util/misc.py
Outdated
@@ -19,32 +19,67 @@ | |||
from uuid import uuid4, UUID | |||
import quest | |||
|
|||
the_providers = None | |||
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon | |||
from jinja2 import Environment, FileSystemLoader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'Environment' from line 3
F811 redefinition of unused 'FileSystemLoader' from line 3
quest/util/misc.py
Outdated
the_providers = None | ||
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon | ||
from jinja2 import Environment, FileSystemLoader | ||
from past.builtins import basestring # for python 2 compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'basestring' from line 13
quest/util/misc.py
Outdated
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon | ||
from jinja2 import Environment, FileSystemLoader | ||
from past.builtins import basestring # for python 2 compatibility | ||
from .config import get_settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'get_settings' from line 4
quest/util/misc.py
Outdated
from jinja2 import Environment, FileSystemLoader | ||
from past.builtins import basestring # for python 2 compatibility | ||
from .config import get_settings | ||
from .. import get_pkg_data_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'get_pkg_data_path' from line 5
quest/util/misc.py
Outdated
import pandas as pd | ||
import importlib | ||
import inspect | ||
import pkgutil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F401 'pkgutil' imported but unused
quest/util/misc.py
Outdated
import importlib | ||
import inspect | ||
import pkgutil | ||
import quest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'quest' from line 20
F401 'quest' imported but unused
quest/util/misc.py
Outdated
import inspect | ||
import pkgutil | ||
import quest | ||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'os' from line 6
quest/util/misc.py
Outdated
import pkgutil | ||
import quest | ||
import os | ||
import re |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 're' from line 9
quest/util/misc.py
Outdated
import re | ||
|
||
try: | ||
import simplejson as json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F811 redefinition of unused 'json' from line 17
quest/api/manage.py
Outdated
@@ -42,7 +42,7 @@ def delete(uris): | |||
return True | |||
|
|||
# group uris by type | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['providers'], require_same_type=True) | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['services', 'publishers'], require_same_type=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (123 > 120 characters)
quest/api/manage.py
Outdated
@@ -88,7 +88,7 @@ def move(uris, destination_collection, as_dataframe=None, expand=None): | |||
if not uris: | |||
return {} | |||
|
|||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['providers', 'collections'], require_same_type=True) | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['services', 'publishers', 'collections'], require_same_type=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (138 > 120 characters)
quest/api/manage.py
Outdated
@@ -137,7 +137,7 @@ def copy(uris, destination_collection, as_dataframe=None, expand=None): | |||
if not uris: | |||
return {} | |||
|
|||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['providers', 'collections'], require_same_type=True) | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['services', 'publishers', 'collections'], require_same_type=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (138 > 120 characters)
quest/api/metadata.py
Outdated
@@ -122,7 +119,7 @@ def update_metadata(uris, display_name=None, description=None, | |||
metadata at each uri keyed on uris | |||
""" | |||
# group uris by type | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['providers'], require_same_type=True) | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['services', 'publishers'], require_same_type=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (123 > 120 characters)
quest/api/manage.py
Outdated
@@ -137,7 +137,7 @@ def copy(uris, destination_collection, as_dataframe=None, expand=None): | |||
if not uris: | |||
return {} | |||
|
|||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['providers', 'collections'], require_same_type=True) | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['services', 'publishers', 'collections'], require_same_type=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (138 > 120 characters)
quest/api/manage.py
Outdated
@@ -137,7 +137,7 @@ def copy(uris, destination_collection, as_dataframe=None, expand=None): | |||
if not uris: | |||
return {} | |||
|
|||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['providers', 'collections'], require_same_type=True) | |||
grouped_uris = util.classify_uris(uris, as_dataframe=False, exclude=['services', 'publishers', 'collections'], require_same_type=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (138 > 120 characters)
Pull Request Test Coverage Report for Build 187
💛 - Coveralls |
quest/util/misc.py
Outdated
|
||
Args: | ||
update (bool): | ||
whether to update cached files. | ||
param1 (string): A string that is a filename. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc strings should use the actual argument name (i.e. path
and mkdir
) not param1
and param2
…e to pair up with the svc:: uri.
@sdc50 There are one or two methods that don't have anything really filled out in them, can you tell me what to put for some of these? Thanks. |
@AaronV77 can you tell me what the method names are? |
@sdc50 they are: classify_uris, and build_smtk. |
quest/util/misc.py
Outdated
|
||
classified by resource type | ||
Args: | ||
uris (?): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
uris (list or string): List of Quest uris to classify into the following types: 'collections', 'services', 'publishers', 'datasets', or 'features'.
-
grouped (bool): If True returns Pandas GroupBy object (see: https://pandas.pydata.org/pandas-docs/stable/groupby.html)
-
as_dataframe (bool): If True returns a Pandas DataFrame
-
require_same_type (bool): If True raises a `ValueError` if uris of more than one type are passed in.
-
exclude (list or string): List of uri types to not allow. If a uri of an excluded type is passed in then a `ValueError` will be raised.
quest/util/misc.py
Outdated
"""Build smtk file from the template, kwargs, and stream as a string. | ||
|
||
Args: | ||
smtk_subdir (string): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smtk_subdir (string): subdirectory where SMTK template is stored.
smtk_filename (string): name of the SMTK template file.
kwargs (kwargs): Keyword arguments to render the SMTK template with.
quest/util/misc.py
Outdated
|
||
classified by resource type | ||
Args: | ||
uris (list or string): List of Quest uris to classify into the following types: 'collections', 'services', 'publishers', 'datasets', or 'features'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (155 > 120 characters)
quest/util/misc.py
Outdated
classified by resource type | ||
Args: | ||
uris (list or string): List of Quest uris to classify into the following types: 'collections', 'services', 'publishers', 'datasets', or 'features'. | ||
grouped (bool): If True returns Pandas GroupBy object (see: https://pandas.pydata.org/pandas-docs/stable/groupby.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (126 > 120 characters)
quest/util/misc.py
Outdated
grouped (bool): If True returns Pandas GroupBy object (see: https://pandas.pydata.org/pandas-docs/stable/groupby.html) | ||
as_dataframe (bool): If True returns a Pandas DataFrame | ||
require_same_type (bool): If True raises a `ValueError` if uris of more than one type are passed in. | ||
exclude (list or string): List of uri types to not allow. If a uri of an excluded type is passed in then a `ValueError` will be raised. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (143 > 120 characters)
quest_io_plugins/timeseries-hdf5.py
Outdated
@@ -21,7 +21,7 @@ def open(self, path, fmt=None): | |||
return dataframe | |||
|
|||
# convert index to datetime in case it is a PeriodIndex | |||
dataframe.index = dataframe.index.to_datetime() | |||
dataframe.index = dataframe.index.() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E999 SyntaxError: invalid syntax
Removed miscellaneous code from util and added comments to the util misc.py file.