Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ twiddle
elbaschid
commadelimited
isms
scottcode
26 changes: 25 additions & 1 deletion googleplaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

__all__ = ['GooglePlaces', 'GooglePlacesError', 'GooglePlacesAttributeError',
'geocode_location']
__version__ = '1.0.0'
__version__ = '1.0.1'
__author__ = 'Samuel Adu'
__email__ = 'sam@slimkrazy.com'

Expand Down Expand Up @@ -575,6 +575,13 @@ def raw_response(self):
def predictions(self):
return self._predictions

def __repr__(self):
"""Return a string representation stating number of predictions."""
return '<{} with {} prediction(s)>'.format(
self.__class__.__name__,
len(self.predictions)
)


class Prediction(object):
"""
Expand Down Expand Up @@ -709,6 +716,10 @@ def _validate_status(self):
'an explicit call to get_details() is made.')
raise GooglePlacesAttributeError(error_detail)

def __repr__(self):
""" Return a string representation with description. """
return '<{} description="{}">'.format(self.__class__.__name__, self.description)


class GooglePlacesSearchResult(object):
"""
Expand Down Expand Up @@ -748,6 +759,10 @@ def has_attributions(self):
"""Returns a flag denoting if the response had any html attributions."""
return len(self.html_attributions) > 0

def __repr__(self):
""" Return a string representation stating the number of results."""
return '<{} with {} result(s)>'.format(self.__class__.__name__, len(self.places))


class Place(object):
"""
Expand Down Expand Up @@ -968,6 +983,15 @@ def _validate_status(self):
'an explicit call to get_details() is made.')
raise GooglePlacesAttributeError(error_detail)

def __repr__(self):
""" Return a string representation including the name, lat, and lng. """
return '<{} name="{}", lat={}, lng={}>'.format(
self.__class__.__name__,
self.name,
self.geo_location['lat'],
self.geo_location['lng']
)


class Photo(object):
def __init__(self, query_instance, attrs):
Expand Down