Commit 3d150daa authored by Denis Bilenko's avatar Denis Bilenko

pep8

parent fb316be9
......@@ -2,7 +2,7 @@ __all__ += ['buffer']
cdef extern from "string.h":
void *memchr(void *s, int c, size_t n)
cdef extern from "libevent.h":
struct evbuffer:
char *buf "buffer"
......@@ -41,7 +41,7 @@ cdef class buffer:
def __nonzero__(self):
if self.__obj:
return evbuffer_get_length(self.__obj)
def detach(self):
self.__obj = NULL
......@@ -88,11 +88,11 @@ cdef class buffer:
return ''
cdef long length = evbuffer_get_length(self.__obj)
cdef char *nl = <char*> memchr(<void*>data, 10, length) # search for "\n"
cdef char *nl = <char*> memchr(<void*>data, 10, length) # search for "\n"
if nl:
length = nl - data + 1
cdef object result = PyString_FromStringAndSize(data, length)
cdef int res = EVBUFFER_DRAIN(self.__obj, length)
if res:
......@@ -104,4 +104,3 @@ cdef class buffer:
def readlines(self, hint=-1):
return list(self)
......@@ -131,4 +131,3 @@ def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback):
if result:
raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, ))
Py_INCREF(callback)
......@@ -9,7 +9,7 @@ EVHTTP_REQ_HEAD = 2
EVHTTP_REQ_PUT = 3
EVHTTP_REQ_DELETE = 4
HTTP_method2name = { 0: 'GET', 1: 'POST', 2: 'HEAD', 3: 'PUT', 4: 'DELETE' }
HTTP_method2name = {0: 'GET', 1: 'POST', 2: 'HEAD', 3: 'PUT', 4: 'DELETE'}
cdef extern from *:
ctypedef char* const_char_ptr "const char*"
......@@ -96,9 +96,11 @@ cdef extern from "libevent.h":
class ObjectDeleted(AttributeError):
pass
class HttpRequestDeleted(ObjectDeleted):
"""Raised when an attribute is accessed of http_request instance whose _obj is 0"""
class HttpConnectionDeleted(ObjectDeleted):
"""Raised when an attribute is accessed of http_connection instance whose _obj is 0"""
......@@ -553,4 +555,3 @@ cdef class http:
cdef res = evhttp_accept_socket(self.__obj, fd)
if res:
raise RuntimeError("evhttp_accept_socket(%r) returned %r" % (fd, res))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment