Skip to content

Commit

Permalink
better pythonic code
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Dec 5, 2014
1 parent 2342354 commit 1c838cb
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 15 deletions.
9 changes: 7 additions & 2 deletions api_crypton/src/api_crypton/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ def _fetch_url(self, url, parameters = None, method = GET_METHOD_VALUE):
http_client = self._get_http_client()

# fetches the url retrieving the http response
http_response = http_client.fetch_url(url, method, parameters, content_type_charset = DEFAULT_CHARSET)
http_response = http_client.fetch_url(
url,
method,
parameters,
content_type_charset = DEFAULT_CHARSET
)

# retrieves the contents from the http response
contents = http_response.received_message
Expand Down Expand Up @@ -370,7 +375,7 @@ def _get_http_client(self):
# returns the http client
return self.http_client

class CryptonStructure:
class CryptonStructure(object):
"""
The crypton structure class.
"""
Expand Down
10 changes: 8 additions & 2 deletions api_dropbox/src/api_dropbox/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ class DropboxClient(object):
http_client = None
""" The http client for the connection """

def __init__(self, json_plugin = None, client_http_plugin = None, encoding = None, oauth_structure = None):
def __init__(
self,
json_plugin = None,
client_http_plugin = None,
encoding = None,
oauth_structure = None
):
"""
Constructor of the class.
Expand Down Expand Up @@ -777,7 +783,7 @@ def _get_http_client(self):
# returns the http client
return self.http_client

class OauthStructure:
class OauthStructure(object):
"""
The oauth structure class.
"""
Expand Down
2 changes: 1 addition & 1 deletion api_easypay/src/api_easypay/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def _get_xml_node_text(self, xml_node):
# returns the xml node text
return xml_node_text

class EasypayStructure:
class EasypayStructure(object):
"""
The easypay structure class.
"""
Expand Down
21 changes: 18 additions & 3 deletions api_facebook/src/api_facebook/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,14 @@ def close(self):
# closes the http client
self.http_client.close({})

def generate_facebook_structure(self, consumer_key, consumer_secret, next, api_version = DEFAULT_API_VERSION, set_structure = True):
def generate_facebook_structure(
self,
consumer_key,
consumer_secret,
next,
api_version = DEFAULT_API_VERSION,
set_structure = True
):
"""
Generates the facebook structure for the given arguments.
Expand Down Expand Up @@ -954,7 +961,7 @@ def _get_http_client(self):
# returns the http client
return self.http_client

class FacebookStructure:
class FacebookStructure(object):
"""
The facebook structure class.
"""
Expand Down Expand Up @@ -989,7 +996,15 @@ class FacebookStructure:
username = None
""" The username of the logged user """

def __init__(self, consumer_key, consumer_secret, next, api_version = DEFAULT_API_VERSION, consumer_id = DEFAULT_CONSUMER_ID, scope = DEFAULT_SCOPE):
def __init__(
self,
consumer_key,
consumer_secret,
next,
api_version = DEFAULT_API_VERSION,
consumer_id = DEFAULT_CONSUMER_ID,
scope = DEFAULT_SCOPE
):
"""
Constructor of the class.
Expand Down
13 changes: 11 additions & 2 deletions api_paypal/src/api_paypal/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,16 @@ def do_direct_payment(self, ip_address, amount, card, payer, address, order = No
# returns the response data
return data

def refund_transaction(self, transaction_id, refund_type = REFUND_TYPE_FULL, refund_source = REFUND_SOURCE_INSTANT, amount = None, currency_code = None, refund_item_details = None, note = None):
def refund_transaction(
self,
transaction_id,
refund_type = REFUND_TYPE_FULL,
refund_source = REFUND_SOURCE_INSTANT,
amount = None,
currency_code = None,
refund_item_details = None,
note = None
):
"""
Refunds the specified transaction, with the specified amount and refund source.
Expand Down Expand Up @@ -769,7 +778,7 @@ def _get_http_client(self):
# returns the http client
return self.http_client

class PaypalStructure:
class PaypalStructure(object):
"""
The paypal structure class used to store
the various paypal dependent attributes
Expand Down
16 changes: 13 additions & 3 deletions api_twitter/src/api_twitter/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def _get_http_client(self):
# returns the http client
return self.http_client

class OauthStructure:
class OauthStructure(object):
"""
The oauth structure class.
"""
Expand Down Expand Up @@ -1148,7 +1148,7 @@ class OauthStructure:
""" The token secret """

oauth_verifier = None
""" The verififer """
""" The verifier """

oauth_access_token = None
""" The oauth access token """
Expand All @@ -1159,7 +1159,17 @@ class OauthStructure:
screen_name = None
""" The screen name """

def __init__(self, oauth_consumer_key, oauth_consumer_secret, oauth_signature_method = DEFAULT_OAUTH_SIGNATURE_METHOD, oauth_signature = None, oauth_timestamp = None, oauth_nonce = None, oauth_version = DEFAULT_OAUTH_VERSION, oauth_callback = OUT_OF_BAND_CALLBACK_VALUE):
def __init__(
self,
oauth_consumer_key,
oauth_consumer_secret,
oauth_signature_method = DEFAULT_OAUTH_SIGNATURE_METHOD,
oauth_signature = None,
oauth_timestamp = None,
oauth_nonce = None,
oauth_version = DEFAULT_OAUTH_VERSION,
oauth_callback = OUT_OF_BAND_CALLBACK_VALUE
):
"""
Constructor of the class.
Expand Down
4 changes: 2 additions & 2 deletions api_yadis/src/api_yadis/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _get_http_client(self):
# returns the http client
return self.http_client

class YadisStructure:
class YadisStructure(object):
"""
The yadis structure class.
"""
Expand Down Expand Up @@ -314,7 +314,7 @@ def set_provider_url(self, provider_url):

self.provider_url = provider_url

class YadisResourceDescriptor:
class YadisResourceDescriptor(object):
"""
The yadis resource descriptor class.
"""
Expand Down

0 comments on commit 1c838cb

Please sign in to comment.