tabs -> spaces

This commit is contained in:
mdipierro
2013-09-13 15:39:39 -05:00
parent ed9def985e
commit 6c1cc6fc96
29 changed files with 128 additions and 130 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ class MemcacheClient(object):
value = obj[1] + value
self.client.set(key, (time.time(), value))
return value
def incr(self, key, value=1):
return self.increment(key, value)
+4 -4
View File
@@ -9,7 +9,7 @@
Note: This module is intended as a plugin replacement of pbkdf2.py
by Armin Ronacher.
Git repository:
Git repository:
$ git clone https://github.com/michele-comitini/pbkdf2_ctypes.git
:copyright: Copyright (c) 2013: Michele Comitini <mcm@glisco.it>
@@ -79,7 +79,7 @@ def openssl_hashlib_to_crypto_map_get(hashfunc):
crypto_hashfunc.restype = ctypes.c_void_p
return crypto_hashfunc()
def openssl_pbkdf2(data, salt, iterations, digest, keylen):
"""OpenSSL compatibile wrapper
"""
@@ -92,7 +92,7 @@ def openssl_pbkdf2(data, salt, iterations, digest, keylen):
c_iter = ctypes.c_int(iterations)
c_keylen = ctypes.c_int(keylen)
c_buff = ctypes.create_string_buffer(keylen)
# PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
# const unsigned char *salt, int saltlen, int iter,
# const EVP_MD *digest,
@@ -102,7 +102,7 @@ def openssl_pbkdf2(data, salt, iterations, digest, keylen):
ctypes.c_char_p, ctypes.c_int,
ctypes.c_int, ctypes.c_void_p,
ctypes.c_int, ctypes.c_char_p]
crypto.PKCS5_PBKDF2_HMAC.restype = ctypes.c_int
err = crypto.PKCS5_PBKDF2_HMAC(c_pass, c_passlen,
c_salt, c_saltlen,
+7 -7
View File
@@ -46,7 +46,7 @@ class PDF(object):
canvas.setLineWidth(4)
canvas.line(0, -1.25 * cm, 21.7 * cm, -1.25 * cm)
canvas.restoreState()
canvas.saveState()
notes = listify(invoice.get('notes',''))
textobject = canvas.beginText(1 * cm, -25 * cm)
@@ -57,7 +57,7 @@ class PDF(object):
textobject.textLine('Pag.%s/%s' % (page+1,pages))
canvas.drawText(textobject)
canvas.restoreState()
canvas.saveState()
business_details = listify(invoice.get('from','FROM:'))
canvas.setFont(self.font_face, 9)
@@ -66,13 +66,13 @@ class PDF(object):
textobject.textLine(line)
canvas.drawText(textobject)
canvas.restoreState()
canvas.saveState()
client_info = listify(invoice.get('to','TO:'))
textobject = canvas.beginText(1.5 * cm, -2.5 * cm)
for line in client_info:
textobject.textLine(line)
canvas.drawText(textobject)
canvas.drawText(textobject)
canvas.restoreState()
textobject = canvas.beginText(1.5 * cm, -6.75 * cm)
@@ -86,7 +86,7 @@ class PDF(object):
data = [invoice_items[0]]
for item in items:
data.append([
self.format_currency(x)
self.format_currency(x)
if isinstance(x,float) else x
for x in item])
righta = [k for k,v in enumerate(items[0])
@@ -116,10 +116,10 @@ class PDF(object):
data = [invoice['totals'][0]]
for item in items:
data.append([
self.format_currency(x)
self.format_currency(x)
if isinstance(x,float) else x
for x in item])
righta = [k for k,v in enumerate(items[0])
righta = [k for k,v in enumerate(items[0])
if isinstance(v,(int,float,Decimal))]
total = self.format_currency(invoice['total'])
data.append(['']*(len(items[0])-1)+[total])
+5 -5
View File
@@ -90,13 +90,13 @@ def populate(table, n=None, default=True, compute=False, contents={}):
can be used in two ways:
>>> populate(db.tablename, n=100)
or
or
>>> for k,row in enumerate(populate(db.tablename)): print row
"""
generator = populate_generator(table, default=default,
generator = populate_generator(table, default=default,
compute=compute, contents=contents)
if n is not None:
for k,record in enumerate(generator):
@@ -246,8 +246,8 @@ def populate_generator(table, default=True, compute=False, contents={}):
record[fieldname] = random.choice(LAST_NAMES)
elif fieldname.find('username')>=0:
record[fieldname] = random.choice(FIRST_NAMES).lower()+str(random.randint(1000,9999))
else:
record[fieldname] = random.choice(FIRST_NAMES)+' '+random.choice(LAST_NAMES)
else:
record[fieldname] = random.choice(FIRST_NAMES)+' '+random.choice(LAST_NAMES)
elif fieldname.find('phone')>=0:
record[fieldname] = '(%s%s%s) %s%s%s-%s%s%s%s' % (
random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'),random.choice('1234567890'))
+1 -1
View File
@@ -244,7 +244,7 @@ def run(history, statement, env={}):
for name, val in statement_module.__dict__.items():
if name not in old_globals or represent(val) != old_globals[name]:
new_globals[name] = val
if True in [isinstance(val, tuple(UNPICKLABLE_TYPES))
for val in new_globals.values()]:
# this statement added an unpicklable global. store the statement and
+1 -1
View File
@@ -65,7 +65,7 @@ class Stripe:
def refund(self, charge_id):
params = urllib.urlencode({})
u = urllib.urlopen(self.URL_REFUND % (self.key, charge_id),
u = urllib.urlopen(self.URL_REFUND % (self.key, charge_id),
params)
return simplejson.loads(u.read())
+1 -1
View File
@@ -123,7 +123,7 @@ class WebClient(object):
else:
self.method = 'GET' if method=='auto' else method
data = None
t0 = time.time()
t0 = time.time()
self.response = opener.open(self.url, data)
self.time = time.time() - t0
except urllib2.HTTPError, error: