Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _editions(isbn, data):
"""Return the records from the parsed response."""
try:
# put the selected data in records
records = [ib['isbn'][0] for ib in data['list']]
except: # pragma: no cover
try:
extra = data['stat']
LOGGER.debug('DataWrongShapeError for %s with data %s',
isbn, extra)
except:
raise DataWrongShapeError(isbn)
raise NoDataForSelectorError(isbn)
return records
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
try:
# put the selected data in records
recs = data['list'][0]
except: # pragma: no cover
try:
extra = data['stat']
LOGGER.debug('DataWrongShapeError for %s with data %s',
isbn, extra)
except:
raise DataWrongShapeError(isbn)
raise NoDataForSelectorError(isbn)
# map canonical <- records
return _mapper(isbn, recs)
def _records(words, data):
"""Classify (canonically) the parsed data."""
try:
# put the selected data in records
records = [d['volumeInfo'] for d in data['items']]
except: # pragma: no cover
try:
extra = data['stat']
LOGGER.debug('DataWrongShapeError for %s with data %s',
words, extra)
except:
raise DataWrongShapeError(words)
raise NoDataForSelectorError(words)
# map canonical <- records
return [_mapper(r) for r in records if _mapper(r)]
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
try:
# put the selected data in records
records = data['data'][0]
except:
try:
extra = data['error']
LOGGER.debug('DataWrongShapeError for %s with data %s',
isbn, extra)
except:
raise DataWrongShapeError(isbn)
raise NoDataForSelectorError(isbn)
# map canonical <- records
return _mapper(isbn, records)
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
try:
# put the selected data in records
records = data['items'][0]['volumeInfo']
except: # pragma: no cover
try:
extra = data['stat']
LOGGER.debug('DataWrongShapeError for %s with data %s',
isbn, extra)
except:
raise DataWrongShapeError(isbn)
raise NoDataForSelectorError(isbn)
# map canonical <- records
return _mapper(isbn, records)