text stringlengths 0 1.05M | meta dict |
|---|---|
# a proxy server that handles both reward channel and vnc.
from twisted.python import log
from autobahn.twisted import websocket
import logging
import os
import time
import pexpect
import sys
import threading
from universe.vncdriver.vnc_proxy_server import VNCProxyServer
from universe.rewarder.reward_proxy_server impo... | {
"repo_name": "openai/universe",
"path": "universe/vncdriver/dual_proxy_server.py",
"copies": "2",
"size": "2271",
"license": "mit",
"hash": -6322280845916708000,
"line_mean": 35.0476190476,
"line_max": 117,
"alpha_frac": 0.6428885953,
"autogenerated": false,
"ratio": 3.9427083333333335,
"confi... |
"""A proxy subprocess-making process for CodeJail."""
import ast
import logging
import os
import os.path
import subprocess
import sys
import time
import six
from six.moves import range
from .subproc import run_subprocess
log = logging.getLogger("codejail")
# We use .readline to get data from the pipes between the ... | {
"repo_name": "edx/codejail",
"path": "codejail/proxy.py",
"copies": "1",
"size": "7585",
"license": "apache-2.0",
"hash": 4488364234049718000,
"line_mean": 33.1666666667,
"line_max": 86,
"alpha_frac": 0.6287409361,
"autogenerated": false,
"ratio": 4.106659447753113,
"config_test": false,
"ha... |
# APRP.py: module containing functions, etc. related to the Approximate Partial Radiation Perturbation method
# (Taylor et al., 2007). Based on Matlab code written by Yen-Ting Hwang.
#
# To run, import this module into an outside script and then run "aprp_main" for
# the desired model
import numpy as np
import netC... | {
"repo_name": "rdrussotto/pyAPRP",
"path": "APRP.py",
"copies": "1",
"size": "25480",
"license": "mit",
"hash": 7492859884158293000,
"line_mean": 44.9945848375,
"line_max": 124,
"alpha_frac": 0.6364599686,
"autogenerated": false,
"ratio": 2.841530054644809,
"config_test": false,
"has_no_keywo... |
"""A pseudo-file mapped into memory
Provides better performance for frequent reads/writes,
and makes reading/writing easier via regions (windows)
of memory. Allows memory to be accessed via array reads/
writes as well.
"""
import mmap
import logging
log = logging.getLogger(__name__)
class ReadOnlyError(Exception):... | {
"repo_name": "Qix-/starfuse",
"path": "starfuse/fs/mapped_file.py",
"copies": "1",
"size": "7231",
"license": "mit",
"hash": -2743488025018029000,
"line_mean": 32.7897196262,
"line_max": 124,
"alpha_frac": 0.5992255566,
"autogenerated": false,
"ratio": 4.076099210822999,
"config_test": false,
... |
'''A pseudo proxy for testing purposes.'''
from bitcoin.core import CBlock
import feemodel.util
from feemodel.util import load_obj
import feemodel.txmempool
from feemodel.txmempool import MemBlock
from feemodel.tests.config import blockdata, test_memblock_dbfile as dbfile
class PseudoProxy(object):
'''A pseudo ... | {
"repo_name": "bitcoinfees/bitcoin-feemodel",
"path": "feemodel/tests/pseudoproxy.py",
"copies": "1",
"size": "2530",
"license": "mit",
"hash": 7439802814858999000,
"line_mean": 26.2043010753,
"line_max": 75,
"alpha_frac": 0.6411067194,
"autogenerated": false,
"ratio": 4.100486223662885,
"confi... |
# APS Journal dictionary: used by parsers/aps.py to get the bibstem
APS_PUBLISHER_IDS = {'PRL': 'PhRvL', 'PRX': 'PhRvX', 'RMP': 'RvMP',
'PRA': 'PhRvA', 'PRB': 'PhRvB', 'PRC': 'PhRvC',
'PRD': 'PhRvD', 'PRE': 'PhRvE', 'PRAB': 'PhRvS',
'PRSTAB': 'PhRvS', 'PRA... | {
"repo_name": "adsabs/parsers",
"path": "pyingest/config/config.py",
"copies": "1",
"size": "5915",
"license": "mit",
"hash": 4724038807153585000,
"line_mean": 37.4090909091,
"line_max": 72,
"alpha_frac": 0.5180050719,
"autogenerated": false,
"ratio": 3.7484157160963245,
"config_test": false,
... |
__aps__ = {
'api': '1.0.0',
'version': '1.0',
'uri': None,
'urimatrix': None
}
import re
import sys
try:
import agn
except:
sys.path.append('/home/openemm/bin/scripts/')
import agn
def handleOutgoingMail(ctx, mail):
precedence = __aps__['prece... | {
"repo_name": "AntonOfTheWoods/openemm-patches",
"path": "full_domain_personalisation/script/process/semu/headerManager.py",
"copies": "1",
"size": "5151",
"license": "mit",
"hash": -4554935613438596600,
"line_mean": 38.320610687,
"line_max": 205,
"alpha_frac": 0.3915744516,
"autogenerated": false,... |
__aps__ = {
'api': '1.0.0',
'version': '1.0',
'uri': None,
'urimatrix': None
}
import re
#
def handleOutgoingMail(ctx, mail):
urimatrix = __aps__['urimatrix']
uri = __aps__['uri']
if urimatrix or uri:
found = None
mid = ... | {
"repo_name": "AntonOfTheWoods/openemm-patches",
"path": "full_domain_personalisation/script/process/semu/listUnsubscribeHeader.py",
"copies": "1",
"size": "2875",
"license": "mit",
"hash": -1808768738562226200,
"line_mean": 41.9104477612,
"line_max": 205,
"alpha_frac": 0.3669565217,
"autogenerated... |
#!/APSshare/epd/rh5-x86/bin/python
'''
This is for X-piezo scan (stage coordinates) and Y-combined (stage coordinates) batch flyscan with different sample_Z postions.
The max scan width in X direction is 80 um.
'''
import epics
from epics import caput, caget
from epics import PV
import time
import numpy as np
import ... | {
"repo_name": "tomography/scanscripts",
"path": "aps_21id/201702_BNP_batch_flyscan_with_z.py",
"copies": "1",
"size": "3256",
"license": "bsd-3-clause",
"hash": -3166853593587177000,
"line_mean": 31.56,
"line_max": 192,
"alpha_frac": 0.6667690418,
"autogenerated": false,
"ratio": 2.34244604316546... |
"""aptget -- utility functions to run apt-get (ubuntu/debian package manager),
along with a generic resource manager for apt packages"""
import os
import os.path
import sys
import re
import copy
import engage.drivers.resource_manager as resource_manager
import engage.drivers.resource_metadata as resource_metadata
imp... | {
"repo_name": "quaddra/engage",
"path": "python_pkg/engage/drivers/genforma/aptget.py",
"copies": "1",
"size": "10863",
"license": "apache-2.0",
"hash": 7262312938786875000,
"line_mean": 38.9375,
"line_max": 118,
"alpha_frac": 0.6109730277,
"autogenerated": false,
"ratio": 3.753628196268141,
"c... |
# aptinstall.py
#: i need to have apt installed
########################## DEPRECATE BECAUSE installing apt is not as complete
########################## as using fabric despite 3.0 issues
import apt
import sys
import requests
def simple_apt_install(pkg_name):
"""
"""
cache = apt.cache.Cache()
cach... | {
"repo_name": "mikadosoftware/weaver",
"path": "weaver/fabmodules/atominstall.py",
"copies": "1",
"size": "1500",
"license": "mit",
"hash": -8995738462746306000,
"line_mean": 24.4237288136,
"line_max": 91,
"alpha_frac": 0.5986666667,
"autogenerated": false,
"ratio": 3.4965034965034967,
"config_... |
#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, merge, publish, distribute, sublicense, and/or sell
#copi... | {
"repo_name": "wuxue/altanalyze",
"path": "APT.py",
"copies": "2",
"size": "15855",
"license": "apache-2.0",
"hash": 1052014943234627300,
"line_mean": 56.4456521739,
"line_max": 211,
"alpha_frac": 0.5763481552,
"autogenerated": false,
"ratio": 3.9322916666666665,
"config_test": false,
"has_no... |
from VideoCapture import Device
import pyaudio
import wave
import subprocess
import pythoncom, pyHook
import sys
import re
import os
import time
import urllib2
import logging
reload(sys)
sys.setdefaultencoding('iso-8859-9')
opener = urllib2.build_opener(urllib2.HTTPHandler)
urllib2.install_opener(open... | {
"repo_name": "mertsarica/hack4career",
"path": "codes/apt_simulator.py",
"copies": "1",
"size": "4363",
"license": "apache-2.0",
"hash": 6215487543844510000,
"line_mean": 21.3315508021,
"line_max": 78,
"alpha_frac": 0.5933990374,
"autogenerated": false,
"ratio": 2.842345276872964,
"config_test... |
"""A publisher that just writes output to a file.
By itself, this is mainly used for testing, but it's also the basis for
classes like PodcastPublisher.
"""
import os
from nose.tools import set_trace
from botfriend.bot import Publisher
from botfriend.model import _now
class FileOutputPublisher(Publisher):
def __i... | {
"repo_name": "leonardr/botfriend",
"path": "botfriend/publish/file.py",
"copies": "1",
"size": "1685",
"license": "mit",
"hash": 4272797181592147000,
"line_mean": 34.1041666667,
"line_max": 81,
"alpha_frac": 0.5768545994,
"autogenerated": false,
"ratio": 4.002375296912114,
"config_test": false... |
"""A Publisher that publishes to a web application using HTTP"""
import time
import requests
from alarmageddon.publishing.publisher import Publisher
from alarmageddon.publishing.exceptions import PublishFailure
class HttpPublisher(Publisher):
"""Creates an HTTP Publisher that publishes successes and/or failures... | {
"repo_name": "curtisallen/Alarmageddon",
"path": "alarmageddon/publishing/http.py",
"copies": "1",
"size": "6608",
"license": "apache-2.0",
"hash": 8385952268562180000,
"line_mean": 39.7901234568,
"line_max": 82,
"alpha_frac": 0.6230326877,
"autogenerated": false,
"ratio": 4.798838053740014,
"... |
"""A pull parser for parsing JSON streams"""
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# 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 witho... | {
"repo_name": "fxstein/PyTd",
"path": "teradata/pulljson.py",
"copies": "1",
"size": "22715",
"license": "mit",
"hash": -3771223324759636000,
"line_mean": 39.1325088339,
"line_max": 79,
"alpha_frac": 0.4960598723,
"autogenerated": false,
"ratio": 5.025442477876106,
"config_test": false,
"has_... |
""" apu.py Tabla APU y Asiento. """
from decimal import Decimal
from ..base import SOLFile
from ..fields import CampoA, CampoT, CampoN, CampoF, CampoND, CampoV
from ..fields import CampoCuenta, CampoDebeHaber
def get_en_pesetas(obj, col_valor):
val = getattr(obj, col_valor)
return val * Decimal('166.386')
c... | {
"repo_name": "telenieko/importasol",
"path": "importasol/db/contasol/apu.py",
"copies": "1",
"size": "1686",
"license": "bsd-3-clause",
"hash": -1478644694118990000,
"line_mean": 33.4081632653,
"line_max": 68,
"alpha_frac": 0.5871886121,
"autogenerated": false,
"ratio": 2.6302652106084246,
"co... |
# A pure-python, exact delaunay triangulation.
# uses robust_predicates for in-circle tests, follows
# the algorithm of CGAL to the extent possible.
import logging
import pdb
logger = logging.getLogger()
import six
import numpy as np
import matplotlib.pyplot as plt
# do these work in py2?
from ..spatial import robust... | {
"repo_name": "rustychris/stompy",
"path": "stompy/grid/exact_delaunay.py",
"copies": "1",
"size": "84123",
"license": "mit",
"hash": 3253068275557715000,
"line_mean": 38.9444444444,
"line_max": 111,
"alpha_frac": 0.4823769956,
"autogenerated": false,
"ratio": 4.084632192279679,
"config_test": ... |
"""A pure Python implementation of binascii.
Rather slow and buggy in corner cases.
PyPy provides an RPython version too.
"""
# borrowed from https://bitbucket.org/pypy/pypy/src/f2bf94943a41/lib_pypy/binascii.py
class Error(ValueError):
def __init__(self, msg=''):
self._msg = msg
def __str__(self):
... | {
"repo_name": "jonathanverner/brython",
"path": "www/src/Lib/binascii.py",
"copies": "2",
"size": "25218",
"license": "bsd-3-clause",
"hash": 2601331929557310500,
"line_mean": 32.8042895442,
"line_max": 85,
"alpha_frac": 0.4936553256,
"autogenerated": false,
"ratio": 2.5976514215080346,
"config... |
"""A pure Python implementation of binascii.
Rather slow and buggy in corner cases.
PyPy provides an RPython version too.
"""
class Error(Exception):
pass
class Done(Exception):
pass
class Incomplete(Exception):
pass
def a2b_uu(s):
if not s:
return ''
length = (ord(s[0]) - 0x20) % 64
... | {
"repo_name": "corona10/grumpy",
"path": "grumpy-runtime-src/third_party/pypy/binascii.py",
"copies": "7",
"size": "24270",
"license": "apache-2.0",
"hash": -569507639079837500,
"line_mean": 32.7097222222,
"line_max": 82,
"alpha_frac": 0.4960444994,
"autogenerated": false,
"ratio": 2.518418594998... |
"""A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirectly). Since... | {
"repo_name": "Mozhuowen/brython",
"path": "www/src/Lib/importlib/__init__.py",
"copies": "12",
"size": "3479",
"license": "bsd-3-clause",
"hash": 2400406564722282000,
"line_mean": 34.8659793814,
"line_max": 80,
"alpha_frac": 0.6659959759,
"autogenerated": false,
"ratio": 4.392676767676767,
"co... |
"""A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches', 'reload']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirect... | {
"repo_name": "tpsatish95/Python-Workshop",
"path": "Python Environment Setup/Alternate/1. Python/1. Installer/Python-3.4.0(Linux)/Lib/importlib/__init__.py",
"copies": "6",
"size": "4990",
"license": "apache-2.0",
"hash": -8442914687888726000,
"line_mean": 32.0463576159,
"line_max": 78,
"alpha_frac"... |
"""A pure Python implementation of import.
References on import:
* Language reference
http://docs.python.org/ref/import.html
* __import__ function
http://docs.python.org/lib/built-in-funcs.html
* Packages
http://www.python.org/doc/essays/packages.html
* PEP 235: Import on... | {
"repo_name": "RockySteveJobs/python-for-android",
"path": "python3-alpha/python3-src/Lib/importlib/__init__.py",
"copies": "51",
"size": "3236",
"license": "apache-2.0",
"hash": -490999631127492300,
"line_mean": 25.0967741935,
"line_max": 80,
"alpha_frac": 0.6152657602,
"autogenerated": false,
"... |
"""A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches', 'reload']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or in... | {
"repo_name": "grupoprog3/proyecto_final",
"path": "proyecto/flask/Lib/importlib/__init__.py",
"copies": "1",
"size": "6041",
"license": "apache-2.0",
"hash": -4303004180038793000,
"line_mean": 32.9190751445,
"line_max": 96,
"alpha_frac": 0.6007283562,
"autogenerated": false,
"ratio": 4.491449814... |
"""A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirectly).... | {
"repo_name": "nattee/cafe-grader-web",
"path": "lib/assets/Lib/importlib/__init__.py",
"copies": "7",
"size": "3576",
"license": "mit",
"hash": -3941000819250131500,
"line_mean": 34.8659793814,
"line_max": 80,
"alpha_frac": 0.6479306488,
"autogenerated": false,
"ratio": 4.431226765799257,
"con... |
"""A pure Python package providing the core RDF constructs.
The packages is intended to provide the core RDF types and interfaces
for working with RDF. The package defines a plugin interface for
parsers, stores, and serializers that other packages can use to
implement parsers, stores, and serializers that will plug in... | {
"repo_name": "unor/schemaorg",
"path": "lib/rdflib/__init__.py",
"copies": "6",
"size": "4692",
"license": "apache-2.0",
"hash": 6132113990458167000,
"line_mean": 27.6097560976,
"line_max": 99,
"alpha_frac": 0.6768968457,
"autogenerated": false,
"ratio": 3.4474650991917706,
"config_test": fals... |
"""A pure-Python Python bytecode interpreter."""
# Based on:
# pyvm2 by Paul Swartz (z3p), from http://www.twistedmatrix.com/users/z3p/
from __future__ import print_function, division
import dis
import inspect
import linecache
import logging
import operator
import sys
import six
from six.moves import reprlib
PY3, PY... | {
"repo_name": "sukwon0709/byterun",
"path": "byterun/pyvm2.py",
"copies": "1",
"size": "37105",
"license": "mit",
"hash": -8876592344558702000,
"line_mean": 30.1806722689,
"line_max": 90,
"alpha_frac": 0.5074787764,
"autogenerated": false,
"ratio": 3.861885928393006,
"config_test": false,
"ha... |
"""A pure-Python Python bytecode interpreter."""
# Derived from Byterun by Ned Batchelder, based on pyvm2 by Paul
# Swartz (z3p), from http://www.twistedmatrix.com/users/z3p/
import builtins, dis, operator, types
class Function:
__slots__ = [
'__name__', '__code__', '__globals__', '__defaults__', '__closu... | {
"repo_name": "darius/tailbiter",
"path": "byterun/interpreter.py",
"copies": "1",
"size": "14299",
"license": "mit",
"hash": -568898643610571900,
"line_mean": 31.8712643678,
"line_max": 94,
"alpha_frac": 0.5561228058,
"autogenerated": false,
"ratio": 3.5393564356435645,
"config_test": false,
... |
# A pure Python replacement for libmagic. Supports most libmagic features, plus
# several additional features not provided by libmagic. Tailored specifically
# for quickly searching blocks of data for multiple embedded signatures.
__all__ = ['Magic']
import re
import struct
import datetime
import binwalk.core.common
... | {
"repo_name": "sundhaug92/binwalk",
"path": "src/binwalk/core/magic.py",
"copies": "1",
"size": "38818",
"license": "mit",
"hash": 8389380352414143000,
"line_mean": 41.6103183315,
"line_max": 124,
"alpha_frac": 0.5197331135,
"autogenerated": false,
"ratio": 4.816726641022459,
"config_test": fal... |
"""A PushTypeLibrary describes the PushTypes which a given instance of PushGP will support."""
from typing import Any, Sequence, Tuple, Optional, Set, Callable
from pyshgp.push.types import PushType, CORE_PUSH_TYPES
from pyshgp.push.atoms import Atom, Literal
from pyshgp.validation import PushError
RESERVED_PSEUDO_S... | {
"repo_name": "erp12/pyshgp",
"path": "pyshgp/push/type_library.py",
"copies": "1",
"size": "7063",
"license": "mit",
"hash": -705865184801138000,
"line_mean": 30.9592760181,
"line_max": 123,
"alpha_frac": 0.585728444,
"autogenerated": false,
"ratio": 4.586363636363636,
"config_test": false,
... |
a = PVector()
assert a.x == 0
assert a.y == 0
assert a.z == 0
a = PVector(5, 7, 11)
b = PVector(13, 17, 23)
assert a - b == PVector(-8.0, -10.0, -12.0)
assert b - a == PVector(8, 10, 12)
c = PVector(18, 24, 34)
assert b + a == c
assert a + b == c
assert PVector.add(a, b) == c
assert PVector.add(a, b) == c
a.add(b)
ass... | {
"repo_name": "mashrin/processing.py",
"path": "testing/resources/test_pvector.py",
"copies": "3",
"size": "2710",
"license": "apache-2.0",
"hash": -8453459603405174000,
"line_mean": 19.0740740741,
"line_max": 74,
"alpha_frac": 0.5926199262,
"autogenerated": false,
"ratio": 2.203252032520325,
"... |
"""A :py:class:`Datasource` based on predefined keras datasets.
"""
# Generic imports
import os.path
import importlib.util
# cifar10 and cifar100 labels are provided as pickled files
# FIXME[todo]: Six: Python 2 and 3 Compatibility Library - do we need this?
# From the docs: ""Some modules which had two implementatio... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/thirdparty/keras/datasource.py",
"copies": "1",
"size": "7668",
"license": "mit",
"hash": -2493869317927171000,
"line_mean": 33.5405405405,
"line_max": 78,
"alpha_frac": 0.5953312467,
"autogenerated": false,
"ratio": 3.938366718027735,
"config_test... |
"""A :py:class:`Datasource` providing data from an array.
"""
# FIXME[todo]: add the option to work with numpy memmap
# np.memmap(filename, dtype='float32', mode='w+',
# shape=(samples,) + network[layer].output_shape[1:])
#
# Notice: the filen referred to by filename has to by an
# (uncompressed) `.npy` fi... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/datasource/array.py",
"copies": "1",
"size": "7425",
"license": "mit",
"hash": -9157966182380185000,
"line_mean": 32.5972850679,
"line_max": 79,
"alpha_frac": 0.5663299663,
"autogenerated": false,
"ratio": 4.324403028538148,
"config_test": false,
... |
"""A :py:class:`Datasource` reading frames from a video.
"""
# standard imports
import logging
# thirdparty imports
import numpy as np
# toolbox imports
from dltb.base.video import Reader
from dltb.base.data import Data
from .datasource import Imagesource, Imagesourcelike, Indexed, Livesource
# logging
LOG = loggin... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/datasource/video.py",
"copies": "1",
"size": "6766",
"license": "mit",
"hash": 3320269411752227300,
"line_mean": 30.3240740741,
"line_max": 82,
"alpha_frac": 0.5885308897,
"autogenerated": false,
"ratio": 4.1281269066503965,
"config_test": false,
... |
"""A :py:class:`Register` is basically an :py:class:`Observable` container,
that notifies its :py:class:`Observer`s when entries are registered or
unregistered.
"""
# Generic imports
from abc import ABCMeta, abstractmethod
from typing import Iterator, Tuple, Union
import importlib
import logging
# Toolbox imports
fro... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/base/register.py",
"copies": "1",
"size": "28888",
"license": "mit",
"hash": -4288238697875908600,
"line_mean": 35.0649188514,
"line_max": 79,
"alpha_frac": 0.6031570202,
"autogenerated": false,
"ratio": 4.41442542787286,
"config_test": false,
"h... |
"""A :py:class:`Worker` is intended for (asynchronously) using
a :py:class.`Tool`.
"""
# standard imports
import logging
# toolbox imports
from ..base.busy import BusyObservable, busy
from ..base.data import Data
from .tool import Tool
# logging
LOG = logging.getLogger(__name__)
class Worker(BusyObservable, Tool.O... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/tool/worker.py",
"copies": "1",
"size": "8068",
"license": "mit",
"hash": 990465609121850400,
"line_mean": 38.7438423645,
"line_max": 78,
"alpha_frac": 0.5941993059,
"autogenerated": false,
"ratio": 4.2196652719665275,
"config_test": false,
"has_... |
# Released subject to the BSD License
from functools import wraps
import json
import socket
import six
import apysigner
if six.PY2:
from urllib import urlencode
from urllib2 import HTTPError, urlopen
from urlparse import parse_qs
else:
from urllib.request import urlopen
from urllib.parse import... | {
"repo_name": "madisona/apyclient",
"path": "apyclient.py",
"copies": "1",
"size": "8330",
"license": "bsd-2-clause",
"hash": 4961916930852017000,
"line_mean": 29.2909090909,
"line_max": 108,
"alpha_frac": 0.61272509,
"autogenerated": false,
"ratio": 4.167083541770886,
"config_test": false,
"... |
"""A pylint checker that simply records what module it's visiting.
This helps diagnose problems with pylint not running on all files.
To use, define an environment variable PYLINT_RECORD_FILES, with a value of
a file name to write them to:
set PYLINT_RECORD_FILES=pylinted_files.txt
"""
import os
from pylint.c... | {
"repo_name": "edx/edx-lint",
"path": "edx_lint/pylint/module_trace.py",
"copies": "1",
"size": "1161",
"license": "apache-2.0",
"hash": -5230543545976911000,
"line_mean": 24.2391304348,
"line_max": 77,
"alpha_frac": 0.6838931955,
"autogenerated": false,
"ratio": 3.6624605678233437,
"config_tes... |
"""a pyqt test app that embeds javascript using QtScript,
defines qt properties and slots in py, and exposes them to js"""
import sys
from PyQt4 import QtGui, QtCore
from PyQt4.QtScript import QScriptEngine, QScriptValue
from PyQt4.QtCore import QObject, pyqtSignature, pyqtProperty, QVariant, QTimer
ps1 = ">>> "
ps2... | {
"repo_name": "antont/tundra",
"path": "src/Application/JavascriptModule/proto/qtscript_test.py",
"copies": "1",
"size": "2402",
"license": "apache-2.0",
"hash": -7739511824187191000,
"line_mean": 26.6091954023,
"line_max": 87,
"alpha_frac": 0.6523730225,
"autogenerated": false,
"ratio": 3.590433... |
# A PySDL port of some C++ code I found linked to in a couple of
# places. The original website is down, but it's available on the
# Wayback Machine here:
# https://web.archive.org/web/20120313055436/http://www.dgames.org/beep-sound-with-sdl/
# Unfortunately, I couldn't find the name of the author. He didn't
# have it... | {
"repo_name": "MageJohn/CHIP8",
"path": "soundtests/sdl_soundtest.py",
"copies": "1",
"size": "3434",
"license": "mit",
"hash": -2191670305280312000,
"line_mean": 25.4230769231,
"line_max": 87,
"alpha_frac": 0.5521258008,
"autogenerated": false,
"ratio": 3.4169154228855723,
"config_test": false... |
"""A PySpark driver that creates Spark tables for Spark SQL benchmark.
It takes an HCFS directory and a list of the names of the subdirectories of that
root directory. The subdirectories each hold Parquet data and are to be
converted into a table of the same name. The subdirectories are explicitly
providing because li... | {
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"path": "perfkitbenchmarker/scripts/spark_sql_test_scripts/spark_table.py",
"copies": "1",
"size": "1944",
"license": "apache-2.0",
"hash": -2075883749000230700,
"line_mean": 37.1176470588,
"line_max": 116,
"alpha_frac": 0.7139917695,
"autogen... |
"""A py.test plugin which helps testing Django applications
This plugin handles creating and destroying the test environment and
test database and provides some useful text fixtues.
"""
import os
import sys
import pytest
from .django_compat import is_django_unittest
from .fixtures import (_django_db_setup, db, tran... | {
"repo_name": "blueyed/pytest_django",
"path": "pytest_django/plugin.py",
"copies": "1",
"size": "9091",
"license": "bsd-3-clause",
"hash": 8742814361490536000,
"line_mean": 32.4227941176,
"line_max": 79,
"alpha_frac": 0.6342536575,
"autogenerated": false,
"ratio": 4.20295885344429,
"config_tes... |
"""A py.test plugin which helps testing Django applications
This plugin handles creating and destroying the test environment and
test database and provides some useful text fixtures.
"""
import contextlib
import inspect
from functools import reduce
import os
import sys
import types
import py
import pytest
from .dja... | {
"repo_name": "pelme/pytest-django",
"path": "pytest_django/plugin.py",
"copies": "1",
"size": "17185",
"license": "bsd-3-clause",
"hash": 7000396604547846000,
"line_mean": 33.6471774194,
"line_max": 93,
"alpha_frac": 0.617107943,
"autogenerated": false,
"ratio": 4.225473321858864,
"config_test... |
"""A pytest plugin which helps testing Django applications
This plugin handles creating and destroying the test environment and
test database and provides some useful text fixtures.
"""
import contextlib
import inspect
from functools import reduce
import os
import sys
import types
import pytest
from .django_compat ... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/pytest-django-3.10.0/pytest_django/plugin.py",
"copies": "2",
"size": "25188",
"license": "apache-2.0",
"hash": -1936636759860216800,
"line_mean": 29.567961165,
"line_max": 88,
"alpha_frac": 0.6276798475,
"autogenerated": false,
"ratio": ... |
"""A py.test plugin which helps testing Django applications
This plugin handles creating and destroying the test environment and
test database and provides some useful text fixtures.
"""
import contextlib
import os
import sys
import types
import py
import pytest
from .django_compat import is_django_unittest
from .f... | {
"repo_name": "hoh/pytest-django",
"path": "pytest_django/plugin.py",
"copies": "2",
"size": "13006",
"license": "bsd-3-clause",
"hash": -4472727649412337000,
"line_mean": 31.9265822785,
"line_max": 79,
"alpha_frac": 0.6264800861,
"autogenerated": false,
"ratio": 4.169926258416159,
"config_test... |
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
#
# a2 + b2 = c2
# For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2.
#
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.
from Problem import Problem
class SpecialPythagoreanTriplet(Problem):
... | {
"repo_name": "hperreault/ProjectEuler",
"path": "009_SpecialPythagoreanTriplet.py",
"copies": "1",
"size": "1079",
"license": "mit",
"hash": -5948408032026635000,
"line_mean": 26.6666666667,
"line_max": 80,
"alpha_frac": 0.5143651529,
"autogenerated": false,
"ratio": 3.0480225988700567,
"confi... |
"""A python3 implementation of the Thud! boardgame
"""
__author__ = "William Dizon"
__license__ = "MIT License"
__version__ = "1.8.0"
__email__ = "wdchromium@gmail.com"
from array import array
import math
import itertools
class NoMoveException(Exception):
'''A user-defined exception class.'''
def __init__(se... | {
"repo_name": "hexparrot/thudgame",
"path": "thudclasses.py",
"copies": "1",
"size": "7225",
"license": "mit",
"hash": 6730677030674622000,
"line_mean": 29.3571428571,
"line_max": 87,
"alpha_frac": 0.5031141869,
"autogenerated": false,
"ratio": 3.4836065573770494,
"config_test": false,
"has_n... |
"""A python3 implementation of the Thud! boardgame
"""
__author__ = "William Dizon"
__license__ = "MIT License"
__version__ = "1.8.0"
__email__ = "wdchromium@gmail.com"
from thudclasses import *
from thud import *
import copy
import tkinter
import tkinter.filedialog
import math
import re
import itertools
import rand... | {
"repo_name": "hexparrot/thudgame",
"path": "gui.py",
"copies": "1",
"size": "27466",
"license": "mit",
"hash": 5732989192608114000,
"line_mean": 42.4588607595,
"line_max": 113,
"alpha_frac": 0.5553411491,
"autogenerated": false,
"ratio": 3.779551396724921,
"config_test": false,
"has_no_keywo... |
"""A python3 implementation of the Thud! boardgame
"""
__author__ = "William Dizon"
__license__ = "MIT License"
__version__ = "1.8.0"
__email__ = "wdchromium@gmail.com"
from thudclasses import *
import copy
import math
import re
import itertools
import random
import sys
import threading
import logging
import sys
ai... | {
"repo_name": "hexparrot/thudgame",
"path": "thud.py",
"copies": "1",
"size": "40073",
"license": "mit",
"hash": 7544303567110820000,
"line_mean": 38.6369930762,
"line_max": 134,
"alpha_frac": 0.4864622065,
"autogenerated": false,
"ratio": 4.026223249271577,
"config_test": false,
"has_no_keyw... |
"""A Python 3 script to write a file with a specified number
of keypairs, using bigchaindb.crypto.generate_key_pair()
The written file is always named keypairs.py and it should be
interpreted as a Python 2 script.
Usage:
$ python3 write_keypairs_file.py num_pairs
Using the list in other Python scripts:
# in a... | {
"repo_name": "charitychain/Charitychain",
"path": "Simplechaindb/clusterdeploy/write_keypairs_file.py",
"copies": "1",
"size": "1603",
"license": "apache-2.0",
"hash": 3639801397304456700,
"line_mean": 31.7142857143,
"line_max": 67,
"alpha_frac": 0.6375545852,
"autogenerated": false,
"ratio": 3.... |
# A Python3 version of process.py. Eventually, this should replace process.py.
class Daemon(object):
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, redirect_output = True, stdin='/dev/null', stdout='/dev/null', stderr='/de... | {
"repo_name": "Kortemme-Lab/klab",
"path": "klab/process3.py",
"copies": "1",
"size": "4264",
"license": "mit",
"hash": 9011702377435957000,
"line_mean": 29.9057971014,
"line_max": 115,
"alpha_frac": 0.5082082552,
"autogenerated": false,
"ratio": 3.99250936329588,
"config_test": false,
"has_n... |
"""A Python API for the MiniSat_ and MiniCard_ constraint solvers.
.. _MiniSat: http://minisat.se/
.. _MiniCard: http://git.io/minicard
Classes:
Solver
An abstract base class for the other classes.
SubsetMixin
A mixin class adding 'subset' functionality to Solver subclasses.
:class:`MinisatSolver`
... | {
"repo_name": "tejasnikumbh/AllSAT",
"path": "minisolvers.py",
"copies": "3",
"size": "17517",
"license": "mit",
"hash": -910697848038940400,
"line_mean": 33.013592233,
"line_max": 143,
"alpha_frac": 0.5964491637,
"autogenerated": false,
"ratio": 3.6947901286648386,
"config_test": false,
"has... |
"""A Python backport of CMU Twokenize.
"""
import os
try:
from setuptools import setup
except ImportError:
from distutils import setup
from distutils.command.clean import clean as Clean
import shutil
import subprocess
############################
# Distribution details
############################
DISTNAME = ... | {
"repo_name": "nryant/twokenize_py",
"path": "setup.py",
"copies": "1",
"size": "3162",
"license": "apache-2.0",
"hash": 3856408247909985000,
"line_mean": 25.7966101695,
"line_max": 71,
"alpha_frac": 0.5477545857,
"autogenerated": false,
"ratio": 3.6853146853146854,
"config_test": false,
"has... |
# A Python class for connection to the Amazon Echo API
# By Scott Vanderlind, December 31 2014
import requests, json, urllib, cookielib
from bs4 import BeautifulSoup
class PyEcho:
url = "https://pitangui.amazon.com"
email = ""
password = ""
session = False
loginsuccess = False
csrf = "-2092727538"
... | {
"repo_name": "peterhajas/control",
"path": "alexa/PyEcho/PyEcho.py",
"copies": "1",
"size": "4485",
"license": "bsd-2-clause",
"hash": 5594839120860065000,
"line_mean": 32.7218045113,
"line_max": 151,
"alpha_frac": 0.6327759197,
"autogenerated": false,
"ratio": 3.81053525913339,
"config_test":... |
# A python class for easy access to the Moves App data. Created by Joost Plattel [http://github.com/jplattel]
import requests
import logging
class Moves():
def __init__(self, client_id, client_secret, redirect_url, \
api_url = 'https://api.moves-app.com/oauth/v1/'):
self.client_id = client_id # Cli... | {
"repo_name": "sdsingh/e-mission-server",
"path": "CFC_WebApp/main/moves.py",
"copies": "1",
"size": "2513",
"license": "bsd-3-clause",
"hash": 6648142861108258000,
"line_mean": 37.0757575758,
"line_max": 166,
"alpha_frac": 0.643454039,
"autogenerated": false,
"ratio": 3.4854368932038833,
"conf... |
# A python class for easy access to the Moves App data. Created by Joost Plattel [http://github.com/jplattel]
import requests
class Moves():
def __init__(self, client_id, client_secret, redirect_url, \
auth_url = 'https://api.moves-app.com/oauth/v1/', \
api_url = 'https://api.moves-app.com/api/1.1/'... | {
"repo_name": "sdsingh/e-mission-server",
"path": "CFC_DataCollector/moves/moves.py",
"copies": "3",
"size": "2987",
"license": "bsd-3-clause",
"hash": 5482749147572457000,
"line_mean": 34.9879518072,
"line_max": 166,
"alpha_frac": 0.6401071309,
"autogenerated": false,
"ratio": 3.4293915040183696... |
# A python class for the Delcom USBLMP 904x multi-color visual signal indicator. This
# has been tested with the 904007-SB but should work with most of the other
# indicators.
#
# Requires the Signal 11 HIDAPI and cython-hidapi.
#
# Copyright (c) 2019 Aaron Linville <aaron@linville.org>
import hid
vendor_id = 0x0FC5
... | {
"repo_name": "linville/delcom904x",
"path": "delcom904x.py",
"copies": "1",
"size": "6254",
"license": "isc",
"hash": 2960943801907454000,
"line_mean": 29.6568627451,
"line_max": 89,
"alpha_frac": 0.493284298,
"autogenerated": false,
"ratio": 3.642399534071054,
"config_test": false,
"has_no_... |
"""A python class library for creating something called a hash map that
is capable of storing name value pairs in a data structure that is
efficient to retrieve values based on provided names.
This rendition only allows a single value for each name.
"""
# This first function is an initializer
def new(n... | {
"repo_name": "jessehagberg/python-playground",
"path": "hashmap.py",
"copies": "1",
"size": "2724",
"license": "cc0-1.0",
"hash": 904727997097923800,
"line_mean": 29.3333333333,
"line_max": 105,
"alpha_frac": 0.6600587372,
"autogenerated": false,
"ratio": 3.2819277108433735,
"config_test": fal... |
""" A Python Class
A simple Python graph class, demonstrating the essential
facts and functionalities of graphs.
"""
class Graph(object):
def __init__(self, graph_dict={}):
""" initializes a graph object """
self.__graph_dict = graph_dict
def vertices(self):
""" returns the vertices ... | {
"repo_name": "ivannz/study_notes",
"path": "year_14_15/fall_2014/programming/graph2.py",
"copies": "1",
"size": "9074",
"license": "mit",
"hash": -5428572147049922000,
"line_mean": 30.6167247387,
"line_max": 83,
"alpha_frac": 0.5076041437,
"autogenerated": false,
"ratio": 4.164295548416705,
"c... |
""" A python class to represent vectors """
import math
class Vector(object):
def __init__(self, coordinates, tolerance=1e-10):
self.coordinates = tuple(coordinates)
self.dimension = len(coordinates)
self.tolerance = tolerance
def __str__(self):
return "{}".format(self.coordina... | {
"repo_name": "certifiedloud/linalg",
"path": "stumpy.py",
"copies": "1",
"size": "3259",
"license": "mit",
"hash": 1164223916371088000,
"line_mean": 35.2111111111,
"line_max": 87,
"alpha_frac": 0.5900583001,
"autogenerated": false,
"ratio": 3.9217809867629363,
"config_test": false,
"has_no_k... |
"""A python client interface for ProofAssistantService."""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import grpc
import tensorflow as tf
from deepmath.proof_assistant import proof_assistant_pb2
from deepmath.proof_assistant im... | {
"repo_name": "tensorflow/deepmath",
"path": "deepmath/deephol/public/proof_assistant.py",
"copies": "1",
"size": "1565",
"license": "apache-2.0",
"hash": -7398573641677141000,
"line_mean": 36.2619047619,
"line_max": 80,
"alpha_frac": 0.731629393,
"autogenerated": false,
"ratio": 3.55681818181818... |
"""A python client library for Google Play Services OAuth."""
from __future__ import annotations
from collections.abc import MutableMapping
from importlib.metadata import version
import ssl
from typing import Any, Iterable
import requests
from urllib3.poolmanager import PoolManager # type: ignore
from . import goog... | {
"repo_name": "simon-weber/gpsoauth",
"path": "gpsoauth/__init__.py",
"copies": "1",
"size": "5217",
"license": "mit",
"hash": -7823423472072371000,
"line_mean": 26.75,
"line_max": 87,
"alpha_frac": 0.5915276979,
"autogenerated": false,
"ratio": 3.416502946954813,
"config_test": false,
"has_n... |
""" A Python Database API Specification v2.0 implementation that provides
configuration loading, variable substitution, logging, query banding,
etc and options to use either ODBC or REST"""
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# Permission is hereby granted, free of charge, to any person obta... | {
"repo_name": "fxstein/PyTd",
"path": "teradata/udaexec.py",
"copies": "1",
"size": "35268",
"license": "mit",
"hash": -5338928629833625000,
"line_mean": 39.3986254296,
"line_max": 79,
"alpha_frac": 0.5587501418,
"autogenerated": false,
"ratio": 4.486452105330111,
"config_test": true,
"has_no... |
"""A Python debugger command class.
Routines here have to do with parsing or processing commands, but are
not the commands themselves which are in gdb.py.in. Generally (but
not always) they are not specific to pydb. They are sort of more
oriented towards any gdb-like debugger. Also routines that need to be
changed fr... | {
"repo_name": "carlgao/lenga",
"path": "images/lenny64-peon/usr/share/python-support/pydb/pydb/pydbcmd.py",
"copies": "1",
"size": "22247",
"license": "mit",
"hash": -2782236886588068000,
"line_mean": 39.0846846847,
"line_max": 133,
"alpha_frac": 0.5266328044,
"autogenerated": false,
"ratio": 4.4... |
"""A python embedding of a NarInfo object."""
import base64
import sys
if sys.version_info >= (3, 0):
from functools import lru_cache
import lzma
from io import BytesIO
else:
from repoze.lru import lru_cache
from backports import lzma
from StringIO import StringIO as BytesIO
import logging
impor... | {
"repo_name": "NarrativeScience/pynix",
"path": "src/pynix/narinfo.py",
"copies": "1",
"size": "18302",
"license": "mit",
"hash": 4220987715986397700,
"line_mean": 38.8736383442,
"line_max": 80,
"alpha_frac": 0.5947437439,
"autogenerated": false,
"ratio": 3.915703893881044,
"config_test": false... |
__doc__ = """pycanvas.Canvas : a Canvas class which can also output Python source code.
pycanvas.Canvas class works exactly like canvas.Canvas, but you can
call str() on pycanvas.Canvas instances. Doing so will return the
Python source code equivalent to your own program, which would, when
run, produce the same PDF do... | {
"repo_name": "alexissmirnov/donomo",
"path": "donomo_archive/lib/reportlab/pdfgen/pycanvas.py",
"copies": "2",
"size": "12041",
"license": "bsd-3-clause",
"hash": -2903274007770771500,
"line_mean": 37.9676375405,
"line_max": 212,
"alpha_frac": 0.6247819949,
"autogenerated": false,
"ratio": 3.980... |
"""A Python frontend to ontologies.
**pronto** is a Python agnostic library designed to work with ontologies. At
the moment, it can parse ontologies in the OBO, OBO Graphs or OWL in RDF/XML
format, on either the local host or from an network location, and export
ontologies to OBO or OBO Graphs (in JSON format).
Cauti... | {
"repo_name": "althonos/pronto",
"path": "pronto/__init__.py",
"copies": "1",
"size": "2473",
"license": "mit",
"hash": -1720939510308966000,
"line_mean": 33.8309859155,
"line_max": 77,
"alpha_frac": 0.7060250708,
"autogenerated": false,
"ratio": 3.858034321372855,
"config_test": false,
"has_... |
#A Python/GSL Wavelet library
# Dale Roberts <dale.o.roberts@gmail.com>
import numpy as np
from ctypes import CDLL, POINTER as PTR, RTLD_GLOBAL, Structure, c_size_t, c_double, c_char_p, c_int
# load BLAS and GSL
from ctypes.util import find_library
libblas = CDLL(find_library("libblas"), RTLD_GLOBAL)
libgslcblas = CD... | {
"repo_name": "daleroberts/py-dwt",
"path": "dwt.py",
"copies": "1",
"size": "2610",
"license": "bsd-3-clause",
"hash": 6594009633114817000,
"line_mean": 32.0379746835,
"line_max": 117,
"alpha_frac": 0.6647509579,
"autogenerated": false,
"ratio": 2.668711656441718,
"config_test": false,
"has_... |
# Riyaz Faizullabhoy
# 7/9/2012
# GTF --> GTF Objects
import argparse
import bisect
import copy
import sys
import warnings
from bisect import *
def run():
"""Runs gtf_parser.py and creates transcript objects for the input GTF
file.
Usage: python gtf_parser.py <gtf-input-file-name>
The GTF file mu... | {
"repo_name": "riyazdf/gtf-parser",
"path": "lib/src/gtf_parser.py",
"copies": "1",
"size": "10645",
"license": "mit",
"hash": -813180131919394000,
"line_mean": 32.4748427673,
"line_max": 81,
"alpha_frac": 0.5458900892,
"autogenerated": false,
"ratio": 4.07230298393267,
"config_test": false,
... |
"""A pythonic alternative to pandocfilters
See:
https://github.com/sergiocorreia/panflute
"""
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | {
"repo_name": "sergiocorreia/panflute",
"path": "setup.py",
"copies": "1",
"size": "4836",
"license": "bsd-3-clause",
"hash": 3814324838442663000,
"line_mean": 33.0563380282,
"line_max": 94,
"alpha_frac": 0.6306865178,
"autogenerated": false,
"ratio": 4.003311258278146,
"config_test": false,
... |
'''a pythonic Ellipse.
Super awesome.
'''
import math
from . import Point
from .line import Line, Segment
class Ellipse(object):
'''
Implements an ellipse in the XY plane with the supplied radii.
Returns a unit ellipse centered on the origin in the XY by default.
Usage:
>>> from Geometry impor... | {
"repo_name": "JnyJny/Geometry",
"path": "Geometry/ellipse.py",
"copies": "1",
"size": "13860",
"license": "mit",
"hash": 5863393421034708000,
"line_mean": 23.6181172291,
"line_max": 79,
"alpha_frac": 0.5570707071,
"autogenerated": false,
"ratio": 4.078869923484403,
"config_test": false,
"has... |
#A pythonic implementation of @bmschmidt 's 'vector reject'. To be used in gensim.
import numpy as np
from gensim import matutils
from numpy import float32 as REAL
from gensim.models import Word2Vec
from numpy import array
from unicodedata import normalize
<<<<<<< HEAD
model = Word2Vec.load(r'C:\Users\spokha01\SkyDriv... | {
"repo_name": "shirish93/CoLing",
"path": "vector_reject.py",
"copies": "1",
"size": "4858",
"license": "mit",
"hash": 9167192636570802000,
"line_mean": 39.35,
"line_max": 108,
"alpha_frac": 0.6437422553,
"autogenerated": false,
"ratio": 3.0338345864661656,
"config_test": false,
"has_no_keywo... |
"A pythonic interface to a Redis dictionary."
import redis_ds.redis_config as redis_config
from redis_ds.serialization import PassThroughSerializer, PickleSerializer, JSONSerializer
class RedisList(PassThroughSerializer):
"Interface to a Redis list."
def __init__(self, list_key, redis_client=redis_config.CLIE... | {
"repo_name": "lethain/Redis-Python-Datastructures",
"path": "redis_ds/redis_list.py",
"copies": "1",
"size": "2372",
"license": "mit",
"hash": -7914642033916656000,
"line_mean": 33.3768115942,
"line_max": 90,
"alpha_frac": 0.6214165261,
"autogenerated": false,
"ratio": 3.933665008291874,
"conf... |
"A Pythonic interface to a Redis set."
import redis_ds.redis_config as redis_config
from redis_ds.serialization import PassThroughSerializer, PickleSerializer, JSONSerializer
class RedisSet(PassThroughSerializer):
"An object which behaves like a Python set, but which is based by Redis."
def __init__(self, set... | {
"repo_name": "lethain/Redis-Python-Datastructures",
"path": "redis_ds/redis_set.py",
"copies": "1",
"size": "1836",
"license": "mit",
"hash": -5831451216841437000,
"line_mean": 30.6551724138,
"line_max": 90,
"alpha_frac": 0.6252723312,
"autogenerated": false,
"ratio": 3.817047817047817,
"confi... |
"""A Pythonic interface to the Internet Storm Center / DShield API."""
import datetime
import requests
__version__ = "0.2.1"
XML = "?xml"
JSON = "?json"
TEXT = "?text"
PHP = "?php"
__BASE_URL = "https://dshield.org/api/"
class Error(Exception):
"""Custom exception class."""
def _get(function, return_format=... | {
"repo_name": "rshipp/python-dshield",
"path": "dshield.py",
"copies": "1",
"size": "10189",
"license": "bsd-3-clause",
"hash": -8443831260920060000,
"line_mean": 32.9633333333,
"line_max": 81,
"alpha_frac": 0.6295024046,
"autogenerated": false,
"ratio": 3.763945326930181,
"config_test": false,... |
'''a pythonic Line
'''
import math
import collections
from . import Point
from .exceptions import InfiniteLength, CollinearPoints, ParallelLines
from .constants import *
class Line(collections.Mapping):
'''
A line with infinite length defined by two points; A and B.
Usage:
>>> a = Line()
...
... | {
"repo_name": "JnyJny/Geometry",
"path": "Geometry/line.py",
"copies": "1",
"size": "14349",
"license": "mit",
"hash": 4776533943774270000,
"line_mean": 22.8752079867,
"line_max": 78,
"alpha_frac": 0.5185727228,
"autogenerated": false,
"ratio": 3.8823051948051948,
"config_test": false,
"has_n... |
'''a pythonic Rectangle
Provides an implementation of a rectangle designed to be easy to use:
- built on a very friendly Point class
- provides a wealth of accessors that are read-write
'''
import random
import math
from . import Point
from .exceptions import *
class Rectangle(object):
'''
Implements a R... | {
"repo_name": "JnyJny/Geometry",
"path": "Geometry/rectangle.py",
"copies": "1",
"size": "13704",
"license": "mit",
"hash": -362437887190386200,
"line_mean": 22.4657534247,
"line_max": 74,
"alpha_frac": 0.5340776416,
"autogenerated": false,
"ratio": 4.068883610451306,
"config_test": false,
"h... |
''' a pythonic Triangle
'''
import math
import collections
import itertools
from . import Point, Segment, Circle
from .constants import Epsilon, Half_Pi, nearly_eq, Sqrt_3
from .exceptions import *
class Triangle(object):
'''a pythonic Triangle
Implements a Triangle object in the XY plane having three
n... | {
"repo_name": "JnyJny/Geometry",
"path": "Geometry/triangle.py",
"copies": "1",
"size": "20631",
"license": "mit",
"hash": 3652244357389421600,
"line_mean": 23.1298245614,
"line_max": 82,
"alpha_frac": 0.5263923222,
"autogenerated": false,
"ratio": 3.986666666666667,
"config_test": false,
"ha... |
# A Python implementation of Ailey's matlab tensor code.
import os
import numpy as np
import math
import SimpleITK as sitk
from scipy import ndimage
import nibabel as nib
from PIL import Image
import scipy.misc
from scipy import signal
import warnings
#warnings.filterwarnings("ignore")
def doggen(sigma):
"""
... | {
"repo_name": "NeuroDataDesign/seelviz",
"path": "jon/algorithms/tractography.py",
"copies": "1",
"size": "13942",
"license": "apache-2.0",
"hash": 8109679874346526000,
"line_mean": 34.4783715013,
"line_max": 231,
"alpha_frac": 0.5839190934,
"autogenerated": false,
"ratio": 3.257476635514019,
"... |
# A python implementation of Ailey's matlab tensor code.
import os
import numpy as np
import math
import SimpleITK as sitk
from scipy import ndimage
import nibabel as nib
from PIL import Image
import scipy.misc
from scipy import signal
import warnings
warnings.filterwarnings("ignore")
def doggen(sigma):
"""
... | {
"repo_name": "alee156/clviz",
"path": "clarityviz/tractography.py",
"copies": "2",
"size": "10679",
"license": "apache-2.0",
"hash": 8551177365187239000,
"line_mean": 34.0163934426,
"line_max": 124,
"alpha_frac": 0.5951868152,
"autogenerated": false,
"ratio": 3.3933905306641248,
"config_test":... |
import numpy as np
import mosek
def f_dot(X,Y):
return sum(sum(X*Y))
def center(km):
""" centering km """
m = len(km)
I = np.eye(m)
one = np.ones((m,1))
t = I - np.dot(one,one.T)/m
return np.dot(np.dot(t,km),t)
def getCKTA(km, ky):
return f_dot(km, ky)/np.sqrt(f_dot(km,km)*f_dot(ky,k... | {
"repo_name": "aalto-ics-kepaco/softALIGNF",
"path": "ovkr_code/alignf.py",
"copies": "2",
"size": "3503",
"license": "apache-2.0",
"hash": 2443401653867814000,
"line_mean": 24.384057971,
"line_max": 75,
"alpha_frac": 0.5286896945,
"autogenerated": false,
"ratio": 2.963620981387479,
"config_tes... |
# a python implementation of a local web server which
# ... recognizes web form data from post requests
# ... and stores web form data in a mysql database.
# to run from root dir: `python software/start_local_web_server.py`
# source(s):
# + http://georgik.sinusgear.com/2011/01/07/how-to-dump-post-request-with-python/... | {
"repo_name": "gwu-business/salad-system-py",
"path": "software/start_local_web_server.py",
"copies": "1",
"size": "7395",
"license": "mit",
"hash": -5664936498330844000,
"line_mean": 31.4342105263,
"line_max": 157,
"alpha_frac": 0.5509127789,
"autogenerated": false,
"ratio": 4.001623376623376,
... |
# a python implementation of math3d.h & math3d.cpp from the OpenGL SuperBible
# Ben Smith
# benjamin.coder.smith@gmail.com
#
# Math3d.h
# Header file for the Math3d library. The C-Runtime has math.h, this file and the
# accompanying math.c are meant to suppliment math.h by adding geometry/math routines
# useful for gra... | {
"repo_name": "fos/fos-legacy",
"path": "scratch/trycubes/math3d.py",
"copies": "1",
"size": "8209",
"license": "bsd-3-clause",
"hash": -1854048983960857600,
"line_mean": 27.2130584192,
"line_max": 125,
"alpha_frac": 0.5396516019,
"autogenerated": false,
"ratio": 2.489084293511219,
"config_test... |
""" A Python implementation of the Algorithm::CouponCode algorithm.
See:
1. http://search.cpan.org/dist/Algorithm-CouponCode/lib/Algorithm/CouponCode.pm
2. https://github.com/chilts/node-coupon-code/blob/master/coupon-code.js
Author: Brett Patterson <bmp2@rice.edu>
"""
import codecs
import random
BAD_WORDS = map(lam... | {
"repo_name": "brett-patterson/coupon_codes",
"path": "coupon_codes/coupon_codes.py",
"copies": "1",
"size": "2841",
"license": "mit",
"hash": 5468226218571048000,
"line_mean": 22.0975609756,
"line_max": 79,
"alpha_frac": 0.5586061246,
"autogenerated": false,
"ratio": 3.246857142857143,
"config... |
"""
The Banker's algorithm is a resource allocation and deadlock avoidance algorithm
developed by Edsger Dijkstra that tests for safety by simulating the allocation of
predetermined maximum possible amounts of all resources, and then makes a "s-state"
check to test for possible deadlock conditions for all other pending... | {
"repo_name": "TheAlgorithms/Python",
"path": "other/dijkstra_bankers_algorithm.py",
"copies": "1",
"size": "8466",
"license": "mit",
"hash": -6763355121744329000,
"line_mean": 36.6266666667,
"line_max": 88,
"alpha_frac": 0.5302386015,
"autogenerated": false,
"ratio": 4.16019656019656,
"config_... |
"""A python implementation of the factory design pattern. It's designed for use as a base class
for various types of data gateways.
"""
from __future__ import absolute_import, division, print_function
from .compat import with_metaclass
from .exceptions import InitializationError
__all__ = ['Factory']
class Factory... | {
"repo_name": "Microsoft/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda/_vendor/auxlib/factory.py",
"copies": "9",
"size": "3232",
"license": "apache-2.0",
"hash": -8980421693201650000,
"line_mean": 34.1304347826,
"line_max": 113,
"alpha_frac": 0.6048886139,
"autoge... |
"""A Python interface to a Dakota input file."""
import os
import importlib
class Experiment(object):
"""An aggregate of control blocks that define a Dakota input file."""
blocks = ("environment", "method", "variables", "interface", "responses")
"""The named control blocks of a Dakota input file."""
... | {
"repo_name": "csdms/dakota",
"path": "dakotathon/experiment.py",
"copies": "1",
"size": "7896",
"license": "mit",
"hash": 3412289276435128000,
"line_mean": 29.4864864865,
"line_max": 79,
"alpha_frac": 0.5586372847,
"autogenerated": false,
"ratio": 4.7594936708860756,
"config_test": false,
"h... |
"""A Python interface to the SocketLabs API.
See:
http://www.socketlabs.com/api-reference/
https://github.com/MattHealy/socketlabs-python
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.ab... | {
"repo_name": "MattHealy/socketlabs-python",
"path": "setup.py",
"copies": "1",
"size": "1190",
"license": "mit",
"hash": 2466200014788747000,
"line_mean": 29.5128205128,
"line_max": 65,
"alpha_frac": 0.6756302521,
"autogenerated": false,
"ratio": 3.6728395061728394,
"config_test": false,
"ha... |
# A python library comparing the result of FFI imported Rust code to native
# code. It assumes you have the library at /tmp/fibonacci.so
#
# The results are as expected, except for the fast implementation. This could
# be because the overhead of doing the system call takes far longer than the
# running of the python fu... | {
"repo_name": "gevious/rust",
"path": "Projects/fibonacci/fib.py",
"copies": "1",
"size": "2180",
"license": "mit",
"hash": 5070413256843912000,
"line_mean": 23.2222222222,
"line_max": 77,
"alpha_frac": 0.6068807339,
"autogenerated": false,
"ratio": 2.9619565217391304,
"config_test": false,
"... |
"""A python library for interacting with the Google Translate API.
"""
__author__ = "Dan Drinkard <dan.drinkard@gmail.com"
__version__ = "0.1.0"
__copyright__ = "Copyright (c) 2012 Dan Drinkard"
__license__ = "BSD"
import urllib
import urllib2
try:
import json
except ImportError:
import simplejson as json
c... | {
"repo_name": "drinks/pyglot",
"path": "pyglot.py",
"copies": "1",
"size": "3195",
"license": "bsd-3-clause",
"hash": -7063105025376513000,
"line_mean": 30.95,
"line_max": 108,
"alpha_frac": 0.59342723,
"autogenerated": false,
"ratio": 4.165580182529335,
"config_test": false,
"has_no_keywords... |
'''A Python library that implements an OEmbed consumer to use with OEmbed providers.
Based on reference from http://oembed.com/
oEmbed is a format for allowing an embedded representation of a URL on
third party sites. The simple API allows a website to display embedded content
(such as photos or videos) when a user... | {
"repo_name": "dokterbob/python-oembed",
"path": "oembed.py",
"copies": "1",
"size": "18684",
"license": "mit",
"hash": 9131043426459385000,
"line_mean": 29.1841680129,
"line_max": 108,
"alpha_frac": 0.5730036395,
"autogenerated": false,
"ratio": 4.433792121499763,
"config_test": false,
"has_... |
"""A python library wrapping the Cap'n Proto C++ library
Example Usage::
import capnp
addressbook = capnp.load('addressbook.capnp')
# Building
addresses = addressbook.AddressBook.newMessage()
people = addresses.init('people', 1)
alice = people[0]
alice.id = 123
alice.name = 'Alice'
... | {
"repo_name": "jparyani/pycapnp",
"path": "capnp/__init__.py",
"copies": "1",
"size": "1434",
"license": "bsd-2-clause",
"hash": -3096686618089659400,
"line_mean": 22.9,
"line_max": 56,
"alpha_frac": 0.659693166,
"autogenerated": false,
"ratio": 3.4388489208633093,
"config_test": false,
"has_... |
"""A Python MapCube Object"""
from __future__ import absolute_import
#pylint: disable=W0401,W0614,W0201,W0212,W0404
__author__ = "Keith Hughitt"
__email__ = "keith.hughitt@nasa.gov"
from sunpy.map import Map
from sunpy.map.sources import *
import numpy as np
#
# 2011/04/13: Should Map be broken up into Map and MapHe... | {
"repo_name": "jslhs/sunpy",
"path": "sunpy/map/mapcube.py",
"copies": "1",
"size": "4703",
"license": "bsd-2-clause",
"hash": -4326517363876252700,
"line_mean": 29.3419354839,
"line_max": 122,
"alpha_frac": 0.5526259834,
"autogenerated": false,
"ratio": 4.12182296231376,
"config_test": false,
... |
"""A Python MapCube Object"""
from __future__ import absolute_import
#pylint: disable=W0401,W0614,W0201,W0212,W0404
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from copy import copy
from sunpy.map import Map
from sunpy.map.sources import *
from sunpy.util... | {
"repo_name": "mjm159/sunpy",
"path": "sunpy/map/mapcube.py",
"copies": "1",
"size": "9043",
"license": "bsd-2-clause",
"hash": -2312816624538916000,
"line_mean": 31.0673758865,
"line_max": 122,
"alpha_frac": 0.5195178591,
"autogenerated": false,
"ratio": 4.1962877030162415,
"config_test": fals... |
"""A Python MapSequence Object"""
#pylint: disable=W0401,W0614,W0201,W0212,W0404
from copy import deepcopy
import numpy as np
import matplotlib.animation
import numpy.ma as ma
import astropy.units as u
from sunpy.map import GenericMap
from sunpy.visualization.animator.mapsequenceanimator import MapSequenceAnimator
... | {
"repo_name": "dpshelio/sunpy",
"path": "sunpy/map/mapsequence.py",
"copies": "2",
"size": "12537",
"license": "bsd-2-clause",
"hash": 7905458284517244000,
"line_mean": 35.3391304348,
"line_max": 110,
"alpha_frac": 0.5695940018,
"autogenerated": false,
"ratio": 4.090375203915172,
"config_test":... |
"""A Python module for interacting and consuming responses from Slack."""
import asyncio
# Standard Imports
import logging
# Internal Imports
from typing import Union
import slack_sdk.errors as e
class LegacySlackResponse(object): # skipcq: PYL-R0205
"""An iterable container of response data.
Attributes... | {
"repo_name": "slackhq/python-slackclient",
"path": "slack_sdk/web/legacy_slack_response.py",
"copies": "1",
"size": "7903",
"license": "mit",
"hash": 4732599416842040000,
"line_mean": 32.3459915612,
"line_max": 85,
"alpha_frac": 0.5685182842,
"autogenerated": false,
"ratio": 4.549798503166379,
... |
"""A Python module for interacting and consuming responses from Slack."""
import asyncio
# Standard Imports
import logging
# Internal Imports
import slack_sdk.errors as e
class LegacySlackResponse(object): # skipcq: PYL-R0205
"""An iterable container of response data.
Attributes:
data (dict): The... | {
"repo_name": "slackapi/python-slackclient",
"path": "slack_sdk/web/legacy_slack_response.py",
"copies": "1",
"size": "6833",
"license": "mit",
"hash": -5970731061680909000,
"line_mean": 31.5380952381,
"line_max": 85,
"alpha_frac": 0.5709058978,
"autogenerated": false,
"ratio": 4.4747871643745905... |
"""A Python module for interacting and consuming responses from Slack."""
import logging
from typing import Union
import slack_sdk.errors as e
from .internal_utils import _next_cursor_is_present
class AsyncSlackResponse:
"""An iterable container of response data.
Attributes:
data (dict): The json-e... | {
"repo_name": "slackhq/python-slackclient",
"path": "slack_sdk/web/async_slack_response.py",
"copies": "1",
"size": "6889",
"license": "mit",
"hash": 3428470462824496000,
"line_mean": 32.2801932367,
"line_max": 84,
"alpha_frac": 0.5770068225,
"autogenerated": false,
"ratio": 4.562251655629139,
... |
"""A Python module for interacting and consuming responses from Slack."""
import logging
import slack.errors as e
from slack.web.internal_utils import _next_cursor_is_present
class AsyncSlackResponse:
"""An iterable container of response data.
Attributes:
data (dict): The json-encoded content of th... | {
"repo_name": "slackhq/python-slackclient",
"path": "slack/web/async_slack_response.py",
"copies": "1",
"size": "5825",
"license": "mit",
"hash": -4032822841874268000,
"line_mean": 31.182320442,
"line_max": 84,
"alpha_frac": 0.5816309013,
"autogenerated": false,
"ratio": 4.4738863287250386,
"co... |
"""A Python module for interacting and consuming responses from Slack."""
import logging
import slack_sdk.errors as e
from .internal_utils import _next_cursor_is_present
class AsyncSlackResponse:
"""An iterable container of response data.
Attributes:
data (dict): The json-encoded content of the res... | {
"repo_name": "slackapi/python-slackclient",
"path": "slack_sdk/web/async_slack_response.py",
"copies": "1",
"size": "5788",
"license": "mit",
"hash": -2848151284887559000,
"line_mean": 31.3351955307,
"line_max": 87,
"alpha_frac": 0.5844851417,
"autogenerated": false,
"ratio": 4.455735180908391,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.