text stringlengths 0 1.05M | meta dict |
|---|---|
"""Asynchronous Advantage Actor-Critic (A3C) algorithm for reinforcement learning."""
from deepchem.models import TensorGraph
from deepchem.models.tensorgraph import TFWrapper
from deepchem.models.tensorgraph.layers import Feature, Weights, Label, Layer
import numpy as np
import tensorflow as tf
import collections
imp... | {
"repo_name": "rbharath/deepchem",
"path": "deepchem/rl/a3c.py",
"copies": "1",
"size": "20119",
"license": "mit",
"hash": -1300909854354987500,
"line_mean": 40.1431492843,
"line_max": 124,
"alpha_frac": 0.6594761171,
"autogenerated": false,
"ratio": 3.8402366863905324,
"config_test": false,
... |
"""Asynchronous Advantage Actor-Critic (A3C) algorithm for reinforcement learning."""
from deepchem.models import TensorGraph
from deepchem.models.tensorgraph.optimizers import Adam
from deepchem.models.tensorgraph.layers import Feature, Weights, Label, Layer
import numpy as np
import tensorflow as tf
import collectio... | {
"repo_name": "Agent007/deepchem",
"path": "deepchem/rl/a3c.py",
"copies": "1",
"size": "23920",
"license": "mit",
"hash": -4710104663599846000,
"line_mean": 40.5277777778,
"line_max": 132,
"alpha_frac": 0.6591137124,
"autogenerated": false,
"ratio": 3.834562359730683,
"config_test": false,
"... |
'''Asynchronous application for serving requests
on sockets. This is the base class of :class:`.WSGIServer`.
All is needed by a :class:`.SocketServer` application is a callable
which build a :class:`.ProtocolConsumer` for each new client request
received.
This is an example of a script for an Echo server::
import ... | {
"repo_name": "inirudebwoy/pulsar",
"path": "pulsar/apps/socket/__init__.py",
"copies": "5",
"size": "12565",
"license": "bsd-3-clause",
"hash": -5193187080484450000,
"line_mean": 32.2407407407,
"line_max": 79,
"alpha_frac": 0.6127337843,
"autogenerated": false,
"ratio": 4.359819569743234,
"con... |
"""Asynchronous client for swaggerpy
Copyright (c) 2014, Matthew Jordan
Matthew Jordan <mjordan@digium.com>
This program is free software, distributed under the terms of
the MIT License (MIT)
This module provides an asynchronous client for SwaggerPy. The normal
SwaggerClient - unfortunately - assumes that the HTTP c... | {
"repo_name": "matt-jordan/twisted-ari",
"path": "twisted_ari/swagger_client.py",
"copies": "1",
"size": "10209",
"license": "mit",
"hash": -2983559699464332000,
"line_mean": 35.4607142857,
"line_max": 81,
"alpha_frac": 0.5693995494,
"autogenerated": false,
"ratio": 4.891710589362722,
"config_t... |
# Asynchronous file example. Works with Linux, OS X and other Unix
# variants, but not Windows, as in Windows sockets don't support file
# I/O for asynchronous I/O.
# The file descriptor is associated with socket. The client sends data
# in chunks and server reads lines from the data receivd from
# client. Both comput... | {
"repo_name": "pgiri/asyncoro",
"path": "examples/socket_afile.py",
"copies": "1",
"size": "2169",
"license": "mit",
"hash": -4630182158640078000,
"line_mean": 32.890625,
"line_max": 89,
"alpha_frac": 0.6763485477,
"autogenerated": false,
"ratio": 3.3732503888024885,
"config_test": false,
"ha... |
"""Asynchronous HTTP client for swaggerpy
Copyright (c) 2014, Matthew Jordan
Matthew Jordan <mjordan@digium.com>
This program is free software, distributed under the terms of
the MIT License (MIT)
This module provides an asynchronous HTTP client for SwaggerPy, along with
supporting classes. The asynchronous HTTP cli... | {
"repo_name": "matt-jordan/twisted-ari",
"path": "twisted_ari/http_client.py",
"copies": "1",
"size": "13525",
"license": "mit",
"hash": 6020989052415412000,
"line_mean": 30.6744730679,
"line_max": 79,
"alpha_frac": 0.6508687616,
"autogenerated": false,
"ratio": 4.590970807875085,
"config_test"... |
"""Asynchronous IO library for python using greenlet based coroutines.
Copyright (c) 2009, Erik Gorset
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the ... | {
"repo_name": "gorset/naglfar",
"path": "naglfar/core.py",
"copies": "1",
"size": "21065",
"license": "bsd-2-clause",
"hash": -7462094646752746000,
"line_mean": 31.3579109063,
"line_max": 129,
"alpha_frac": 0.5863280323,
"autogenerated": false,
"ratio": 4.0847391894512315,
"config_test": false,... |
"""Asynchronous msgpack-rpc handling in the event loop pipeline."""
import logging
from traceback import format_exc
logger = logging.getLogger(__name__)
debug, info, warn = (logger.debug, logger.info, logger.warning,)
class AsyncSession(object):
"""Asynchronous msgpack-rpc layer that wraps a msgpack stream.
... | {
"repo_name": "bfredl/python-client",
"path": "neovim/msgpack_rpc/async_session.py",
"copies": "3",
"size": "4629",
"license": "apache-2.0",
"hash": 7260319515561505000,
"line_mean": 33.5447761194,
"line_max": 78,
"alpha_frac": 0.5938647656,
"autogenerated": false,
"ratio": 3.893187552565181,
"... |
"""Asynchronous msgpack-rpc handling in the event loop pipeline."""
import threading
from traceback import format_exc
class AsyncSession(object):
"""Asynchronous msgpack-rpc layer that wraps a msgpack stream.
This wraps the msgpack stream interface for reading/writing msgpack
documents and exposes an in... | {
"repo_name": "lunixbochs/actualvim",
"path": "lib/neovim/msgpack_rpc/async_session.py",
"copies": "1",
"size": "4333",
"license": "mit",
"hash": -5201657606713233000,
"line_mean": 33.1181102362,
"line_max": 78,
"alpha_frac": 0.5908146781,
"autogenerated": false,
"ratio": 3.986200551977921,
"co... |
"""asynchronous networking"""
import aiohttp
import asyncio
import hashlib
from urllib.parse import urlencode, urlparse, urlunparse, parse_qsl
DEFAULT_HEADERS = {"User-Agent": "Mozilla/5.0"}
def url_concat(url, **args):
"""Concatenate url and arguments regardless of whether
url has existing query parameters... | {
"repo_name": "sourcepirate/data-style",
"path": "data/requests.py",
"copies": "1",
"size": "1488",
"license": "bsd-2-clause",
"hash": 8997965741691401000,
"line_mean": 28.1764705882,
"line_max": 87,
"alpha_frac": 0.6001344086,
"autogenerated": false,
"ratio": 4.05449591280654,
"config_test": f... |
"""Asynchronous nng socket interface."""
__all__ = [
'Context',
'Socket',
]
import ctypes
from g1.asyncs import kernels
from g1.asyncs.bases import locks
from g1.bases.assertions import ASSERT
from . import _nng
from . import bases
from . import errors
from . import messages
class Dialer(bases.DialerBase)... | {
"repo_name": "clchiou/garage",
"path": "py/g1/third-party/nng/nng/asyncs.py",
"copies": "1",
"size": "4565",
"license": "mit",
"hash": -3988898277664032000,
"line_mean": 24.6460674157,
"line_max": 79,
"alpha_frac": 0.6059145674,
"autogenerated": false,
"ratio": 3.2794540229885056,
"config_test... |
# Asynchronous pipe example using chained Popen
import sys, subprocess, traceback, platform
import asyncoro
import asyncoro.asyncfile
def writer(apipe, inp, coro=None):
fd = open(inp)
while True:
line = fd.readline()
if not line:
break
yield apipe.stdin.write(line.encod... | {
"repo_name": "pgiri/asyncoro",
"path": "examples/pipe_grep.py",
"copies": "1",
"size": "1985",
"license": "mit",
"hash": 3178352326215165400,
"line_mean": 36.4528301887,
"line_max": 101,
"alpha_frac": 0.6377833753,
"autogenerated": false,
"ratio": 3.2540983606557377,
"config_test": false,
"h... |
# Asynchronous pipe example with "communicate" method that is similar
# to Popen's "communicate". Same example is used to show how custom
# write/read processes can be provided to feed / read from the
# asynchronous pipe
# argv[1] must be a text file
import sys, os, traceback, subprocess, platform
import asyncoro
imp... | {
"repo_name": "pgiri/asyncoro",
"path": "examples/pipe_csum.py",
"copies": "1",
"size": "2553",
"license": "mit",
"hash": -2837535440552661500,
"line_mean": 39.5238095238,
"line_max": 118,
"alpha_frac": 0.6705836271,
"autogenerated": false,
"ratio": 3.565642458100559,
"config_test": false,
"h... |
"""Asynchronous request engine."""
__author__ = 'vovanec@gmail.com'
from tornado import curl_httpclient
from tornado import gen
from tornado import httpclient
from .base import BaseRequestEngine
from .errors import ClientError
from .errors import CommunicationError
from .errors import MalformedResponse
from .errors... | {
"repo_name": "vovanec/httputil",
"path": "httputil/request_engines/async.py",
"copies": "1",
"size": "4479",
"license": "mit",
"hash": 6376839361730604000,
"line_mean": 35.1209677419,
"line_max": 78,
"alpha_frac": 0.5916499219,
"autogenerated": false,
"ratio": 4.6080246913580245,
"config_test"... |
"""Asynchronous request parser. Compatible with Python>=3.5."""
import asyncio
import functools
import inspect
import typing
from collections.abc import Mapping
from marshmallow import Schema, ValidationError
from marshmallow.fields import Field
import marshmallow as ma
from marshmallow.utils import missing
from weba... | {
"repo_name": "sloria/webargs",
"path": "src/webargs/asyncparser.py",
"copies": "1",
"size": "8815",
"license": "mit",
"hash": 3099429554414004000,
"line_mean": 39.0681818182,
"line_max": 88,
"alpha_frac": 0.5513329552,
"autogenerated": false,
"ratio": 4.532133676092545,
"config_test": false,
... |
'''
Generate the errno module by extracting the values from CPython.
Better windows error messages could be derived by parsing:
http://www.sockets.com/err_lst1.htm#DetailedErrorDescriptions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/errors_2036.asp
'''
import os
if os.name == 'java':
... | {
"repo_name": "nelmiux/CarnotKE",
"path": "jyhton/Misc/make_errno.py",
"copies": "7",
"size": "3525",
"license": "apache-2.0",
"hash": -8992240812756177000,
"line_mean": 33.900990099,
"line_max": 95,
"alpha_frac": 0.5815602837,
"autogenerated": false,
"ratio": 3.260869565217391,
"config_test": ... |
"""Asynchronous support for garage.threads.actors."""
__all__ = [
'StubAdapter',
]
from garage.asyncs import futures
class StubAdapter:
"""Wrap all method calls, adding FutureAdapter on their result.
While this simple adapter does not work for all corner cases, for
common cases, it should work fine... | {
"repo_name": "clchiou/garage",
"path": "py/garage/garage/asyncs/actors.py",
"copies": "1",
"size": "1247",
"license": "mit",
"hash": -8308930582010044000,
"line_mean": 28.6904761905,
"line_max": 74,
"alpha_frac": 0.6311146752,
"autogenerated": false,
"ratio": 4.061889250814332,
"config_test": ... |
"""Asynchronous tasks."""
import snowfloat.request
import snowfloat.result
class Task(object):
"""Asynchronous task sent to the server.
Attributes:
uuid (str): Task UUID.
uri (str): Task URI.
operation (str): Task operation: map.
task_filter (dict): Query filter.
... | {
"repo_name": "snowfloat/snowfloat-python",
"path": "snowfloat/task.py",
"copies": "1",
"size": "3073",
"license": "bsd-3-clause",
"hash": -1352192416161451300,
"line_mean": 27.9905660377,
"line_max": 74,
"alpha_frac": 0.5056947608,
"autogenerated": false,
"ratio": 4.169606512890095,
"config_te... |
'''Asynchronous WSGI_ Remote Procedure Calls middleware. It implements a
JSON-RPC_ server and client. Check out the
:ref:`json-rpc tutorial <tutorials-calculator>` if you want to get started
quickly with a working example.
To quickly setup a server::
class MyRpc(rpc.JSONRPC):
def rpc_ping(self, request):... | {
"repo_name": "dejlek/pulsar",
"path": "pulsar/apps/rpc/__init__.py",
"copies": "1",
"size": "1683",
"license": "bsd-3-clause",
"hash": 3749502652103921700,
"line_mean": 19.7777777778,
"line_max": 74,
"alpha_frac": 0.5971479501,
"autogenerated": false,
"ratio": 3.7483296213808464,
"config_test"... |
"""Asynchronous WSGI_ Remote Procedure Calls middleware. It implements a
JSON-RPC_ server and client. Check out the
:ref:`json-rpc tutorial <tutorials-calculator>` if you want to get started
quickly with a working example.
To quickly setup a server::
class MyRpc(rpc.JSONRPC):
def rpc_ping(self, request):... | {
"repo_name": "quantmind/pulsar",
"path": "pulsar/apps/rpc/__init__.py",
"copies": "1",
"size": "2013",
"license": "bsd-3-clause",
"hash": -7648460218246820000,
"line_mean": 19.5408163265,
"line_max": 74,
"alpha_frac": 0.6169895678,
"autogenerated": false,
"ratio": 3.7346938775510203,
"config_t... |
"""Asynchronous WSGI Server/Gateway implementation."""
__all__ = [
'FileWrapper',
'HttpSession',
]
import collections
import enum
import http
import io
import itertools
import logging
import os
import re
import socket
from g1.asyncs.bases import locks
from g1.asyncs.bases import queues
from g1.asyncs.bases i... | {
"repo_name": "clchiou/garage",
"path": "py/g1/http/http1_servers/g1/http/http1_servers/wsgi.py",
"copies": "1",
"size": "23561",
"license": "mit",
"hash": 4457118436835384000,
"line_mean": 33.1959361393,
"line_max": 78,
"alpha_frac": 0.5416153814,
"autogenerated": false,
"ratio": 4.2239153818572... |
"""Asynchronous WSGI Server/Gateway implementation.
This implements a asynchronous-variant of WSGI server. It handles one
incoming HTTP/2 session at a time.
At the moment it does not implements HTTP/2 Push.
"""
__all__ = [
'HttpSession',
]
import collections
import ctypes
import functools
import logging
import... | {
"repo_name": "clchiou/garage",
"path": "py/g1/http/http2_servers/g1/http/http2_servers/wsgi.py",
"copies": "1",
"size": "22326",
"license": "mit",
"hash": -8699270819437327000,
"line_mean": 29.3755102041,
"line_max": 78,
"alpha_frac": 0.5524948491,
"autogenerated": false,
"ratio": 3.802111716621... |
"""Async HTTP client with bonus features!
- Support caching via upstream 304 with ETag, Last-Modified
- Log request timings for profiling
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import hashlib
import pickle
import time
from tornado.simple_httpclient i... | {
"repo_name": "christophelec/nbviewer",
"path": "nbviewer/providers/url/client.py",
"copies": "1",
"size": "5538",
"license": "bsd-3-clause",
"hash": 7150160330944261000,
"line_mean": 34.7290322581,
"line_max": 91,
"alpha_frac": 0.6063560852,
"autogenerated": false,
"ratio": 4.343529411764706,
... |
"""Async I/O backend support utilities."""
from __future__ import absolute_import, unicode_literals
import socket
import threading
from collections import deque
from time import sleep
from weakref import WeakKeyDictionary
from kombu.utils.compat import detect_environment
from kombu.utils.objects import cached_propert... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/celery-4.2.1/celery/backends/async.py",
"copies": "2",
"size": "9103",
"license": "apache-2.0",
"hash": -5849780360650487000,
"line_mean": 29.4448160535,
"line_max": 79,
"alpha_frac": 0.5873887729,
"autogenerated": false,
"ratio": 4.12647... |
"""Async I/O backend support utilities."""
from __future__ import absolute_import, unicode_literals
import socket
import threading
from collections import deque
from time import sleep
from weakref import WeakKeyDictionary
from kombu.utils.compat import detect_environment
from kombu.utils.objects import cached_proper... | {
"repo_name": "ammarkhann/FinalSeniorCode",
"path": "lib/python2.7/site-packages/celery/backends/async.py",
"copies": "2",
"size": "9104",
"license": "mit",
"hash": -1765712084561805000,
"line_mean": 29.3466666667,
"line_max": 79,
"alpha_frac": 0.5873242531,
"autogenerated": false,
"ratio": 4.125... |
"""Asyncio backports for Python 3.4.3 compatibility."""
import concurrent.futures
from asyncio import coroutines
from asyncio.futures import Future
try:
from asyncio import ensure_future
except ImportError:
# Python 3.4.3 and earlier has this as async
# pylint: disable=unused-import
from asyncio import... | {
"repo_name": "jawilson/home-assistant",
"path": "homeassistant/util/async.py",
"copies": "2",
"size": "4940",
"license": "mit",
"hash": -1834255470542732000,
"line_mean": 31.0779220779,
"line_max": 78,
"alpha_frac": 0.6562753036,
"autogenerated": false,
"ratio": 4.207836456558773,
"config_test... |
"""Asyncio backports for Python 3.4.3 compatibility."""
import concurrent.futures
import threading
from asyncio import coroutines
from asyncio.futures import Future
try:
from asyncio import ensure_future
except ImportError:
# Python 3.4.3 and earlier has this as async
# pylint: disable=unused-import
fr... | {
"repo_name": "varunr047/homefile",
"path": "homeassistant/util/async.py",
"copies": "1",
"size": "5506",
"license": "mit",
"hash": -4671917813682454000,
"line_mean": 31.9700598802,
"line_max": 78,
"alpha_frac": 0.6574645841,
"autogenerated": false,
"ratio": 4.235384615384615,
"config_test": fa... |
"""Asyncio backports for Python 3.4.3 compatibility."""
import concurrent.futures
import threading
import logging
from asyncio import coroutines
from asyncio.events import AbstractEventLoop
from asyncio.futures import Future
import asyncio
from asyncio import ensure_future
from typing import Any, Union, Coroutine, Cal... | {
"repo_name": "aequitas/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "11",
"size": "7198",
"license": "apache-2.0",
"hash": 7348158618652304000,
"line_mean": 34.4581280788,
"line_max": 79,
"alpha_frac": 0.6433731592,
"autogenerated": false,
"ratio": 4.187318208260617,
"con... |
"""Asyncio backports for Python 3.4.3 compatibility."""
import concurrent.futures
import threading
import logging
from asyncio import coroutines
from asyncio.futures import Future
try:
from asyncio import ensure_future
except ImportError:
# Python 3.4.3 and earlier has this as async
# pylint: disable=unuse... | {
"repo_name": "hexxter/home-assistant",
"path": "homeassistant/util/async.py",
"copies": "8",
"size": "5793",
"license": "mit",
"hash": 7227016433226927000,
"line_mean": 32.1028571429,
"line_max": 78,
"alpha_frac": 0.6551009839,
"autogenerated": false,
"ratio": 4.228467153284671,
"config_test":... |
"""Asyncio backports for Python 3.4.3 compatibility."""
import concurrent.futures
import threading
import logging
from asyncio import coroutines
from asyncio.futures import Future
try:
# pylint: disable=ungrouped-imports
from asyncio import ensure_future
except ImportError:
# Python 3.4.3 and earlier has t... | {
"repo_name": "keerts/home-assistant",
"path": "homeassistant/util/async.py",
"copies": "22",
"size": "5833",
"license": "apache-2.0",
"hash": 7468884344073960000,
"line_mean": 32.1420454545,
"line_max": 78,
"alpha_frac": 0.6555803189,
"autogenerated": false,
"ratio": 4.226811594202899,
"config... |
"""Asyncio backports for Python 3.6 compatibility."""
from asyncio import coroutines, ensure_future, get_running_loop
from asyncio.events import AbstractEventLoop
import concurrent.futures
import functools
import logging
import threading
from traceback import extract_stack
from typing import Any, Callable, Coroutine, T... | {
"repo_name": "GenericStudent/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "6",
"size": "3782",
"license": "apache-2.0",
"hash": -5316001510660286000,
"line_mean": 29.7479674797,
"line_max": 138,
"alpha_frac": 0.6380222105,
"autogenerated": false,
"ratio": 4.17439293598234,
... |
"""Asyncio backports for Python 3.6 compatibility."""
from asyncio import coroutines, ensure_future
from asyncio.events import AbstractEventLoop
import concurrent.futures
import logging
import threading
from typing import Any, Callable, Coroutine
_LOGGER = logging.getLogger(__name__)
def fire_coroutine_threadsafe(co... | {
"repo_name": "leppa/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "3",
"size": "2016",
"license": "apache-2.0",
"hash": -8920435883794269000,
"line_mean": 34.3684210526,
"line_max": 80,
"alpha_frac": 0.6800595238,
"autogenerated": false,
"ratio": 4.1652892561983474,
"confi... |
"""Asyncio backports for Python 3.6 compatibility."""
import concurrent.futures
import threading
import logging
from asyncio import coroutines
from asyncio.events import AbstractEventLoop
import asyncio
from asyncio import ensure_future
from typing import Any, Coroutine, Callable, TypeVar, Awaitable
_LOGGER = logging... | {
"repo_name": "qedi-r/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "2",
"size": "2598",
"license": "apache-2.0",
"hash": 3253344474153591300,
"line_mean": 32.3076923077,
"line_max": 80,
"alpha_frac": 0.662817552,
"autogenerated": false,
"ratio": 4.03416149068323,
"config_t... |
""" asyncio-based rfc2812-compliant IRC Client """
import logging
import asyncio
from . import connection
from . import event
from . import pack
from . import unpack
__all__ = ["Client"]
logger = logging.getLogger(__name__)
class Client(event.EventsMixin):
__conn_cls__ = connection.Connection
def __init__(se... | {
"repo_name": "kernelpanic3/IdleBot",
"path": "bottom/__init__.py",
"copies": "3",
"size": "1745",
"license": "bsd-3-clause",
"hash": -3445575103675354000,
"line_mean": 29.0862068966,
"line_max": 74,
"alpha_frac": 0.6114613181,
"autogenerated": false,
"ratio": 4.340796019900497,
"config_test": ... |
""" Asyncio client module """
import socket
import asyncio
import asyncio.streams
from smserver.smutils import smconn
class AsyncSocketClient(smconn.StepmaniaConn):
ENCODING = "binary"
def __init__(self, serv, ip, port, reader, writer, loop):
smconn.StepmaniaConn.__init__(self, serv, ip, port)
... | {
"repo_name": "ningirsu/stepmania-server",
"path": "smserver/smutils/smconnections/asynctcpserver.py",
"copies": "1",
"size": "3724",
"license": "mit",
"hash": -9083318885030885000,
"line_mean": 25.9855072464,
"line_max": 98,
"alpha_frac": 0.5308807734,
"autogenerated": false,
"ratio": 4.01725997... |
"""asyncio-compatible logstash logging handler."""
__version__ = "2.0.0"
import asyncio
import logging
import types
from typing import Any, Mapping
from .tcp_handler import TCPLogstashHandler
__all__ = ("create_tcp_handler",)
async def create_tcp_handler(
host: str,
port: int,
level: int = logging.N... | {
"repo_name": "wikibusiness/aiologstash",
"path": "aiologstash/__init__.py",
"copies": "1",
"size": "1078",
"license": "mit",
"hash": -2502195581025100000,
"line_mean": 21.4583333333,
"line_max": 58,
"alpha_frac": 0.6224489796,
"autogenerated": false,
"ratio": 3.7301038062283736,
"config_test":... |
#Asyncio Finite State Machine
import asyncio
import time
from random import randint
@asyncio.coroutine
def StartState():
print ("Start State called \n")
input_value = randint(0,1)
time.sleep(1)
if (input_value == 0):
result = yield from State2(input_value)
else :
re... | {
"repo_name": "IdiosyncraticDragon/Reading-Notes",
"path": "Python Parallel Programming Cookbook_Code/Chapter 4/Asyncio_coroutine.py",
"copies": "1",
"size": "2282",
"license": "apache-2.0",
"hash": -7897211880351372000,
"line_mean": 28.0263157895,
"line_max": 67,
"alpha_frac": 0.5893952673,
"autog... |
"""asyncio (PEP 3156) connector for the XMMS2 Python bindings."""
class AIOXMMSConnector:
def __init__(self, loop, xmms):
self.loop = loop
self.xmms = xmms
self.has_writer = False
self.connect()
def handle_out(self):
if self.xmms.want_ioout():
self.xmms.ioo... | {
"repo_name": "chrippa/aioxmmsclient",
"path": "aioxmmsclient.py",
"copies": "1",
"size": "1129",
"license": "mit",
"hash": -6647882112934364000,
"line_mean": 29.5135135135,
"line_max": 69,
"alpha_frac": 0.617360496,
"autogenerated": false,
"ratio": 3.059620596205962,
"config_test": false,
"h... |
import utime as time
import utimeq
from uasyncio import *
class PriorityEventLoop(PollEventLoop):
def __init__(self, len=42, lpqlen=42, max_overdue_ms=0, hpqlen=0):
super().__init__(len)
self._max_overdue_ms = max_overdue_ms
self.lpq = utimeq.utimeq(lpqlen)
if hpqlen:
s... | {
"repo_name": "zentropi/python-uzentropi",
"path": "mpylibs/asyncio_priority/__init__.py",
"copies": "1",
"size": "9081",
"license": "apache-2.0",
"hash": 6660208653124494000,
"line_mean": 40.4657534247,
"line_max": 122,
"alpha_frac": 0.4310098007,
"autogenerated": false,
"ratio": 4.5111773472429... |
"""Asyncio protocol implementation for handling telegrams."""
from functools import partial
import asyncio
import logging
from serial_asyncio import create_serial_connection
from dsmr_parser import telegram_specifications
from dsmr_parser.clients.telegram_buffer import TelegramBuffer
from dsmr_parser.exceptions impo... | {
"repo_name": "ndokter/dsmr_parser",
"path": "dsmr_parser/clients/protocol.py",
"copies": "1",
"size": "5197",
"license": "mit",
"hash": -7874381210979669000,
"line_mean": 35.8581560284,
"line_max": 80,
"alpha_frac": 0.6478737733,
"autogenerated": false,
"ratio": 4.016228748068007,
"config_test... |
"""Asyncio protocol implementation of RFlink."""
# ./.homeassistant/deps/lib/python/site-packages/rflink/protocol.py
# /Library/Frameworks/Python.framework/Versions/3.6//lib/python3.6/site-packages/rflink/protocol.py
import asyncio
import concurrent
import logging
from datetime import timedelta
from fnmatch import fn... | {
"repo_name": "aequitas/python-rflink",
"path": "rflink/protocol.py",
"copies": "1",
"size": "15600",
"license": "mit",
"hash": 8156465502377076000,
"line_mean": 33.2105263158,
"line_max": 99,
"alpha_frac": 0.5992307692,
"autogenerated": false,
"ratio": 4.240282685512367,
"config_test": false,
... |
# asyncio Sample for MyMusicTaste
# SELO77
# 2016-07-24
import asyncio
import time
class SpawnClass():
def __init__(self):
pass
@asyncio.coroutine
def execute(self, request_class_list):
response = []
if request_class_list:
@asyncio.coroutine
def run(requ... | {
"repo_name": "SELO77/seloPython",
"path": "seminar/spwan.py",
"copies": "1",
"size": "1468",
"license": "mit",
"hash": -3452122050323272700,
"line_mean": 19.6901408451,
"line_max": 74,
"alpha_frac": 0.5899182561,
"autogenerated": false,
"ratio": 3.978319783197832,
"config_test": false,
"has_... |
# asyncio Sample for MyMusicTaste
# SELO77
# 2016-07-24
import asyncio
import traceback
class SpawnClass():
def __init__(self):
pass
@asyncio.coroutine
def execute(self, request_class_list):
response = []
try:
if request_class_list:
@asyncio.coroutine
def run(request_class)... | {
"repo_name": "SELO77/seloPython",
"path": "3.X/module/async_gather.py",
"copies": "1",
"size": "1423",
"license": "mit",
"hash": -1631435848732161500,
"line_mean": 19.3428571429,
"line_max": 68,
"alpha_frac": 0.627547435,
"autogenerated": false,
"ratio": 3.8150134048257374,
"config_test": fals... |
"""AsyncIO support for zmq
Requires asyncio and Python 3.
"""
# Copyright (c) PyZMQ Developers.
# Distributed under the terms of the Modified BSD License.
# Derived from Python 3.5.1 selectors._BaseSelectorImpl, used under PSF License
from collections import Mapping
import zmq as _zmq
from zmq.eventloop import futu... | {
"repo_name": "zanph/zanph",
"path": "flaskroulette/venv/lib/python2.7/site-packages/zmq/asyncio.py",
"copies": "6",
"size": "9631",
"license": "mit",
"hash": 5727308518395307000,
"line_mean": 27.9219219219,
"line_max": 89,
"alpha_frac": 0.5859204652,
"autogenerated": false,
"ratio": 4.1530832255... |
"""AsyncIO support for zmq
Requires asyncio and Python 3.
"""
# Copyright (c) PyZMQ Developers.
# Distributed under the terms of the Modified BSD License.
import zmq as _zmq
from zmq import _future
# TODO: support trollius for Legacy Python? (probably not)
import asyncio
from asyncio import SelectorEventLoop, Futu... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/zmq/asyncio/__init__.py",
"copies": "1",
"size": "2680",
"license": "mit",
"hash": -1240195530702323200,
"line_mean": 24.5238095238,
"line_max": 170,
"alpha_frac": 0.6593283582,
"autogenerated": false,
"ratio": 3.8953... |
"""AsyncIO TCP Server for Kytos."""
import asyncio
import errno
import logging
from kytos.core.connection import Connection
from kytos.core.events import KytosEvent
LOG = logging.getLogger(__name__)
def exception_handler(loop, context):
"""Exception handler to avoid tracebacks because of network timeouts."""
... | {
"repo_name": "kytos/kytos",
"path": "kytos/core/atcp_server.py",
"copies": "1",
"size": "7116",
"license": "mit",
"hash": 8214921928264685000,
"line_mean": 35.6804123711,
"line_max": 79,
"alpha_frac": 0.6287240022,
"autogenerated": false,
"ratio": 4.188346085932902,
"config_test": false,
"ha... |
"""AsyncIO TCP Server for Kytos."""
import asyncio
import logging
from kytos.core.connection import Connection
from kytos.core.events import KytosEvent
LOG = logging.getLogger("atcp_server")
def exception_handler(loop, context):
"""Exception handler to avoid tracebacks because of network timeouts."""
if is... | {
"repo_name": "kytos/kyco",
"path": "kytos/core/atcp_server.py",
"copies": "1",
"size": "6960",
"license": "mit",
"hash": -6357257682721284000,
"line_mean": 36.0212765957,
"line_max": 79,
"alpha_frac": 0.6288793103,
"autogenerated": false,
"ratio": 4.202898550724638,
"config_test": false,
"ha... |
"""Asyncio utilities."""
from asyncio import Semaphore, coroutines, ensure_future, gather, get_running_loop
from asyncio.events import AbstractEventLoop
import concurrent.futures
import functools
import logging
import threading
from traceback import extract_stack
from typing import Any, Awaitable, Callable, Coroutine, ... | {
"repo_name": "turbokongen/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "2",
"size": "6146",
"license": "apache-2.0",
"hash": 1797480535233578000,
"line_mean": 32.7692307692,
"line_max": 138,
"alpha_frac": 0.6537585421,
"autogenerated": false,
"ratio": 4.180952380952381,
"... |
"""Asyncio utilities."""
from __future__ import annotations
from asyncio import Semaphore, coroutines, ensure_future, gather, get_running_loop
from asyncio.events import AbstractEventLoop
from collections.abc import Awaitable, Coroutine
import concurrent.futures
import functools
import logging
import threading
from tr... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "2",
"size": "6467",
"license": "apache-2.0",
"hash": -6471417228432887000,
"line_mean": 33.2169312169,
"line_max": 138,
"alpha_frac": 0.6559455698,
"autogenerated": false,
"ratio": 4.153500321130379,... |
"""Asyncio utilities."""
from __future__ import annotations
from asyncio import Semaphore, coroutines, ensure_future, gather, get_running_loop
from asyncio.events import AbstractEventLoop
import concurrent.futures
import functools
import logging
import threading
from traceback import extract_stack
from typing import A... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/util/async_.py",
"copies": "3",
"size": "6440",
"license": "mit",
"hash": -6530162100796150000,
"line_mean": 33.2553191489,
"line_max": 138,
"alpha_frac": 0.6549689441,
"autogenerated": false,
"ratio": 4.149484536082475,
"confi... |
import pyb, stm
from machine import SPI, Pin
# define constants
#
T_GETX = const(0xd0) ## 12 bit resolution
T_GETY = const(0x90) ## 12 bit resolution
T_GETZ1 = const(0xb8) ## 8 bit resolution
T_GETZ2 = const(0xc8) ## 8 bit resolution
#
X_LOW = const(10) ## lowest reasonable X value from the touchpad
Y_HIGH =... | {
"repo_name": "robert-hh/XPT2046-touch-pad-driver-for-PyBoard",
"path": "touch.py",
"copies": "1",
"size": "9126",
"license": "mit",
"hash": -1130777117690351000,
"line_mean": 41.25,
"line_max": 125,
"alpha_frac": 0.6077142231,
"autogenerated": false,
"ratio": 3.7993338884263115,
"config_test":... |
"""Async iterable that wraps an EventEmitter."""
import asyncio
import collections
from collections.abc import AsyncIterator, AsyncIterable
class EventIterator(AsyncIterator):
"""An iterator who values are the payloads from emitted events."""
def __init__(self, emitter, event):
"""Initialize the it... | {
"repo_name": "asyncdef/eventemitter",
"path": "eventemitter/iterable.py",
"copies": "1",
"size": "1527",
"license": "apache-2.0",
"hash": -1984079445701771300,
"line_mean": 29.54,
"line_max": 78,
"alpha_frac": 0.6260641781,
"autogenerated": false,
"ratio": 4.362857142857143,
"config_test": fal... |
# async_move.py
# aoneill - 04/16/17
import threading
import time
from libs import psmove
class AsyncPSMove(threading.Thread):
'''
Asynchronous class designed to update the associated PSMove controller
at a pre-defined frame rate.
This avoids having the controller lose its light / rumble after not having
... | {
"repo_name": "alexoneill/15-love",
"path": "rackets/src/util/async_move.py",
"copies": "1",
"size": "1866",
"license": "mit",
"hash": 2253124871186045000,
"line_mean": 20.2045454545,
"line_max": 76,
"alpha_frac": 0.6216505895,
"autogenerated": false,
"ratio": 3.256544502617801,
"config_test": ... |
# AsyncNotifier example from tutorial
#
# See: http://github.com/seb-m/pyinotify/wiki/Tutorial
#
import asyncore
import pyinotify
from .FeedsDownloader import FeedsDownloader
class EventHandler(pyinotify.ProcessEvent):
iDler = FeedsDownloader()
def process_IN_CREATE(self, event):
path = event.pat... | {
"repo_name": "PodSearch/PodSearch",
"path": "src/FeedsDownloader/FeedListsWatcher.py",
"copies": "1",
"size": "1078",
"license": "bsd-3-clause",
"hash": 6885202615631321000,
"line_mean": 28.9444444444,
"line_max": 76,
"alpha_frac": 0.7115027829,
"autogenerated": false,
"ratio": 3.337461300309597... |
# AsyncNotifier example from tutorial
#
# See: http://github.com/seb-m/pyinotify/wiki/Tutorial
#
import asyncore
import pyinotify
from ImagesDownloader import ImagesDownloader
class EventHandler(pyinotify.ProcessEvent):
iDler = ImagesDownloader()
def process_IN_CREATE(self, event):
path = event.p... | {
"repo_name": "PodSearch/PodSearch",
"path": "src/Digester/FeedsWatcher.py",
"copies": "1",
"size": "1050",
"license": "bsd-3-clause",
"hash": -3858620304474216400,
"line_mean": 28.1666666667,
"line_max": 76,
"alpha_frac": 0.7104761905,
"autogenerated": false,
"ratio": 3.3980582524271843,
"conf... |
## async.py
# Light wrapper around whatever async library pydle uses.
import functools
import itertools
import collections
import threading
import datetime
import types
import tornado.concurrent
import tornado.ioloop
FUTURE_TIMEOUT = 30
class Future(tornado.concurrent.TracebackFuture):
"""
A future. An obje... | {
"repo_name": "suut/psychic-happiness",
"path": "pydle/async.py",
"copies": "1",
"size": "11596",
"license": "unlicense",
"hash": 2750609133380345000,
"line_mean": 35.0124223602,
"line_max": 151,
"alpha_frac": 0.6152121421,
"autogenerated": false,
"ratio": 4.3027829313543595,
"config_test": fal... |
# AsyncPy shell
# tom coladonato
# with boilerplate from
# http://stackoverflow.com/a/9109699
import threading
import Queue
import sys
import time
def console(q, stdout_lock):
while 1:
raw_input()
with stdout_lock:
cmd = raw_input('> ')
q.put(cmd)
if cmd == 'quit' or ... | {
"repo_name": "tomcola512/AsyncPy",
"path": "Async.py",
"copies": "1",
"size": "2710",
"license": "mit",
"hash": -1601571571045683000,
"line_mean": 25.0576923077,
"line_max": 84,
"alpha_frac": 0.4494464945,
"autogenerated": false,
"ratio": 4.329073482428115,
"config_test": false,
"has_no_keyw... |
"""async-rasterio.py
Operate on a raster dataset window-by-window using asyncio's event loop
and thread executor.
Simulates a CPU-bound thread situation where multiple threads can improve
performance.
"""
import asyncio
import time
import numpy as np
import rasterio
from rasterio._example import compute
def main(... | {
"repo_name": "kapadia/rasterio",
"path": "examples/async-rasterio.py",
"copies": "1",
"size": "3336",
"license": "bsd-3-clause",
"hash": -3490711419676865000,
"line_mean": 33.0408163265,
"line_max": 73,
"alpha_frac": 0.5590527578,
"autogenerated": false,
"ratio": 4.731914893617021,
"config_tes... |
from flask import Flask, jsonify, request
from flask_restful import Api, Resource
import time, threading, requests
from datetime import datetime
app = Flask(__name__)
api = Api(app)
task_check = {}
class TimedWorker(threading._Timer):
def __init__(self, *args, **kwargs):
threading._Timer.__init__(self, ... | {
"repo_name": "Zex/neural-node",
"path": "optm/rest_agent.py",
"copies": "1",
"size": "2320",
"license": "mit",
"hash": -5197683852238762000,
"line_mean": 28,
"line_max": 80,
"alpha_frac": 0.5280172414,
"autogenerated": false,
"ratio": 3.552833078101072,
"config_test": false,
"has_no_keywords... |
from flask import Flask, jsonify, request
from flask_restful import Api, Resource
import requests, time, threading
from datetime import datetime
app = Flask(__name__)
api = Api(app)
task_completed = {}
@app.route('/completed', methods=['POST'])
def completed():
print("=====completed======")
if request.args.h... | {
"repo_name": "Zex/neural-node",
"path": "optm/rest_mng.py",
"copies": "1",
"size": "1499",
"license": "mit",
"hash": -1264023628796056300,
"line_mean": 25.7678571429,
"line_max": 70,
"alpha_frac": 0.5790527018,
"autogenerated": false,
"ratio": 3.3609865470852016,
"config_test": false,
"has_n... |
"""AsyncResult objects for the client
Authors:
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of th... | {
"repo_name": "WillisXChen/django-oscar",
"path": "oscar/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.py",
"copies": "7",
"size": "24813",
"license": "bsd-3-clause",
"hash": 770480422107963600,
"line_mean": 34.0961810467,
"line_max": 100,
"alpha_frac": 0.5145286745,
"autogenerate... |
"""AsyncResult objects for the client"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import sys
import time
from concurrent.futures import Future
from datetime import datetime
from threading import Event
from decorator im... | {
"repo_name": "fzheng/codejam",
"path": "lib/python2.7/site-packages/ipyparallel/client/asyncresult.py",
"copies": "1",
"size": "27369",
"license": "mit",
"hash": -5953697036539599000,
"line_mean": 34.3148387097,
"line_max": 100,
"alpha_frac": 0.5314772188,
"autogenerated": false,
"ratio": 4.6569... |
"""Asyncronous tasks for MDN scraping."""
from json import dumps
from traceback import format_exc
from celery import shared_task
import requests
from .models import FeaturePage, TranslatedContent
from .scrape import scrape_feature_page
@shared_task(ignore_result=True)
def start_crawl(featurepage_id):
"""Start ... | {
"repo_name": "jwhitlock/web-platform-compat",
"path": "mdn/tasks.py",
"copies": "2",
"size": "6212",
"license": "mpl-2.0",
"hash": 7358624710026280000,
"line_mean": 32.2192513369,
"line_max": 77,
"alpha_frac": 0.6134900193,
"autogenerated": false,
"ratio": 3.5016910935738443,
"config_test": fa... |
"""Async tasks."""
from django.utils import timezone
from modoboa.lib import cryptutils
from .lib import carddav
from . import models
def get_cdav_client(request, addressbook, write_support=False):
"""Instantiate a new CardDAV client."""
return carddav.PyCardDAV(
addressbook.url, user=request.user.... | {
"repo_name": "modoboa/modoboa-contacts",
"path": "modoboa_contacts/tasks.py",
"copies": "1",
"size": "3333",
"license": "mit",
"hash": -8058892499155863000,
"line_mean": 33.3608247423,
"line_max": 73,
"alpha_frac": 0.6420642064,
"autogenerated": false,
"ratio": 3.5761802575107295,
"config_test... |
"""Async TCP Server tests."""
import asyncio
import logging
import unittest
from kytos.core.atcp_server import KytosServer, KytosServerProtocol
# from unittest.mock import Mock
logging.basicConfig(level=logging.CRITICAL)
# Using "nettest" TCP port as a way to avoid conflict with a running
# Kytos server on 6633.
... | {
"repo_name": "kytos/kyco",
"path": "tests/test_core/test_atcp_server.py",
"copies": "1",
"size": "1279",
"license": "mit",
"hash": -267697117079491550,
"line_mean": 31.7948717949,
"line_max": 70,
"alpha_frac": 0.6395621579,
"autogenerated": false,
"ratio": 3.7728613569321534,
"config_test": tr... |
# Copyright (c) 2020 Peter Hinch
# Released under the MIT License (MIT) - see LICENSE file
import uasyncio as asyncio
from sched.sched import schedule
from time import localtime
def foo(txt): # Demonstrate callback
yr, mo, md, h, m, s, wd = localtime()[:7]
fst = 'Callback {} {:02d}:{:02d}:{:02d} on {:02d}/{... | {
"repo_name": "peterhinch/micropython-async",
"path": "v3/as_drivers/sched/asynctest.py",
"copies": "1",
"size": "1257",
"license": "mit",
"hash": 2114479265500601000,
"line_mean": 33.9166666667,
"line_max": 91,
"alpha_frac": 0.6420047733,
"autogenerated": false,
"ratio": 2.8374717832957113,
"c... |
"""Async versions of the itertools features."""
import collections
import functools
import itertools as sync_itertools
import operator
import types
class AsyncIterWrapper:
"""Async wrapper for synchronous iterables."""
def __init__(self, iterable):
"""Initialize the wrapper with some iterable."""
... | {
"repo_name": "asyncdef/aitertools",
"path": "aitertools/__init__.py",
"copies": "1",
"size": "30221",
"license": "apache-2.0",
"hash": -2864358634082374700,
"line_mean": 27.3158388004,
"line_max": 79,
"alpha_frac": 0.6097375302,
"autogenerated": false,
"ratio": 4.656033287101248,
"config_test"... |
"""Async web request example with tornado.
Requests to localhost:8888 will be relayed via 0MQ to a slow responder,
who will take 1-5 seconds to respond. The tornado app will remain responsive
duriung this time, and when the worker replies, the web request will finish.
A '.' is printed every 100ms to demonstrate that... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/tornadosrv.py",
"copies": "1",
"size": "2905",
"license": "mit",
"hash": 5048747921250137000,
"line_mean": 25.4090909091,
"line_max": 80,
"alpha_frac": 0.6643717728,
"autogenerated":... |
"""Async wrappers for spooled temp files and temp directory objects"""
# Imports
import asyncio
from types import coroutine
from ..base import AsyncBase
from ..threadpool.utils import (delegate_to_executor, proxy_property_directly,
cond_delegate_to_executor)
from functools imp... | {
"repo_name": "Tinche/aiofiles",
"path": "src/aiofiles/tempfile/temptypes.py",
"copies": "1",
"size": "2172",
"license": "apache-2.0",
"hash": -9124166035143820000,
"line_mean": 33.606557377,
"line_max": 78,
"alpha_frac": 0.5934622468,
"autogenerated": false,
"ratio": 4.2671905697445975,
"confi... |
"""Async xkcd library."""
from .json import loads as jloads
import random
import async_timeout
import aiohttp
XKCD_URL = 'http://www.xkcd.com/'
IMAGE_URL = 'http://imgs.xkcd.com/comics/'
EXPLAIN_URL = 'http://explainxkcd.com/'
LINK_OFFSET = len(IMAGE_URL)
class Comic(object):
"""xkcd comic."""
def __init__(se... | {
"repo_name": "Armored-Dragon/goldmine",
"path": "util/xkcd.py",
"copies": "1",
"size": "2200",
"license": "mit",
"hash": 6092186129407239000,
"line_mean": 30.4285714286,
"line_max": 71,
"alpha_frac": 0.6127272727,
"autogenerated": false,
"ratio": 3.3846153846153846,
"config_test": false,
"ha... |
# asyn.py 'micro' synchronisation primitives for uasyncio
# Test/demo programs asyntest.py, barrier_test.py
# Provides Lock, Event, Barrier, Semaphore, BoundedSemaphore, Condition,
# NamedTask and Cancellable classes, also sleep coro.
# Updated 31 Dec 2017 for uasyncio.core V1.6 and to provide task cancellation.
# The... | {
"repo_name": "peterhinch/micropython-async",
"path": "v2/asyn.py",
"copies": "3",
"size": "14778",
"license": "mit",
"hash": -4981122547430343000,
"line_mean": 30.4425531915,
"line_max": 86,
"alpha_frac": 0.6165922317,
"autogenerated": false,
"ratio": 3.9629927594529364,
"config_test": false,
... |
# asyn.py 'micro' synchronisation primitives for uasyncio
# Test/demo programs asyntest.py, barrier_test.py
# Provides Lock, Event, Barrier, Semaphore, BoundedSemaphore, NamedTask
# and Cancellable classes, also sleep coro.
# Uses low_priority where available and appropriate.
# Updated 31 Dec 2017 for uasyncio.core V1.... | {
"repo_name": "peterhinch/micropython-mqtt",
"path": "pb_link/asyn.py",
"copies": "1",
"size": "12226",
"license": "mit",
"hash": -4055824793102636000,
"line_mean": 31.0052356021,
"line_max": 83,
"alpha_frac": 0.6286602323,
"autogenerated": false,
"ratio": 3.948966408268734,
"config_test": fals... |
# The MIT License (MIT)
#
# Copyright (c) 2017-2018 Peter Hinch
#
# 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,... | {
"repo_name": "peterhinch/micropython-async",
"path": "v2/asyntest.py",
"copies": "1",
"size": "12174",
"license": "mit",
"hash": -2176107452497519600,
"line_mean": 27.5774647887,
"line_max": 83,
"alpha_frac": 0.6760308855,
"autogenerated": false,
"ratio": 3.4177428411005053,
"config_test": tru... |
# as you can see - the import line now requires even less typing!
from Rpyc import *
c = SocketConnection("localhost")
#------------------------------------------------------------------------------
# this demo shows the new `execute` and `namespace` features of rpyc
#-------------------------------------------------... | {
"repo_name": "tempbottle/restcommander",
"path": "play-1.2.4/python/Lib/site-packages/Rpyc/Demo/demo-6.py",
"copies": "4",
"size": "4546",
"license": "apache-2.0",
"hash": 6812129151861162000,
"line_mean": 33.9692307692,
"line_max": 93,
"alpha_frac": 0.6977562692,
"autogenerated": false,
"ratio"... |
# as you can see - the import line now requires even less typing!
from Rpyc import *
c = SocketConnection("localhost")
#------------------------------------------------------------------------------
# this demo shows the new `execute` and `namespace` features of rpyc
#-------------------------------------------... | {
"repo_name": "chvrga/outdoor-explorer",
"path": "java/play-1.4.4/python/Lib/site-packages/Rpyc/Demo/demo-6.py",
"copies": "3",
"size": "4676",
"license": "mit",
"hash": 738466087462804,
"line_mean": 33.9692307692,
"line_max": 93,
"alpha_frac": 0.6783575706,
"autogenerated": false,
"ratio": 3.621... |
'''As you might see now the pseudo
tutorial will be all written in Python
This way you could just copy the code
and test yourself'''
#The most basic thing we learn to print in Python is
#The one and only, the world famous Hello world
print ("Hello world")
'''In python 3.something print works
as a function. It takes o... | {
"repo_name": "QuirinoC/Python",
"path": "print.py",
"copies": "1",
"size": "2371",
"license": "apache-2.0",
"hash": 3810817049688870400,
"line_mean": 37.868852459,
"line_max": 68,
"alpha_frac": 0.7279628849,
"autogenerated": false,
"ratio": 3.4017216642754664,
"config_test": false,
"has_no_k... |
'''A system that combines global bindable hotkeys with a widget focus behavior
Manages kivy Window key_up, key_down events and calls methods, callbacks
where necessary'''
from . import focus as focus_behavior
from kivy.core.window import Window
from kivy.core.window import Keyboard
from kivy.logger import Logger
from ... | {
"repo_name": "Bakterija/mmplayer",
"path": "mmplayer/kivy_soil/kb_system/__init__.py",
"copies": "1",
"size": "8000",
"license": "mit",
"hash": -4445377944644979700,
"line_mean": 30.8725099602,
"line_max": 78,
"alpha_frac": 0.582875,
"autogenerated": false,
"ratio": 3.937007874015748,
"config_... |
"""A system to create a directory tree from a template.
The format is very simple. A line beginning with @ should be a path to a file. Subsequent lines after that line will be appended to the specified file.
The template is passed through moya templates, creating a very flexible system for dynamically creating file t... | {
"repo_name": "moyaproject/moya",
"path": "moya/command/sub/templatebuilder.py",
"copies": "1",
"size": "3396",
"license": "mit",
"hash": -3269101359801168400,
"line_mean": 28.5304347826,
"line_max": 151,
"alpha_frac": 0.5535924617,
"autogenerated": false,
"ratio": 3.752486187845304,
"config_te... |
# A tab completion entrybox - originally found on github,
# modified to remove dependency on Gtk EntryCompletion
# See https://gist.github.com/ssokolow/135673/ for original
from gi.repository import Gtk, Gio, Gdk
MOD_MASK = ( Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK |
Gdk.ModifierType.MOD4_MA... | {
"repo_name": "rymate1234/Gnome-IRC",
"path": "gnomeirc/TabCompletionEntry.py",
"copies": "1",
"size": "2780",
"license": "mit",
"hash": -1981154282910749200,
"line_mean": 37.1549295775,
"line_max": 78,
"alpha_frac": 0.5665467626,
"autogenerated": false,
"ratio": 4.212121212121212,
"config_test... |
"""A table of all known GitHub repos of vim plugins that we want to scrape."""
import time
import rethinkdb as r
import db.util
r_conn = db.util.r_conn
# TODO(david): Using a proper ODM to do inheritance, enforce constraints, and
# ensure a schema would be really nice.
class GithubRepos(object):
"""Abstra... | {
"repo_name": "jonafato/vim-awesome",
"path": "db/github_repos.py",
"copies": "3",
"size": "7226",
"license": "mit",
"hash": -5487856805060038000,
"line_mean": 32.1467889908,
"line_max": 79,
"alpha_frac": 0.5956269029,
"autogenerated": false,
"ratio": 3.7891976927110647,
"config_test": false,
... |
# A table of all known mana symbols and their canonical form.
# This ensures that all mana symbols in the database are in a
# specific known form for easier searching.
CANONICAL_SYMBOLS = {
# basic color symbols
'w':'w', 'u':'u', 'b':'b', 'r':'r', 'g':'g', 'c':'c',
# numbers
'0':'0', '1':'1', '2':'2', '3':'3', '4... | {
"repo_name": "Ehnonymoose/delver",
"path": "server/mana.py",
"copies": "1",
"size": "8018",
"license": "mit",
"hash": 7283301391535508000,
"line_mean": 28.5867158672,
"line_max": 164,
"alpha_frac": 0.6273384884,
"autogenerated": false,
"ratio": 2.659369817578773,
"config_test": false,
"has_n... |
""" A table with WASM opcodes. """
import enum
class ArgType(enum.Enum):
TYPE = 1
BYTE = 2
U32 = 3
I32 = 10
I64 = 11
F32 = 12
F64 = 13
TYPEIDX = 20
TABLEIDX = 21
LOCALIDX = 22
BLOCKIDX = 23
FUNCIDX = 24
LABELIDX = 25
GLOBALIDX = 26
class Space(enum.Enum):
... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/wasm/opcodes.py",
"copies": "1",
"size": "13301",
"license": "bsd-2-clause",
"hash": 3346913034764796400,
"line_mean": 29.2295454545,
"line_max": 75,
"alpha_frac": 0.4549282009,
"autogenerated": false,
"ratio": 2.3108061153578876,
"config... |
"""A tab that displays a >>> prompt.
This plugin is disabled by default because sending a Ctrl+C ,to a
subprocess is basically impossible on Windows and interrupts. If you
don't use Windows, get rid of the _ in this file's name and have fun
with it :)
"""
# FIXME: >>> while True: print("lel")
# TODO: test this on win... | {
"repo_name": "PurpleMyst/porcupine",
"path": "more_plugins/pythonprompt.py",
"copies": "1",
"size": "6303",
"license": "mit",
"hash": 9134854285427765000,
"line_mean": 33.0702702703,
"line_max": 79,
"alpha_frac": 0.5917816913,
"autogenerated": false,
"ratio": 3.919776119402985,
"config_test": ... |
"""ATA over Ethernet Protocol."""
import struct
import dpkt
class AOE(dpkt.Packet):
__hdr__ = (
('ver_fl', 'B', 0x10),
('err', 'B', 0),
('maj', 'H', 0),
('min', 'B', 0),
('cmd', 'B', 0),
('tag', 'I', 0),
)
_cmdsw = {}
def _get_ver(self): retu... | {
"repo_name": "dproc/trex_odp_porting_integration",
"path": "scripts/external_libs/dpkt-1.8.6/dpkt/aoe.py",
"copies": "2",
"size": "1697",
"license": "apache-2.0",
"hash": 7738211281327974000,
"line_mean": 23.2428571429,
"line_max": 75,
"alpha_frac": 0.5085444903,
"autogenerated": false,
"ratio":... |
"""A Tape Head to the DNC.
This 'Tape Head' contains a 'Write Head' and a 'Read Head' as defined in the
DNC architecutre in DeepMind's Nature paper:
http://www.nature.com/nature/journal/vaop/ncurrent/full/nature20101.html
Author: Austin Derrow-Pinion
"""
import collections
import numpy as np
import sonnet as snt
imp... | {
"repo_name": "derrowap/DNC-TensorFlow",
"path": "src/dnc/tape_head.py",
"copies": "1",
"size": "15602",
"license": "mit",
"hash": 4561000431350604000,
"line_mean": 41.7452054795,
"line_max": 79,
"alpha_frac": 0.5746699141,
"autogenerated": false,
"ratio": 3.9369164774160987,
"config_test": fal... |
_atari7 = ['BeamRider', 'Breakout', 'Enduro', 'Pong', 'Qbert', 'Seaquest', 'SpaceInvaders']
_atariexpl7 = ['Freeway', 'Gravitar', 'MontezumaRevenge', 'Pitfall', 'PrivateEye', 'Solaris', 'Venture']
_BENCHMARKS = []
def register_benchmark(benchmark):
for b in _BENCHMARKS:
if b['name'] == benchmark['name']:
... | {
"repo_name": "machine-intelligence/rl-teacher-atari",
"path": "agents/pposgd-mpi/pposgd_mpi/bench/benchmarks.py",
"copies": "3",
"size": "3963",
"license": "mit",
"hash": 4242218768454199300,
"line_mean": 41.6129032258,
"line_max": 119,
"alpha_frac": 0.6278072168,
"autogenerated": false,
"ratio"... |
## AtariTrainer.py Dana Hughes 21-Sept-2017
##
## Class to perform training and evaluation on Atari agents.
import numpy as np
class AtariTrainer:
"""
"""
def __init__(self, environment, agent, counter, **kwargs):
"""
Load the game and create a display using pygame
"""
self.environment = environmen... | {
"repo_name": "danathughes/AtariRL",
"path": "AtariTrainer.py",
"copies": "1",
"size": "2771",
"license": "mit",
"hash": -9189570839213579000,
"line_mean": 21.9090909091,
"line_max": 85,
"alpha_frac": 0.6820642367,
"autogenerated": false,
"ratio": 3.263839811542992,
"config_test": false,
"has... |
""" a task for waiting on a Batch Apex job to complete """
from datetime import datetime
from typing import Sequence, Optional
from cumulusci.utils import parse_api_datetime
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.core.exceptions import SalesforceException
COMPLETED_STATUSES = ["Co... | {
"repo_name": "SalesforceFoundation/CumulusCI",
"path": "cumulusci/tasks/apex/batch.py",
"copies": "1",
"size": "6781",
"license": "bsd-3-clause",
"hash": -7715836974647470000,
"line_mean": 36.6722222222,
"line_max": 144,
"alpha_frac": 0.5645185076,
"autogenerated": false,
"ratio": 4.172923076923... |
""" a task for waiting on a Batch Apex job to complete """
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.core.exceptions import SalesforceException
import arrow
COMPLETED_STATUSES = ['Completed']
class BatchApexWait(BaseSalesforceApiTask):
""" BatchApexWait polls an org until the la... | {
"repo_name": "e02d96ec16/CumulusCI",
"path": "cumulusci/tasks/apex/batch.py",
"copies": "1",
"size": "2908",
"license": "bsd-3-clause",
"hash": -2306581599191575000,
"line_mean": 34.0361445783,
"line_max": 88,
"alpha_frac": 0.57565337,
"autogenerated": false,
"ratio": 4.239067055393586,
"confi... |
""" a task for waiting on a specific custom settings value """
from simple_salesforce.exceptions import SalesforceError
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.utils import process_bool_arg
class CustomSettingValueWait(B... | {
"repo_name": "SalesforceFoundation/CumulusCI",
"path": "cumulusci/tasks/salesforce/custom_settings_wait.py",
"copies": "1",
"size": "5010",
"license": "bsd-3-clause",
"hash": -8274162256345123000,
"line_mean": 36.1111111111,
"line_max": 127,
"alpha_frac": 0.5882235529,
"autogenerated": false,
"r... |
"""A tasklet decorator.
Tasklets are a way to write concurrently running functions without
threads; tasklets are executed by an event loop and can suspend
themselves blocking for I/O or some other operation using a yield
statement. The notion of a blocking operation is abstracted into the
Future class, but a tasklet ... | {
"repo_name": "undoware/neutron-drive",
"path": "google_appengine/google/appengine/ext/ndb/tasklets.py",
"copies": "1",
"size": "36074",
"license": "bsd-3-clause",
"hash": -3757450836407581700,
"line_mean": 30.811287478,
"line_max": 80,
"alpha_frac": 0.647668681,
"autogenerated": false,
"ratio": ... |
"""A Task logger that presents our DB interface,
but exists entirely in memory and implemented with dicts.
Authors:
* Min RK
TaskRecords are dicts of the form::
{
'msg_id' : str(uuid),
'client_uuid' : str(uuid),
'engine_uuid' : str(uuid) or None,
'header' : dict(header),
... | {
"repo_name": "poojavade/Genomics_Docker",
"path": "Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/ipython-2.2.0-py2.7.egg/IPython/parallel/controller/dictdb.py",
"copies": "8",
"size": "10346",
"license": "apache-2.0",
"hash": -1563589498940623400,
"line_mean": 31.6372239748,
"li... |
"""A task queue."""
import select
import psycopg2.extras
import handler
import schema
import task
class PgTq(object):
"""Represents a single task queue."""
def __init__(self, name, connection_string):
"""Create a task queue with the given name in the given DB."""
self.name = name
self... | {
"repo_name": "DanielCollins/pgtq",
"path": "src/pgtq.py",
"copies": "1",
"size": "5214",
"license": "isc",
"hash": -6665344497449318000,
"line_mean": 38.2030075188,
"line_max": 77,
"alpha_frac": 0.5784426544,
"autogenerated": false,
"ratio": 4.381512605042017,
"config_test": false,
"has_no_k... |
"""A TaskRecord backend using mongodb
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of t... | {
"repo_name": "sodafree/backend",
"path": "build/ipython/IPython/parallel/controller/mongodb.py",
"copies": "3",
"size": "4214",
"license": "bsd-3-clause",
"hash": 4783443282388012000,
"line_mean": 35.0170940171,
"line_max": 100,
"alpha_frac": 0.561461794,
"autogenerated": false,
"ratio": 4.52631... |
"""A TaskRecord backend using sqlite3
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this s... | {
"repo_name": "sodafree/backend",
"path": "build/ipython/build/lib.linux-i686-2.7/IPython/parallel/controller/sqlitedb.py",
"copies": "3",
"size": "13828",
"license": "bsd-3-clause",
"hash": 2962140669798790000,
"line_mean": 32.5655339806,
"line_max": 110,
"alpha_frac": 0.5013017067,
"autogenerated... |
"""A TaskRecord backend using sqlite3"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import json
import os
try:
import cPickle as pickle
except ImportError:
import pickle
from datetime import datetime
try:
import sqlite3
except ImportError:
sql... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/parallel/controller/sqlitedb.py",
"copies": "1",
"size": "14541",
"license": "mit",
"hash": 3610325204712102000,
"line_mean": 33.1338028169,
"line_max": 103,
"alpha_frac": 0.4877243656,
"autogenerated": false,
"ratio": 4.4318805242... |
# ATCA Rapid Response Service
# Jamie.Stevens@csiro.au
# example1.py
# This example script shows how to make a schedule and request time for it from
# the web service.
# The modules we'll need.
import atca_rapid_response_api as arrApi
import cabb_scheduler as cabb
# Example 1.
# The situation is the same as in examp... | {
"repo_name": "ste616/atca-rapid-response-api",
"path": "python/example1.py",
"copies": "1",
"size": "3549",
"license": "mit",
"hash": 3545998996935254000,
"line_mean": 38,
"line_max": 92,
"alpha_frac": 0.7275288814,
"autogenerated": false,
"ratio": 3.357615894039735,
"config_test": false,
"h... |
# ATCA Rapid Response Service
# Jamie.Stevens@csiro.au
# example2.py
# This example script shows how to make a schedule and request time for it from
# the web service.
# The modules we'll need.
import atca_rapid_response_api as arrApi
import cabb_scheduler as cabb
# Example 1.
# The situation is the same as in examp... | {
"repo_name": "ste616/atca-rapid-response-api",
"path": "python/example2.py",
"copies": "1",
"size": "3756",
"license": "mit",
"hash": 4618140915194058000,
"line_mean": 38.125,
"line_max": 92,
"alpha_frac": 0.7281682641,
"autogenerated": false,
"ratio": 3.3475935828877006,
"config_test": false,... |
# ATCA Rapid Response Service
# Jamie.Stevens@csiro.au
# example3_multifreq.py
# This example script shows how to make a schedule with more than one frequency
# and request time for it from the web service.
# The modules we'll need.
import atca_rapid_response_api as arrApi
import cabb_scheduler as cabb
# Example 3.
... | {
"repo_name": "ste616/atca-rapid-response-api",
"path": "python/example3_multifreq.py",
"copies": "1",
"size": "4690",
"license": "mit",
"hash": -5498181470124600000,
"line_mean": 39.0854700855,
"line_max": 100,
"alpha_frac": 0.710021322,
"autogenerated": false,
"ratio": 3.2797202797202796,
"co... |
"""atcui URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | {
"repo_name": "duydb2/ZTC",
"path": "atcui/atcui/urls.py",
"copies": "1",
"size": "1129",
"license": "bsd-3-clause",
"hash": 4885653333462414000,
"line_mean": 37.9310344828,
"line_max": 77,
"alpha_frac": 0.684676705,
"autogenerated": false,
"ratio": 3.2819767441860463,
"config_test": false,
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.