code
stringlengths
1
1.49M
vector
listlengths
0
7.38k
snippet
listlengths
0
7.38k
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
[ [ 1, 0, 0.3514, 0.0135, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.3649, 0.0135, 0, 0.66, 0.1111, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.3784, 0.0135, 0, ...
[ "import os", "import re", "import tempfile", "import shutil", "ignore_pattern = re.compile('^(.svn|target|bin|classes)')", "java_pattern = re.compile('^.*\\.java')", "annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')", "def process_dir(dir):\n files = os.listdir(dir)\n for...
#---------------------------- # Name: Aaron Carson # Project: Madlibs.py # Period: 2 # Start Date: 9/17/2013 # Last Revision Date: 10/7/2013 # Version: 1.2.0 #---------------------------- swearFilter = ["dumb", "stupid", "retard", "crap", "poop", ...
[ [ 14, 0, 0.098, 0.1029, 0, 0.66, 0, 381, 0, 0, 0, 0, 0, 5, 0 ], [ 2, 0, 0.1618, 0.0147, 0, 0.66, 0.0833, 371, 0, 0, 0, 0, 0, 0, 2 ], [ 8, 1, 0.1618, 0.0049, 1, 0.19...
[ "swearFilter = [\"dumb\",\n \"stupid\",\n \"retard\",\n \"crap\",\n \"poop\",\n \"anal beads\",\n \"anal\",\n \"shit\",", "def displayStartScreen():\n print(\"Madlibs\")\n raw_input(\"Press Enter to Continue\")...
#!/usr/bin/python2.4 # -*- coding: UTF-8 -*- # subversion info: # $HeadURL: $ # $Author: $ # $Id: $ # $Revision: $ from distutils.core import setup import os import sys import setuptools class doc(setuptools.Command): description = 'Create the package\'s documentation' user_options = [] doc_src = "Abacum" d...
[ [ 1, 0, 0.1818, 0.0182, 0, 0.66, 0, 152, 0, 1, 0, 0, 152, 0, 0 ], [ 1, 0, 0.2, 0.0182, 0, 0.66, 0.2, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.2182, 0.0182, 0, 0.66, ...
[ "from distutils.core import setup", "import os", "import sys", "import setuptools", "class doc(setuptools.Command):\n description = 'Create the package\\'s documentation'\n user_options = []\n doc_src = \"Abacum\"\n doc_dst = \"doc\"\n excepciones = ['__init__.py'] # Not for document\n\n def initializ...
import sys import simplejson """ Simple utility for loads a json file. """ if __name__ == '__main__': if len(sys.argv) < 2: print '%s: You must provide some file to load' % sys.argv[0] sys.exit(-1) fd = open(sys.argv[1]) _input = ''.join([l for l in fd.xreadlines() if l.find('#') == -1]) print _input...
[ [ 1, 0, 0.05, 0.05, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.1, 0.05, 0, 0.66, 0.3333, 386, 0, 1, 0, 0, 386, 0, 0 ], [ 8, 0, 0.25, 0.15, 0, 0.66, 0.6...
[ "import sys", "import simplejson", "\"\"\"\nSimple utility for loads a json file.\n\"\"\"", "if __name__ == '__main__':\n if len(sys.argv) < 2:\n print('%s: You must provide some file to load' % sys.argv[0])\n sys.exit(-1)\n\n fd = open(sys.argv[1])\n _input = ''.join([l for l in fd.xreadlines() if l...
import logging from errorcodes import GeneralError """ Module for logging facilities. """ class Logger(logging.Logger): """ Base class of loggers, derived from logging.Logger. """ def raiseLog(self, exceptionClass, msg): """ Convenience method for raise an exception after logging the incident. "...
[ [ 1, 0, 0.0185, 0.0185, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.037, 0.0185, 0, 0.66, 0.25, 634, 0, 1, 0, 0, 634, 0, 0 ], [ 8, 0, 0.0926, 0.0556, 0, 0.6...
[ "import logging", "from errorcodes import GeneralError", "\"\"\"\nModule for logging facilities.\n\"\"\"", "class Logger(logging.Logger):\n \"\"\"\n Base class of loggers, derived from logging.Logger.\n \"\"\"\n\n def raiseLog(self, exceptionClass, msg):\n \"\"\"\n Convenience method for raise an ex...
""" This module is the basic module for all the Abacum magic. """
[ [ 8, 0, 0.6667, 1, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ] ]
[ "\"\"\"\nThis module is the basic module for all the Abacum magic.\n\"\"\"" ]
""" Module that provides custom errors. """ class NotYetSupportedError(Exception): """ This error raises when something is not implemented yet. """ pass class GeneralError(Exception): """ This is the main error for all the abacum system. """ pass
[ [ 8, 0, 0.1333, 0.2, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 3, 0, 0.4667, 0.3333, 0, 0.66, 0.5, 452, 0, 0, 0, 0, 645, 0, 0 ], [ 8, 1, 0.4667, 0.2, 1, 0.14, 0, ...
[ "\"\"\"\nModule that provides custom errors.\n\"\"\"", "class NotYetSupportedError(Exception):\n \"\"\"\n This error raises when something is not implemented yet.\n \"\"\"\n pass", " \"\"\"\n This error raises when something is not implemented yet.\n \"\"\"", "class GeneralError(Exception):\n \"\"\"\n...
import component """ Module for objects that execute code. """ class Programable(component.Component): """ Base class for all the programable objects. Is a derived class from component. """
[ [ 1, 0, 0.0769, 0.0769, 0, 0.66, 0, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 8, 0, 0.3077, 0.2308, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 3, 0, 0.7692, 0.3846, 0, 0.66, ...
[ "import component", "\"\"\"\nModule for objects that execute code.\n\"\"\"", "class Programable(component.Component):\n \"\"\"\n Base class for all the programable objects.\n Is a derived class from component.\n \"\"\"", " \"\"\"\n Base class for all the programable objects.\n Is a derived class from c...
#!/usr/bin/python2.4 # -*- coding: UTF-8 -*- # subversion info: # $HeadURL: $ # $Author: $ # $Id: $ # $Revision: $ from distutils.core import setup import os import sys import setuptools class doc(setuptools.Command): description = 'Create the package\'s documentation' user_options = [] doc_src = "Abacum" d...
[ [ 1, 0, 0.1818, 0.0182, 0, 0.66, 0, 152, 0, 1, 0, 0, 152, 0, 0 ], [ 1, 0, 0.2, 0.0182, 0, 0.66, 0.2, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.2182, 0.0182, 0, 0.66, ...
[ "from distutils.core import setup", "import os", "import sys", "import setuptools", "class doc(setuptools.Command):\n description = 'Create the package\\'s documentation'\n user_options = []\n doc_src = \"Abacum\"\n doc_dst = \"doc\"\n excepciones = ['__init__.py'] # Not for document\n\n def initializ...
"""Run all unittests. Usage: python3 runtests.py [-v] [-q] [pattern] ... Where: -v: verbose -q: quiet pattern: optional regex patterns to match test ids (default all tests) Note that the test id is the fully qualified name of the test, including package, module, class and method, e.g. 'tests.events_test.Poli...
[ [ 8, 0, 0.055, 0.105, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.125, 0.005, 0, 0.66, 0.0455, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.13, 0.005, 0, 0.66, 0...
[ "\"\"\"Run all unittests.\n\nUsage:\n python3 runtests.py [-v] [-q] [pattern] ...\n\nWhere:\n -v: verbose\n -q: quiet", "import argparse", "import logging", "import os", "import re", "import sys", "import subprocess", "import unittest", "import importlib.machinery", "ARGS = argparse.ArgumentPar...
import os from distutils.core import setup, Extension extensions = [] if os.name == 'nt': ext = Extension('_overlapped', ['overlapped.c'], libraries=['ws2_32']) extensions.append(ext) setup(name='tulip', description="reference implementation of PEP 3156", url='http://www.python.org/dev/peps/pep-31...
[ [ 1, 0, 0.0714, 0.0714, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.1429, 0.0714, 0, 0.66, 0.25, 152, 0, 2, 0, 0, 152, 0, 0 ], [ 14, 0, 0.2857, 0.0714, 0, 0...
[ "import os", "from distutils.core import setup, Extension", "extensions = []", "if os.name == 'nt':\n ext = Extension('_overlapped', ['overlapped.c'], libraries=['ws2_32'])\n extensions.append(ext)", " ext = Extension('_overlapped', ['overlapped.c'], libraries=['ws2_32'])", " extensions.append...
"""Event loop and event loop policy. Beyond the PEP: - Only the main thread has a default event loop. """ __all__ = ['AbstractEventLoopPolicy', 'DefaultEventLoopPolicy', 'AbstractEventLoop', 'TimerHandle', 'Handle', 'make_handle', 'get_event_loop_policy', 'set_event_loop_policy', 'get...
[ [ 8, 0, 0.0074, 0.0123, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0222, 0.0123, 0, 0.66, 0.0588, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0321, 0.0025, 0, 0.66,...
[ "\"\"\"Event loop and event loop policy.\n\nBeyond the PEP:\n- Only the main thread has a default event loop.\n\"\"\"", "__all__ = ['AbstractEventLoopPolicy', 'DefaultEventLoopPolicy',\n 'AbstractEventLoop', 'TimerHandle', 'Handle', 'make_handle',\n 'get_event_loop_policy', 'set_event_loop_pol...
"""A socket pair usable as a self-pipe, for Windows. Origin: https://gist.github.com/4325783, by Geert Jansen. Public domain. """ import socket import sys if sys.platform != 'win32': # pragma: no cover raise ImportError('winsocketpair is win32 only') def socketpair(family=socket.AF_INET, type=socket.SOCK_STR...
[ [ 8, 0, 0.0735, 0.1176, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1765, 0.0294, 0, 0.66, 0.25, 687, 0, 1, 0, 0, 687, 0, 0 ], [ 1, 0, 0.2059, 0.0294, 0, 0.66, ...
[ "\"\"\"A socket pair usable as a self-pipe, for Windows.\n\nOrigin: https://gist.github.com/4325783, by Geert Jansen. Public domain.\n\"\"\"", "import socket", "import sys", "if sys.platform != 'win32': # pragma: no cover\n raise ImportError('winsocketpair is win32 only')", "def socketpair(family=socke...
"""Queues""" __all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue'] import collections import concurrent.futures import heapq import queue from . import events from . import futures from . import locks from .tasks import coroutine class Queue: """A queue, useful for coordinating producer and consum...
[ [ 8, 0, 0.0034, 0.0034, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0103, 0.0034, 0, 0.66, 0.0769, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0171, 0.0034, 0, 0.66,...
[ "\"\"\"Queues\"\"\"", "__all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue']", "import collections", "import concurrent.futures", "import heapq", "import queue", "from . import events", "from . import futures", "from . import locks", "from .tasks import coroutine", "class Queue:\n ...
"""Event loop using a selector and related classes. A selector is a "notify-when-ready" multiplexer. For a subclass which also includes support for signal handling, see the unix_events sub-module. """ import collections import socket try: import ssl except ImportError: # pragma: no cover ssl = None from . ...
[ [ 8, 0, 0.0042, 0.0071, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0099, 0.0014, 0, 0.66, 0.0714, 193, 0, 1, 0, 0, 193, 0, 0 ], [ 1, 0, 0.0113, 0.0014, 0, 0.66...
[ "\"\"\"Event loop using a selector and related classes.\n\nA selector is a \"notify-when-ready\" multiplexer. For a subclass which\nalso includes support for signal handling, see the unix_events sub-module.\n\"\"\"", "import collections", "import socket", "try:\n import ssl\nexcept ImportError: # pragma:...
"""Constants.""" LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5
[ [ 8, 0, 0.25, 0.25, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 1, 0.25, 0, 0.66, 1, 187, 1, 0, 0, 0, 0, 1, 0 ] ]
[ "\"\"\"Constants.\"\"\"", "LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5" ]
"""Abstract Protocol class.""" __all__ = ['Protocol', 'DatagramProtocol'] class BaseProtocol: """ABC for base protocol class. Usually user implements protocols that derived from BaseProtocol like Protocol or ProcessProtocol. The only case when BaseProtocol should be implemented directly is writ...
[ [ 8, 0, 0.0128, 0.0128, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0385, 0.0128, 0, 0.66, 0.25, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 3, 0, 0.2308, 0.3205, 0, 0.66, ...
[ "\"\"\"Abstract Protocol class.\"\"\"", "__all__ = ['Protocol', 'DatagramProtocol']", "class BaseProtocol:\n \"\"\"ABC for base protocol class.\n\n Usually user implements protocols that derived from BaseProtocol\n like Protocol or ProcessProtocol.\n\n The only case when BaseProtocol should be imple...
"""Tulip logging configuration""" import logging tulip_log = logging.getLogger("tulip")
[ [ 8, 0, 0.1667, 0.1667, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.5, 0.1667, 0, 0.66, 0.5, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 14, 0, 1, 0.1667, 0, 0.66, 1, ...
[ "\"\"\"Tulip logging configuration\"\"\"", "import logging", "tulip_log = logging.getLogger(\"tulip\")" ]
"""Parser is a generator function. Parser receives data with generator's send() method and sends data to destination DataBuffer. Parser receives ParserBuffer and DataBuffer objects as a parameters of the first send() call, all subsequent send() calls should send bytes objects. Parser sends parsed 'term' to desitnation...
[ [ 8, 0, 0.0743, 0.1461, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.1499, 0.005, 0, 0.66, 0.0833, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.1562, 0.0025, 0, 0.66, ...
[ "\"\"\"Parser is a generator function.\n\nParser receives data with generator's send() method and sends data to\ndestination DataBuffer. Parser receives ParserBuffer and DataBuffer objects\nas a parameters of the first send() call, all subsequent send() calls should\nsend bytes objects. Parser sends parsed 'term' t...
# NOTE: This is a hack. Andrew Svetlov is working in a proper # subprocess management transport for use with # connect_{read,write}_pipe(). import fcntl import os import traceback from . import transports from . import events from .log import tulip_log class UnixSubprocessTransport(transports.Transport): """Tr...
[ [ 1, 0, 0.0321, 0.0064, 0, 0.66, 0, 488, 0, 1, 0, 0, 488, 0, 0 ], [ 1, 0, 0.0385, 0.0064, 0, 0.66, 0.1429, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0449, 0.0064, 0, ...
[ "import fcntl", "import os", "import traceback", "from . import transports", "from . import events", "from .log import tulip_log", "class UnixSubprocessTransport(transports.Transport):\n \"\"\"Transport class managing a subprocess.\n\n TODO: Separate this into something that just handles pipe I/O,...
"""client session support.""" __all__ = ['Session'] import tulip import http.cookies class Session: def __init__(self): self._conns = {} self.cookies = http.cookies.SimpleCookie() def __del__(self): self.close() def close(self): """Close all opened transports.""" ...
[ [ 8, 0, 0.0099, 0.0099, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0297, 0.0099, 0, 0.66, 0.2, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0495, 0.0099, 0, 0.66, ...
[ "\"\"\"client session support.\"\"\"", "__all__ = ['Session']", "import tulip", "import http.cookies", "class Session:\n\n def __init__(self):\n self._conns = {}\n self.cookies = http.cookies.SimpleCookie()\n\n def __del__(self):\n self.close()", " def __init__(self):\n ...
"""HTTP Client for Tulip. Most basic usage: response = yield from tulip.http.request('GET', url) response['Content-Type'] == 'application/json' response.status == 200 content = yield from response.content.read() """ __all__ = ['request'] import base64 import email.message import http.client import http.coo...
[ [ 8, 0, 0.0098, 0.0179, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0214, 0.0018, 0, 0.66, 0.0476, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.025, 0.0018, 0, 0.66, ...
[ "\"\"\"HTTP Client for Tulip.\n\nMost basic usage:\n\n response = yield from tulip.http.request('GET', url)\n response['Content-Type'] == 'application/json'\n response.status == 200", "__all__ = ['request']", "import base64", "import email.message", "import http.client", "import http.cookies", "impor...
"""Http related helper utils.""" __all__ = ['HttpMessage', 'Request', 'Response', 'RawRequestMessage', 'RawResponseMessage', 'http_request_parser', 'http_response_parser', 'http_payload_parser'] import collections import functools import http.server import itertools import re import s...
[ [ 8, 0, 0.0013, 0.0013, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.006, 0.0054, 0, 0.66, 0.0303, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0107, 0.0013, 0, 0.66, ...
[ "\"\"\"Http related helper utils.\"\"\"", "__all__ = ['HttpMessage', 'Request', 'Response',\n 'RawRequestMessage', 'RawResponseMessage',\n 'http_request_parser', 'http_response_parser',\n 'http_payload_parser']", "import collections", "import functools", "import http.server", ...
"""simple http server.""" __all__ = ['ServerHttpProtocol'] import http.server import inspect import logging import traceback import tulip from tulip.http import errors RESPONSES = http.server.BaseHTTPRequestHandler.responses DEFAULT_ERROR_MESSAGE = """ <html> <head> <title>{status} {reason}</title> </head>...
[ [ 8, 0, 0.0055, 0.0055, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0164, 0.0055, 0, 0.66, 0.1, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0273, 0.0055, 0, 0.66, ...
[ "\"\"\"simple http server.\"\"\"", "__all__ = ['ServerHttpProtocol']", "import http.server", "import inspect", "import logging", "import traceback", "import tulip", "from tulip.http import errors", "RESPONSES = http.server.BaseHTTPRequestHandler.responses", "DEFAULT_ERROR_MESSAGE = \"\"\"\n<html>\...
"""WebSocket protocol versions 13 and 8.""" __all__ = ['WebSocketParser', 'WebSocketWriter', 'do_handshake', 'Message', 'WebSocketError', 'MSG_TEXT', 'MSG_BINARY', 'MSG_CLOSE', 'MSG_PING', 'MSG_PONG'] import base64 import binascii import collections import hashlib import struct from tulip.http i...
[ [ 8, 0, 0.0044, 0.0044, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0176, 0.0132, 0, 0.66, 0.0455, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0308, 0.0044, 0, 0.66,...
[ "\"\"\"WebSocket protocol versions 13 and 8.\"\"\"", "__all__ = ['WebSocketParser', 'WebSocketWriter', 'do_handshake',\n 'Message', 'WebSocketError',\n 'MSG_TEXT', 'MSG_BINARY', 'MSG_CLOSE', 'MSG_PING', 'MSG_PONG']", "import base64", "import binascii", "import collections", "import has...
"""http related errors.""" __all__ = ['HttpException', 'HttpStatusException', 'IncompleteRead', 'BadStatusLine', 'LineTooLong', 'InvalidHeader'] import http.client class HttpException(http.client.HTTPException): code = None headers = () class HttpStatusException(HttpException): def __init...
[ [ 8, 0, 0.0227, 0.0227, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0795, 0.0455, 0, 0.66, 0.1111, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.1364, 0.0227, 0, 0.66,...
[ "\"\"\"http related errors.\"\"\"", "__all__ = ['HttpException', 'HttpStatusException',\n 'IncompleteRead', 'BadStatusLine', 'LineTooLong', 'InvalidHeader']", "import http.client", "class HttpException(http.client.HTTPException):\n\n code = None\n headers = ()", " code = None", " hea...
# This relies on each of the submodules having an __all__ variable. from .client import * from .errors import * from .protocol import * from .server import * from .session import * from .wsgi import * __all__ = (client.__all__ + errors.__all__ + protocol.__all__ + server.__all__ + ...
[ [ 1, 0, 0.1875, 0.0625, 0, 0.66, 0, 608, 0, 1, 0, 0, 608, 0, 0 ], [ 1, 0, 0.25, 0.0625, 0, 0.66, 0.1667, 841, 0, 1, 0, 0, 841, 0, 0 ], [ 1, 0, 0.3125, 0.0625, 0, 0....
[ "from .client import *", "from .errors import *", "from .protocol import *", "from .server import *", "from .session import *", "from .wsgi import *", "__all__ = (client.__all__ +\n errors.__all__ +\n protocol.__all__ +\n server.__all__ +\n session.__all__ +\n ...
"""wsgi server. TODO: * proxy protocol * x-forward security * wsgi file support (os.sendfile) """ __all__ = ['WSGIServerHttpProtocol'] import inspect import io import os import sys from urllib.parse import unquote, urlsplit import tulip import tulip.http from tulip.http import server class WSGIServerHttpPro...
[ [ 8, 0, 0.0181, 0.0317, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0407, 0.0045, 0, 0.66, 0.0833, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0498, 0.0045, 0, 0.66,...
[ "\"\"\"wsgi server.\n\nTODO:\n * proxy protocol\n * x-forward security\n * wsgi file support (os.sendfile)\n\"\"\"", "__all__ = ['WSGIServerHttpProtocol']", "import inspect", "import io", "import os", "import sys", "from urllib.parse import unquote, urlsplit", "import tulip", "import tulip.http",...
"""Selector and proactor eventloops for Windows.""" import errno import socket import weakref import struct import _winapi from . import futures from . import proactor_events from . import selector_events from . import winsocketpair from . import _overlapped from .log import tulip_log __all__ = ['SelectorEventLoop'...
[ [ 8, 0, 0.006, 0.006, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0181, 0.006, 0, 0.66, 0.0526, 546, 0, 1, 0, 0, 546, 0, 0 ], [ 1, 0, 0.0241, 0.006, 0, 0.66, ...
[ "\"\"\"Selector and proactor eventloops for Windows.\"\"\"", "import errno", "import socket", "import weakref", "import struct", "import _winapi", "from . import futures", "from . import proactor_events", "from . import selector_events", "from . import winsocketpair", "from . import _overlapped"...
"""Support for tasks, coroutines and the scheduler.""" __all__ = ['coroutine', 'task', 'taskify', 'Task', 'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED', 'wait', 'as_completed', 'sleep', ] import concurrent.futures import functools import inspect import time from . import futu...
[ [ 8, 0, 0.0029, 0.0029, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0132, 0.0117, 0, 0.66, 0.05, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0234, 0.0029, 0, 0.66, ...
[ "\"\"\"Support for tasks, coroutines and the scheduler.\"\"\"", "__all__ = ['coroutine', 'task', 'taskify', 'Task',\n 'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED',\n 'wait', 'as_completed', 'sleep',\n ]", "import concurrent.futures", "import functools", "import inspect...
"""Stream-related things.""" __all__ = ['StreamReader'] import collections from . import futures from . import tasks class StreamReader: def __init__(self, limit=2**16): self.limit = limit # Max line length. (Security feature.) self.buffer = collections.deque() # Deque of bytes objects. ...
[ [ 8, 0, 0.0068, 0.0068, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0204, 0.0068, 0, 0.66, 0.2, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.034, 0.0068, 0, 0.66, ...
[ "\"\"\"Stream-related things.\"\"\"", "__all__ = ['StreamReader']", "import collections", "from . import futures", "from . import tasks", "class StreamReader:\n\n def __init__(self, limit=2**16):\n self.limit = limit # Max line length. (Security feature.)\n self.buffer = collections.deq...
"""Tulip 2.0, tracking PEP 3156.""" import sys # This relies on each of the submodules having an __all__ variable. from .futures import * from .events import * from .locks import * from .transports import * from .parsers import * from .protocols import * from .streams import * from .tasks import * if sys.platform ==...
[ [ 8, 0, 0.0357, 0.0357, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1071, 0.0357, 0, 0.66, 0.0909, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.2143, 0.0357, 0, 0.66...
[ "\"\"\"Tulip 2.0, tracking PEP 3156.\"\"\"", "import sys", "from .futures import *", "from .events import *", "from .locks import *", "from .transports import *", "from .parsers import *", "from .protocols import *", "from .streams import *", "from .tasks import *", "if sys.platform == 'win32': ...
"""Select module. This module supports asynchronous I/O on multiple file descriptors. """ import sys from select import * from .log import tulip_log # generic events, that must be mapped to implementation-specific ones # read event EVENT_READ = (1 << 0) # write event EVENT_WRITE = (1 << 1) def _fileobj_to_fd(fil...
[ [ 8, 0, 0.0059, 0.0094, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0141, 0.0023, 0, 0.66, 0.0769, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.0164, 0.0023, 0, 0.66...
[ "\"\"\"Select module.\n\nThis module supports asynchronous I/O on multiple file descriptors.\n\"\"\"", "import sys", "from select import *", "from .log import tulip_log", "EVENT_READ = (1 << 0)", "EVENT_WRITE = (1 << 1)", "def _fileobj_to_fd(fileobj):\n \"\"\"Return a file descriptor from a file obje...
"""Event loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. """ from . import base_events from . import constants from . import transports from .log import tulip_log class _ProactorSocketTransport(transports....
[ [ 8, 0, 0.0151, 0.0251, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0352, 0.005, 0, 0.66, 0.1667, 0, 0, 1, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0402, 0.005, 0, 0.66, ...
[ "\"\"\"Event loop using a proactor and related classes.\n\nA proactor is a \"notify-on-completion\" multiplexer. Currently a\nproactor is only implemented on Windows with IOCP.\n\"\"\"", "from . import base_events", "from . import constants", "from . import transports", "from .log import tulip_log", "cla...
"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of IO events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a ca...
[ [ 8, 0, 0.0133, 0.0248, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0301, 0.0018, 0, 0.66, 0.0588, 193, 0, 1, 0, 0, 193, 0, 0 ], [ 1, 0, 0.0319, 0.0018, 0, 0.66...
[ "\"\"\"Base implementation of event loop.\n\nThe event loop can be broken up into a multiplexer (the part\nresponsible for notifying us of IO events) and the event loop proper,\nwhich wraps a multiplexer with functionality for scheduling callbacks,\nimmediately or at a given time in the future.\n\nWhenever a public...
"""Selector eventloop for Unix with signal handling.""" import errno import fcntl import os import socket import sys try: import signal except ImportError: # pragma: no cover signal = None from . import constants from . import events from . import selector_events from . import transports from .log import tu...
[ [ 8, 0, 0.0032, 0.0032, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0097, 0.0032, 0, 0.66, 0.0588, 546, 0, 1, 0, 0, 546, 0, 0 ], [ 1, 0, 0.0129, 0.0032, 0, 0.66...
[ "\"\"\"Selector eventloop for Unix with signal handling.\"\"\"", "import errno", "import fcntl", "import os", "import socket", "import sys", "try:\n import signal\nexcept ImportError: # pragma: no cover\n signal = None", " import signal", " signal = None", "from . import constants", ...
"""Abstract Transport class.""" __all__ = ['ReadTransport', 'WriteTransport', 'Transport'] class BaseTransport: """Base ABC for transports.""" def __init__(self, extra=None): if extra is None: extra = {} self._extra = extra def get_extra_info(self, name, default=None): ...
[ [ 8, 0, 0.0075, 0.0075, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0224, 0.0075, 0, 0.66, 0.1667, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 3, 0, 0.1194, 0.1567, 0, 0.66,...
[ "\"\"\"Abstract Transport class.\"\"\"", "__all__ = ['ReadTransport', 'WriteTransport', 'Transport']", "class BaseTransport:\n \"\"\"Base ABC for transports.\"\"\"\n\n def __init__(self, extra=None):\n if extra is None:\n extra = {}\n self._extra = extra", " \"\"\"Base ABC fo...
"""Synchronization primitives""" __all__ = ['Lock', 'EventWaiter', 'Condition', 'Semaphore'] import collections import time from . import events from . import futures from . import tasks class Lock: """The class implementing primitive lock objects. A primitive lock is a synchronization primitive that is n...
[ [ 8, 0, 0.0023, 0.0023, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0068, 0.0023, 0, 0.66, 0.1, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0113, 0.0023, 0, 0.66, ...
[ "\"\"\"Synchronization primitives\"\"\"", "__all__ = ['Lock', 'EventWaiter', 'Condition', 'Semaphore']", "import collections", "import time", "from . import events", "from . import futures", "from . import tasks", "class Lock:\n \"\"\"The class implementing primitive lock objects.\n\n A primitiv...
"""A Future class similar to the one in PEP 3148.""" __all__ = ['CancelledError', 'TimeoutError', 'InvalidStateError', 'InvalidTimeoutError', 'Future', ] import concurrent.futures._base import logging import traceback from . import events from .log import tulip_log # States for Futu...
[ [ 8, 0, 0.0029, 0.0029, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.013, 0.0116, 0, 0.66, 0.0588, 272, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0232, 0.0029, 0, 0.66, ...
[ "\"\"\"A Future class similar to the one in PEP 3148.\"\"\"", "__all__ = ['CancelledError', 'TimeoutError',\n 'InvalidStateError', 'InvalidTimeoutError',\n 'Future',\n ]", "import concurrent.futures._base", "import logging", "import traceback", "from . import events", "from...
"""Tests for http/wsgi.py""" import io import unittest import unittest.mock import tulip from tulip.http import wsgi from tulip.http import protocol class HttpWsgiServerProtocolTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop() tulip.set_event_loop(self.loop) ...
[ [ 8, 0, 0.0041, 0.0041, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0124, 0.0041, 0, 0.66, 0.1429, 518, 0, 1, 0, 0, 518, 0, 0 ], [ 1, 0, 0.0166, 0.0041, 0, 0.66...
[ "\"\"\"Tests for http/wsgi.py\"\"\"", "import io", "import unittest", "import unittest.mock", "import tulip", "from tulip.http import wsgi", "from tulip.http import protocol", "class HttpWsgiServerProtocolTests(unittest.TestCase):\n\n def setUp(self):\n self.loop = tulip.new_event_loop()\n ...
"""Tests for http/parser.py""" from collections import deque import zlib import unittest import unittest.mock import tulip from tulip.http import errors from tulip.http import protocol class ParseHeadersTests(unittest.TestCase): def test_parse_headers(self): hdrs = ('', 'test: line\r\n', ' continue\r\n...
[ [ 8, 0, 0.002, 0.002, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0059, 0.002, 0, 0.66, 0.0833, 193, 0, 1, 0, 0, 193, 0, 0 ], [ 1, 0, 0.0078, 0.002, 0, 0.66, ...
[ "\"\"\"Tests for http/parser.py\"\"\"", "from collections import deque", "import zlib", "import unittest", "import unittest.mock", "import tulip", "from tulip.http import errors", "from tulip.http import protocol", "class ParseHeadersTests(unittest.TestCase):\n\n def test_parse_headers(self):\n ...
"""Tests for tasks.py.""" import concurrent.futures import time import unittest import unittest.mock from tulip import events from tulip import futures from tulip import tasks class Dummy: def __repr__(self): return 'Dummy()' def __call__(self, *args): pass class TaskTests(unittest.TestC...
[ [ 8, 0, 0.0013, 0.0013, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.004, 0.0013, 0, 0.66, 0.1, 682, 0, 1, 0, 0, 682, 0, 0 ], [ 1, 0, 0.0054, 0.0013, 0, 0.66, ...
[ "\"\"\"Tests for tasks.py.\"\"\"", "import concurrent.futures", "import time", "import unittest", "import unittest.mock", "from tulip import events", "from tulip import futures", "from tulip import tasks", "class Dummy:\n\n def __repr__(self):\n return 'Dummy()'\n\n def __call__(self, *...
"""Tests for tulip/http/session.py""" import http.cookies import unittest import unittest.mock import tulip import tulip.http from tulip.http.client import HttpResponse from tulip.http.session import Session class HttpSessionTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop()...
[ [ 8, 0, 0.0075, 0.0075, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0226, 0.0075, 0, 0.66, 0.125, 991, 0, 1, 0, 0, 991, 0, 0 ], [ 1, 0, 0.0301, 0.0075, 0, 0.66,...
[ "\"\"\"Tests for tulip/http/session.py\"\"\"", "import http.cookies", "import unittest", "import unittest.mock", "import tulip", "import tulip.http", "from tulip.http.client import HttpResponse", "from tulip.http.session import Session", "class HttpSessionTests(unittest.TestCase):\n\n def setUp(s...
"""Tests for streams.py.""" import unittest from tulip import events from tulip import streams from tulip import tasks class StreamReaderTests(unittest.TestCase): DATA = b'line1\nline2\nline3\n' def setUp(self): self.loop = events.new_event_loop() events.set_event_loop(self.loop) def ...
[ [ 8, 0, 0.0035, 0.0035, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0104, 0.0035, 0, 0.66, 0.1667, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0173, 0.0035, 0, 0.66, ...
[ "\"\"\"Tests for streams.py.\"\"\"", "import unittest", "from tulip import events", "from tulip import streams", "from tulip import tasks", "class StreamReaderTests(unittest.TestCase):\n\n DATA = b'line1\\nline2\\nline3\\n'\n\n def setUp(self):\n self.loop = events.new_event_loop()\n e...
"""Tests for base_events.py""" import concurrent.futures import logging import socket import time import unittest import unittest.mock from tulip import base_events from tulip import events from tulip import futures from tulip import protocols from tulip import tasks class BaseEventLoopTests(unittest.TestCase): ...
[ [ 8, 0, 0.0017, 0.0017, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.005, 0.0017, 0, 0.66, 0.0667, 682, 0, 1, 0, 0, 682, 0, 0 ], [ 1, 0, 0.0066, 0.0017, 0, 0.66,...
[ "\"\"\"Tests for base_events.py\"\"\"", "import concurrent.futures", "import logging", "import socket", "import time", "import unittest", "import unittest.mock", "from tulip import base_events", "from tulip import events", "from tulip import futures", "from tulip import protocols", "from tulip...
# NOTE: This is a hack. Andrew Svetlov is working in a proper # subprocess management transport for use with # connect_{read,write}_pipe(). """Tests for subprocess_transport.py.""" import logging import unittest from tulip import events from tulip import futures from tulip import protocols from tulip import subproc...
[ [ 8, 0, 0.082, 0.0164, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1148, 0.0164, 0, 0.66, 0.1111, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.1311, 0.0164, 0, 0.66,...
[ "\"\"\"Tests for subprocess_transport.py.\"\"\"", "import logging", "import unittest", "from tulip import events", "from tulip import futures", "from tulip import protocols", "from tulip import subprocess_transport", "class MyProto(protocols.Protocol):\n\n def __init__(self):\n self.state = ...
"""Tests for futures.py.""" import unittest import unittest.mock from tulip import events from tulip import futures def _fakefunc(f): return f class FutureTests(unittest.TestCase): def setUp(self): self.loop = events.new_event_loop() events.set_event_loop(self.loop) def tearDown(self...
[ [ 8, 0, 0.0035, 0.0035, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0105, 0.0035, 0, 0.66, 0.1111, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.014, 0.0035, 0, 0.66, ...
[ "\"\"\"Tests for futures.py.\"\"\"", "import unittest", "import unittest.mock", "from tulip import events", "from tulip import futures", "def _fakefunc(f):\n return f", " return f", "class FutureTests(unittest.TestCase):\n\n def setUp(self):\n self.loop = events.new_event_loop()\n ...
"""Http client functional tests.""" import gc import io import os.path import http.cookies import unittest import tulip import tulip.http from tulip import test_utils from tulip.http import client class HttpClientFunctionalTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop() ...
[ [ 8, 0, 0.0021, 0.0021, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0062, 0.0021, 0, 0.66, 0.0909, 92, 0, 1, 0, 0, 92, 0, 0 ], [ 1, 0, 0.0082, 0.0021, 0, 0.66, ...
[ "\"\"\"Http client functional tests.\"\"\"", "import gc", "import io", "import os.path", "import http.cookies", "import unittest", "import tulip", "import tulip.http", "from tulip import test_utils", "from tulip.http import client", "class HttpClientFunctionalTests(unittest.TestCase):\n\n def...
"""Tests for queues.py""" import unittest import queue from tulip import events from tulip import futures from tulip import locks from tulip import queues from tulip import tasks class _QueueTestBase(unittest.TestCase): def setUp(self): self.loop = events.new_event_loop() events.set_event_loop(...
[ [ 8, 0, 0.0025, 0.0025, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0074, 0.0025, 0, 0.66, 0.0667, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0098, 0.0025, 0, 0.66, ...
[ "\"\"\"Tests for queues.py\"\"\"", "import unittest", "import queue", "from tulip import events", "from tulip import futures", "from tulip import locks", "from tulip import queues", "from tulip import tasks", "class _QueueTestBase(unittest.TestCase):\n\n def setUp(self):\n self.loop = even...
"""Tests for parser.py""" import unittest import unittest.mock from tulip import events from tulip import parsers from tulip import tasks class StreamBufferTests(unittest.TestCase): DATA = b'line1\nline2\nline3\n' def setUp(self): self.loop = events.new_event_loop() events.set_event_loop(s...
[ [ 8, 0, 0.0017, 0.0017, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.005, 0.0017, 0, 0.66, 0.1111, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0067, 0.0017, 0, 0.66, ...
[ "\"\"\"Tests for parser.py\"\"\"", "import unittest", "import unittest.mock", "from tulip import events", "from tulip import parsers", "from tulip import tasks", "class StreamBufferTests(unittest.TestCase):\n\n DATA = b'line1\\nline2\\nline3\\n'\n\n def setUp(self):\n self.loop = events.new...
"""Tests for events.py.""" import concurrent.futures import gc import io import os import re import signal import socket try: import ssl except ImportError: ssl = None import sys import threading import time import errno import unittest import unittest.mock from test.support import find_unused_port from tuli...
[ [ 8, 0, 0.0009, 0.0009, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0026, 0.0009, 0, 0.66, 0.0294, 682, 0, 1, 0, 0, 682, 0, 0 ], [ 1, 0, 0.0035, 0.0009, 0, 0.66...
[ "\"\"\"Tests for events.py.\"\"\"", "import concurrent.futures", "import gc", "import io", "import os", "import re", "import signal", "import socket", "try:\n import ssl\nexcept ImportError:\n ssl = None", " import ssl", " ssl = None", "import sys", "import threading", "import ...
"""Tests for http/server.py""" import unittest import unittest.mock import tulip from tulip.http import server from tulip.http import errors class HttpServerProtocolTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop() tulip.set_event_loop(self.loop) def tearDown(se...
[ [ 8, 0, 0.004, 0.004, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0121, 0.004, 0, 0.66, 0.1667, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0161, 0.004, 0, 0.66, ...
[ "\"\"\"Tests for http/server.py\"\"\"", "import unittest", "import unittest.mock", "import tulip", "from tulip.http import server", "from tulip.http import errors", "class HttpServerProtocolTests(unittest.TestCase):\n\n def setUp(self):\n self.loop = tulip.new_event_loop()\n tulip.set_e...
"""Tests for http/protocol.py""" import unittest import unittest.mock import zlib from tulip.http import protocol class HttpMessageTests(unittest.TestCase): def setUp(self): self.transport = unittest.mock.Mock() def test_start_request(self): msg = protocol.Request( self.transpo...
[ [ 8, 0, 0.0026, 0.0026, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0078, 0.0026, 0, 0.66, 0.2, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0104, 0.0026, 0, 0.66, ...
[ "\"\"\"Tests for http/protocol.py\"\"\"", "import unittest", "import unittest.mock", "import zlib", "from tulip.http import protocol", "class HttpMessageTests(unittest.TestCase):\n\n def setUp(self):\n self.transport = unittest.mock.Mock()\n\n def test_start_request(self):\n msg = prot...
"""Tests for selectors.py.""" import unittest import unittest.mock from tulip import selectors class BaseSelectorTests(unittest.TestCase): def test_fileobj_to_fd(self): self.assertEqual(10, selectors._fileobj_to_fd(10)) f = unittest.mock.Mock() f.fileno.return_value = 10 self.a...
[ [ 8, 0, 0.007, 0.007, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.021, 0.007, 0, 0.66, 0.25, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.028, 0.007, 0, 0.66, 0.5,...
[ "\"\"\"Tests for selectors.py.\"\"\"", "import unittest", "import unittest.mock", "from tulip import selectors", "class BaseSelectorTests(unittest.TestCase):\n\n def test_fileobj_to_fd(self):\n self.assertEqual(10, selectors._fileobj_to_fd(10))\n\n f = unittest.mock.Mock()\n f.fileno...
"""Tests for winsocketpair.py""" import unittest import unittest.mock from tulip import winsocketpair class WinsocketpairTests(unittest.TestCase): def test_winsocketpair(self): ssock, csock = winsocketpair.socketpair() csock.send(b'xxx') self.assertEqual(b'xxx', ssock.recv(1024)) ...
[ [ 8, 0, 0.0385, 0.0385, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1154, 0.0385, 0, 0.66, 0.25, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.1538, 0.0385, 0, 0.66, ...
[ "\"\"\"Tests for winsocketpair.py\"\"\"", "import unittest", "import unittest.mock", "from tulip import winsocketpair", "class WinsocketpairTests(unittest.TestCase):\n\n def test_winsocketpair(self):\n ssock, csock = winsocketpair.socketpair()\n\n csock.send(b'xxx')\n self.assertEqua...
"""Tests for lock.py""" import time import unittest import unittest.mock from tulip import events from tulip import futures from tulip import locks from tulip import tasks from tulip.test_utils import run_once class LockTests(unittest.TestCase): def setUp(self): self.loop = events.new_event_loop() ...
[ [ 8, 0, 0.0012, 0.0012, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0037, 0.0012, 0, 0.66, 0.0769, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.0049, 0.0012, 0, 0.66...
[ "\"\"\"Tests for lock.py\"\"\"", "import time", "import unittest", "import unittest.mock", "from tulip import events", "from tulip import futures", "from tulip import locks", "from tulip import tasks", "from tulip.test_utils import run_once", "class LockTests(unittest.TestCase):\n\n def setUp(s...
"""Tests for selector_events.py""" import errno import socket import unittest import unittest.mock try: import ssl except ImportError: ssl = None from tulip import futures from tulip import selectors from tulip.events import AbstractEventLoop from tulip.protocols import DatagramProtocol, Protocol from tulip.s...
[ [ 8, 0, 0.0007, 0.0007, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0022, 0.0007, 0, 0.66, 0.0556, 546, 0, 1, 0, 0, 546, 0, 0 ], [ 1, 0, 0.0029, 0.0007, 0, 0.66...
[ "\"\"\"Tests for selector_events.py\"\"\"", "import errno", "import socket", "import unittest", "import unittest.mock", "try:\n import ssl\nexcept ImportError:\n ssl = None", " import ssl", " ssl = None", "from tulip import futures", "from tulip import selectors", "from tulip.events ...
# -*- coding: utf-8 -*- """Tests for tulip/http/client.py""" import unittest import unittest.mock import urllib.parse import tulip import tulip.http from tulip.http.client import HttpRequest, HttpResponse class HttpResponseTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop() ...
[ [ 8, 0, 0.0069, 0.0035, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0138, 0.0035, 0, 0.66, 0.125, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0173, 0.0035, 0, 0.66, ...
[ "\"\"\"Tests for tulip/http/client.py\"\"\"", "import unittest", "import unittest.mock", "import urllib.parse", "import tulip", "import tulip.http", "from tulip.http.client import HttpRequest, HttpResponse", "class HttpResponseTests(unittest.TestCase):\n\n def setUp(self):\n self.loop = tuli...
"""Tests for unix_events.py.""" import errno import io import unittest import unittest.mock try: import signal except ImportError: signal = None from tulip import events from tulip import futures from tulip import protocols from tulip import unix_events @unittest.skipUnless(signal, 'Signals are not support...
[ [ 8, 0, 0.0017, 0.0017, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.005, 0.0017, 0, 0.66, 0.0833, 546, 0, 1, 0, 0, 546, 0, 0 ], [ 1, 0, 0.0066, 0.0017, 0, 0.66,...
[ "\"\"\"Tests for unix_events.py.\"\"\"", "import errno", "import io", "import unittest", "import unittest.mock", "try:\n import signal\nexcept ImportError:\n signal = None", " import signal", " signal = None", "from tulip import events", "from tulip import futures", "from tulip impor...
"""Tests for proactor_events.py""" import socket import unittest import unittest.mock import tulip from tulip.proactor_events import BaseProactorEventLoop from tulip.proactor_events import _ProactorSocketTransport class ProactorSocketTransportTests(unittest.TestCase): def setUp(self): self.loop = unitt...
[ [ 8, 0, 0.003, 0.003, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0091, 0.003, 0, 0.66, 0.125, 687, 0, 1, 0, 0, 687, 0, 0 ], [ 1, 0, 0.0122, 0.003, 0, 0.66, ...
[ "\"\"\"Tests for proactor_events.py\"\"\"", "import socket", "import unittest", "import unittest.mock", "import tulip", "from tulip.proactor_events import BaseProactorEventLoop", "from tulip.proactor_events import _ProactorSocketTransport", "class ProactorSocketTransportTests(unittest.TestCase):\n\n ...
"""Tests for http/websocket.py""" import base64 import hashlib import os import struct import unittest import unittest.mock import tulip from tulip.http import websocket, protocol, errors class WebsocketParserTests(unittest.TestCase): def test_parse_frame(self): buf = tulip.ParserBuffer() p = w...
[ [ 8, 0, 0.0023, 0.0023, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.007, 0.0023, 0, 0.66, 0.0909, 177, 0, 1, 0, 0, 177, 0, 0 ], [ 1, 0, 0.0094, 0.0023, 0, 0.66,...
[ "\"\"\"Tests for http/websocket.py\"\"\"", "import base64", "import hashlib", "import os", "import struct", "import unittest", "import unittest.mock", "import tulip", "from tulip.http import websocket, protocol, errors", "class WebsocketParserTests(unittest.TestCase):\n\n def test_parse_frame(s...
"""Tests for transports.py.""" import unittest import unittest.mock from tulip import transports class TransportTests(unittest.TestCase): def test_ctor_extra_is_none(self): transport = transports.Transport() self.assertEqual(transport._extra, {}) def test_get_extra_info(self): tran...
[ [ 8, 0, 0.0222, 0.0222, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0667, 0.0222, 0, 0.66, 0.25, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0889, 0.0222, 0, 0.66, ...
[ "\"\"\"Tests for transports.py.\"\"\"", "import unittest", "import unittest.mock", "from tulip import transports", "class TransportTests(unittest.TestCase):\n\n def test_ctor_extra_is_none(self):\n transport = transports.Transport()\n self.assertEqual(transport._extra, {})\n\n def test_g...
"""Search for lines >= 80 chars or with trailing whitespace.""" import sys, os def main(): args = sys.argv[1:] or os.curdir for arg in args: if os.path.isdir(arg): for dn, dirs, files in os.walk(arg): for fn in sorted(files): if fn.endswith('.py'): ...
[ [ 8, 0, 0.0244, 0.0244, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0732, 0.0244, 0, 0.66, 0.2, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.2561, 0.2927, 0, 0.66, ...
[ "\"\"\"Search for lines >= 80 chars or with trailing whitespace.\"\"\"", "import sys, os", "def main():\n args = sys.argv[1:] or os.curdir\n for arg in args:\n if os.path.isdir(arg):\n for dn, dirs, files in os.walk(arg):\n for fn in sorted(files):\n if ...
#!/usr/bin/env python3 """Protocol parser example.""" import argparse import collections import tulip try: import signal except ImportError: signal = None MSG_TEXT = b'text:' MSG_PING = b'ping:' MSG_PONG = b'pong:' MSG_STOP = b'stop:' Message = collections.namedtuple('Message', ('tp', 'data')) def my_proto...
[ [ 8, 0, 0.0118, 0.0059, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0176, 0.0059, 0, 0.66, 0.05, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0235, 0.0059, 0, 0.66, ...
[ "\"\"\"Protocol parser example.\"\"\"", "import argparse", "import collections", "import tulip", "try:\n import signal\nexcept ImportError:\n signal = None", " import signal", " signal = None", "MSG_TEXT = b'text:'", "MSG_PING = b'ping:'", "MSG_PONG = b'pong:'", "MSG_STOP = b'stop:'"...
#!/usr/bin/env python3 import sys import tulip import tulip.http def curl(url): response = yield from tulip.http.request('GET', url) print(repr(response)) data = yield from response.read() print(data.decode('utf-8', 'replace')) if __name__ == '__main__': if '--iocp' in sys.argv: from t...
[ [ 1, 0, 0.125, 0.0417, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.1667, 0.0417, 0, 0.66, 0.25, 162, 0, 1, 0, 0, 162, 0, 0 ], [ 1, 0, 0.2083, 0.0417, 0, 0.6...
[ "import sys", "import tulip", "import tulip.http", "def curl(url):\n response = yield from tulip.http.request('GET', url)\n print(repr(response))\n\n data = yield from response.read()\n print(data.decode('utf-8', 'replace'))", " response = yield from tulip.http.request('GET', url)", " pr...
#!/usr/bin/env python3 """websocket cmd client for wssrv.py example.""" import argparse import base64 import hashlib import os import signal import sys import tulip import tulip.http from tulip.http import websocket import tulip.selectors WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" def start_client(loop, url):...
[ [ 8, 0, 0.0206, 0.0103, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0309, 0.0103, 0, 0.66, 0.0625, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0412, 0.0103, 0, 0.66...
[ "\"\"\"websocket cmd client for wssrv.py example.\"\"\"", "import argparse", "import base64", "import hashlib", "import os", "import signal", "import sys", "import tulip", "import tulip.http", "from tulip.http import websocket", "import tulip.selectors", "WS_KEY = b\"258EAFA5-E914-47DA-95CA-C5...
#!/usr/bin/env python3 import logging import re import signal import sys import urllib.parse import tulip import tulip.http class Crawler: def __init__(self, rooturl, loop, maxtasks=100): self.rooturl = rooturl self.loop = loop self.todo = set() self.busy = set() self.do...
[ [ 1, 0, 0.0288, 0.0096, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0385, 0.0096, 0, 0.66, 0.1111, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.0481, 0.0096, 0, ...
[ "import logging", "import re", "import signal", "import sys", "import urllib.parse", "import tulip", "import tulip.http", "class Crawler:\n\n def __init__(self, rooturl, loop, maxtasks=100):\n self.rooturl = rooturl\n self.loop = loop\n self.todo = set()\n self.busy = se...
#!/usr/bin/env python3 """Multiprocess WebSocket http chat example.""" import argparse import os import socket import signal import time import tulip import tulip.http from tulip.http import websocket ARGS = argparse.ArgumentParser(description="Run simple http server.") ARGS.add_argument( '--host', action="store"...
[ [ 8, 0, 0.0065, 0.0032, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.013, 0.0032, 0, 0.66, 0.0526, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0162, 0.0032, 0, 0.66,...
[ "\"\"\"Multiprocess WebSocket http chat example.\"\"\"", "import argparse", "import os", "import socket", "import signal", "import time", "import tulip", "import tulip.http", "from tulip.http import websocket", "ARGS = argparse.ArgumentParser(description=\"Run simple http server.\")", "ARGS.add_...
#!/usr/bin/env python3 """Simple multiprocess http server written using an event loop.""" import argparse import email.message import os import socket import signal import time import tulip import tulip.http from tulip.http import websocket ARGS = argparse.ArgumentParser(description="Run simple http server.") ARGS.ad...
[ [ 8, 0, 0.007, 0.0035, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0139, 0.0035, 0, 0.66, 0.0526, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0174, 0.0035, 0, 0.66,...
[ "\"\"\"Simple multiprocess http server written using an event loop.\"\"\"", "import argparse", "import email.message", "import os", "import socket", "import signal", "import time", "import tulip", "import tulip.http", "from tulip.http import websocket", "ARGS = argparse.ArgumentParser(descriptio...
#!/usr/bin/env python3 """TCP echo server example.""" import argparse import tulip try: import signal except ImportError: signal = None class EchoServer(tulip.Protocol): TIMEOUT = 5.0 def timeout(self): print('connection timeout, closing.') self.transport.close() def connection_...
[ [ 8, 0, 0.018, 0.009, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.027, 0.009, 0, 0.66, 0.0769, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.036, 0.009, 0, 0.66, ...
[ "\"\"\"TCP echo server example.\"\"\"", "import argparse", "import tulip", "try:\n import signal\nexcept ImportError:\n signal = None", " import signal", " signal = None", "class EchoServer(tulip.Protocol):\n\n TIMEOUT = 5.0\n\n def timeout(self):\n print('connection timeout, cl...
#!/usr/bin/env python3 """Simple server written using an event loop.""" import argparse import email.message import logging import os import sys try: import ssl except ImportError: # pragma: no cover ssl = None assert sys.version >= '3.3', 'Please use Python 3.3 or higher.' import tulip import tulip.http ...
[ [ 8, 0, 0.0124, 0.0062, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0248, 0.0062, 0, 0.66, 0.0556, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0311, 0.0062, 0, 0.66...
[ "\"\"\"Simple server written using an event loop.\"\"\"", "import argparse", "import email.message", "import logging", "import os", "import sys", "try:\n import ssl\nexcept ImportError: # pragma: no cover\n ssl = None", " import ssl", " ssl = None", "import tulip", "import tulip.htt...
#!/usr/bin/env python3 """UDP echo example.""" import argparse import sys import tulip try: import signal except ImportError: signal = None class MyServerUdpEchoProtocol: def connection_made(self, transport): print('start', transport) self.transport = transport def datagram_received(...
[ [ 8, 0, 0.0204, 0.0102, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0306, 0.0102, 0, 0.66, 0.0714, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0408, 0.0102, 0, 0.66...
[ "\"\"\"UDP echo example.\"\"\"", "import argparse", "import sys", "import tulip", "try:\n import signal\nexcept ImportError:\n signal = None", " import signal", " signal = None", "class MyServerUdpEchoProtocol:\n\n def connection_made(self, transport):\n print('start', transport)...
#!/usr/bin/env python import numpy import pylab from math import factorial from matplotlib.font_manager import FontProperties as FP #import nc_broadcast_probability as ncbp import unicast_probability as ucp import broadcast_probability as bcp fp = FP() fp.set_size('small') ### SPECIFICATIONS: ### node_count = 10 pa...
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0714, 0.0179, 0, 0.66, 0.0357, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0893, 0.0179, 0, ...
[ "import numpy", "import pylab", "from math import factorial", "from matplotlib.font_manager import FontProperties as FP", "import unicast_probability as ucp", "import broadcast_probability as bcp", "fp = FP()", "fp.set_size('small')", "node_count = 10", "packets_needed = 100", "packet_range = 60...
#!/usr/bin/env python import numpy as np import time import os def enc_expanding_windows(windows, generation_size, field_size): window_size = windows[np.random.randint(len(windows))] enc = np.random.randint(field_size, size=(1,window_size)) zeros = np.zeros((1,generation_size-window_size)) enc_vector = np.hstack(...
[ [ 1, 0, 0.0216, 0.0072, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0288, 0.0072, 0, 0.66, 0.0833, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.036, 0.0072, 0, 0...
[ "import numpy as np", "import time", "import os", "def enc_expanding_windows(windows, generation_size, field_size):\n\twindow_size = windows[np.random.randint(len(windows))]\n\tenc = np.random.randint(field_size, size=(1,window_size))\n\tzeros = np.zeros((1,generation_size-window_size))\n\tenc_vector = np.hst...
#!/usr/bin/env python import numpy as np import time import os def enc_expanding_windows(windows, generation_size, field_size): window_size = windows[np.random.randint(len(windows))] enc = np.random.randint(field_size, size=(1,window_size)) zeros = np.zeros((1,generation_size-window_size)) enc_vector = np.hstack(...
[ [ 1, 0, 0.0216, 0.0072, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0288, 0.0072, 0, 0.66, 0.0833, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.036, 0.0072, 0, 0...
[ "import numpy as np", "import time", "import os", "def enc_expanding_windows(windows, generation_size, field_size):\n\twindow_size = windows[np.random.randint(len(windows))]\n\tenc = np.random.randint(field_size, size=(1,window_size))\n\tzeros = np.zeros((1,generation_size-window_size))\n\tenc_vector = np.hst...
#!/usr/bin/env python import random from math import factorial class node(object): def __init__(self): self.has_packet = False def receive_packet(self, succesrate): if random.random() <= succesrate: self.has_packet = True def reset(self): self.has_packet = False def bc_probability_after_transmissi...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.3333, 526, 0, 1, 0, 0, 526, 0, 0 ], [ 3, 0, 0.3696, 0.4348, 0, 0...
[ "import random", "from math import factorial", "class node(object):\n\tdef __init__(self):\n\t\tself.has_packet = False\n\t\n\tdef receive_packet(self, succesrate):\n\t\tif random.random() <= succesrate:\n\t\t\tself.has_packet = True", "\tdef __init__(self):\n\t\tself.has_packet = False", "\t\tself.has_pack...
#!/usr/bin/env python import random import numpy as np from math import factorial class node(object): def __init__(self, ID): self.has_packet = False self.received_packets = 0 self.id = ID def receive_packet(self, succesrate): if random.random() <= succesrate: self.has_packet = True self.received_pa...
[ [ 1, 0, 0.0341, 0.0114, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0455, 0.0114, 0, 0.66, 0.1667, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0568, 0.0114, 0, ...
[ "import random", "import numpy as np", "from math import factorial", "class node(object):\n\tdef __init__(self, ID):\n\t\tself.has_packet = False\n\t\tself.received_packets = 0\n\t\tself.id = ID\n\t\n\tdef receive_packet(self, succesrate):\n\t\tif random.random() <= succesrate:", "\tdef __init__(self, ID):\...
#!/usr/bin/env python import numpy import pylab from math import factorial from matplotlib.font_manager import FontProperties as FP #import nc_broadcast_probability as ncbp import unicast_probability as ucp import broadcast_probability as bcp fp = FP() fp.set_size('small') ### SPECIFICATIONS: ### node_count = 10 pa...
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0714, 0.0179, 0, 0.66, 0.0357, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0893, 0.0179, 0, ...
[ "import numpy", "import pylab", "from math import factorial", "from matplotlib.font_manager import FontProperties as FP", "import unicast_probability as ucp", "import broadcast_probability as bcp", "fp = FP()", "fp.set_size('small')", "node_count = 10", "packets_needed = 100", "packet_range = 60...
#!/usr/bin/env python import random from math import factorial class node(object): def __init__(self): self.has_packet = False def receive_packet(self, succesrate): if random.random() <= succesrate: self.has_packet = True def reset(self): self.has_packet = False def bc_probability_after_transmissi...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.3333, 526, 0, 1, 0, 0, 526, 0, 0 ], [ 3, 0, 0.3696, 0.4348, 0, 0...
[ "import random", "from math import factorial", "class node(object):\n\tdef __init__(self):\n\t\tself.has_packet = False\n\t\n\tdef receive_packet(self, succesrate):\n\t\tif random.random() <= succesrate:\n\t\t\tself.has_packet = True", "\tdef __init__(self):\n\t\tself.has_packet = False", "\t\tself.has_pack...
#!/usr/bin/env python import random from math import factorial class node(object): def __init__(self): self.has_packet = False def receive_packet(self, succesrate): if random.random() <= succesrate: self.has_packet = True def reset(self): self.has_packet = False def uc_probability_after_transmissi...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.3333, 526, 0, 1, 0, 0, 526, 0, 0 ], [ 3, 0, 0.3696, 0.4348, 0, 0...
[ "import random", "from math import factorial", "class node(object):\n\tdef __init__(self):\n\t\tself.has_packet = False\n\t\n\tdef receive_packet(self, succesrate):\n\t\tif random.random() <= succesrate:\n\t\t\tself.has_packet = True", "\tdef __init__(self):\n\t\tself.has_packet = False", "\t\tself.has_pack...
#!/usr/bin/env python import numpy import pylab from math import factorial from matplotlib.font_manager import FontProperties as FP import nc_broadcast_probability as ncbp import broadcast_probability as bcp fp = FP() fp.set_size('small') ### SPECIFICATIONS: ### node_count = 10 packets_needed = 100 packet_range = ...
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0714, 0.0179, 0, 0.66, 0.0357, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0893, 0.0179, 0, ...
[ "import numpy", "import pylab", "from math import factorial", "from matplotlib.font_manager import FontProperties as FP", "import nc_broadcast_probability as ncbp", "import broadcast_probability as bcp", "fp = FP()", "fp.set_size('small')", "node_count = 10", "packets_needed = 100", "packet_rang...
#!/usr/bin/env python import sys sys.path.insert(0,'../expanding_windows') from expanding_windows import * def enc_non_overlapping_windows(wndws, generation_size, field_size): # Create encoding vector of list of window borders (start and ending borders (0, 'generation_size') should be omitted) windows = wndws if...
[ [ 1, 0, 0.0714, 0.0238, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 8, 0, 0.119, 0.0238, 0, 0.66, 0.25, 368, 3, 2, 0, 0, 0, 0, 1 ], [ 1, 0, 0.1667, 0.0238, 0, 0.66,...
[ "import sys", "sys.path.insert(0,'../expanding_windows')", "from expanding_windows import *", "def enc_non_overlapping_windows(wndws, generation_size, field_size): # Create encoding vector of list of window borders (start and ending borders (0, 'generation_size') should be omitted)\n\twindows = wndws\n\tif no...
#!/usr/bin/env python import sys sys.path.insert(0,'../expanding_windows') from expanding_windows import * def enc_non_overlapping_windows(wndws, generation_size, field_size): # Create encoding vector of list of window borders (start and ending borders (0, 'generation_size') should be omitted) windows = wndws if...
[ [ 1, 0, 0.0714, 0.0238, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 8, 0, 0.119, 0.0238, 0, 0.66, 0.25, 368, 3, 2, 0, 0, 0, 0, 1 ], [ 1, 0, 0.1667, 0.0238, 0, 0.66,...
[ "import sys", "sys.path.insert(0,'../expanding_windows')", "from expanding_windows import *", "def enc_non_overlapping_windows(wndws, generation_size, field_size): # Create encoding vector of list of window borders (start and ending borders (0, 'generation_size') should be omitted)\n\twindows = wndws\n\tif no...
#!/usr/bin/env python import numpy import pylab from math import factorial from matplotlib.font_manager import FontProperties as FP import nc_broadcast_probability as ncbp import broadcast_probability as bcp fp = FP() fp.set_size('small') ### SPECIFICATIONS: ### node_count = 10 packets_needed = 100 packet_range = ...
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0714, 0.0179, 0, 0.66, 0.0357, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0893, 0.0179, 0, ...
[ "import numpy", "import pylab", "from math import factorial", "from matplotlib.font_manager import FontProperties as FP", "import nc_broadcast_probability as ncbp", "import broadcast_probability as bcp", "fp = FP()", "fp.set_size('small')", "node_count = 10", "packets_needed = 100", "packet_rang...
#!/usr/bin/env python import random import numpy as np from math import factorial class node(object): def __init__(self, ID): self.has_packet = False self.received_packets = 0 self.id = ID def receive_packet(self, succesrate): if random.random() <= succesrate: self.has_packet = True self.received_pa...
[ [ 1, 0, 0.0341, 0.0114, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0455, 0.0114, 0, 0.66, 0.1667, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0568, 0.0114, 0, ...
[ "import random", "import numpy as np", "from math import factorial", "class node(object):\n\tdef __init__(self, ID):\n\t\tself.has_packet = False\n\t\tself.received_packets = 0\n\t\tself.id = ID\n\t\n\tdef receive_packet(self, succesrate):\n\t\tif random.random() <= succesrate:", "\tdef __init__(self, ID):\...
#!/usr/bin/env python import random from math import factorial class node(object): def __init__(self): self.has_packet = False def receive_packet(self, succesrate): if random.random() <= succesrate: self.has_packet = True def reset(self): self.has_packet = False def uc_probability_after_transmissi...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.3333, 526, 0, 1, 0, 0, 526, 0, 0 ], [ 3, 0, 0.3696, 0.4348, 0, 0...
[ "import random", "from math import factorial", "class node(object):\n\tdef __init__(self):\n\t\tself.has_packet = False\n\t\n\tdef receive_packet(self, succesrate):\n\t\tif random.random() <= succesrate:\n\t\t\tself.has_packet = True", "\tdef __init__(self):\n\t\tself.has_packet = False", "\t\tself.has_pack...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp import sys import matplotlib from matplotlib.font_manager import FontProperties as FP # Fixes font size fp = FP() fp.set_size('small') matplotlib.rc('text', usetex=True) # Use latex formatting! ptotal=1400 # total packet size [bytes] ...
[ [ 1, 0, 0.0219, 0.0073, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0292, 0.0073, 0, 0.66, 0.0385, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0365, 0.0073, 0, ...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "import matplotlib", "from matplotlib.font_manager import FontProperties as FP", "fp = FP()", "fp.set_size('small')", "matplotlib.rc('text', usetex=True) # Use latex formatting!", "ptotal=1400 # total packet size [b...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp import sys from matplotlib.font_manager import FontProperties as FP def new_frame(filep): line = '1' while not line.startswith('[/FRAME]'): line = filep.readline() if line.startswith('pkt_pos='): pos = int(line[line.find('=')+1...
[ [ 1, 0, 0.0375, 0.0125, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.05, 0.0125, 0, 0.66, 0.1667, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0625, 0.0125, 0, 0....
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "from matplotlib.font_manager import FontProperties as FP", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\tline = filep.readline()\n\t\tif line.startswith('pkt_pos='):\n\t\t\tpos = int(l...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp import sys from matplotlib.font_manager import FontProperties as FP def new_frame(filep): line = '1' while not line.startswith('[/FRAME]'): line = filep.readline() if line.startswith('pkt_pos='): pos = int(line[line.find('=')+...
[ [ 1, 0, 0.0233, 0.0078, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.031, 0.0078, 0, 0.66, 0.1667, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0388, 0.0078, 0, 0...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "from matplotlib.font_manager import FontProperties as FP", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\tline = filep.readline()\n\t\tif line.startswith('pkt_pos='):\n\t\t\tpos = int(l...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp import sys from matplotlib.font_manager import FontProperties as FP def new_frame(filep): line = '1' while not line.startswith('[/FRAME]'): line = filep.readline() if line.startswith('pkt_pos='): pos = int(line[line.find('=')+...
[ [ 1, 0, 0.0233, 0.0078, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.031, 0.0078, 0, 0.66, 0.1667, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0388, 0.0078, 0, 0...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "from matplotlib.font_manager import FontProperties as FP", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\tline = filep.readline()\n\t\tif line.startswith('pkt_pos='):\n\t\t\tpos = int(l...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp import sys from matplotlib.font_manager import FontProperties as FP def new_frame(filep): line = '1' while not line.startswith('[/FRAME]'): line = filep.readline() if line.startswith('pkt_pos='): pos = int(line[line.find('=')+1...
[ [ 1, 0, 0.0375, 0.0125, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.05, 0.0125, 0, 0.66, 0.1667, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0625, 0.0125, 0, 0....
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "from matplotlib.font_manager import FontProperties as FP", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\tline = filep.readline()\n\t\tif line.startswith('pkt_pos='):\n\t\t\tpos = int(l...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp def extract_info(filep): qdict = {} line = '1' # info = np.array([False]) while line: line = filep.readline() if line.startswith('GOP = '): tmp = line.replace('GOP = ','').replace('Qscale = ','').replace(':','').replace('\t',...
[ [ 1, 0, 0.0492, 0.0164, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0656, 0.0164, 0, 0.66, 0.2, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.082, 0.0164, 0, 0.66...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "def extract_info(filep):\n\tqdict = {}\n\tline = '1'\n\t# info = np.array([False])\n\twhile line:\n\t\tline = filep.readline()\n\t\tif line.startswith('GOP = '):\n\t\t\ttmp = line.replace('GOP = ','').replace('Qscale = ','').replace(':','')...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp import sys import matplotlib from matplotlib.font_manager import FontProperties as FP # Fixes font size fp = FP() fp.set_size('small') matplotlib.rc('text', usetex=True) # Use latex formatting! ptotal=1400 # total packet size [bytes] ...
[ [ 1, 0, 0.0219, 0.0073, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0292, 0.0073, 0, 0.66, 0.0385, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0365, 0.0073, 0, ...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "import matplotlib", "from matplotlib.font_manager import FontProperties as FP", "fp = FP()", "fp.set_size('small')", "matplotlib.rc('text', usetex=True) # Use latex formatting!", "ptotal=1400 # total packet size [b...
#!/usr/bin/env python import numpy as np import pylab as pl import os.path as osp def extract_info(filep): qdict = {} line = '1' # info = np.array([False]) while line: line = filep.readline() if line.startswith('GOP = '): tmp = line.replace('GOP = ','').replace('Qscale = ','').replace(':','').replace('\t',...
[ [ 1, 0, 0.0492, 0.0164, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0656, 0.0164, 0, 0.66, 0.2, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.082, 0.0164, 0, 0.66...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "def extract_info(filep):\n\tqdict = {}\n\tline = '1'\n\t# info = np.array([False])\n\twhile line:\n\t\tline = filep.readline()\n\t\tif line.startswith('GOP = '):\n\t\t\ttmp = line.replace('GOP = ','').replace('Qscale = ','').replace(':','')...
#!/usr/bin/env sage -python from sage.all import * import random import math import numpy as np import pylab as pl import time as t from scipy import stats as s #import antigravity start = t.time() ###Creating transition matrices### def create_trans_matrix(L_size,gamma,q): r=range(0,L_size+1) P = np.matrix(np.zer...
[ [ 1, 0, 0.0291, 0.0097, 0, 0.66, 0, 792, 0, 1, 0, 0, 792, 0, 0 ], [ 1, 0, 0.0388, 0.0097, 0, 0.66, 0.0455, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0485, 0.0097, 0, ...
[ "from sage.all import *", "import random", "import math", "import numpy as np", "import pylab as pl", "import time as t", "from scipy import stats as s", "start = t.time()", "def create_trans_matrix(L_size,gamma,q):\n\tr=range(0,L_size+1)\n\tP = np.matrix(np.zeros((L_size+1,L_size+1)))\n\t\n\tfor n ...
#!/usr/bin/env sage -python from sage.all import * import random import time as t #import antigravity start = t.time() gen_size=96 L1_size=32 L2_size=64 L3_size=0 #field = GF(2**8, name='a') field = GF(2, name='a') nb_sim = 10000 nb_trans = 185 layer_3_active = false Pr_liste = [[50,50,0],[30,70,0],[40,60,0]] ...
[ [ 1, 0, 0.025, 0.0083, 0, 0.66, 0, 792, 0, 1, 0, 0, 792, 0, 0 ], [ 1, 0, 0.0333, 0.0083, 0, 0.66, 0.0667, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0417, 0.0083, 0, 0...
[ "from sage.all import *", "import random", "import time as t", "start = t.time()", "gen_size=96", "L1_size=32", "L2_size=64", "L3_size=0", "field = GF(2, name='a')", "nb_sim = 10000", "nb_trans = 185", "layer_3_active = false", "Pr_liste = [[50,50,0],[30,70,0],[40,60,0]]", "gammas = 3", ...
#!/usr/bin/env sage -python from sage.all import * import random import time as t #import antigravity start = t.time() gen_size=96 L1_size=32 L2_size=96 L3_size=0 #field = GF(2**8, name='a') field = GF(2, name='a') nb_sim = 10000 nb_trans = 185 Pr_liste = [[50,50,0],[30,70,0],[40,60,0]] gammas = 3 L3_active=Fa...
[ [ 1, 0, 0.0208, 0.0069, 0, 0.66, 0, 792, 0, 1, 0, 0, 792, 0, 0 ], [ 1, 0, 0.0278, 0.0069, 0, 0.66, 0.0455, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0347, 0.0069, 0, ...
[ "from sage.all import *", "import random", "import time as t", "start = t.time()", "gen_size=96", "L1_size=32", "L2_size=96", "L3_size=0", "field = GF(2, name='a')", "nb_sim = 10000", "nb_trans = 185", "Pr_liste = [[50,50,0],[30,70,0],[40,60,0]]", "gammas = 3", "L3_active=False", "for a ...
#!/usr/bin/env python # This script uses framestats logfiles to plot the distribution of I and P frames for a number of videos # # Inputs(given as arguments to script call): video1_framestats.txt, video2_framestats.txt etc... # Output: Plot #2 # # To do: # Check that x axis is correctly scaled (It seems so but messy c...
[ [ 1, 0, 0.0585, 0.0049, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0634, 0.0049, 0, 0.66, 0.125, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0683, 0.0049, 0, 0...
[ "import numpy as np", "import pylab as pl", "import scipy.stats as spstats", "import os.path as osp", "import sys", "from matplotlib.font_manager import FontProperties as FP", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\tline = filep.readline()\n\t\tif line.startsw...
#!/usr/bin/env python # This script analyses framestats logfiles and saves a log with number statistics about given videos. # # Inputs(given as arguments to script call): video1_framestats.txt, video2_framestats.txt etc... # Output: frame_log.txt # # To do: # Check that x axis is correctly scaled (It seems so but mess...
[ [ 1, 0, 0.1008, 0.0084, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.1092, 0.0084, 0, 0.66, 0.1429, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.1176, 0.0084, 0, ...
[ "import numpy as np", "import pylab as pl", "import os.path as osp", "import sys", "from matplotlib.font_manager import FontProperties as FP", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\tline = filep.readline()\n\t\tif line.startswith('pkt_pos='):\n\t\t\tpos = int(l...
#!/usr/bin/env python # This script plots the distribution of the gop data. # # Inputs (given as arguments): video1_framestats.txt, video2_framestats.txt, etc... # Output Plot #3: Distribution of GOP data size (for each file given) # # To Do: # - Verify x-axis scaling import numpy as np import pylab as pl # Plotting...
[ [ 1, 0, 0.0696, 0.0063, 0, 0.66, 0, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 1, 0, 0.0759, 0.0063, 0, 0.66, 0.1429, 735, 0, 1, 0, 0, 735, 0, 0 ], [ 1, 0, 0.0823, 0.0063, 0, ...
[ "import numpy as np", "import pylab as pl # Plotting", "import os.path as osp # path", "import sys # Handling command line arguments", "from matplotlib.font_manager import FontProperties as FP # Font formatting in plots", "def new_frame(filep):\n\tline = '1'\n\twhile not line.startswith('[/FRAME]'):\n\t\t...