Skip to content

Commit

Permalink
Moving deprecated methods to compatibility layer
Browse files Browse the repository at this point in the history
  • Loading branch information
jllong-usgs committed Jul 7, 2017
1 parent 4ef5627 commit 04cef70
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 115 deletions.
61 changes: 61 additions & 0 deletions Searching ScienceBase with Pysb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3502,6 +3502,66 @@
"response"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found 3 items\n"
]
},
{
"data": {
"text/plain": [
"{'items': [{'_searchHit': {'_score': 8.0},\n",
" 'hasChildren': False,\n",
" 'id': '5942bfe8e4b0764e6c65fdf1',\n",
" 'link': {'rel': 'self',\n",
" 'url': 'https://www.sciencebase.gov/catalog/item/5942bfe8e4b0764e6c65fdf1'},\n",
" 'relatedItems': {'link': {'rel': 'related',\n",
" 'url': 'https://www.sciencebase.gov/catalog/itemLinks?itemId=5942bfe8e4b0764e6c65fdf1'}},\n",
" 'summary': 'Describes all data products for this project; shapefiles & tables (geodatabase), hydrographs (plots), and raw hydrologic data.',\n",
" 'title': 'Description of data products'},\n",
" {'_searchHit': {'_score': 8.0},\n",
" 'hasChildren': False,\n",
" 'id': '59414682e4b0764e6c64a4a3',\n",
" 'link': {'rel': 'self',\n",
" 'url': 'https://www.sciencebase.gov/catalog/item/59414682e4b0764e6c64a4a3'},\n",
" 'relatedItems': {'link': {'rel': 'related',\n",
" 'url': 'https://www.sciencebase.gov/catalog/itemLinks?itemId=59414682e4b0764e6c64a4a3'}},\n",
" 'summary': 'Gridded SSURGO (gSSURGO) is similar to the standard USDA-NRCS Soil Survey Geographic (SSURGO) Database product but in the format of an Environmental Systems Research Institute, Inc. (ESRI®) file geodatabase. gSSURGO contains all of the original soil attribute tables in SSURGO. Both SSURGO and gSSURGO are considered products of the National Cooperative Soil Survey (NCSS) partnership. The gridded map layer is in an ArcGIS file geodatabase in raster format. The raster and vector map data have a statewide extent. The raster map data have a 10-meter cell size that approximates the vector polygons in an Albers Equal Area projection. Each cell (and polygon) is linked to a map unit identifier called the map unit key. A unique map unit key [...]',\n",
" 'title': 'gSSURGO Data Layers'},\n",
" {'_searchHit': {'_score': 3.0},\n",
" 'hasChildren': False,\n",
" 'id': '59556e34e4b04e08be532c52',\n",
" 'link': {'rel': 'self',\n",
" 'url': 'https://www.sciencebase.gov/catalog/item/59556e34e4b04e08be532c52'},\n",
" 'relatedItems': {'link': {'rel': 'related',\n",
" 'url': 'https://www.sciencebase.gov/catalog/itemLinks?itemId=59556e34e4b04e08be532c52'}},\n",
" 'summary': 'Webinar recording of the LCC DMWG Monthly Meeting (6/29/2017).',\n",
" 'title': 'LCC DMWG Monthly Meeting (6/28/2017)'}],\n",
" 'selflink': {'rel': 'self',\n",
" 'url': 'https://www.sciencebase.gov/catalog/items?filter=dateRange%3D%7B%22dateType%22%3A%22creation%22%2C%22choice%22%3A%22month%22%7D&max=20'},\n",
" 'took': '71ms',\n",
" 'total': 3}"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Find all items created in the past month\n",
"response = sb.find_items({'filter': 'dateRange={\"dateType\":\"creation\",\"choice\":\"month\"}'})\n",
"print(\"Found %s items\" % response['total'])\n",
"response"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -5325,6 +5385,7 @@
"source": [
"## Search Result Control\n",
"* `sort` -- sort by `title`, `dateCreated`, `lastUpdated`, or `firstContact`\n",
"* `order` -- `asc` `desc`\n",
"* `max` -- max number of items to return per request. Note, ScienceBase enforces an upper limit of 1000.\n",
"* `offset` -- paging parameter. Return items beginning at `offset`.\n",
"* `fields` -- specifies which fields in the sbJSON to return, e.g. `title,summary,distributionLinks,webLinks,previewImage`\n",
Expand Down
116 changes: 1 addition & 115 deletions pysb/SbSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,118 +770,4 @@ def debug(self):
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True

#
# Backwards compatibility section. May be removed in future releases.
#
def isLoggedIn(self):
"""Deprecated, use is_logged_in instead"""
return self.is_logged_in()

def getSessionInfo(self):
"""Deprecated, use get_session_info instead"""
return self.get_session_info()

def getSbItem(self, item_id):
"""Deprecated, use get_item instead"""
return self.get_item(item_id)

def createSbItem(self, item_json):
"""Deprecated, use create_item instead"""
return self.create_item(item_json)

def updateSbItem(self, item_json):
"""Deprecated, use update_item instead"""
return self.update_item(item_json)

def deleteSbItem(self, item_json):
"""Deprecated, use delete_item instead"""
return self.delete_item(item_json)

def undeleteSbItem(self, item_id):
"""Deprecated, use undelete_item instead"""
return self.undelete_item(item_id)

def deleteSbItems(self, item_ids):
"""Deprecated, use delete_items instead"""
return self.delete_items(item_ids)

def moveSbItem(self, item_id, parent_id):
"""Deprecated, use move_item instead"""
return self.move_item(item_id, parent_id)

def moveSbItems(self, item_ids, parent_id):
"""Deprecated, use move_items instead"""
return self.move_items(item_ids, parent_id)

def uploadFileToItem(self, item, filename):
"""Deprecated, use upload_file_to_item instead"""
return self.upload_file_to_item(item, filename)

def uploadFileAndCreateItem(self, parent_id, filename):
"""Deprecated, use upload_file_and_create_item instead"""
return self.upload_file_and_create_item(parent_id, filename)

def uploadFilesAndCreateItem(self, parent_id, filenames):
"""Deprecated, use upload_files_and_create_item instead"""
return self.upload_files_and_create_item(parent_id, filenames)

def uploadFilesAndUpdateItem(self, item, filenames):
"""Deprecated, use upload_files_and_update_item instead"""
return self.upload_files_and_update_item(item, filenames)

def uploadFilesAndUpsertItem(self, item, filenames):
"""Deprecated, use upload_files_and_upsert_item instead"""
return self.upload_files_and_upsert_item(item, filenames)

def uploadFile(self, filename, mimetype=None):
"""Deprecated, use upload_file instead"""
return self.upload_file(filename, mimetype)

def replaceFile(self, filename, item):
"""Deprecated, use replace_file instead"""
return self.replace_file(filename, item)

def getItemFilesZip(self, item, destination='.'):
"""Deprecated, use get_item_files_zip instead"""
return self.get_item_files_zip(item, destination)

def getItemFileInfo(self, item):
"""Deprecated, use get_item_file_info instead"""
return self.get_item_file_info(item)

def downloadFile(self, url, local_filename, destination='.'):
"""Deprecated, use download_file instead"""
return self.download_file(url, local_filename, destination)

def getItemFiles(self, item, destination='.'):
"""Deprecated, use get_item_files instead"""
return self.get_item_files(item, destination)

def getMyItemsId(self):
"""Deprecated, use get_my_items_id instead"""
return self.get_my_items_id()

def getChildIds(self, parent_id):
"""Deprecated, use get_child_ids instead"""
return self.get_child_ids(parent_id)

def getNetCDFOPeNDAPInfoFacet(self, url):
"""Deprecated, use get_NetCDFOPeNDAP_info_facet instead"""
return self.get_NetCDFOPeNDAP_info_facet(url)

def findSbItems(self, params):
"""Deprecated, use find_items instead"""
return self.find_items(params)

def findSbItemsByAnytext(self, text):
"""Deprecated, use find_items_by_any_text instead"""
return self.find_items_by_any_text(text)

def findSbItemsByTitle(self, text):
"""Deprecated, use find_items_by_title instead"""
return self.find_items_by_title(text)

def getJson(self, response):
"""Deprecated, use get_json instead"""
return self.get_json(response)

Loading

0 comments on commit 04cef70

Please sign in to comment.