From dcc1304855ad03ac9285486af4974bed4fe55a8c Mon Sep 17 00:00:00 2001 From: Saleem Latif Date: Fri, 22 Jan 2016 12:14:12 +0500 Subject: [PATCH] Remove Commented Code --- geocode/geocode.py | 55 ++-------------------------------------------- 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/geocode/geocode.py b/geocode/geocode.py index 09e9833..034c25a 100644 --- a/geocode/geocode.py +++ b/geocode/geocode.py @@ -67,8 +67,8 @@ def __init__(self, key='', client='', signature=''): :param client: Client key for accessing google services. :param signature: client signature for accessing google services. """ - # if not key or (client and signature): - # raise ValueError("A 'key' or 'client', 'signature' pair must be provided to access GeoApi.") + if not key or (client and signature): + raise ValueError("A 'key' or 'client', 'signature' pair must be provided to access GeoApi.") if key: self._authentication_parameters.update({ @@ -113,24 +113,6 @@ def get_geocode(self, address): ) return geocode - - # def __init__(self, address='', lat='', lng='', key='', client='', signature='', extra_url_parameters=''): - # - # if not (address or (lat and lng)): - # raise ValueError("An Address or latitude, longitude pair must be provided.") - # - # self._address = address - # self._lat = lat - # self._lng = lng - # self._key = key - # self._client = client - # self._signature = signature - # - # if extra_url_parameters: - # self._extra_url_parameters = extra_url_parameters - # - # self.update() - def __str__(self): return "Address : {address}\n(lat, lng): ({lat}, {lng}).".format( address=self.address, lat=self.lat, lng=self.lng @@ -153,39 +135,6 @@ def lat(self): def lng(self): return self._lng - # def update(self, address='', lat='', lng='', extra_url_parameters=None): - # if (not (address or (lat and lng))) and (not (self.address or (self.lat and self.lng))): - # raise ValueError("No address or (lat, lng) given!") - # - # if extra_url_parameters and type(extra_url_parameters) is not dict: - # raise TypeError("Argument extra_url_parameters of type (%s) is not a dict" % type(extra_url_parameters)) - # - # if address: - # self._address = address - # if lat: - # self._lat = lat - # if lng: - # self._lng = lng - # if extra_url_parameters: - # self._extra_url_parameters = extra_url_parameters - # - # self._url = encode_geocode_url( - # base_url=geo_code_url, - # parameter_names_map=parameter_names_map, - # address=self.address, - # lat=self.lat, - # lng=self.lng, - # key=self._key, - # client=self._client, - # signature=self._signature, - # **self._extra_url_parameters - # ) - # - # tree = self._get_xml_response_tree() - # self._address = tree.find(google_geocode_response_tags['address']).text - # self._lat = tree.find(google_geocode_response_tags['lat']).text - # self._lng = tree.find(google_geocode_response_tags['lng']).text - def _get_xml_response_tree(self): reply = urllib2.urlopen(self._url) response_tree = ElementTree.parse(reply)