Commit fc56a9d6 authored by Denis Bilenko's avatar Denis Bilenko

pep8

--HG--
extra : transplant_source : %91%1F%03%84v%7E%20%B5%A3l%E8%02%06%FBIB%DD%8A.%D4
parent 3227ffd8
...@@ -2,7 +2,7 @@ __all__ += ['buffer'] ...@@ -2,7 +2,7 @@ __all__ += ['buffer']
cdef extern from "string.h": cdef extern from "string.h":
void *memchr(void *s, int c, size_t n) void *memchr(void *s, int c, size_t n)
cdef extern from "libevent.h": cdef extern from "libevent.h":
struct evbuffer: struct evbuffer:
char *buf "buffer" char *buf "buffer"
...@@ -41,7 +41,7 @@ cdef class buffer: ...@@ -41,7 +41,7 @@ cdef class buffer:
def __nonzero__(self): def __nonzero__(self):
if self.__obj: if self.__obj:
return evbuffer_get_length(self.__obj) return evbuffer_get_length(self.__obj)
def detach(self): def detach(self):
self.__obj = NULL self.__obj = NULL
...@@ -88,11 +88,11 @@ cdef class buffer: ...@@ -88,11 +88,11 @@ cdef class buffer:
return '' return ''
cdef long length = evbuffer_get_length(self.__obj) 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: if nl:
length = nl - data + 1 length = nl - data + 1
cdef object result = PyString_FromStringAndSize(data, length) cdef object result = PyString_FromStringAndSize(data, length)
cdef int res = EVBUFFER_DRAIN(self.__obj, length) cdef int res = EVBUFFER_DRAIN(self.__obj, length)
if res: if res:
...@@ -104,4 +104,3 @@ cdef class buffer: ...@@ -104,4 +104,3 @@ cdef class buffer:
def readlines(self, hint=-1): def readlines(self, hint=-1):
return list(self) return list(self)
...@@ -131,4 +131,3 @@ def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback): ...@@ -131,4 +131,3 @@ def dns_resolve_reverse_ipv6(char* packed_ip, int flags, object callback):
if result: if result:
raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, )) raise IOError('evdns_resolve_reverse_ipv6(%r, %r) returned %s' % (packed_ip, flags, result, ))
Py_INCREF(callback) Py_INCREF(callback)
...@@ -9,7 +9,7 @@ EVHTTP_REQ_HEAD = 2 ...@@ -9,7 +9,7 @@ EVHTTP_REQ_HEAD = 2
EVHTTP_REQ_PUT = 3 EVHTTP_REQ_PUT = 3
EVHTTP_REQ_DELETE = 4 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 *: cdef extern from *:
ctypedef char* const_char_ptr "const char*" ctypedef char* const_char_ptr "const char*"
...@@ -96,9 +96,11 @@ cdef extern from "libevent.h": ...@@ -96,9 +96,11 @@ cdef extern from "libevent.h":
class ObjectDeleted(AttributeError): class ObjectDeleted(AttributeError):
pass pass
class HttpRequestDeleted(ObjectDeleted): class HttpRequestDeleted(ObjectDeleted):
"""Raised when an attribute is accessed of http_request instance whose _obj is 0""" """Raised when an attribute is accessed of http_request instance whose _obj is 0"""
class HttpConnectionDeleted(ObjectDeleted): class HttpConnectionDeleted(ObjectDeleted):
"""Raised when an attribute is accessed of http_connection instance whose _obj is 0""" """Raised when an attribute is accessed of http_connection instance whose _obj is 0"""
...@@ -547,4 +549,3 @@ cdef class http: ...@@ -547,4 +549,3 @@ cdef class http:
cdef res = evhttp_accept_socket(self.__obj, fd) cdef res = evhttp_accept_socket(self.__obj, fd)
if res: if res:
raise RuntimeError("evhttp_accept_socket(%r) returned %r" % (fd, 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