add: CONTRIBUTORS + pep8
This commit is contained in:
parent
b21f2e4aaa
commit
94d031444d
@ -86,5 +86,8 @@ In chronological order:
|
||||
* @p-vitt & @M4a1x
|
||||
* Documentation on troubleshooting for uberspace users
|
||||
|
||||
* @benjhess
|
||||
* Optionnal gravatar support
|
||||
|
||||
* [Your name or handle] <[email or website]>
|
||||
* [Brief summary of your changes]
|
||||
|
@ -55,7 +55,7 @@ class Progress(object):
|
||||
|
||||
if time() - self.last > 0.2:
|
||||
sys.stdout.write("\r{0}".format(" " * cols))
|
||||
sys.stdout.write("\r[{0:.0%}] {1}".format(i/self.end, message))
|
||||
sys.stdout.write("\r[{0:.0%}] {1}".format(i / self.end, message))
|
||||
sys.stdout.flush()
|
||||
self.last = time()
|
||||
|
||||
|
@ -134,13 +134,13 @@ class TestComments(unittest.TestCase):
|
||||
self.assertFalse(verify({"text": text}))
|
||||
|
||||
# email/website length
|
||||
self.assertTrue(verify({"text": "...", "email": "*"*254}))
|
||||
self.assertTrue(verify({"text": "...", "email": "*" * 254}))
|
||||
self.assertTrue(
|
||||
verify({"text": "...", "website": "google.de/" + "a"*128}))
|
||||
verify({"text": "...", "website": "google.de/" + "a" * 128}))
|
||||
|
||||
self.assertFalse(verify({"text": "...", "email": "*"*1024}))
|
||||
self.assertFalse(verify({"text": "...", "email": "*" * 1024}))
|
||||
self.assertFalse(
|
||||
verify({"text": "...", "website": "google.de/" + "*"*1024}))
|
||||
verify({"text": "...", "website": "google.de/" + "*" * 1024}))
|
||||
|
||||
# valid website url
|
||||
self.assertTrue(comments.isurl("example.tld"))
|
||||
|
@ -36,7 +36,7 @@ def anonymize(remote_addr):
|
||||
ipv6 = ipaddress.IPv6Address(remote_addr)
|
||||
if ipv6.ipv4_mapped is not None:
|
||||
return anonymize(ipv6.ipv4_mapped)
|
||||
return u'' + ipv6.exploded.rsplit(':', 5)[0] + ':' + ':'.join(['0000']*5)
|
||||
return u'' + ipv6.exploded.rsplit(':', 5)[0] + ':' + ':'.join(['0000'] * 5)
|
||||
except ipaddress.AddressValueError:
|
||||
return u'0.0.0.0'
|
||||
|
||||
@ -89,11 +89,11 @@ class Bloomfilter:
|
||||
|
||||
def add(self, key):
|
||||
for i in self.get_probes(key):
|
||||
self.array[i//8] |= 2 ** (i % 8)
|
||||
self.array[i // 8] |= 2 ** (i % 8)
|
||||
self.elements += 1
|
||||
|
||||
def __contains__(self, key):
|
||||
return all(self.array[i//8] & (2 ** (i % 8)) for i in self.get_probes(key))
|
||||
return all(self.array[i // 8] & (2 ** (i % 8)) for i in self.get_probes(key))
|
||||
|
||||
def __len__(self):
|
||||
return self.elements
|
||||
|
@ -110,4 +110,4 @@ def new(conf):
|
||||
|
||||
|
||||
sha1 = Hash(func="sha1").uhash
|
||||
md5 = Hash(func="md5").uhash
|
||||
md5 = Hash(func="md5").uhash
|
||||
|
@ -732,6 +732,7 @@ class API(object):
|
||||
comment['replies'] = self._process_fetched_list(replies, plain)
|
||||
|
||||
return JSON(rv, 200)
|
||||
|
||||
def _add_gravatar_image(self, item):
|
||||
if not self.conf.getboolean('gravatar'):
|
||||
return item
|
||||
@ -743,6 +744,7 @@ class API(object):
|
||||
item['gravatar_image'] = gravatar_url.format(email_md5_hash)
|
||||
|
||||
return item
|
||||
|
||||
def _process_fetched_list(self, fetched_list, plain=False):
|
||||
for item in fetched_list:
|
||||
|
||||
@ -851,7 +853,6 @@ class API(object):
|
||||
@apiSuccessExample Counts of 5 threads:
|
||||
[2, 18, 4, 0, 3]
|
||||
"""
|
||||
|
||||
def counts(self, environ, request):
|
||||
|
||||
data = request.get_json()
|
||||
|
@ -30,7 +30,7 @@ def host(environ): # pragma: no cover
|
||||
of http://www.python.org/dev/peps/pep-0333/#url-reconstruction
|
||||
"""
|
||||
|
||||
url = environ['wsgi.url_scheme']+'://'
|
||||
url = environ['wsgi.url_scheme'] + '://'
|
||||
|
||||
if environ.get('HTTP_HOST'):
|
||||
url += environ['HTTP_HOST']
|
||||
|
Loading…
Reference in New Issue
Block a user