/usr/lib/python3/dist-packages/aiohttp/abc.py is in python3-aiohttp 3.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | import asyncio
from abc import ABC, abstractmethod
from collections.abc import Iterable, Sized
class AbstractRouter(ABC):
def __init__(self):
self._frozen = False
def post_init(self, app):
"""Post init stage.
Not an abstract method for sake of backward compatibility,
but if the router wants to be aware of the application
it can override this.
"""
@property
def frozen(self):
return self._frozen
def freeze(self):
"""Freeze router."""
self._frozen = True
@abstractmethod
async def resolve(self, request):
"""Return MATCH_INFO for given request"""
class AbstractMatchInfo(ABC):
@abstractmethod
async def handler(self, request):
"""Execute matched request handler"""
@abstractmethod
async def expect_handler(self, request):
"""Expect handler for 100-continue processing"""
@property # pragma: no branch
@abstractmethod
def http_exception(self):
"""HTTPException instance raised on router's resolving, or None"""
@abstractmethod # pragma: no branch
def get_info(self):
"""Return a dict with additional info useful for introspection"""
@property # pragma: no branch
@abstractmethod
def apps(self):
"""Stack of nested applications.
Top level application is left-most element.
"""
@abstractmethod
def add_app(self, app):
"""Add application to the nested apps stack."""
@abstractmethod
def freeze(self):
"""Freeze the match info.
The method is called after route resolution.
After the call .add_app() is forbidden.
"""
class AbstractView(ABC):
"""Abstract class based view."""
def __init__(self, request):
self._request = request
@property
def request(self):
"""Request instance."""
return self._request
@abstractmethod
def __await__(self):
"""Execute the view handler."""
class AbstractResolver(ABC):
"""Abstract DNS resolver."""
@abstractmethod
async def resolve(self, hostname):
"""Return IP address for given hostname"""
@abstractmethod
async def close(self):
"""Release resolver"""
class AbstractCookieJar(Sized, Iterable):
"""Abstract Cookie Jar."""
def __init__(self, *, loop=None):
self._loop = loop or asyncio.get_event_loop()
@abstractmethod
def clear(self):
"""Clear all cookies."""
@abstractmethod
def update_cookies(self, cookies, response_url=None):
"""Update cookies."""
@abstractmethod
def filter_cookies(self, request_url):
"""Return the jar's cookies filtered by their attributes."""
class AbstractStreamWriter(ABC):
"""Abstract stream writer."""
@abstractmethod
async def write(self, chunk):
"""Write chunk into stream."""
@abstractmethod
async def write_eof(self, chunk=b''):
"""Write last chunk."""
@abstractmethod
async def drain(self):
"""Flush the write buffer."""
class AbstractAccessLogger(ABC):
"""Abstract writer to access log."""
def __init__(self, logger, log_format):
self.logger = logger
self.log_format = log_format
@abstractmethod
def log(self, request, response, time):
"""Emit log to logger."""
|