repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
gevent | gevent-master/examples/psycopg2_pool.py | from __future__ import print_function
# gevent-test-requires-resource: psycopg2
# pylint:disable=import-error,broad-except,bare-except
import sys
import contextlib
import gevent
from gevent.queue import Queue
from gevent.socket import wait_read, wait_write
from psycopg2 import extensions, OperationalError, connect
i... | 4,896 | 28.5 | 113 | py |
gevent | gevent-master/examples/wsgiserver.py | #!/usr/bin/python
"""WSGI server example"""
from __future__ import print_function
from gevent.pywsgi import WSGIServer
def application(env, start_response):
if env['PATH_INFO'] == '/':
start_response('200 OK', [('Content-Type', 'text/html')])
return [b"<b>hello world</b>"]
start_response('404... | 527 | 26.789474 | 68 | py |
gevent | gevent-master/examples/webproxy.py | #!/usr/bin/env python
"""A web application that retrieves other websites for you.
To start serving the application on port 8088, type
python webproxy.py
To start the server on some other interface/port, use
python -m gevent.wsgi -p 8000 -i 0.0.0.0 webproxy.py
"""
from __future__ import print_function
from geve... | 5,281 | 30.254438 | 110 | py |
gevent | gevent-master/examples/geventsendfile.py | """An example how to use sendfile[1] with gevent.
[1] http://pypi.python.org/pypi/py-sendfile/
"""
# gevent-test-requires-resource: sendfile
# pylint:disable=import-error
from errno import EAGAIN
from sendfile import sendfile as original_sendfile
from gevent.socket import wait_write
def gevent_sendfile(out_fd, in_fd... | 882 | 28.433333 | 101 | py |
gevent | gevent-master/examples/udp_server.py | # Copyright (c) 2012 Denis Bilenko. See LICENSE for details.
"""A simple UDP server.
For every message received, it sends a reply back.
You can use udp_client.py to send a message.
"""
from __future__ import print_function
from gevent.server import DatagramServer
class EchoServer(DatagramServer):
def handle(se... | 618 | 27.136364 | 86 | py |
gevent | gevent-master/examples/threadpool.py | from __future__ import print_function
import time
import gevent
from gevent.threadpool import ThreadPool
pool = ThreadPool(3)
start = time.time()
for _ in range(4):
pool.spawn(time.sleep, 1)
gevent.wait()
delay = time.time() - start
print('Running "time.sleep(1)" 4 times with 3 threads. Should take about 2 second... | 339 | 23.285714 | 99 | py |
gevent | gevent-master/examples/udp_client.py | # Copyright (c) 2012 Denis Bilenko. See LICENSE for details.
"""Send a datagram to localhost:9000 and receive a datagram back.
Usage: python udp_client.py MESSAGE
Make sure you're running a UDP server on port 9001 (see udp_server.py).
There's nothing gevent-specific here.
"""
from __future__ import print_function
im... | 675 | 28.391304 | 71 | py |
gevent | gevent-master/examples/echoserver.py | #!/usr/bin/env python
"""Simple server that listens on port 16000 and echos back every input to the client.
Connect to it with:
telnet 127.0.0.1 16000
Terminate the connection by terminating telnet (typically Ctrl-] and then 'quit').
"""
from __future__ import print_function
from gevent.server import StreamServer
... | 1,345 | 34.421053 | 88 | py |
gevent | gevent-master/examples/processes.py | #!/usr/bin/env python
from __future__ import print_function
import gevent
from gevent import subprocess
import sys
if sys.platform.startswith('win'):
UNAME = ['cmd.exe', '/C', 'ver']
LS = ['dir.exe']
else:
UNAME = ['uname']
LS = ['ls']
# run 2 jobs in parallel
p1 = subprocess.Popen(UNAME, stdout=subp... | 714 | 20.666667 | 52 | py |
gevent | gevent-master/examples/portforwarder.py | """Port forwarder with graceful exit.
Run the example as
python portforwarder.py :8080 gevent.org:80
Then direct your browser to http://localhost:8080 or do "telnet localhost 8080".
When the portforwarder receives TERM or INT signal (type Ctrl-C),
it closes the listening socket and waits for all existing
connecti... | 3,504 | 30.017699 | 111 | py |
gevent | gevent-master/examples/unixsocket_client.py | from __future__ import print_function
# gevent-test-requires-resource: unixsocket_server
import socket
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect("./unixsocket_server.py.sock")
s.send('GET / HTTP/1.0\r\n\r\n')
data = s.recv(1024)
print('received %s bytes' % len(data))
print(data)
s.close()
| 313 | 25.166667 | 53 | py |
gevent | gevent-master/examples/concurrent_download.py | #!/usr/bin/python
# Copyright (c) 2009 Denis Bilenko. See LICENSE for details.
# gevent-test-requires-resource: network
"""Spawn multiple workers and wait for them to complete"""
from __future__ import print_function
import gevent
from gevent import monkey
# patches stdlib (including socket and ssl modules) to coopera... | 779 | 23.375 | 85 | py |
gevent | gevent-master/examples/webchat/run_standalone.py | #!/usr/bin/python
from __future__ import print_function
from gevent.wsgi import WSGIServer
from application import application
print('Serving on 8000...')
WSGIServer(('', 8000), application).serve_forever()
| 207 | 28.714286 | 51 | py |
gevent | gevent-master/examples/webchat/settings.py | from os.path import dirname, join, abspath
__dir__ = dirname(abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/gevent-webchat.sqlite'
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
TIME_ZONE = 'America... | 1,011 | 24.948718 | 67 | py |
gevent | gevent-master/examples/webchat/application.py | #!/usr/bin/python
from gevent import monkey; monkey.patch_all()
import os
import traceback
from django.core.handlers.wsgi import WSGIHandler
from django.core.signals import got_request_exception
from django.core.management import call_command
os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings'
def exception_pr... | 475 | 21.666667 | 57 | py |
gevent | gevent-master/examples/webchat/manage.py | #!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("""Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.
You'll have to ru... | 538 | 34.933333 | 133 | py |
gevent | gevent-master/examples/webchat/__init__.py | 0 | 0 | 0 | py | |
gevent | gevent-master/examples/webchat/urls.py | from django.conf.urls.defaults import *
from webchat import settings
urlpatterns = patterns('webchat.chat.views',
('^$', 'main'),
('^a/message/new$', 'message_new'),
('^a/message/updates$', 'message_updates'))
urlpatterns += patterns('django.views.s... | 530 | 39.846154 | 87 | py |
gevent | gevent-master/examples/webchat/chat/views.py | import uuid
import simplejson
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.http import HttpResponse
from gevent.event import Event
from webchat import settings
class ChatRoom(object):
cache_size = 200
def __init__(self):
self.cache = ... | 2,269 | 33.393939 | 106 | py |
gevent | gevent-master/examples/webchat/chat/__init__.py | 0 | 0 | 0 | py | |
gevent | gevent-master/src/greentest/3.10/test_socket.py | import unittest
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform... | 251,982 | 36.954963 | 117 | py |
gevent | gevent-master/src/greentest/3.10/test_signal.py | import errno
import inspect
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, spawn_python
try:
import _t... | 49,967 | 34.84505 | 86 | py |
gevent | gevent-master/src/greentest/3.10/test_httplib.py | import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import warnings
import unittest
from unittest import mock
TestCase = unittest.TestCase
from test import support
from test.support import os_helper
from test.support import socket... | 81,035 | 37.423898 | 102 | py |
gevent | gevent-master/src/greentest/3.10/signalinterproctester.py | import os
import signal
import subprocess
import sys
import time
import unittest
from test import support
class SIGUSR1Exception(Exception):
pass
class InterProcessSignalTests(unittest.TestCase):
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(se... | 2,803 | 31.988235 | 75 | py |
gevent | gevent-master/src/greentest/3.10/test_smtpd.py | import unittest
import textwrap
from test import support, mock_socket
from test.support import socket_helper
from test.support import warnings_helper
import socket
import io
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
import smtpd
import asyncore
cl... | 41,621 | 39.845927 | 87 | py |
gevent | gevent-master/src/greentest/3.10/test_context.py | import concurrent.futures
import contextvars
import functools
import gc
import random
import time
import unittest
import weakref
try:
from _testcapi import hamt
except ImportError:
hamt = None
def isolated_context(func):
"""Needed to make reftracking test mode work."""
@functools.wraps(func)
def ... | 31,362 | 27.460073 | 78 | py |
gevent | gevent-master/src/greentest/3.10/test_selectors.py | import errno
import os
import random
import selectors
import signal
import socket
import sys
from test import support
from test.support import os_helper
from test.support import socket_helper
from time import sleep
import unittest
import unittest.mock
import tempfile
from time import monotonic as time
try:
import r... | 18,707 | 31.310881 | 81 | py |
gevent | gevent-master/src/greentest/3.10/test_subprocess.py | import unittest
from unittest import mock
from test import support
from test.support import check_sanitizer
from test.support import import_helper
from test.support import os_helper
from test.support import warnings_helper
import subprocess
import sys
import signal
import io
import itertools
import os
import errno
impo... | 160,086 | 41.598989 | 110 | py |
gevent | gevent-master/src/greentest/3.10/test_wsgiref.py | from unittest import mock
from test import support
from test.support import socket_helper
from test.support import warnings_helper
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers... | 30,921 | 34.583429 | 87 | py |
gevent | gevent-master/src/greentest/3.10/test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import socket
import io
import errno
import os
import threading
import time
import unittest
try:
import ssl
except ImportError:
ssl = None
from unittest import TestCase, skipUnless... | 42,995 | 36.001721 | 85 | py |
gevent | gevent-master/src/greentest/3.10/test_asyncore.py | import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
import threading
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
from io import B... | 26,753 | 30.774347 | 86 | py |
gevent | gevent-master/src/greentest/3.10/test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... | 211,271 | 41.73301 | 118 | py |
gevent | gevent-master/src/greentest/3.10/test_select.py | import errno
import os
import select
import subprocess
import sys
import textwrap
import unittest
from test import support
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
class Nope:
pass
class Almost:
d... | 3,398 | 32.653465 | 79 | py |
gevent | gevent-master/src/greentest/3.10/test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper
from test.support import verbose, cpython_only, os_helper
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
i... | 60,950 | 34.191109 | 88 | py |
gevent | gevent-master/src/greentest/3.9/test_socket.py | import unittest
from test import support
from test.support import socket_helper
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform
import array
import contextlib
from weakref import proxy
import signal
impor... | 251,115 | 36.967342 | 117 | py |
gevent | gevent-master/src/greentest/3.9/test_signal.py | import errno
import inspect
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support.script_helper import assert_python_ok, spawn_python
try:
import _testcapi
except ImportError:
_te... | 49,146 | 34.847557 | 86 | py |
gevent | gevent-master/src/greentest/3.9/test_httplib.py | import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import warnings
import unittest
from unittest import mock
TestCase = unittest.TestCase
from test import support
from test.support import socket_helper
here = os.path.dirname(__f... | 79,893 | 37.429052 | 102 | py |
gevent | gevent-master/src/greentest/3.9/test_smtpd.py | import unittest
import textwrap
from test import support, mock_socket
from test.support import socket_helper
import socket
import io
import smtpd
import asyncore
class DummyServer(smtpd.SMTPServer):
def __init__(self, *args, **kwargs):
smtpd.SMTPServer.__init__(self, *args, **kwargs)
self.messages... | 41,283 | 39.673892 | 87 | py |
gevent | gevent-master/src/greentest/3.9/test_context.py | import concurrent.futures
import contextvars
import functools
import gc
import random
import time
import unittest
import weakref
try:
from _testcapi import hamt
except ImportError:
hamt = None
def isolated_context(func):
"""Needed to make reftracking test mode work."""
@functools.wraps(func)
def ... | 31,362 | 27.460073 | 78 | py |
gevent | gevent-master/src/greentest/3.9/test_selectors.py | import errno
import os
import random
import selectors
import signal
import socket
import sys
from test import support
from test.support import socket_helper
from time import sleep
import unittest
import unittest.mock
import tempfile
from time import monotonic as time
try:
import resource
except ImportError:
res... | 18,670 | 31.302768 | 81 | py |
gevent | gevent-master/src/greentest/3.9/test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import traceback
import types
import selectors
import sysconfig
import select
import shutil
import threading
import gc
import textwr... | 156,370 | 41.573101 | 107 | py |
gevent | gevent-master/src/greentest/3.9/test_wsgiref.py | from unittest import mock
from test import support
from test.support import socket_helper
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, Simp... | 30,872 | 34.567972 | 87 | py |
gevent | gevent-master/src/greentest/3.9/test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import asyncore
import asynchat
import socket
import io
import errno
import os
import threading
import time
import unittest
try:
import ssl
except ImportError:
ssl = None
from unit... | 42,747 | 36.043328 | 85 | py |
gevent | gevent-master/src/greentest/3.9/test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
import threading
from test import support
from test.support import socket_helper
from io import BytesIO
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
HAS_UNIX_SOCKETS ... | 26,460 | 30.68982 | 86 | py |
gevent | gevent-master/src/greentest/3.9/test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import socket_helper, warnings_helper
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import tr... | 209,920 | 41.998976 | 118 | py |
gevent | gevent-master/src/greentest/3.9/test_select.py | import errno
import os
import select
import sys
import unittest
from test import support
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
class Nope:
pass
class Almost:
def fileno(self):
retur... | 2,758 | 32.646341 | 83 | py |
gevent | gevent-master/src/greentest/3.9/test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import verbose, import_module, cpython_only, unlink
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import time
import unittest
import weakref
import os... | 53,869 | 33.912508 | 88 | py |
gevent | gevent-master/src/greentest/3.12/test_socket.py | import unittest
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
import _thread as thread
import array
import contextlib
import errno
import gc
import io
import itertools
import math
import os
import pickle
import platform
impo... | 260,406 | 37.132523 | 117 | py |
gevent | gevent-master/src/greentest/3.12/test_signal.py | import enum
import errno
import inspect
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, spawn_python
from t... | 52,568 | 35.229497 | 86 | py |
gevent | gevent-master/src/greentest/3.12/test_httplib.py | import enum
import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import unittest
from unittest import mock
TestCase = unittest.TestCase
from test import support
from test.support import os_helper
from test.support import socket_hel... | 95,969 | 38.445129 | 100 | py |
gevent | gevent-master/src/greentest/3.12/signalinterproctester.py | import os
import signal
import subprocess
import sys
import time
import unittest
from test import support
class SIGUSR1Exception(Exception):
pass
class InterProcessSignalTests(unittest.TestCase):
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(se... | 2,849 | 32.928571 | 75 | py |
gevent | gevent-master/src/greentest/3.12/test_context.py | import concurrent.futures
import contextvars
import functools
import gc
import random
import time
import unittest
import weakref
from test.support import threading_helper
try:
from _testcapi import hamt
except ImportError:
hamt = None
def isolated_context(func):
"""Needed to make reftracking test mode wo... | 31,455 | 27.492754 | 78 | py |
gevent | gevent-master/src/greentest/3.12/test_selectors.py | import errno
import os
import random
import selectors
import signal
import socket
import sys
from test import support
from test.support import os_helper
from test.support import socket_helper
from time import sleep
import unittest
import unittest.mock
import tempfile
from time import monotonic as time
try:
import r... | 18,830 | 31.300172 | 81 | py |
gevent | gevent-master/src/greentest/3.12/test_subprocess.py | import unittest
from unittest import mock
from test import support
from test.support import check_sanitizer
from test.support import import_helper
from test.support import os_helper
from test.support import warnings_helper
from test.support.script_helper import assert_python_ok
import subprocess
import sys
import signa... | 162,765 | 41.530964 | 110 | py |
gevent | gevent-master/src/greentest/3.12/test_wsgiref.py | from unittest import mock
from test import support
from test.support import socket_helper
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, Simp... | 30,027 | 34.536095 | 87 | py |
gevent | gevent-master/src/greentest/3.12/test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import socket
import io
import errno
import os
import threading
import time
import unittest
try:
import ssl
except ImportError:
ssl = None
from unittest import TestCase, skipUnless... | 42,961 | 36.036207 | 85 | py |
gevent | gevent-master/src/greentest/3.12/test_weakref.py | import gc
import sys
import doctest
import unittest
import collections
import weakref
import operator
import contextlib
import copy
import threading
import time
import random
from test import support
from test.support import script_helper, ALWAYS_EQ
from test.support import gc_collect
from test.support import threadin... | 76,026 | 32.865033 | 90 | py |
gevent | gevent-master/src/greentest/3.12/test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
from test.s... | 204,864 | 41.450269 | 118 | py |
gevent | gevent-master/src/greentest/3.12/test_select.py | import errno
import select
import subprocess
import sys
import textwrap
import unittest
from test import support
support.requires_working_socket(module=True)
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
class Nope:
... | 3,504 | 32.380952 | 79 | py |
gevent | gevent-master/src/greentest/3.12/test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper, requires_subprocess
from test.support import verbose, cpython_only, os_helper
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
impor... | 66,700 | 33.995278 | 88 | py |
gevent | gevent-master/src/greentest/3.8/test_socket.py | import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform
import array
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
impo... | 238,273 | 36.92964 | 117 | py |
gevent | gevent-master/src/greentest/3.8/test_signal.py | import errno
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support.script_helper import assert_python_ok, spawn_python
try:
import _testcapi
except ImportError:
_testcapi = None
... | 47,733 | 34.595824 | 86 | py |
gevent | gevent-master/src/greentest/3.8/test_httplib.py | import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import warnings
import unittest
TestCase = unittest.TestCase
from test import support
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
CERT_localhost = o... | 78,822 | 37.319397 | 102 | py |
gevent | gevent-master/src/greentest/3.8/test_smtpd.py | import unittest
import textwrap
from test import support, mock_socket
import socket
import io
import smtpd
import asyncore
class DummyServer(smtpd.SMTPServer):
def __init__(self, *args, **kwargs):
smtpd.SMTPServer.__init__(self, *args, **kwargs)
self.messages = []
if self._decode_data:
... | 41,100 | 39.533531 | 80 | py |
gevent | gevent-master/src/greentest/3.8/test_context.py | import concurrent.futures
import contextvars
import functools
import gc
import random
import time
import unittest
import weakref
try:
from _testcapi import hamt
except ImportError:
hamt = None
def isolated_context(func):
"""Needed to make reftracking test mode work."""
@functools.wraps(func)
def ... | 31,482 | 27.465642 | 78 | py |
gevent | gevent-master/src/greentest/3.8/test_selectors.py | import errno
import os
import random
import selectors
import signal
import socket
import sys
from test import support
from time import sleep
import unittest
import unittest.mock
import tempfile
from time import monotonic as time
try:
import resource
except ImportError:
resource = None
if hasattr(socket, 'sock... | 18,215 | 31.240708 | 81 | py |
gevent | gevent-master/src/greentest/3.8/test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import traceback
import selectors
import sysconfig
import select
import shutil
import threading
import gc
import textwrap
from test.... | 146,059 | 41.78266 | 107 | py |
gevent | gevent-master/src/greentest/3.8/test_wsgiref.py | from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref import util
from... | 30,826 | 34.55594 | 87 | py |
gevent | gevent-master/src/greentest/3.8/test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import asyncore
import asynchat
import socket
import io
import errno
import os
import threading
import time
try:
import ssl
except ImportError:
ssl = None
from unittest import Test... | 40,660 | 35.336908 | 85 | py |
gevent | gevent-master/src/greentest/3.8/test_weakref.py | import gc
import sys
import unittest
import collections
import weakref
import operator
import contextlib
import copy
import threading
import time
import random
from test import support
from test.support import script_helper
# Used in ReferencesTestCase.test_ref_created_during_del() .
ref_from_del = None
# Used by Fi... | 71,134 | 32.809411 | 86 | py |
gevent | gevent-master/src/greentest/3.8/test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
import threading
from test import support
from io import BytesIO
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
TIMEOUT = 3
HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX'... | 26,431 | 30.65509 | 86 | py |
gevent | gevent-master/src/greentest/3.8/test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
i... | 208,713 | 41.892314 | 118 | py |
gevent | gevent-master/src/greentest/3.8/test_select.py | import errno
import os
import select
import sys
import unittest
from test import support
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
class Nope:
pass
class Almost:
def fileno(self):
retur... | 2,758 | 32.646341 | 83 | py |
gevent | gevent-master/src/greentest/3.8/test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import (verbose, import_module, cpython_only,
requires_type_collecting)
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import... | 48,693 | 34.234443 | 88 | py |
gevent | gevent-master/src/greentest/3.11/test_socket.py | import unittest
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform... | 255,118 | 37.009386 | 117 | py |
gevent | gevent-master/src/greentest/3.11/test_signal.py | import enum
import errno
import inspect
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, spawn_python
from t... | 52,912 | 35.291495 | 86 | py |
gevent | gevent-master/src/greentest/3.11/test_httplib.py | import enum
import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import warnings
import unittest
from unittest import mock
TestCase = unittest.TestCase
from test import support
from test.support import os_helper
from test.support i... | 89,708 | 38.380597 | 102 | py |
gevent | gevent-master/src/greentest/3.11/signalinterproctester.py | import os
import signal
import subprocess
import sys
import time
import unittest
from test import support
class SIGUSR1Exception(Exception):
pass
class InterProcessSignalTests(unittest.TestCase):
def setUp(self):
self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0}
def sighup_handler(se... | 2,803 | 31.988235 | 75 | py |
gevent | gevent-master/src/greentest/3.11/test_smtpd.py | import unittest
import textwrap
from test import support, mock_socket
from test.support import socket_helper
from test.support import warnings_helper
import socket
import io
smtpd = warnings_helper.import_deprecated('smtpd')
asyncore = warnings_helper.import_deprecated('asyncore')
if not socket_helper.has_gethostnam... | 41,687 | 39.870588 | 87 | py |
gevent | gevent-master/src/greentest/3.11/test_context.py | import concurrent.futures
import contextvars
import functools
import gc
import random
import time
import unittest
import weakref
from test.support import threading_helper
try:
from _testcapi import hamt
except ImportError:
hamt = None
def isolated_context(func):
"""Needed to make reftracking test mode wo... | 31,455 | 27.492754 | 78 | py |
gevent | gevent-master/src/greentest/3.11/test_selectors.py | import errno
import os
import random
import selectors
import signal
import socket
import sys
from test import support
from test.support import os_helper
from test.support import socket_helper
from time import sleep
import unittest
import unittest.mock
import tempfile
from time import monotonic as time
try:
import r... | 18,830 | 31.300172 | 81 | py |
gevent | gevent-master/src/greentest/3.11/test_subprocess.py | import unittest
from unittest import mock
from test import support
from test.support import check_sanitizer
from test.support import import_helper
from test.support import os_helper
from test.support import warnings_helper
import subprocess
import sys
import signal
import io
import itertools
import os
import errno
impo... | 161,773 | 41.583311 | 110 | py |
gevent | gevent-master/src/greentest/3.11/test_wsgiref.py | from unittest import mock
from test import support
from test.support import socket_helper
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, Simp... | 30,027 | 34.536095 | 87 | py |
gevent | gevent-master/src/greentest/3.11/test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import socket
import io
import errno
import os
import threading
import time
import unittest
try:
import ssl
except ImportError:
ssl = None
from unittest import TestCase, skipUnless... | 43,012 | 36.016351 | 85 | py |
gevent | gevent-master/src/greentest/3.11/test_asyncore.py | import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
import threading
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
from io import B... | 26,732 | 30.787158 | 86 | py |
gevent | gevent-master/src/greentest/3.11/test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... | 216,473 | 41.554354 | 118 | py |
gevent | gevent-master/src/greentest/3.11/test_select.py | import errno
import os
import select
import subprocess
import sys
import textwrap
import unittest
from test import support
support.requires_working_socket(module=True)
@unittest.skipIf((sys.platform[:3]=='win'),
"can't easily test on this system")
class SelectTestCase(unittest.TestCase):
class N... | 3,514 | 32.160377 | 79 | py |
gevent | gevent-master/src/greentest/3.11/test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper, requires_subprocess
from test.support import verbose, cpython_only, os_helper
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
impor... | 61,722 | 34.030079 | 88 | py |
gevent | gevent-master/src/gevent/threading.py | """
Implementation of the standard :mod:`threading` using greenlets.
.. note::
This module is a helper for :mod:`gevent.monkey` and is not
intended to be used directly. For spawning greenlets in your
applications, prefer higher level constructs like
:class:`gevent.Greenlet` class or :func:`gevent.spaw... | 8,781 | 35.89916 | 109 | py |
gevent | gevent-master/src/gevent/_threading.py | """
A small selection of primitives that always work with
native threads. This has very limited utility and is
targeted only for the use of gevent's threadpool.
"""
from __future__ import absolute_import
from collections import deque
from gevent import monkey
from gevent._compat import thread_mod_name
__all__ = [
... | 8,342 | 34.502128 | 91 | py |
gevent | gevent-master/src/gevent/win32util.py | # Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, mer... | 3,637 | 35.747475 | 79 | py |
gevent | gevent-master/src/gevent/backdoor.py | # Copyright (c) 2009-2014, gevent contributors
# Based on eventlet.backdoor Copyright (c) 2005-2006, Bob Ippolito
"""
Interactive greenlet-based network console that can be used in any process.
The :class:`BackdoorServer` provides a REPL inside a running process. As
long as the process is monkey-patched, the ``Backdoo... | 8,642 | 32.114943 | 100 | py |
gevent | gevent-master/src/gevent/_socket3.py | # Port of Python 3.3's socket module to gevent
"""
Python 3 socket module.
"""
# Our import magic sadly makes this warning useless
# pylint: disable=undefined-variable
# pylint: disable=too-many-statements,too-many-branches
# pylint: disable=too-many-public-methods,unused-argument
from __future__ import absolute_import... | 21,953 | 34.581848 | 101 | py |
gevent | gevent-master/src/gevent/events.py | # -*- coding: utf-8 -*-
# Copyright 2018 gevent. See LICENSE for details.
"""
Publish/subscribe event infrastructure.
When certain "interesting" things happen during the lifetime of the
process, gevent will "publish" an event (an object). That event is
delivered to interested "subscribers" (functions that take one
par... | 16,740 | 32.150495 | 93 | py |
gevent | gevent-master/src/gevent/_greenlet_primitives.py | # -*- coding: utf-8 -*-
# copyright (c) 2018 gevent. See LICENSE.
# cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
"""
A collection of primitives used by the hub, and suitable for
compilation with Cython because of their frequency of use.
"""
from __future__ import absolute_import
from __fu... | 4,647 | 33.947368 | 103 | py |
gevent | gevent-master/src/gevent/core.py | # Copyright (c) 2009-2015 Denis Bilenko and gevent contributors. See LICENSE for details.
"""
Deprecated; this does not reflect all the possible options
and its interface varies.
.. versionchanged:: 1.3a2
Deprecated.
"""
from __future__ import absolute_import
import sys
from gevent._config import config
from gev... | 479 | 21.857143 | 89 | py |
gevent | gevent-master/src/gevent/_interfaces.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 gevent contributors. See LICENSE for details.
"""
Interfaces gevent uses that don't belong any one place.
This is not a public module, these interfaces are not
currently exposed to the public, they mostly exist for
documentation and testing purposes.
.. versionadded:: 1.3b... | 9,731 | 29.507837 | 91 | py |
gevent | gevent-master/src/gevent/_semaphore.py | # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
###
# This file is ``gevent._semaphore`` so that it can be compiled by Cython
# individually. However, this is not the place to import from. Everyone,
# gevent internal code included, must import from ``gevent.lock``.
# The only exception are .... | 20,942 | 38.515094 | 115 | py |
gevent | gevent-master/src/gevent/exceptions.py | # -*- coding: utf-8 -*-
# copyright 2018 gevent
"""
Exceptions.
.. versionadded:: 1.3b1
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from greenlet import GreenletExit
__all__ = [
'LoopExit',
]
class LoopExit(Exception):
"""
Exception ... | 3,932 | 27.708029 | 86 | py |
gevent | gevent-master/src/gevent/_tblib.py | # -*- coding: utf-8 -*-
# A vendored version of part of https://github.com/ionelmc/python-tblib
# pylint:disable=redefined-outer-name,reimported,function-redefined,bare-except,no-else-return,broad-except
####
# Copyright (c) 2013-2016, Ionel Cristian Mărieș
# All rights reserved.
# Redistribution and use in source and... | 12,217 | 31.408488 | 138 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.