partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
BaseConnector.connect
Get from pool or create new connection.
aiohttp/connector.py
async def connect(self, req: 'ClientRequest', traces: List['Trace'], timeout: 'ClientTimeout') -> Connection: """Get from pool or create new connection.""" key = req.connection_key available = self._available_connections(key) # Wait if there a...
async def connect(self, req: 'ClientRequest', traces: List['Trace'], timeout: 'ClientTimeout') -> Connection: """Get from pool or create new connection.""" key = req.connection_key available = self._available_connections(key) # Wait if there a...
[ "Get", "from", "pool", "or", "create", "new", "connection", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/connector.py#L469-L547
[ "async", "def", "connect", "(", "self", ",", "req", ":", "'ClientRequest'", ",", "traces", ":", "List", "[", "'Trace'", "]", ",", "timeout", ":", "'ClientTimeout'", ")", "->", "Connection", ":", "key", "=", "req", ".", "connection_key", "available", "=", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseConnector._release_waiter
Iterates over all waiters till found one that is not finsihed and belongs to a host that has available connections.
aiohttp/connector.py
def _release_waiter(self) -> None: """ Iterates over all waiters till found one that is not finsihed and belongs to a host that has available connections. """ if not self._waiters: return # Having the dict keys ordered this avoids to iterate # at the ...
def _release_waiter(self) -> None: """ Iterates over all waiters till found one that is not finsihed and belongs to a host that has available connections. """ if not self._waiters: return # Having the dict keys ordered this avoids to iterate # at the ...
[ "Iterates", "over", "all", "waiters", "till", "found", "one", "that", "is", "not", "finsihed", "and", "belongs", "to", "a", "host", "that", "has", "available", "connections", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/connector.py#L575-L597
[ "def", "_release_waiter", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "_waiters", ":", "return", "# Having the dict keys ordered this avoids to iterate", "# at the same order at each call.", "queues", "=", "list", "(", "self", ".", "_waiters", ".", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
TCPConnector.close
Close all ongoing DNS calls.
aiohttp/connector.py
def close(self) -> Awaitable[None]: """Close all ongoing DNS calls.""" for ev in self._throttle_dns_events.values(): ev.cancel() return super().close()
def close(self) -> Awaitable[None]: """Close all ongoing DNS calls.""" for ev in self._throttle_dns_events.values(): ev.cancel() return super().close()
[ "Close", "all", "ongoing", "DNS", "calls", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/connector.py#L744-L749
[ "def", "close", "(", "self", ")", "->", "Awaitable", "[", "None", "]", ":", "for", "ev", "in", "self", ".", "_throttle_dns_events", ".", "values", "(", ")", ":", "ev", ".", "cancel", "(", ")", "return", "super", "(", ")", ".", "close", "(", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
TCPConnector.clear_dns_cache
Remove specified host/port or clear all dns local cache.
aiohttp/connector.py
def clear_dns_cache(self, host: Optional[str]=None, port: Optional[int]=None) -> None: """Remove specified host/port or clear all dns local cache.""" if host is not None and port is not None: self._cached_hosts.remove((host, port)) elif...
def clear_dns_cache(self, host: Optional[str]=None, port: Optional[int]=None) -> None: """Remove specified host/port or clear all dns local cache.""" if host is not None and port is not None: self._cached_hosts.remove((host, port)) elif...
[ "Remove", "specified", "host", "/", "port", "or", "clear", "all", "dns", "local", "cache", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/connector.py#L761-L771
[ "def", "clear_dns_cache", "(", "self", ",", "host", ":", "Optional", "[", "str", "]", "=", "None", ",", "port", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "None", ":", "if", "host", "is", "not", "None", "and", "port", "is", "not", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
TCPConnector._create_connection
Create connection. Has same keyword arguments as BaseEventLoop.create_connection.
aiohttp/connector.py
async def _create_connection(self, req: 'ClientRequest', traces: List['Trace'], timeout: 'ClientTimeout') -> ResponseHandler: """Create connection. Has same keyword arguments as BaseEventLoop.create_connection. """ if req...
async def _create_connection(self, req: 'ClientRequest', traces: List['Trace'], timeout: 'ClientTimeout') -> ResponseHandler: """Create connection. Has same keyword arguments as BaseEventLoop.create_connection. """ if req...
[ "Create", "connection", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/connector.py#L842-L856
[ "async", "def", "_create_connection", "(", "self", ",", "req", ":", "'ClientRequest'", ",", "traces", ":", "List", "[", "'Trace'", "]", ",", "timeout", ":", "'ClientTimeout'", ")", "->", "ResponseHandler", ":", "if", "req", ".", "proxy", ":", "_", ",", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
TCPConnector._get_ssl_context
Logic to get the correct SSL context 0. if req.ssl is false, return None 1. if ssl_context is specified in req, use it 2. if _ssl_context is specified in self, use it 3. otherwise: 1. if verify_ssl is not specified in req, use self.ssl_context (will generate ...
aiohttp/connector.py
def _get_ssl_context(self, req: 'ClientRequest') -> Optional[SSLContext]: """Logic to get the correct SSL context 0. if req.ssl is false, return None 1. if ssl_context is specified in req, use it 2. if _ssl_context is specified in self, use it 3. otherwise: 1. if ve...
def _get_ssl_context(self, req: 'ClientRequest') -> Optional[SSLContext]: """Logic to get the correct SSL context 0. if req.ssl is false, return None 1. if ssl_context is specified in req, use it 2. if _ssl_context is specified in self, use it 3. otherwise: 1. if ve...
[ "Logic", "to", "get", "the", "correct", "SSL", "context" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/connector.py#L871-L902
[ "def", "_get_ssl_context", "(", "self", ",", "req", ":", "'ClientRequest'", ")", "->", "Optional", "[", "SSLContext", "]", ":", "if", "req", ".", "is_ssl", "(", ")", ":", "if", "ssl", "is", "None", ":", "# pragma: no cover", "raise", "RuntimeError", "(", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
_websocket_mask_python
Websocket masking function. `mask` is a `bytes` object of length 4; `data` is a `bytearray` object of any length. The contents of `data` are masked with `mask`, as specified in section 5.3 of RFC 6455. Note that this function mutates the `data` argument. This pure-python implementation may be rep...
aiohttp/http_websocket.py
def _websocket_mask_python(mask: bytes, data: bytearray) -> None: """Websocket masking function. `mask` is a `bytes` object of length 4; `data` is a `bytearray` object of any length. The contents of `data` are masked with `mask`, as specified in section 5.3 of RFC 6455. Note that this function mut...
def _websocket_mask_python(mask: bytes, data: bytearray) -> None: """Websocket masking function. `mask` is a `bytes` object of length 4; `data` is a `bytearray` object of any length. The contents of `data` are masked with `mask`, as specified in section 5.3 of RFC 6455. Note that this function mut...
[ "Websocket", "masking", "function", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L117-L138
[ "def", "_websocket_mask_python", "(", "mask", ":", "bytes", ",", "data", ":", "bytearray", ")", "->", "None", ":", "assert", "isinstance", "(", "data", ",", "bytearray", ")", ",", "data", "assert", "len", "(", "mask", ")", "==", "4", ",", "mask", "if",...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WSMessage.json
Return parsed JSON data. .. versionadded:: 0.22
aiohttp/http_websocket.py
def json(self, *, # type: ignore loads: Callable[[Any], Any]=json.loads) -> None: """Return parsed JSON data. .. versionadded:: 0.22 """ return loads(self.data)
def json(self, *, # type: ignore loads: Callable[[Any], Any]=json.loads) -> None: """Return parsed JSON data. .. versionadded:: 0.22 """ return loads(self.data)
[ "Return", "parsed", "JSON", "data", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L85-L91
[ "def", "json", "(", "self", ",", "*", ",", "# type: ignore", "loads", ":", "Callable", "[", "[", "Any", "]", ",", "Any", "]", "=", "json", ".", "loads", ")", "->", "None", ":", "return", "loads", "(", "self", ".", "data", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WebSocketReader.parse_frame
Return the next frame from the socket.
aiohttp/http_websocket.py
def parse_frame(self, buf: bytes) -> List[Tuple[bool, Optional[int], bytearray, Optional[bool]]]: """Return the next frame from the socket.""" frames = [] if self._tail: buf, self....
def parse_frame(self, buf: bytes) -> List[Tuple[bool, Optional[int], bytearray, Optional[bool]]]: """Return the next frame from the socket.""" frames = [] if self._tail: buf, self....
[ "Return", "the", "next", "frame", "from", "the", "socket", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L392-L541
[ "def", "parse_frame", "(", "self", ",", "buf", ":", "bytes", ")", "->", "List", "[", "Tuple", "[", "bool", ",", "Optional", "[", "int", "]", ",", "bytearray", ",", "Optional", "[", "bool", "]", "]", "]", ":", "frames", "=", "[", "]", "if", "self"...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WebSocketWriter._send_frame
Send a frame over the websocket with message as its payload.
aiohttp/http_websocket.py
async def _send_frame(self, message: bytes, opcode: int, compress: Optional[int]=None) -> None: """Send a frame over the websocket with message as its payload.""" if self._closing: ws_logger.warning('websocket connection is closing.') rsv = 0 # Onl...
async def _send_frame(self, message: bytes, opcode: int, compress: Optional[int]=None) -> None: """Send a frame over the websocket with message as its payload.""" if self._closing: ws_logger.warning('websocket connection is closing.') rsv = 0 # Onl...
[ "Send", "a", "frame", "over", "the", "websocket", "with", "message", "as", "its", "payload", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L561-L620
[ "async", "def", "_send_frame", "(", "self", ",", "message", ":", "bytes", ",", "opcode", ":", "int", ",", "compress", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "None", ":", "if", "self", ".", "_closing", ":", "ws_logger", ".", "warnin...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WebSocketWriter.pong
Send pong message.
aiohttp/http_websocket.py
async def pong(self, message: bytes=b'') -> None: """Send pong message.""" if isinstance(message, str): message = message.encode('utf-8') await self._send_frame(message, WSMsgType.PONG)
async def pong(self, message: bytes=b'') -> None: """Send pong message.""" if isinstance(message, str): message = message.encode('utf-8') await self._send_frame(message, WSMsgType.PONG)
[ "Send", "pong", "message", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L622-L626
[ "async", "def", "pong", "(", "self", ",", "message", ":", "bytes", "=", "b''", ")", "->", "None", ":", "if", "isinstance", "(", "message", ",", "str", ")", ":", "message", "=", "message", ".", "encode", "(", "'utf-8'", ")", "await", "self", ".", "_...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WebSocketWriter.ping
Send ping message.
aiohttp/http_websocket.py
async def ping(self, message: bytes=b'') -> None: """Send ping message.""" if isinstance(message, str): message = message.encode('utf-8') await self._send_frame(message, WSMsgType.PING)
async def ping(self, message: bytes=b'') -> None: """Send ping message.""" if isinstance(message, str): message = message.encode('utf-8') await self._send_frame(message, WSMsgType.PING)
[ "Send", "ping", "message", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L628-L632
[ "async", "def", "ping", "(", "self", ",", "message", ":", "bytes", "=", "b''", ")", "->", "None", ":", "if", "isinstance", "(", "message", ",", "str", ")", ":", "message", "=", "message", ".", "encode", "(", "'utf-8'", ")", "await", "self", ".", "_...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WebSocketWriter.send
Send a frame over the websocket with message as its payload.
aiohttp/http_websocket.py
async def send(self, message: Union[str, bytes], binary: bool=False, compress: Optional[int]=None) -> None: """Send a frame over the websocket with message as its payload.""" if isinstance(message, str): message = message.encode('utf-8') if binar...
async def send(self, message: Union[str, bytes], binary: bool=False, compress: Optional[int]=None) -> None: """Send a frame over the websocket with message as its payload.""" if isinstance(message, str): message = message.encode('utf-8') if binar...
[ "Send", "a", "frame", "over", "the", "websocket", "with", "message", "as", "its", "payload", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L634-L643
[ "async", "def", "send", "(", "self", ",", "message", ":", "Union", "[", "str", ",", "bytes", "]", ",", "binary", ":", "bool", "=", "False", ",", "compress", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "None", ":", "if", "isinstance", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
WebSocketWriter.close
Close the websocket, sending the specified code and message.
aiohttp/http_websocket.py
async def close(self, code: int=1000, message: bytes=b'') -> None: """Close the websocket, sending the specified code and message.""" if isinstance(message, str): message = message.encode('utf-8') try: await self._send_frame( PACK_CLOSE_CODE(code) + messag...
async def close(self, code: int=1000, message: bytes=b'') -> None: """Close the websocket, sending the specified code and message.""" if isinstance(message, str): message = message.encode('utf-8') try: await self._send_frame( PACK_CLOSE_CODE(code) + messag...
[ "Close", "the", "websocket", "sending", "the", "specified", "code", "and", "message", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L645-L653
[ "async", "def", "close", "(", "self", ",", "code", ":", "int", "=", "1000", ",", "message", ":", "bytes", "=", "b''", ")", "->", "None", ":", "if", "isinstance", "(", "message", ",", "str", ")", ":", "message", "=", "message", ".", "encode", "(", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
CookieJar.update_cookies
Update cookies.
aiohttp/cookiejar.py
def update_cookies(self, cookies: LooseCookies, response_url: URL=URL()) -> None: """Update cookies.""" hostname = response_url.raw_host if not self._unsafe and is_ip_address(hostname): # Don't accept cookies from IPs return ...
def update_cookies(self, cookies: LooseCookies, response_url: URL=URL()) -> None: """Update cookies.""" hostname = response_url.raw_host if not self._unsafe and is_ip_address(hostname): # Don't accept cookies from IPs return ...
[ "Update", "cookies", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/cookiejar.py#L113-L186
[ "def", "update_cookies", "(", "self", ",", "cookies", ":", "LooseCookies", ",", "response_url", ":", "URL", "=", "URL", "(", ")", ")", "->", "None", ":", "hostname", "=", "response_url", ".", "raw_host", "if", "not", "self", ".", "_unsafe", "and", "is_ip...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
CookieJar.filter_cookies
Returns this jar's cookies filtered by their attributes.
aiohttp/cookiejar.py
def filter_cookies(self, request_url: URL=URL()) -> 'BaseCookie[str]': """Returns this jar's cookies filtered by their attributes.""" self._do_expiration() request_url = URL(request_url) filtered = SimpleCookie() hostname = request_url.raw_host or "" is_not_secure = reque...
def filter_cookies(self, request_url: URL=URL()) -> 'BaseCookie[str]': """Returns this jar's cookies filtered by their attributes.""" self._do_expiration() request_url = URL(request_url) filtered = SimpleCookie() hostname = request_url.raw_host or "" is_not_secure = reque...
[ "Returns", "this", "jar", "s", "cookies", "filtered", "by", "their", "attributes", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/cookiejar.py#L188-L226
[ "def", "filter_cookies", "(", "self", ",", "request_url", ":", "URL", "=", "URL", "(", ")", ")", "->", "'BaseCookie[str]'", ":", "self", ".", "_do_expiration", "(", ")", "request_url", "=", "URL", "(", "request_url", ")", "filtered", "=", "SimpleCookie", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
CookieJar._is_domain_match
Implements domain matching adhering to RFC 6265.
aiohttp/cookiejar.py
def _is_domain_match(domain: str, hostname: str) -> bool: """Implements domain matching adhering to RFC 6265.""" if hostname == domain: return True if not hostname.endswith(domain): return False non_matching = hostname[:-len(domain)] if not non_matching...
def _is_domain_match(domain: str, hostname: str) -> bool: """Implements domain matching adhering to RFC 6265.""" if hostname == domain: return True if not hostname.endswith(domain): return False non_matching = hostname[:-len(domain)] if not non_matching...
[ "Implements", "domain", "matching", "adhering", "to", "RFC", "6265", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/cookiejar.py#L229-L242
[ "def", "_is_domain_match", "(", "domain", ":", "str", ",", "hostname", ":", "str", ")", "->", "bool", ":", "if", "hostname", "==", "domain", ":", "return", "True", "if", "not", "hostname", ".", "endswith", "(", "domain", ")", ":", "return", "False", "n...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
CookieJar._is_path_match
Implements path matching adhering to RFC 6265.
aiohttp/cookiejar.py
def _is_path_match(req_path: str, cookie_path: str) -> bool: """Implements path matching adhering to RFC 6265.""" if not req_path.startswith("/"): req_path = "/" if req_path == cookie_path: return True if not req_path.startswith(cookie_path): return ...
def _is_path_match(req_path: str, cookie_path: str) -> bool: """Implements path matching adhering to RFC 6265.""" if not req_path.startswith("/"): req_path = "/" if req_path == cookie_path: return True if not req_path.startswith(cookie_path): return ...
[ "Implements", "path", "matching", "adhering", "to", "RFC", "6265", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/cookiejar.py#L245-L261
[ "def", "_is_path_match", "(", "req_path", ":", "str", ",", "cookie_path", ":", "str", ")", "->", "bool", ":", "if", "not", "req_path", ".", "startswith", "(", "\"/\"", ")", ":", "req_path", "=", "\"/\"", "if", "req_path", "==", "cookie_path", ":", "retur...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
CookieJar._parse_date
Implements date string parsing adhering to RFC 6265.
aiohttp/cookiejar.py
def _parse_date(cls, date_str: str) -> Optional[datetime.datetime]: """Implements date string parsing adhering to RFC 6265.""" if not date_str: return None found_time = False found_day = False found_month = False found_year = False hour = minute = se...
def _parse_date(cls, date_str: str) -> Optional[datetime.datetime]: """Implements date string parsing adhering to RFC 6265.""" if not date_str: return None found_time = False found_day = False found_month = False found_year = False hour = minute = se...
[ "Implements", "date", "string", "parsing", "adhering", "to", "RFC", "6265", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/cookiejar.py#L264-L327
[ "def", "_parse_date", "(", "cls", ",", "date_str", ":", "str", ")", "->", "Optional", "[", "datetime", ".", "datetime", "]", ":", "if", "not", "date_str", ":", "return", "None", "found_time", "=", "False", "found_day", "=", "False", "found_month", "=", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
my_protocol_parser
Parser is used with StreamParser for incremental protocol parsing. Parser is a generator function, but it is not a coroutine. Usually parsers are implemented as a state machine. more details in asyncio/parsers.py existing parsers: * HTTP protocol parsers asyncio/http/protocol.py * websocket...
examples/legacy/tcp_protocol_parser.py
def my_protocol_parser(out, buf): """Parser is used with StreamParser for incremental protocol parsing. Parser is a generator function, but it is not a coroutine. Usually parsers are implemented as a state machine. more details in asyncio/parsers.py existing parsers: * HTTP protocol parsers a...
def my_protocol_parser(out, buf): """Parser is used with StreamParser for incremental protocol parsing. Parser is a generator function, but it is not a coroutine. Usually parsers are implemented as a state machine. more details in asyncio/parsers.py existing parsers: * HTTP protocol parsers a...
[ "Parser", "is", "used", "with", "StreamParser", "for", "incremental", "protocol", "parsing", ".", "Parser", "is", "a", "generator", "function", "but", "it", "is", "not", "a", "coroutine", ".", "Usually", "parsers", "are", "implemented", "as", "a", "state", "...
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/examples/legacy/tcp_protocol_parser.py#L23-L46
[ "def", "my_protocol_parser", "(", "out", ",", "buf", ")", ":", "while", "True", ":", "tp", "=", "yield", "from", "buf", ".", "read", "(", "5", ")", "if", "tp", "in", "(", "MSG_PING", ",", "MSG_PONG", ")", ":", "# skip line", "yield", "from", "buf", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
Payload.set_content_disposition
Sets ``Content-Disposition`` header.
aiohttp/payload.py
def set_content_disposition(self, disptype: str, quote_fields: bool=True, **params: Any) -> None: """Sets ``Content-Disposition`` header.""" self._headers[hdrs.CONTENT_DISPOSITION] = content_disposition_heade...
def set_content_disposition(self, disptype: str, quote_fields: bool=True, **params: Any) -> None: """Sets ``Content-Disposition`` header.""" self._headers[hdrs.CONTENT_DISPOSITION] = content_disposition_heade...
[ "Sets", "Content", "-", "Disposition", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/payload.py#L187-L193
[ "def", "set_content_disposition", "(", "self", ",", "disptype", ":", "str", ",", "quote_fields", ":", "bool", "=", "True", ",", "*", "*", "params", ":", "Any", ")", "->", "None", ":", "self", ".", "_headers", "[", "hdrs", ".", "CONTENT_DISPOSITION", "]",...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.clone
Clone itself with replacement some attributes. Creates and returns a new instance of Request object. If no parameters are given, an exact copy is returned. If a parameter is not passed, it will reuse the one from the current request object.
aiohttp/web_request.py
def clone(self, *, method: str=sentinel, rel_url: StrOrURL=sentinel, headers: LooseHeaders=sentinel, scheme: str=sentinel, host: str=sentinel, remote: str=sentinel) -> 'BaseRequest': """Clone itself with replacement some attributes. Creates and returns a new in...
def clone(self, *, method: str=sentinel, rel_url: StrOrURL=sentinel, headers: LooseHeaders=sentinel, scheme: str=sentinel, host: str=sentinel, remote: str=sentinel) -> 'BaseRequest': """Clone itself with replacement some attributes. Creates and returns a new in...
[ "Clone", "itself", "with", "replacement", "some", "attributes", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L148-L196
[ "def", "clone", "(", "self", ",", "*", ",", "method", ":", "str", "=", "sentinel", ",", "rel_url", ":", "StrOrURL", "=", "sentinel", ",", "headers", ":", "LooseHeaders", "=", "sentinel", ",", "scheme", ":", "str", "=", "sentinel", ",", "host", ":", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.forwarded
A tuple containing all parsed Forwarded header(s). Makes an effort to parse Forwarded headers as specified by RFC 7239: - It adds one (immutable) dictionary per Forwarded 'field-value', ie per proxy. The element corresponds to the data in the Forwarded field-value added by the firs...
aiohttp/web_request.py
def forwarded(self) -> Tuple[Mapping[str, str], ...]: """A tuple containing all parsed Forwarded header(s). Makes an effort to parse Forwarded headers as specified by RFC 7239: - It adds one (immutable) dictionary per Forwarded 'field-value', ie per proxy. The element corresponds to ...
def forwarded(self) -> Tuple[Mapping[str, str], ...]: """A tuple containing all parsed Forwarded header(s). Makes an effort to parse Forwarded headers as specified by RFC 7239: - It adds one (immutable) dictionary per Forwarded 'field-value', ie per proxy. The element corresponds to ...
[ "A", "tuple", "containing", "all", "parsed", "Forwarded", "header", "(", "s", ")", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L259-L318
[ "def", "forwarded", "(", "self", ")", "->", "Tuple", "[", "Mapping", "[", "str", ",", "str", "]", ",", "...", "]", ":", "elems", "=", "[", "]", "for", "field_value", "in", "self", ".", "_message", ".", "headers", ".", "getall", "(", "hdrs", ".", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.host
Hostname of the request. Hostname is resolved in this order: - overridden value by .clone(host=new_host) call. - HOST HTTP header - socket.getfqdn() value
aiohttp/web_request.py
def host(self) -> str: """Hostname of the request. Hostname is resolved in this order: - overridden value by .clone(host=new_host) call. - HOST HTTP header - socket.getfqdn() value """ host = self._message.headers.get(hdrs.HOST) if host is not None: ...
def host(self) -> str: """Hostname of the request. Hostname is resolved in this order: - overridden value by .clone(host=new_host) call. - HOST HTTP header - socket.getfqdn() value """ host = self._message.headers.get(hdrs.HOST) if host is not None: ...
[ "Hostname", "of", "the", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L353-L366
[ "def", "host", "(", "self", ")", "->", "str", ":", "host", "=", "self", ".", "_message", ".", "headers", ".", "get", "(", "hdrs", ".", "HOST", ")", "if", "host", "is", "not", "None", ":", "return", "host", "else", ":", "return", "socket", ".", "g...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.remote
Remote IP of client initiated HTTP request. The IP is resolved in this order: - overridden value by .clone(remote=new_remote) call. - peername of opened socket
aiohttp/web_request.py
def remote(self) -> Optional[str]: """Remote IP of client initiated HTTP request. The IP is resolved in this order: - overridden value by .clone(remote=new_remote) call. - peername of opened socket """ if isinstance(self._transport_peername, (list, tuple)): ...
def remote(self) -> Optional[str]: """Remote IP of client initiated HTTP request. The IP is resolved in this order: - overridden value by .clone(remote=new_remote) call. - peername of opened socket """ if isinstance(self._transport_peername, (list, tuple)): ...
[ "Remote", "IP", "of", "client", "initiated", "HTTP", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L369-L380
[ "def", "remote", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "isinstance", "(", "self", ".", "_transport_peername", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "self", ".", "_transport_peername", "[", "0", "]", "else", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest._http_date
Process a date string, return a datetime object
aiohttp/web_request.py
def _http_date(_date_str: str) -> Optional[datetime.datetime]: """Process a date string, return a datetime object """ if _date_str is not None: timetuple = parsedate(_date_str) if timetuple is not None: return datetime.datetime(*timetuple[:6], ...
def _http_date(_date_str: str) -> Optional[datetime.datetime]: """Process a date string, return a datetime object """ if _date_str is not None: timetuple = parsedate(_date_str) if timetuple is not None: return datetime.datetime(*timetuple[:6], ...
[ "Process", "a", "date", "string", "return", "a", "datetime", "object" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L436-L444
[ "def", "_http_date", "(", "_date_str", ":", "str", ")", "->", "Optional", "[", "datetime", ".", "datetime", "]", ":", "if", "_date_str", "is", "not", "None", ":", "timetuple", "=", "parsedate", "(", "_date_str", ")", "if", "timetuple", "is", "not", "None...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.if_modified_since
The value of If-Modified-Since HTTP header, or None. This header is represented as a `datetime` object.
aiohttp/web_request.py
def if_modified_since(self) -> Optional[datetime.datetime]: """The value of If-Modified-Since HTTP header, or None. This header is represented as a `datetime` object. """ return self._http_date(self.headers.get(hdrs.IF_MODIFIED_SINCE))
def if_modified_since(self) -> Optional[datetime.datetime]: """The value of If-Modified-Since HTTP header, or None. This header is represented as a `datetime` object. """ return self._http_date(self.headers.get(hdrs.IF_MODIFIED_SINCE))
[ "The", "value", "of", "If", "-", "Modified", "-", "Since", "HTTP", "header", "or", "None", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L447-L452
[ "def", "if_modified_since", "(", "self", ")", "->", "Optional", "[", "datetime", ".", "datetime", "]", ":", "return", "self", ".", "_http_date", "(", "self", ".", "headers", ".", "get", "(", "hdrs", ".", "IF_MODIFIED_SINCE", ")", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.if_unmodified_since
The value of If-Unmodified-Since HTTP header, or None. This header is represented as a `datetime` object.
aiohttp/web_request.py
def if_unmodified_since(self) -> Optional[datetime.datetime]: """The value of If-Unmodified-Since HTTP header, or None. This header is represented as a `datetime` object. """ return self._http_date(self.headers.get(hdrs.IF_UNMODIFIED_SINCE))
def if_unmodified_since(self) -> Optional[datetime.datetime]: """The value of If-Unmodified-Since HTTP header, or None. This header is represented as a `datetime` object. """ return self._http_date(self.headers.get(hdrs.IF_UNMODIFIED_SINCE))
[ "The", "value", "of", "If", "-", "Unmodified", "-", "Since", "HTTP", "header", "or", "None", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L455-L460
[ "def", "if_unmodified_since", "(", "self", ")", "->", "Optional", "[", "datetime", ".", "datetime", "]", ":", "return", "self", ".", "_http_date", "(", "self", ".", "headers", ".", "get", "(", "hdrs", ".", "IF_UNMODIFIED_SINCE", ")", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.if_range
The value of If-Range HTTP header, or None. This header is represented as a `datetime` object.
aiohttp/web_request.py
def if_range(self) -> Optional[datetime.datetime]: """The value of If-Range HTTP header, or None. This header is represented as a `datetime` object. """ return self._http_date(self.headers.get(hdrs.IF_RANGE))
def if_range(self) -> Optional[datetime.datetime]: """The value of If-Range HTTP header, or None. This header is represented as a `datetime` object. """ return self._http_date(self.headers.get(hdrs.IF_RANGE))
[ "The", "value", "of", "If", "-", "Range", "HTTP", "header", "or", "None", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L463-L468
[ "def", "if_range", "(", "self", ")", "->", "Optional", "[", "datetime", ".", "datetime", "]", ":", "return", "self", ".", "_http_date", "(", "self", ".", "headers", ".", "get", "(", "hdrs", ".", "IF_RANGE", ")", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.cookies
Return request cookies. A read-only dictionary-like object.
aiohttp/web_request.py
def cookies(self) -> Mapping[str, str]: """Return request cookies. A read-only dictionary-like object. """ raw = self.headers.get(hdrs.COOKIE, '') parsed = SimpleCookie(raw) return MappingProxyType( {key: val.value for key, val in parsed.items()})
def cookies(self) -> Mapping[str, str]: """Return request cookies. A read-only dictionary-like object. """ raw = self.headers.get(hdrs.COOKIE, '') parsed = SimpleCookie(raw) return MappingProxyType( {key: val.value for key, val in parsed.items()})
[ "Return", "request", "cookies", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L476-L484
[ "def", "cookies", "(", "self", ")", "->", "Mapping", "[", "str", ",", "str", "]", ":", "raw", "=", "self", ".", "headers", ".", "get", "(", "hdrs", ".", "COOKIE", ",", "''", ")", "parsed", "=", "SimpleCookie", "(", "raw", ")", "return", "MappingPro...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.http_range
The content of Range HTTP header. Return a slice instance.
aiohttp/web_request.py
def http_range(self) -> slice: """The content of Range HTTP header. Return a slice instance. """ rng = self._headers.get(hdrs.RANGE) start, end = None, None if rng is not None: try: pattern = r'^bytes=(\d*)-(\d*)$' start, end ...
def http_range(self) -> slice: """The content of Range HTTP header. Return a slice instance. """ rng = self._headers.get(hdrs.RANGE) start, end = None, None if rng is not None: try: pattern = r'^bytes=(\d*)-(\d*)$' start, end ...
[ "The", "content", "of", "Range", "HTTP", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L487-L520
[ "def", "http_range", "(", "self", ")", "->", "slice", ":", "rng", "=", "self", ".", "_headers", ".", "get", "(", "hdrs", ".", "RANGE", ")", "start", ",", "end", "=", "None", ",", "None", "if", "rng", "is", "not", "None", ":", "try", ":", "pattern...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.has_body
Return True if request's HTTP BODY can be read, False otherwise.
aiohttp/web_request.py
def has_body(self) -> bool: """Return True if request's HTTP BODY can be read, False otherwise.""" warnings.warn( "Deprecated, use .can_read_body #2005", DeprecationWarning, stacklevel=2) return not self._payload.at_eof()
def has_body(self) -> bool: """Return True if request's HTTP BODY can be read, False otherwise.""" warnings.warn( "Deprecated, use .can_read_body #2005", DeprecationWarning, stacklevel=2) return not self._payload.at_eof()
[ "Return", "True", "if", "request", "s", "HTTP", "BODY", "can", "be", "read", "False", "otherwise", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L528-L533
[ "def", "has_body", "(", "self", ")", "->", "bool", ":", "warnings", ".", "warn", "(", "\"Deprecated, use .can_read_body #2005\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "return", "not", "self", ".", "_payload", ".", "at_eof", "(", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.read
Read request body if present. Returns bytes object with full request content.
aiohttp/web_request.py
async def read(self) -> bytes: """Read request body if present. Returns bytes object with full request content. """ if self._read_bytes is None: body = bytearray() while True: chunk = await self._payload.readany() body.extend(chunk...
async def read(self) -> bytes: """Read request body if present. Returns bytes object with full request content. """ if self._read_bytes is None: body = bytearray() while True: chunk = await self._payload.readany() body.extend(chunk...
[ "Read", "request", "body", "if", "present", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L553-L573
[ "async", "def", "read", "(", "self", ")", "->", "bytes", ":", "if", "self", ".", "_read_bytes", "is", "None", ":", "body", "=", "bytearray", "(", ")", "while", "True", ":", "chunk", "=", "await", "self", ".", "_payload", ".", "readany", "(", ")", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.text
Return BODY as text using encoding from .charset.
aiohttp/web_request.py
async def text(self) -> str: """Return BODY as text using encoding from .charset.""" bytes_body = await self.read() encoding = self.charset or 'utf-8' return bytes_body.decode(encoding)
async def text(self) -> str: """Return BODY as text using encoding from .charset.""" bytes_body = await self.read() encoding = self.charset or 'utf-8' return bytes_body.decode(encoding)
[ "Return", "BODY", "as", "text", "using", "encoding", "from", ".", "charset", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L575-L579
[ "async", "def", "text", "(", "self", ")", "->", "str", ":", "bytes_body", "=", "await", "self", ".", "read", "(", ")", "encoding", "=", "self", ".", "charset", "or", "'utf-8'", "return", "bytes_body", ".", "decode", "(", "encoding", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.json
Return BODY as JSON.
aiohttp/web_request.py
async def json(self, *, loads: JSONDecoder=DEFAULT_JSON_DECODER) -> Any: """Return BODY as JSON.""" body = await self.text() return loads(body)
async def json(self, *, loads: JSONDecoder=DEFAULT_JSON_DECODER) -> Any: """Return BODY as JSON.""" body = await self.text() return loads(body)
[ "Return", "BODY", "as", "JSON", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L581-L584
[ "async", "def", "json", "(", "self", ",", "*", ",", "loads", ":", "JSONDecoder", "=", "DEFAULT_JSON_DECODER", ")", "->", "Any", ":", "body", "=", "await", "self", ".", "text", "(", ")", "return", "loads", "(", "body", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BaseRequest.post
Return POST parameters.
aiohttp/web_request.py
async def post(self) -> 'MultiDictProxy[Union[str, bytes, FileField]]': """Return POST parameters.""" if self._post is not None: return self._post if self._method not in self.POST_METHODS: self._post = MultiDictProxy(MultiDict()) return self._post con...
async def post(self) -> 'MultiDictProxy[Union[str, bytes, FileField]]': """Return POST parameters.""" if self._post is not None: return self._post if self._method not in self.POST_METHODS: self._post = MultiDictProxy(MultiDict()) return self._post con...
[ "Return", "POST", "parameters", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_request.py#L590-L662
[ "async", "def", "post", "(", "self", ")", "->", "'MultiDictProxy[Union[str, bytes, FileField]]'", ":", "if", "self", ".", "_post", "is", "not", "None", ":", "return", "self", ".", "_post", "if", "self", ".", "_method", "not", "in", "self", ".", "POST_METHODS...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
RequestHandler.shutdown
Worker process is about to exit, we need cleanup everything and stop accepting requests. It is especially important for keep-alive connections.
aiohttp/web_protocol.py
async def shutdown(self, timeout: Optional[float]=15.0) -> None: """Worker process is about to exit, we need cleanup everything and stop accepting requests. It is especially important for keep-alive connections.""" self._force_close = True if self._keepalive_handle is not None: ...
async def shutdown(self, timeout: Optional[float]=15.0) -> None: """Worker process is about to exit, we need cleanup everything and stop accepting requests. It is especially important for keep-alive connections.""" self._force_close = True if self._keepalive_handle is not None: ...
[ "Worker", "process", "is", "about", "to", "exit", "we", "need", "cleanup", "everything", "and", "stop", "accepting", "requests", ".", "It", "is", "especially", "important", "for", "keep", "-", "alive", "connections", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_protocol.py#L184-L213
[ "async", "def", "shutdown", "(", "self", ",", "timeout", ":", "Optional", "[", "float", "]", "=", "15.0", ")", "->", "None", ":", "self", ".", "_force_close", "=", "True", "if", "self", ".", "_keepalive_handle", "is", "not", "None", ":", "self", ".", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
RequestHandler.keep_alive
Set keep-alive connection mode. :param bool val: new state.
aiohttp/web_protocol.py
def keep_alive(self, val: bool) -> None: """Set keep-alive connection mode. :param bool val: new state. """ self._keepalive = val if self._keepalive_handle: self._keepalive_handle.cancel() self._keepalive_handle = None
def keep_alive(self, val: bool) -> None: """Set keep-alive connection mode. :param bool val: new state. """ self._keepalive = val if self._keepalive_handle: self._keepalive_handle.cancel() self._keepalive_handle = None
[ "Set", "keep", "-", "alive", "connection", "mode", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_protocol.py#L316-L324
[ "def", "keep_alive", "(", "self", ",", "val", ":", "bool", ")", "->", "None", ":", "self", ".", "_keepalive", "=", "val", "if", "self", ".", "_keepalive_handle", ":", "self", ".", "_keepalive_handle", ".", "cancel", "(", ")", "self", ".", "_keepalive_han...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
RequestHandler.close
Stop accepting new pipelinig messages and close connection when handlers done processing messages
aiohttp/web_protocol.py
def close(self) -> None: """Stop accepting new pipelinig messages and close connection when handlers done processing messages""" self._close = True if self._waiter: self._waiter.cancel()
def close(self) -> None: """Stop accepting new pipelinig messages and close connection when handlers done processing messages""" self._close = True if self._waiter: self._waiter.cancel()
[ "Stop", "accepting", "new", "pipelinig", "messages", "and", "close", "connection", "when", "handlers", "done", "processing", "messages" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_protocol.py#L326-L331
[ "def", "close", "(", "self", ")", "->", "None", ":", "self", ".", "_close", "=", "True", "if", "self", ".", "_waiter", ":", "self", ".", "_waiter", ".", "cancel", "(", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
RequestHandler.force_close
Force close connection
aiohttp/web_protocol.py
def force_close(self) -> None: """Force close connection""" self._force_close = True if self._waiter: self._waiter.cancel() if self.transport is not None: self.transport.close() self.transport = None
def force_close(self) -> None: """Force close connection""" self._force_close = True if self._waiter: self._waiter.cancel() if self.transport is not None: self.transport.close() self.transport = None
[ "Force", "close", "connection" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_protocol.py#L333-L340
[ "def", "force_close", "(", "self", ")", "->", "None", ":", "self", ".", "_force_close", "=", "True", "if", "self", ".", "_waiter", ":", "self", ".", "_waiter", ".", "cancel", "(", ")", "if", "self", ".", "transport", "is", "not", "None", ":", "self",...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
RequestHandler.start
Process incoming request. It reads request line, request headers and request payload, then calls handle_request() method. Subclass has to override handle_request(). start() handles various exceptions in request or response handling. Connection is being closed always unless keep_...
aiohttp/web_protocol.py
async def start(self) -> None: """Process incoming request. It reads request line, request headers and request payload, then calls handle_request() method. Subclass has to override handle_request(). start() handles various exceptions in request or response handling. Connection i...
async def start(self) -> None: """Process incoming request. It reads request line, request headers and request payload, then calls handle_request() method. Subclass has to override handle_request(). start() handles various exceptions in request or response handling. Connection i...
[ "Process", "incoming", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_protocol.py#L373-L509
[ "async", "def", "start", "(", "self", ")", "->", "None", ":", "loop", "=", "self", ".", "_loop", "handler", "=", "self", ".", "_task_handler", "assert", "handler", "is", "not", "None", "manager", "=", "self", ".", "_manager", "assert", "manager", "is", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
RequestHandler.handle_error
Handle errors. Returns HTTP response with specific status code. Logs additional information. It always closes current connection.
aiohttp/web_protocol.py
def handle_error(self, request: BaseRequest, status: int=500, exc: Optional[BaseException]=None, message: Optional[str]=None) -> StreamResponse: """Handle errors. Returns HTTP response with specific status code. Logs ad...
def handle_error(self, request: BaseRequest, status: int=500, exc: Optional[BaseException]=None, message: Optional[str]=None) -> StreamResponse: """Handle errors. Returns HTTP response with specific status code. Logs ad...
[ "Handle", "errors", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_protocol.py#L511-L556
[ "def", "handle_error", "(", "self", ",", "request", ":", "BaseRequest", ",", "status", ":", "int", "=", "500", ",", "exc", ":", "Optional", "[", "BaseException", "]", "=", "None", ",", "message", ":", "Optional", "[", "str", "]", "=", "None", ")", "-...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
run_app
Run an app locally
aiohttp/web.py
def run_app(app: Union[Application, Awaitable[Application]], *, host: Optional[str]=None, port: Optional[int]=None, path: Optional[str]=None, sock: Optional[socket.socket]=None, shutdown_timeout: float=60.0, ssl_context: Optional[SSLContext]=None, ...
def run_app(app: Union[Application, Awaitable[Application]], *, host: Optional[str]=None, port: Optional[int]=None, path: Optional[str]=None, sock: Optional[socket.socket]=None, shutdown_timeout: float=60.0, ssl_context: Optional[SSLContext]=None, ...
[ "Run", "an", "app", "locally" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web.py#L375-L422
[ "def", "run_app", "(", "app", ":", "Union", "[", "Application", ",", "Awaitable", "[", "Application", "]", "]", ",", "*", ",", "host", ":", "Optional", "[", "str", "]", "=", "None", ",", "port", ":", "Optional", "[", "int", "]", "=", "None", ",", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
AsyncStreamReaderMixin.iter_chunked
Returns an asynchronous iterator that yields chunks of size n. Python-3.5 available for Python 3.5+ only
aiohttp/streams.py
def iter_chunked(self, n: int) -> AsyncStreamIterator[bytes]: """Returns an asynchronous iterator that yields chunks of size n. Python-3.5 available for Python 3.5+ only """ return AsyncStreamIterator(lambda: self.read(n))
def iter_chunked(self, n: int) -> AsyncStreamIterator[bytes]: """Returns an asynchronous iterator that yields chunks of size n. Python-3.5 available for Python 3.5+ only """ return AsyncStreamIterator(lambda: self.read(n))
[ "Returns", "an", "asynchronous", "iterator", "that", "yields", "chunks", "of", "size", "n", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/streams.py#L68-L73
[ "def", "iter_chunked", "(", "self", ",", "n", ":", "int", ")", "->", "AsyncStreamIterator", "[", "bytes", "]", ":", "return", "AsyncStreamIterator", "(", "lambda", ":", "self", ".", "read", "(", "n", ")", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
StreamReader.unread_data
rollback reading some data from stream, inserting it to buffer head.
aiohttp/streams.py
def unread_data(self, data: bytes) -> None: """ rollback reading some data from stream, inserting it to buffer head. """ warnings.warn("unread_data() is deprecated " "and will be removed in future releases (#3260)", DeprecationWarning, ...
def unread_data(self, data: bytes) -> None: """ rollback reading some data from stream, inserting it to buffer head. """ warnings.warn("unread_data() is deprecated " "and will be removed in future releases (#3260)", DeprecationWarning, ...
[ "rollback", "reading", "some", "data", "from", "stream", "inserting", "it", "to", "buffer", "head", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/streams.py#L211-L227
[ "def", "unread_data", "(", "self", ",", "data", ":", "bytes", ")", "->", "None", ":", "warnings", ".", "warn", "(", "\"unread_data() is deprecated \"", "\"and will be removed in future releases (#3260)\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
StreamReader.readchunk
Returns a tuple of (data, end_of_http_chunk). When chunked transfer encoding is used, end_of_http_chunk is a boolean indicating if the end of the data corresponds to the end of a HTTP chunk , otherwise it is always False.
aiohttp/streams.py
async def readchunk(self) -> Tuple[bytes, bool]: """Returns a tuple of (data, end_of_http_chunk). When chunked transfer encoding is used, end_of_http_chunk is a boolean indicating if the end of the data corresponds to the end of a HTTP chunk , otherwise it is always False. """ ...
async def readchunk(self) -> Tuple[bytes, bool]: """Returns a tuple of (data, end_of_http_chunk). When chunked transfer encoding is used, end_of_http_chunk is a boolean indicating if the end of the data corresponds to the end of a HTTP chunk , otherwise it is always False. """ ...
[ "Returns", "a", "tuple", "of", "(", "data", "end_of_http_chunk", ")", ".", "When", "chunked", "transfer", "encoding", "is", "used", "end_of_http_chunk", "is", "a", "boolean", "indicating", "if", "the", "end", "of", "the", "data", "corresponds", "to", "the", ...
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/streams.py#L385-L413
[ "async", "def", "readchunk", "(", "self", ")", "->", "Tuple", "[", "bytes", ",", "bool", "]", ":", "while", "True", ":", "if", "self", ".", "_exception", "is", "not", "None", ":", "raise", "self", ".", "_exception", "while", "self", ".", "_http_chunk_s...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
StreamReader._read_nowait
Read not more than n bytes, or whole buffer is n == -1
aiohttp/streams.py
def _read_nowait(self, n: int) -> bytes: """ Read not more than n bytes, or whole buffer is n == -1 """ chunks = [] while self._buffer: chunk = self._read_nowait_chunk(n) chunks.append(chunk) if n != -1: n -= len(chunk) if n ==...
def _read_nowait(self, n: int) -> bytes: """ Read not more than n bytes, or whole buffer is n == -1 """ chunks = [] while self._buffer: chunk = self._read_nowait_chunk(n) chunks.append(chunk) if n != -1: n -= len(chunk) if n ==...
[ "Read", "not", "more", "than", "n", "bytes", "or", "whole", "buffer", "is", "n", "==", "-", "1" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/streams.py#L472-L484
[ "def", "_read_nowait", "(", "self", ",", "n", ":", "int", ")", "->", "bytes", ":", "chunks", "=", "[", "]", "while", "self", ".", "_buffer", ":", "chunk", "=", "self", ".", "_read_nowait_chunk", "(", "n", ")", "chunks", ".", "append", "(", "chunk", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
Signal.send
Sends data to all registered receivers.
aiohttp/signals.py
async def send(self, *args, **kwargs): """ Sends data to all registered receivers. """ if not self.frozen: raise RuntimeError("Cannot send non-frozen signal.") for receiver in self: await receiver(*args, **kwargs)
async def send(self, *args, **kwargs): """ Sends data to all registered receivers. """ if not self.frozen: raise RuntimeError("Cannot send non-frozen signal.") for receiver in self: await receiver(*args, **kwargs)
[ "Sends", "data", "to", "all", "registered", "receivers", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/signals.py#L26-L34
[ "async", "def", "send", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "frozen", ":", "raise", "RuntimeError", "(", "\"Cannot send non-frozen signal.\"", ")", "for", "receiver", "in", "self", ":", "await", "re...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
AccessLogger.compile_format
Translate log_format into form usable by modulo formatting All known atoms will be replaced with %s Also methods for formatting of those atoms will be added to _methods in appropriate order For example we have log_format = "%a %t" This format will be translated to "%s %s" ...
aiohttp/web_log.py
def compile_format(self, log_format: str) -> Tuple[str, List[KeyMethod]]: """Translate log_format into form usable by modulo formatting All known atoms will be replaced with %s Also methods for formatting of those atoms will be added to _methods in appropriate order For example...
def compile_format(self, log_format: str) -> Tuple[str, List[KeyMethod]]: """Translate log_format into form usable by modulo formatting All known atoms will be replaced with %s Also methods for formatting of those atoms will be added to _methods in appropriate order For example...
[ "Translate", "log_format", "into", "form", "usable", "by", "modulo", "formatting" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_log.py#L78-L118
[ "def", "compile_format", "(", "self", ",", "log_format", ":", "str", ")", "->", "Tuple", "[", "str", ",", "List", "[", "KeyMethod", "]", "]", ":", "# list of (key, method) tuples, we don't use an OrderedDict as users", "# can repeat the same key more than once", "methods"...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
normalize_path_middleware
Middleware factory which produces a middleware that normalizes the path of a request. By normalizing it means: - Add or remove a trailing slash to the path. - Double slashes are replaced by one. The middleware returns as soon as it finds a path that resolves correctly. The order if both me...
aiohttp/web_middlewares.py
def normalize_path_middleware( *, append_slash: bool=True, remove_slash: bool=False, merge_slashes: bool=True, redirect_class: Type[HTTPMove]=HTTPMovedPermanently) -> _Middleware: """ Middleware factory which produces a middleware that normalizes the path of a request. By normalizing...
def normalize_path_middleware( *, append_slash: bool=True, remove_slash: bool=False, merge_slashes: bool=True, redirect_class: Type[HTTPMove]=HTTPMovedPermanently) -> _Middleware: """ Middleware factory which produces a middleware that normalizes the path of a request. By normalizing...
[ "Middleware", "factory", "which", "produces", "a", "middleware", "that", "normalizes", "the", "path", "of", "a", "request", ".", "By", "normalizing", "it", "means", ":" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_middlewares.py#L42-L111
[ "def", "normalize_path_middleware", "(", "*", ",", "append_slash", ":", "bool", "=", "True", ",", "remove_slash", ":", "bool", "=", "False", ",", "merge_slashes", ":", "bool", "=", "True", ",", "redirect_class", ":", "Type", "[", "HTTPMove", "]", "=", "HTT...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
FormData._gen_form_data
Encode a list of fields using the multipart/form-data MIME format
aiohttp/formdata.py
def _gen_form_data(self) -> multipart.MultipartWriter: """Encode a list of fields using the multipart/form-data MIME format""" for dispparams, headers, value in self._fields: try: if hdrs.CONTENT_TYPE in headers: part = payload.get_payload( ...
def _gen_form_data(self) -> multipart.MultipartWriter: """Encode a list of fields using the multipart/form-data MIME format""" for dispparams, headers, value in self._fields: try: if hdrs.CONTENT_TYPE in headers: part = payload.get_payload( ...
[ "Encode", "a", "list", "of", "fields", "using", "the", "multipart", "/", "form", "-", "data", "MIME", "format" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/formdata.py#L116-L144
[ "def", "_gen_form_data", "(", "self", ")", "->", "multipart", ".", "MultipartWriter", ":", "for", "dispparams", ",", "headers", ",", "value", "in", "self", ".", "_fields", ":", "try", ":", "if", "hdrs", ".", "CONTENT_TYPE", "in", "headers", ":", "part", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
StreamWriter.write
Writes chunk of data to a stream. write_eof() indicates end of stream. writer can't be used after write_eof() method being called. write() return drain future.
aiohttp/http_writer.py
async def write(self, chunk: bytes, *, drain: bool=True, LIMIT: int=0x10000) -> None: """Writes chunk of data to a stream. write_eof() indicates end of stream. writer can't be used after write_eof() method being called. write() return drain future. """ ...
async def write(self, chunk: bytes, *, drain: bool=True, LIMIT: int=0x10000) -> None: """Writes chunk of data to a stream. write_eof() indicates end of stream. writer can't be used after write_eof() method being called. write() return drain future. """ ...
[ "Writes", "chunk", "of", "data", "to", "a", "stream", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_writer.py#L70-L105
[ "async", "def", "write", "(", "self", ",", "chunk", ":", "bytes", ",", "*", ",", "drain", ":", "bool", "=", "True", ",", "LIMIT", ":", "int", "=", "0x10000", ")", "->", "None", ":", "if", "self", ".", "_on_chunk_sent", "is", "not", "None", ":", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
StreamWriter.write_headers
Write request/response status and headers.
aiohttp/http_writer.py
async def write_headers(self, status_line: str, headers: 'CIMultiDict[str]') -> None: """Write request/response status and headers.""" # status + headers buf = _serialize_headers(status_line, headers) self._write(buf)
async def write_headers(self, status_line: str, headers: 'CIMultiDict[str]') -> None: """Write request/response status and headers.""" # status + headers buf = _serialize_headers(status_line, headers) self._write(buf)
[ "Write", "request", "/", "response", "status", "and", "headers", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_writer.py#L107-L112
[ "async", "def", "write_headers", "(", "self", ",", "status_line", ":", "str", ",", "headers", ":", "'CIMultiDict[str]'", ")", "->", "None", ":", "# status + headers", "buf", "=", "_serialize_headers", "(", "status_line", ",", "headers", ")", "self", ".", "_wri...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
netrc_from_env
Attempt to load the netrc file from the path specified by the env-var NETRC or in the default location in the user's home directory. Returns None if it couldn't be found or fails to parse.
aiohttp/helpers.py
def netrc_from_env() -> Optional[netrc.netrc]: """Attempt to load the netrc file from the path specified by the env-var NETRC or in the default location in the user's home directory. Returns None if it couldn't be found or fails to parse. """ netrc_env = os.environ.get('NETRC') if netrc_env is...
def netrc_from_env() -> Optional[netrc.netrc]: """Attempt to load the netrc file from the path specified by the env-var NETRC or in the default location in the user's home directory. Returns None if it couldn't be found or fails to parse. """ netrc_env = os.environ.get('NETRC') if netrc_env is...
[ "Attempt", "to", "load", "the", "netrc", "file", "from", "the", "path", "specified", "by", "the", "env", "-", "var", "NETRC", "or", "in", "the", "default", "location", "in", "the", "user", "s", "home", "directory", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L186-L219
[ "def", "netrc_from_env", "(", ")", "->", "Optional", "[", "netrc", ".", "netrc", "]", ":", "netrc_env", "=", "os", ".", "environ", ".", "get", "(", "'NETRC'", ")", "if", "netrc_env", "is", "not", "None", ":", "netrc_path", "=", "Path", "(", "netrc_env"...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
parse_mimetype
Parses a MIME type into its components. mimetype is a MIME type string. Returns a MimeType object. Example: >>> parse_mimetype('text/html; charset=utf-8') MimeType(type='text', subtype='html', suffix='', parameters={'charset': 'utf-8'})
aiohttp/helpers.py
def parse_mimetype(mimetype: str) -> MimeType: """Parses a MIME type into its components. mimetype is a MIME type string. Returns a MimeType object. Example: >>> parse_mimetype('text/html; charset=utf-8') MimeType(type='text', subtype='html', suffix='', parameters={'charset': 'u...
def parse_mimetype(mimetype: str) -> MimeType: """Parses a MIME type into its components. mimetype is a MIME type string. Returns a MimeType object. Example: >>> parse_mimetype('text/html; charset=utf-8') MimeType(type='text', subtype='html', suffix='', parameters={'charset': 'u...
[ "Parses", "a", "MIME", "type", "into", "its", "components", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L291-L328
[ "def", "parse_mimetype", "(", "mimetype", ":", "str", ")", "->", "MimeType", ":", "if", "not", "mimetype", ":", "return", "MimeType", "(", "type", "=", "''", ",", "subtype", "=", "''", ",", "suffix", "=", "''", ",", "parameters", "=", "MultiDictProxy", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
content_disposition_header
Sets ``Content-Disposition`` header. disptype is a disposition type: inline, attachment, form-data. Should be valid extension token (see RFC 2183) params is a dict with disposition params.
aiohttp/helpers.py
def content_disposition_header(disptype: str, quote_fields: bool=True, **params: str) -> str: """Sets ``Content-Disposition`` header. disptype is a disposition type: inline, attachment, form-data. Should be valid extension token (see RFC 2183) ...
def content_disposition_header(disptype: str, quote_fields: bool=True, **params: str) -> str: """Sets ``Content-Disposition`` header. disptype is a disposition type: inline, attachment, form-data. Should be valid extension token (see RFC 2183) ...
[ "Sets", "Content", "-", "Disposition", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L338-L365
[ "def", "content_disposition_header", "(", "disptype", ":", "str", ",", "quote_fields", ":", "bool", "=", "True", ",", "*", "*", "params", ":", "str", ")", "->", "str", ":", "if", "not", "disptype", "or", "not", "(", "TOKEN", ">", "set", "(", "disptype"...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BasicAuth.decode
Create a BasicAuth object from an Authorization HTTP header.
aiohttp/helpers.py
def decode(cls, auth_header: str, encoding: str='latin1') -> 'BasicAuth': """Create a BasicAuth object from an Authorization HTTP header.""" try: auth_type, encoded_credentials = auth_header.split(' ', 1) except ValueError: raise ValueError('Could not parse authorization ...
def decode(cls, auth_header: str, encoding: str='latin1') -> 'BasicAuth': """Create a BasicAuth object from an Authorization HTTP header.""" try: auth_type, encoded_credentials = auth_header.split(' ', 1) except ValueError: raise ValueError('Could not parse authorization ...
[ "Create", "a", "BasicAuth", "object", "from", "an", "Authorization", "HTTP", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L134-L160
[ "def", "decode", "(", "cls", ",", "auth_header", ":", "str", ",", "encoding", ":", "str", "=", "'latin1'", ")", "->", "'BasicAuth'", ":", "try", ":", "auth_type", ",", "encoded_credentials", "=", "auth_header", ".", "split", "(", "' '", ",", "1", ")", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BasicAuth.from_url
Create BasicAuth from url.
aiohttp/helpers.py
def from_url(cls, url: URL, *, encoding: str='latin1') -> Optional['BasicAuth']: """Create BasicAuth from url.""" if not isinstance(url, URL): raise TypeError("url should be yarl.URL instance") if url.user is None: return None return cls(url.user,...
def from_url(cls, url: URL, *, encoding: str='latin1') -> Optional['BasicAuth']: """Create BasicAuth from url.""" if not isinstance(url, URL): raise TypeError("url should be yarl.URL instance") if url.user is None: return None return cls(url.user,...
[ "Create", "BasicAuth", "from", "url", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L163-L170
[ "def", "from_url", "(", "cls", ",", "url", ":", "URL", ",", "*", ",", "encoding", ":", "str", "=", "'latin1'", ")", "->", "Optional", "[", "'BasicAuth'", "]", ":", "if", "not", "isinstance", "(", "url", ",", "URL", ")", ":", "raise", "TypeError", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BasicAuth.encode
Encode credentials.
aiohttp/helpers.py
def encode(self) -> str: """Encode credentials.""" creds = ('%s:%s' % (self.login, self.password)).encode(self.encoding) return 'Basic %s' % base64.b64encode(creds).decode(self.encoding)
def encode(self) -> str: """Encode credentials.""" creds = ('%s:%s' % (self.login, self.password)).encode(self.encoding) return 'Basic %s' % base64.b64encode(creds).decode(self.encoding)
[ "Encode", "credentials", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L172-L175
[ "def", "encode", "(", "self", ")", "->", "str", ":", "creds", "=", "(", "'%s:%s'", "%", "(", "self", ".", "login", ",", "self", ".", "password", ")", ")", ".", "encode", "(", "self", ".", "encoding", ")", "return", "'Basic %s'", "%", "base64", ".",...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
HeadersMixin.content_type
The value of content part for Content-Type HTTP header.
aiohttp/helpers.py
def content_type(self) -> str: """The value of content part for Content-Type HTTP header.""" raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore if self._stored_content_type != raw: self._parse_content_type(raw) return self._content_type
def content_type(self) -> str: """The value of content part for Content-Type HTTP header.""" raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore if self._stored_content_type != raw: self._parse_content_type(raw) return self._content_type
[ "The", "value", "of", "content", "part", "for", "Content", "-", "Type", "HTTP", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L624-L629
[ "def", "content_type", "(", "self", ")", "->", "str", ":", "raw", "=", "self", ".", "_headers", ".", "get", "(", "hdrs", ".", "CONTENT_TYPE", ")", "# type: ignore", "if", "self", ".", "_stored_content_type", "!=", "raw", ":", "self", ".", "_parse_content_t...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
HeadersMixin.charset
The value of charset part for Content-Type HTTP header.
aiohttp/helpers.py
def charset(self) -> Optional[str]: """The value of charset part for Content-Type HTTP header.""" raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore if self._stored_content_type != raw: self._parse_content_type(raw) return self._content_dict.get('charset')
def charset(self) -> Optional[str]: """The value of charset part for Content-Type HTTP header.""" raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore if self._stored_content_type != raw: self._parse_content_type(raw) return self._content_dict.get('charset')
[ "The", "value", "of", "charset", "part", "for", "Content", "-", "Type", "HTTP", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L632-L637
[ "def", "charset", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "raw", "=", "self", ".", "_headers", ".", "get", "(", "hdrs", ".", "CONTENT_TYPE", ")", "# type: ignore", "if", "self", ".", "_stored_content_type", "!=", "raw", ":", "self", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
HeadersMixin.content_length
The value of Content-Length HTTP header.
aiohttp/helpers.py
def content_length(self) -> Optional[int]: """The value of Content-Length HTTP header.""" content_length = self._headers.get(hdrs.CONTENT_LENGTH) # type: ignore if content_length is not None: return int(content_length) else: return None
def content_length(self) -> Optional[int]: """The value of Content-Length HTTP header.""" content_length = self._headers.get(hdrs.CONTENT_LENGTH) # type: ignore if content_length is not None: return int(content_length) else: return None
[ "The", "value", "of", "Content", "-", "Length", "HTTP", "header", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/helpers.py#L640-L647
[ "def", "content_length", "(", "self", ")", "->", "Optional", "[", "int", "]", ":", "content_length", "=", "self", ".", "_headers", ".", "get", "(", "hdrs", ".", "CONTENT_LENGTH", ")", "# type: ignore", "if", "content_length", "is", "not", "None", ":", "ret...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
request
Constructs and sends a request. Returns response object. method - HTTP method url - request url params - (optional) Dictionary or bytes to be sent in the query string of the new request data - (optional) Dictionary, bytes, or file-like object to send in the body of the request json - (op...
aiohttp/client.py
def request( method: str, url: StrOrURL, *, params: Optional[Mapping[str, str]]=None, data: Any=None, json: Any=None, headers: LooseHeaders=None, skip_auto_headers: Optional[Iterable[str]]=None, auth: Optional[BasicAuth]=None, allow_redirects: bool...
def request( method: str, url: StrOrURL, *, params: Optional[Mapping[str, str]]=None, data: Any=None, json: Any=None, headers: LooseHeaders=None, skip_auto_headers: Optional[Iterable[str]]=None, auth: Optional[BasicAuth]=None, allow_redirects: bool...
[ "Constructs", "and", "sends", "a", "request", ".", "Returns", "response", "object", ".", "method", "-", "HTTP", "method", "url", "-", "request", "url", "params", "-", "(", "optional", ")", "Dictionary", "or", "bytes", "to", "be", "sent", "in", "the", "qu...
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L1035-L1119
[ "def", "request", "(", "method", ":", "str", ",", "url", ":", "StrOrURL", ",", "*", ",", "params", ":", "Optional", "[", "Mapping", "[", "str", ",", "str", "]", "]", "=", "None", ",", "data", ":", "Any", "=", "None", ",", "json", ":", "Any", "=...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.request
Perform HTTP request.
aiohttp/client.py
def request(self, method: str, url: StrOrURL, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP request.""" return _RequestContextManager(self._request(method, url, **kwargs))
def request(self, method: str, url: StrOrURL, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP request.""" return _RequestContextManager(self._request(method, url, **kwargs))
[ "Perform", "HTTP", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L297-L302
[ "def", "request", "(", "self", ",", "method", ":", "str", ",", "url", ":", "StrOrURL", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "_request", "(", "method", ",", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.ws_connect
Initiate websocket connection.
aiohttp/client.py
def ws_connect( self, url: StrOrURL, *, method: str=hdrs.METH_GET, protocols: Iterable[str]=(), timeout: float=10.0, receive_timeout: Optional[float]=None, autoclose: bool=True, autoping: bool=True, heartbeat: Op...
def ws_connect( self, url: StrOrURL, *, method: str=hdrs.METH_GET, protocols: Iterable[str]=(), timeout: float=10.0, receive_timeout: Optional[float]=None, autoclose: bool=True, autoping: bool=True, heartbeat: Op...
[ "Initiate", "websocket", "connection", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L604-L641
[ "def", "ws_connect", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "method", ":", "str", "=", "hdrs", ".", "METH_GET", ",", "protocols", ":", "Iterable", "[", "str", "]", "=", "(", ")", ",", "timeout", ":", "float", "=", "10.0", ",", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession._prepare_headers
Add default headers and transform it to CIMultiDict
aiohttp/client.py
def _prepare_headers( self, headers: Optional[LooseHeaders]) -> 'CIMultiDict[str]': """ Add default headers and transform it to CIMultiDict """ # Convert headers to MultiDict result = CIMultiDict(self._default_headers) if headers: if not isinst...
def _prepare_headers( self, headers: Optional[LooseHeaders]) -> 'CIMultiDict[str]': """ Add default headers and transform it to CIMultiDict """ # Convert headers to MultiDict result = CIMultiDict(self._default_headers) if headers: if not isinst...
[ "Add", "default", "headers", "and", "transform", "it", "to", "CIMultiDict" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L800-L817
[ "def", "_prepare_headers", "(", "self", ",", "headers", ":", "Optional", "[", "LooseHeaders", "]", ")", "->", "'CIMultiDict[str]'", ":", "# Convert headers to MultiDict", "result", "=", "CIMultiDict", "(", "self", ".", "_default_headers", ")", "if", "headers", ":"...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.get
Perform HTTP GET request.
aiohttp/client.py
def get(self, url: StrOrURL, *, allow_redirects: bool=True, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP GET request.""" return _RequestContextManager( self._request(hdrs.METH_GET, url, allow_redirects=allow_redirects, ...
def get(self, url: StrOrURL, *, allow_redirects: bool=True, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP GET request.""" return _RequestContextManager( self._request(hdrs.METH_GET, url, allow_redirects=allow_redirects, ...
[ "Perform", "HTTP", "GET", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L819-L825
[ "def", "get", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "allow_redirects", ":", "bool", "=", "True", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "_r...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.options
Perform HTTP OPTIONS request.
aiohttp/client.py
def options(self, url: StrOrURL, *, allow_redirects: bool=True, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP OPTIONS request.""" return _RequestContextManager( self._request(hdrs.METH_OPTIONS, url, allow_redirects=allow_redirects, ...
def options(self, url: StrOrURL, *, allow_redirects: bool=True, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP OPTIONS request.""" return _RequestContextManager( self._request(hdrs.METH_OPTIONS, url, allow_redirects=allow_redirects, ...
[ "Perform", "HTTP", "OPTIONS", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L827-L833
[ "def", "options", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "allow_redirects", ":", "bool", "=", "True", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.head
Perform HTTP HEAD request.
aiohttp/client.py
def head(self, url: StrOrURL, *, allow_redirects: bool=False, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP HEAD request.""" return _RequestContextManager( self._request(hdrs.METH_HEAD, url, allow_redirects=allow_redirects, ...
def head(self, url: StrOrURL, *, allow_redirects: bool=False, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP HEAD request.""" return _RequestContextManager( self._request(hdrs.METH_HEAD, url, allow_redirects=allow_redirects, ...
[ "Perform", "HTTP", "HEAD", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L835-L841
[ "def", "head", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "allow_redirects", ":", "bool", "=", "False", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.post
Perform HTTP POST request.
aiohttp/client.py
def post(self, url: StrOrURL, *, data: Any=None, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP POST request.""" return _RequestContextManager( self._request(hdrs.METH_POST, url, data=data, **kwargs))
def post(self, url: StrOrURL, *, data: Any=None, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP POST request.""" return _RequestContextManager( self._request(hdrs.METH_POST, url, data=data, **kwargs))
[ "Perform", "HTTP", "POST", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L843-L849
[ "def", "post", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "data", ":", "Any", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "_request", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.put
Perform HTTP PUT request.
aiohttp/client.py
def put(self, url: StrOrURL, *, data: Any=None, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP PUT request.""" return _RequestContextManager( self._request(hdrs.METH_PUT, url, data=data, **kwargs))
def put(self, url: StrOrURL, *, data: Any=None, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP PUT request.""" return _RequestContextManager( self._request(hdrs.METH_PUT, url, data=data, **kwargs))
[ "Perform", "HTTP", "PUT", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L851-L857
[ "def", "put", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "data", ":", "Any", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "_request", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.patch
Perform HTTP PATCH request.
aiohttp/client.py
def patch(self, url: StrOrURL, *, data: Any=None, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP PATCH request.""" return _RequestContextManager( self._request(hdrs.METH_PATCH, url, data=data, **kwargs))
def patch(self, url: StrOrURL, *, data: Any=None, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP PATCH request.""" return _RequestContextManager( self._request(hdrs.METH_PATCH, url, data=data, **kwargs))
[ "Perform", "HTTP", "PATCH", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L859-L865
[ "def", "patch", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", ",", "data", ":", "Any", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "_request", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.delete
Perform HTTP DELETE request.
aiohttp/client.py
def delete(self, url: StrOrURL, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP DELETE request.""" return _RequestContextManager( self._request(hdrs.METH_DELETE, url, **kwargs))
def delete(self, url: StrOrURL, **kwargs: Any) -> '_RequestContextManager': """Perform HTTP DELETE request.""" return _RequestContextManager( self._request(hdrs.METH_DELETE, url, **kwargs))
[ "Perform", "HTTP", "DELETE", "request", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L867-L871
[ "def", "delete", "(", "self", ",", "url", ":", "StrOrURL", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "'_RequestContextManager'", ":", "return", "_RequestContextManager", "(", "self", ".", "_request", "(", "hdrs", ".", "METH_DELETE", ",", "url", ",", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.close
Close underlying connector. Release all acquired resources.
aiohttp/client.py
async def close(self) -> None: """Close underlying connector. Release all acquired resources. """ if not self.closed: if self._connector is not None and self._connector_owner: await self._connector.close() self._connector = None
async def close(self) -> None: """Close underlying connector. Release all acquired resources. """ if not self.closed: if self._connector is not None and self._connector_owner: await self._connector.close() self._connector = None
[ "Close", "underlying", "connector", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L873-L881
[ "async", "def", "close", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "closed", ":", "if", "self", ".", "_connector", "is", "not", "None", "and", "self", ".", "_connector_owner", ":", "await", "self", ".", "_connector", ".", "close", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientSession.requote_redirect_url
Do URL requoting on redirection handling.
aiohttp/client.py
def requote_redirect_url(self, val: bool) -> None: """Do URL requoting on redirection handling.""" warnings.warn("session.requote_redirect_url modification " "is deprecated #2778", DeprecationWarning, stacklevel=2) self._requote_r...
def requote_redirect_url(self, val: bool) -> None: """Do URL requoting on redirection handling.""" warnings.warn("session.requote_redirect_url modification " "is deprecated #2778", DeprecationWarning, stacklevel=2) self._requote_r...
[ "Do", "URL", "requoting", "on", "redirection", "handling", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client.py#L912-L918
[ "def", "requote_redirect_url", "(", "self", ",", "val", ":", "bool", ")", "->", "None", ":", "warnings", ".", "warn", "(", "\"session.requote_redirect_url modification \"", "\"is deprecated #2778\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "self...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
AbstractResolver.resolve
Return IP address for given hostname
aiohttp/abc.py
async def resolve(self, host: str, port: int, family: int) -> List[Dict[str, Any]]: """Return IP address for given hostname"""
async def resolve(self, host: str, port: int, family: int) -> List[Dict[str, Any]]: """Return IP address for given hostname"""
[ "Return", "IP", "address", "for", "given", "hostname" ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/abc.py#L126-L128
[ "async", "def", "resolve", "(", "self", ",", "host", ":", "str", ",", "port", ":", "int", ",", "family", ":", "int", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartResponseWrapper.next
Emits next multipart reader object.
aiohttp/multipart.py
async def next(self) -> Any: """Emits next multipart reader object.""" item = await self.stream.next() if self.stream.at_eof(): await self.release() return item
async def next(self) -> Any: """Emits next multipart reader object.""" item = await self.stream.next() if self.stream.at_eof(): await self.release() return item
[ "Emits", "next", "multipart", "reader", "object", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L222-L227
[ "async", "def", "next", "(", "self", ")", "->", "Any", ":", "item", "=", "await", "self", ".", "stream", ".", "next", "(", ")", "if", "self", ".", "stream", ".", "at_eof", "(", ")", ":", "await", "self", ".", "release", "(", ")", "return", "item"...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.read
Reads body part data. decode: Decodes data following by encoding method from Content-Encoding header. If it missed data remains untouched
aiohttp/multipart.py
async def read(self, *, decode: bool=False) -> Any: """Reads body part data. decode: Decodes data following by encoding method from Content-Encoding header. If it missed data remains untouched """ if self._at_eof: return b'' data = byt...
async def read(self, *, decode: bool=False) -> Any: """Reads body part data. decode: Decodes data following by encoding method from Content-Encoding header. If it missed data remains untouched """ if self._at_eof: return b'' data = byt...
[ "Reads", "body", "part", "data", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L277-L291
[ "async", "def", "read", "(", "self", ",", "*", ",", "decode", ":", "bool", "=", "False", ")", "->", "Any", ":", "if", "self", ".", "_at_eof", ":", "return", "b''", "data", "=", "bytearray", "(", ")", "while", "not", "self", ".", "_at_eof", ":", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.read_chunk
Reads body part content chunk of the specified size. size: chunk size
aiohttp/multipart.py
async def read_chunk(self, size: int=chunk_size) -> bytes: """Reads body part content chunk of the specified size. size: chunk size """ if self._at_eof: return b'' if self._length: chunk = await self._read_chunk_from_length(size) else: ...
async def read_chunk(self, size: int=chunk_size) -> bytes: """Reads body part content chunk of the specified size. size: chunk size """ if self._at_eof: return b'' if self._length: chunk = await self._read_chunk_from_length(size) else: ...
[ "Reads", "body", "part", "content", "chunk", "of", "the", "specified", "size", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L293-L312
[ "async", "def", "read_chunk", "(", "self", ",", "size", ":", "int", "=", "chunk_size", ")", "->", "bytes", ":", "if", "self", ".", "_at_eof", ":", "return", "b''", "if", "self", ".", "_length", ":", "chunk", "=", "await", "self", ".", "_read_chunk_from...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.readline
Reads body part by line by line.
aiohttp/multipart.py
async def readline(self) -> bytes: """Reads body part by line by line.""" if self._at_eof: return b'' if self._unread: line = self._unread.popleft() else: line = await self._content.readline() if line.startswith(self._boundary): #...
async def readline(self) -> bytes: """Reads body part by line by line.""" if self._at_eof: return b'' if self._unread: line = self._unread.popleft() else: line = await self._content.readline() if line.startswith(self._boundary): #...
[ "Reads", "body", "part", "by", "line", "by", "line", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L362-L390
[ "async", "def", "readline", "(", "self", ")", "->", "bytes", ":", "if", "self", ".", "_at_eof", ":", "return", "b''", "if", "self", ".", "_unread", ":", "line", "=", "self", ".", "_unread", ".", "popleft", "(", ")", "else", ":", "line", "=", "await...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.release
Like read(), but reads all the data to the void.
aiohttp/multipart.py
async def release(self) -> None: """Like read(), but reads all the data to the void.""" if self._at_eof: return while not self._at_eof: await self.read_chunk(self.chunk_size)
async def release(self) -> None: """Like read(), but reads all the data to the void.""" if self._at_eof: return while not self._at_eof: await self.read_chunk(self.chunk_size)
[ "Like", "read", "()", "but", "reads", "all", "the", "data", "to", "the", "void", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L392-L397
[ "async", "def", "release", "(", "self", ")", "->", "None", ":", "if", "self", ".", "_at_eof", ":", "return", "while", "not", "self", ".", "_at_eof", ":", "await", "self", ".", "read_chunk", "(", "self", ".", "chunk_size", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.text
Like read(), but assumes that body part contains text data.
aiohttp/multipart.py
async def text(self, *, encoding: Optional[str]=None) -> str: """Like read(), but assumes that body part contains text data.""" data = await self.read(decode=True) # see https://www.w3.org/TR/html5/forms.html#multipart/form-data-encoding-algorithm # NOQA # and https://dvcs.w3.org/hg/xhr/...
async def text(self, *, encoding: Optional[str]=None) -> str: """Like read(), but assumes that body part contains text data.""" data = await self.read(decode=True) # see https://www.w3.org/TR/html5/forms.html#multipart/form-data-encoding-algorithm # NOQA # and https://dvcs.w3.org/hg/xhr/...
[ "Like", "read", "()", "but", "assumes", "that", "body", "part", "contains", "text", "data", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L399-L405
[ "async", "def", "text", "(", "self", ",", "*", ",", "encoding", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "data", "=", "await", "self", ".", "read", "(", "decode", "=", "True", ")", "# see https://www.w3.org/TR/html5/forms.htm...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.json
Like read(), but assumes that body parts contains JSON data.
aiohttp/multipart.py
async def json(self, *, encoding: Optional[str]=None) -> Any: """Like read(), but assumes that body parts contains JSON data.""" data = await self.read(decode=True) if not data: return None encoding = encoding or self.get_charset(default='utf-8') return json.loads(dat...
async def json(self, *, encoding: Optional[str]=None) -> Any: """Like read(), but assumes that body parts contains JSON data.""" data = await self.read(decode=True) if not data: return None encoding = encoding or self.get_charset(default='utf-8') return json.loads(dat...
[ "Like", "read", "()", "but", "assumes", "that", "body", "parts", "contains", "JSON", "data", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L407-L413
[ "async", "def", "json", "(", "self", ",", "*", ",", "encoding", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Any", ":", "data", "=", "await", "self", ".", "read", "(", "decode", "=", "True", ")", "if", "not", "data", ":", "return", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.form
Like read(), but assumes that body parts contains form urlencoded data.
aiohttp/multipart.py
async def form(self, *, encoding: Optional[str]=None) -> List[Tuple[str, str]]: """Like read(), but assumes that body parts contains form urlencoded data. """ data = await self.read(decode=True) if not data: return [] if encoding is not None...
async def form(self, *, encoding: Optional[str]=None) -> List[Tuple[str, str]]: """Like read(), but assumes that body parts contains form urlencoded data. """ data = await self.read(decode=True) if not data: return [] if encoding is not None...
[ "Like", "read", "()", "but", "assumes", "that", "body", "parts", "contains", "form", "urlencoded", "data", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L415-L429
[ "async", "def", "form", "(", "self", ",", "*", ",", "encoding", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "Tuple", "[", "str", ",", "str", "]", "]", ":", "data", "=", "await", "self", ".", "read", "(", "decode", "="...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.decode
Decodes data according the specified Content-Encoding or Content-Transfer-Encoding headers value.
aiohttp/multipart.py
def decode(self, data: bytes) -> bytes: """Decodes data according the specified Content-Encoding or Content-Transfer-Encoding headers value. """ if CONTENT_TRANSFER_ENCODING in self.headers: data = self._decode_content_transfer(data) if CONTENT_ENCODING in self.header...
def decode(self, data: bytes) -> bytes: """Decodes data according the specified Content-Encoding or Content-Transfer-Encoding headers value. """ if CONTENT_TRANSFER_ENCODING in self.headers: data = self._decode_content_transfer(data) if CONTENT_ENCODING in self.header...
[ "Decodes", "data", "according", "the", "specified", "Content", "-", "Encoding", "or", "Content", "-", "Transfer", "-", "Encoding", "headers", "value", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L435-L443
[ "def", "decode", "(", "self", ",", "data", ":", "bytes", ")", "->", "bytes", ":", "if", "CONTENT_TRANSFER_ENCODING", "in", "self", ".", "headers", ":", "data", "=", "self", ".", "_decode_content_transfer", "(", "data", ")", "if", "CONTENT_ENCODING", "in", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.get_charset
Returns charset parameter from Content-Type header or default.
aiohttp/multipart.py
def get_charset(self, default: str) -> str: """Returns charset parameter from Content-Type header or default.""" ctype = self.headers.get(CONTENT_TYPE, '') mimetype = parse_mimetype(ctype) return mimetype.parameters.get('charset', default)
def get_charset(self, default: str) -> str: """Returns charset parameter from Content-Type header or default.""" ctype = self.headers.get(CONTENT_TYPE, '') mimetype = parse_mimetype(ctype) return mimetype.parameters.get('charset', default)
[ "Returns", "charset", "parameter", "from", "Content", "-", "Type", "header", "or", "default", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L470-L474
[ "def", "get_charset", "(", "self", ",", "default", ":", "str", ")", "->", "str", ":", "ctype", "=", "self", ".", "headers", ".", "get", "(", "CONTENT_TYPE", ",", "''", ")", "mimetype", "=", "parse_mimetype", "(", "ctype", ")", "return", "mimetype", "."...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
BodyPartReader.name
Returns name specified in Content-Disposition header or None if missed or header is malformed.
aiohttp/multipart.py
def name(self) -> Optional[str]: """Returns name specified in Content-Disposition header or None if missed or header is malformed. """ _, params = parse_content_disposition( self.headers.get(CONTENT_DISPOSITION)) return content_disposition_filename(params, 'name')
def name(self) -> Optional[str]: """Returns name specified in Content-Disposition header or None if missed or header is malformed. """ _, params = parse_content_disposition( self.headers.get(CONTENT_DISPOSITION)) return content_disposition_filename(params, 'name')
[ "Returns", "name", "specified", "in", "Content", "-", "Disposition", "header", "or", "None", "if", "missed", "or", "header", "is", "malformed", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L477-L484
[ "def", "name", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "_", ",", "params", "=", "parse_content_disposition", "(", "self", ".", "headers", ".", "get", "(", "CONTENT_DISPOSITION", ")", ")", "return", "content_disposition_filename", "(", "para...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartReader.from_response
Constructs reader instance from HTTP response. :param response: :class:`~aiohttp.client.ClientResponse` instance
aiohttp/multipart.py
def from_response(cls, response: 'ClientResponse') -> Any: """Constructs reader instance from HTTP response. :param response: :class:`~aiohttp.client.ClientResponse` instance """ obj = cls.response_wrapper_cls(response, cls(response.headers, ...
def from_response(cls, response: 'ClientResponse') -> Any: """Constructs reader instance from HTTP response. :param response: :class:`~aiohttp.client.ClientResponse` instance """ obj = cls.response_wrapper_cls(response, cls(response.headers, ...
[ "Constructs", "reader", "instance", "from", "HTTP", "response", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L557-L564
[ "def", "from_response", "(", "cls", ",", "response", ":", "'ClientResponse'", ")", "->", "Any", ":", "obj", "=", "cls", ".", "response_wrapper_cls", "(", "response", ",", "cls", "(", "response", ".", "headers", ",", "response", ".", "content", ")", ")", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartReader.next
Emits the next multipart body part.
aiohttp/multipart.py
async def next(self) -> Any: """Emits the next multipart body part.""" # So, if we're at BOF, we need to skip till the boundary. if self._at_eof: return await self._maybe_release_last_part() if self._at_bof: await self._read_until_first_boundary() ...
async def next(self) -> Any: """Emits the next multipart body part.""" # So, if we're at BOF, we need to skip till the boundary. if self._at_eof: return await self._maybe_release_last_part() if self._at_bof: await self._read_until_first_boundary() ...
[ "Emits", "the", "next", "multipart", "body", "part", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L572-L586
[ "async", "def", "next", "(", "self", ")", "->", "Any", ":", "# So, if we're at BOF, we need to skip till the boundary.", "if", "self", ".", "_at_eof", ":", "return", "await", "self", ".", "_maybe_release_last_part", "(", ")", "if", "self", ".", "_at_bof", ":", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartReader.release
Reads all the body parts to the void till the final boundary.
aiohttp/multipart.py
async def release(self) -> None: """Reads all the body parts to the void till the final boundary.""" while not self._at_eof: item = await self.next() if item is None: break await item.release()
async def release(self) -> None: """Reads all the body parts to the void till the final boundary.""" while not self._at_eof: item = await self.next() if item is None: break await item.release()
[ "Reads", "all", "the", "body", "parts", "to", "the", "void", "till", "the", "final", "boundary", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L588-L594
[ "async", "def", "release", "(", "self", ")", "->", "None", ":", "while", "not", "self", ".", "_at_eof", ":", "item", "=", "await", "self", ".", "next", "(", ")", "if", "item", "is", "None", ":", "break", "await", "item", ".", "release", "(", ")" ]
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartReader._get_part_reader
Dispatches the response by the `Content-Type` header, returning suitable reader instance. :param dict headers: Response headers
aiohttp/multipart.py
def _get_part_reader(self, headers: 'CIMultiDictProxy[str]') -> Any: """Dispatches the response by the `Content-Type` header, returning suitable reader instance. :param dict headers: Response headers """ ctype = headers.get(CONTENT_TYPE, '') mimetype = parse_mimetype(cty...
def _get_part_reader(self, headers: 'CIMultiDictProxy[str]') -> Any: """Dispatches the response by the `Content-Type` header, returning suitable reader instance. :param dict headers: Response headers """ ctype = headers.get(CONTENT_TYPE, '') mimetype = parse_mimetype(cty...
[ "Dispatches", "the", "response", "by", "the", "Content", "-", "Type", "header", "returning", "suitable", "reader", "instance", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L601-L619
[ "def", "_get_part_reader", "(", "self", ",", "headers", ":", "'CIMultiDictProxy[str]'", ")", "->", "Any", ":", "ctype", "=", "headers", ".", "get", "(", "CONTENT_TYPE", ",", "''", ")", "mimetype", "=", "parse_mimetype", "(", "ctype", ")", "if", "mimetype", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartReader._maybe_release_last_part
Ensures that the last read body part is read completely.
aiohttp/multipart.py
async def _maybe_release_last_part(self) -> None: """Ensures that the last read body part is read completely.""" if self._last_part is not None: if not self._last_part.at_eof(): await self._last_part.release() self._unread.extend(self._last_part._unread) ...
async def _maybe_release_last_part(self) -> None: """Ensures that the last read body part is read completely.""" if self._last_part is not None: if not self._last_part.at_eof(): await self._last_part.release() self._unread.extend(self._last_part._unread) ...
[ "Ensures", "that", "the", "last", "read", "body", "part", "is", "read", "completely", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L698-L704
[ "async", "def", "_maybe_release_last_part", "(", "self", ")", "->", "None", ":", "if", "self", ".", "_last_part", "is", "not", "None", ":", "if", "not", "self", ".", "_last_part", ".", "at_eof", "(", ")", ":", "await", "self", ".", "_last_part", ".", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartWriter._boundary_value
Wrap boundary parameter value in quotes, if necessary. Reads self.boundary and returns a unicode sting.
aiohttp/multipart.py
def _boundary_value(self) -> str: """Wrap boundary parameter value in quotes, if necessary. Reads self.boundary and returns a unicode sting. """ # Refer to RFCs 7231, 7230, 5234. # # parameter = token "=" ( token / quoted-string ) # token = 1*tchar ...
def _boundary_value(self) -> str: """Wrap boundary parameter value in quotes, if necessary. Reads self.boundary and returns a unicode sting. """ # Refer to RFCs 7231, 7230, 5234. # # parameter = token "=" ( token / quoted-string ) # token = 1*tchar ...
[ "Wrap", "boundary", "parameter", "value", "in", "quotes", "if", "necessary", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L752-L781
[ "def", "_boundary_value", "(", "self", ")", "->", "str", ":", "# Refer to RFCs 7231, 7230, 5234.", "#", "# parameter = token \"=\" ( token / quoted-string )", "# token = 1*tchar", "# quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE", "# qdtext = HTAB / SP / %x...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartWriter.append_payload
Adds a new body part to multipart writer.
aiohttp/multipart.py
def append_payload(self, payload: Payload) -> Payload: """Adds a new body part to multipart writer.""" # compression encoding = payload.headers.get(CONTENT_ENCODING, '').lower() # type: Optional[str] # noqa if encoding and encoding not in ('deflate', 'gzip', 'identity'): ra...
def append_payload(self, payload: Payload) -> Payload: """Adds a new body part to multipart writer.""" # compression encoding = payload.headers.get(CONTENT_ENCODING, '').lower() # type: Optional[str] # noqa if encoding and encoding not in ('deflate', 'gzip', 'identity'): ra...
[ "Adds", "a", "new", "body", "part", "to", "multipart", "writer", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L806-L830
[ "def", "append_payload", "(", "self", ",", "payload", ":", "Payload", ")", "->", "Payload", ":", "# compression", "encoding", "=", "payload", ".", "headers", ".", "get", "(", "CONTENT_ENCODING", ",", "''", ")", ".", "lower", "(", ")", "# type: Optional[str] ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartWriter.append_json
Helper to append JSON part.
aiohttp/multipart.py
def append_json( self, obj: Any, headers: Optional['MultiMapping[str]']=None ) -> Payload: """Helper to append JSON part.""" if headers is None: headers = CIMultiDict() return self.append_payload(JsonPayload(obj, headers=headers))
def append_json( self, obj: Any, headers: Optional['MultiMapping[str]']=None ) -> Payload: """Helper to append JSON part.""" if headers is None: headers = CIMultiDict() return self.append_payload(JsonPayload(obj, headers=headers))
[ "Helper", "to", "append", "JSON", "part", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L832-L841
[ "def", "append_json", "(", "self", ",", "obj", ":", "Any", ",", "headers", ":", "Optional", "[", "'MultiMapping[str]'", "]", "=", "None", ")", "->", "Payload", ":", "if", "headers", "is", "None", ":", "headers", "=", "CIMultiDict", "(", ")", "return", ...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartWriter.append_form
Helper to append form urlencoded part.
aiohttp/multipart.py
def append_form( self, obj: Union[Sequence[Tuple[str, str]], Mapping[str, str]], headers: Optional['MultiMapping[str]']=None ) -> Payload: """Helper to append form urlencoded part.""" assert isinstance(obj, (Sequence, Mapping)) if h...
def append_form( self, obj: Union[Sequence[Tuple[str, str]], Mapping[str, str]], headers: Optional['MultiMapping[str]']=None ) -> Payload: """Helper to append form urlencoded part.""" assert isinstance(obj, (Sequence, Mapping)) if h...
[ "Helper", "to", "append", "form", "urlencoded", "part", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L843-L861
[ "def", "append_form", "(", "self", ",", "obj", ":", "Union", "[", "Sequence", "[", "Tuple", "[", "str", ",", "str", "]", "]", ",", "Mapping", "[", "str", ",", "str", "]", "]", ",", "headers", ":", "Optional", "[", "'MultiMapping[str]'", "]", "=", "...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartWriter.size
Size of the payload.
aiohttp/multipart.py
def size(self) -> Optional[int]: """Size of the payload.""" if not self._parts: return 0 total = 0 for part, encoding, te_encoding in self._parts: if encoding or te_encoding or part.size is None: return None total += int( ...
def size(self) -> Optional[int]: """Size of the payload.""" if not self._parts: return 0 total = 0 for part, encoding, te_encoding in self._parts: if encoding or te_encoding or part.size is None: return None total += int( ...
[ "Size", "of", "the", "payload", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L864-L881
[ "def", "size", "(", "self", ")", "->", "Optional", "[", "int", "]", ":", "if", "not", "self", ".", "_parts", ":", "return", "0", "total", "=", "0", "for", "part", ",", "encoding", ",", "te_encoding", "in", "self", ".", "_parts", ":", "if", "encodin...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
MultipartWriter.write
Write body.
aiohttp/multipart.py
async def write(self, writer: Any, close_boundary: bool=True) -> None: """Write body.""" if not self._parts: return for part, encoding, te_encoding in self._parts: await writer.write(b'--' + self._boundary + b'\r\n') await writer.write(par...
async def write(self, writer: Any, close_boundary: bool=True) -> None: """Write body.""" if not self._parts: return for part, encoding, te_encoding in self._parts: await writer.write(b'--' + self._boundary + b'\r\n') await writer.write(par...
[ "Write", "body", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L883-L907
[ "async", "def", "write", "(", "self", ",", "writer", ":", "Any", ",", "close_boundary", ":", "bool", "=", "True", ")", "->", "None", ":", "if", "not", "self", ".", "_parts", ":", "return", "for", "part", ",", "encoding", ",", "te_encoding", "in", "se...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientRequest.update_host
Update destination host, port and connection type (ssl).
aiohttp/client_reqrep.py
def update_host(self, url: URL) -> None: """Update destination host, port and connection type (ssl).""" # get host/port if not url.host: raise InvalidURL(url) # basic auth info username, password = url.user, url.password if username: self.auth = h...
def update_host(self, url: URL) -> None: """Update destination host, port and connection type (ssl).""" # get host/port if not url.host: raise InvalidURL(url) # basic auth info username, password = url.user, url.password if username: self.auth = h...
[ "Update", "destination", "host", "port", "and", "connection", "type", "(", "ssl", ")", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client_reqrep.py#L296-L305
[ "def", "update_host", "(", "self", ",", "url", ":", "URL", ")", "->", "None", ":", "# get host/port", "if", "not", "url", ".", "host", ":", "raise", "InvalidURL", "(", "url", ")", "# basic auth info", "username", ",", "password", "=", "url", ".", "user",...
9504fe2affaaff673fa4f3754c1c44221f8ba47d
train
ClientRequest.update_version
Convert request version to two elements tuple. parser HTTP version '1.1' => (1, 1)
aiohttp/client_reqrep.py
def update_version(self, version: Union[http.HttpVersion, str]) -> None: """Convert request version to two elements tuple. parser HTTP version '1.1' => (1, 1) """ if isinstance(version, str): v = [l.strip() for l in version.split('.', 1)] try: ver...
def update_version(self, version: Union[http.HttpVersion, str]) -> None: """Convert request version to two elements tuple. parser HTTP version '1.1' => (1, 1) """ if isinstance(version, str): v = [l.strip() for l in version.split('.', 1)] try: ver...
[ "Convert", "request", "version", "to", "two", "elements", "tuple", "." ]
aio-libs/aiohttp
python
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/client_reqrep.py#L307-L320
[ "def", "update_version", "(", "self", ",", "version", ":", "Union", "[", "http", ".", "HttpVersion", ",", "str", "]", ")", "->", "None", ":", "if", "isinstance", "(", "version", ",", "str", ")", ":", "v", "=", "[", "l", ".", "strip", "(", ")", "f...
9504fe2affaaff673fa4f3754c1c44221f8ba47d