Skip to content
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

Merged
merged 11 commits into from
May 24, 2018
Merged

API cleanup #63

merged 11 commits into from
May 24, 2018

Conversation

AaronV77
Copy link
Collaborator

Removed miscellaneous code from util and added comments to the util misc.py file.

@AaronV77
Copy link
Collaborator Author

Fixes #55

@@ -19,32 +19,67 @@
from uuid import uuid4, UUID
import quest

the_providers = None
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon

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

@@ -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

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

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

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

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

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

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

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

import pandas as pd
import importlib
import inspect
import pkgutil

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

import importlib
import inspect
import pkgutil
import quest

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

import inspect
import pkgutil
import quest
import os

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

import pkgutil
import quest
import os
import re

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

import re

try:
import simplejson as json

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

@AaronV77 AaronV77 self-assigned this May 16, 2018
@AaronV77 AaronV77 added enhancement New feature or request refactor labels May 16, 2018
@AaronV77 AaronV77 added this to the Quest 2.6 Release milestone May 16, 2018
@@ -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)

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)

@@ -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)

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)

@@ -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)

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)

@@ -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)

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)

@@ -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)

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)

@@ -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)

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)

@coveralls
Copy link

coveralls commented May 23, 2018

Pull Request Test Coverage Report for Build 187

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 61 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+1.7%) to 68.892%

Files with Coverage Reduction New Missed Lines %
/Users/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/quest/api/metadata.py 12 84.31%
/Users/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/quest/api/manage.py 15 88.24%
/Users/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/quest/util/misc.py 34 78.26%
Totals Coverage Status
Change from base Build 181: 1.7%
Covered Lines: 1455
Relevant Lines: 2112

💛 - Coveralls


Args:
update (bool):
whether to update cached files.
param1 (string): A string that is a filename.
Copy link
Member

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

@AaronV77
Copy link
Collaborator Author

@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.

@sdc50
Copy link
Member

sdc50 commented May 24, 2018

@AaronV77 can you tell me what the method names are?

@AaronV77
Copy link
Collaborator Author

@sdc50 they are: classify_uris, and build_smtk.

@AaronV77 AaronV77 closed this May 24, 2018
@AaronV77 AaronV77 reopened this May 24, 2018

classified by resource type
Args:
uris (?):
Copy link
Member

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.  
    

"""Build smtk file from the template, kwargs, and stream as a string.

Args:
smtk_subdir (string):
Copy link
Member

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.


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'.

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)

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)

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)

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.

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)

@@ -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.()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E999 SyntaxError: invalid syntax

@sdc50 sdc50 merged commit a7f15e1 into erdc:master May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants