text stringlengths 0 1.05M | meta dict |
|---|---|
__all__ = ["build_template"]
import numpy as np
from tempfile import mktemp
from .reflect_image import reflect_image
from .interface import registration
from .apply_transforms import apply_transforms
from .resample_image import resample_image_to_target
from ..core import ants_image_io as iio
from .. import utils
d... | {
"repo_name": "ANTsX/ANTsPy",
"path": "ants/registration/build_template.py",
"copies": "1",
"size": "3143",
"license": "apache-2.0",
"hash": 8487119511016370000,
"line_mean": 29.5145631068,
"line_max": 103,
"alpha_frac": 0.6019726376,
"autogenerated": false,
"ratio": 3.5715909090909093,
"config... |
__all__ = ('BulkWhoisCymru')
from bulkwhois import BulkWhois
class BulkWhoisCymru(BulkWhois):
"""
An interface to the Shadowserver bulk whois service.
Usage:
from bulkwhois.shadowserver import BulkWhoisShadowserver
bw = BulkWhoisShadowserver()
bw.lookup_ips(["69.12.38.2... | {
"repo_name": "csirtfoundry/BulkWhois",
"path": "deb_dist/bulkwhois-0.2.1/build/lib.linux-x86_64-2.6/bulkwhois/cymru.py",
"copies": "5",
"size": "1946",
"license": "mit",
"hash": -8133520806268474000,
"line_mean": 32.5517241379,
"line_max": 127,
"alpha_frac": 0.4398766701,
"autogenerated": false,
... |
__all__ = ('BulkWhois')
import telnetlib
import socket
import logging
class BulkWhois(object):
"""
Query a list of IP addresses from a bulk whois server. This is an
efficient way to query a large number of IP addresses. It sends all
the IP addresses at once, and receives all whois result... | {
"repo_name": "csirtfoundry/BulkWhois",
"path": "bulkwhois/__init__.py",
"copies": "1",
"size": "6227",
"license": "mit",
"hash": 7188524273878808000,
"line_mean": 33.9831460674,
"line_max": 127,
"alpha_frac": 0.5651196403,
"autogenerated": false,
"ratio": 4.187626092804304,
"config_test": fals... |
__all__ = ('BulkWhoisShadowserver')
import socket
from bulkwhois import BulkWhois
class BulkWhoisShadowserver(BulkWhois):
"""
An interface to the Shadowserver bulk whois service.
Usage:
from bulkwhois.shadowserver import BulkWhoisShadowserver
bw = BulkWhoisShadowserver()
... | {
"repo_name": "csirtfoundry/BulkWhois",
"path": "deb_dist/bulkwhois-0.2.1/bulkwhois/shadowserver.py",
"copies": "5",
"size": "1802",
"license": "mit",
"hash": 4705747407618506000,
"line_mean": 30.0689655172,
"line_max": 127,
"alpha_frac": 0.4961154273,
"autogenerated": false,
"ratio": 3.380863039... |
__all__ = ['CacheHandler', 'CacheFileHandler', 'DjangoSessionCacheHandler', 'MemoryCacheHandler']
import errno
import json
import logging
import os
from spotipy.util import CLIENT_CREDS_ENV_VARS
logger = logging.getLogger(__name__)
class CacheHandler():
"""
An abstraction layer for handling the caching and ... | {
"repo_name": "plamere/spotipy",
"path": "spotipy/cache_handler.py",
"copies": "1",
"size": "4102",
"license": "mit",
"hash": 7064776875447933000,
"line_mean": 28.3,
"line_max": 97,
"alpha_frac": 0.5862993662,
"autogenerated": false,
"ratio": 4.39186295503212,
"config_test": false,
"has_no_ke... |
__all__ = ['Callback', 'ModeScriptCallback']
class Callback:
def __init__(self, name, parameter):
self.name = name
self.parameter = parameter
if name == 'ManiaPlanet.PlayerChat':
self.playerid = parameter[0]
self.login = parameter[1]
self.text = param... | {
"repo_name": "juergenz/pie",
"path": "src/pie/callbacks.py",
"copies": "1",
"size": "1762",
"license": "mit",
"hash": 2428973012078145500,
"line_mean": 27.9016393443,
"line_max": 59,
"alpha_frac": 0.5550510783,
"autogenerated": false,
"ratio": 4.2457831325301205,
"config_test": false,
"has_n... |
__all__ = ['camera']
import os
import pickle
from paraview.simple import GetActiveCamera, RenderAllViews, WriteImage
class camera:
"""An object to store a single camera location/view. You can make a list/dict of these objects to save interesting views for your project. This object saves just a few parameters ab... | {
"repo_name": "banesullivan/ParaViewGeophysics",
"path": "pvmacros/vis/objs.py",
"copies": "1",
"size": "5418",
"license": "bsd-3-clause",
"hash": 8970695320851323000,
"line_mean": 37.1549295775,
"line_max": 242,
"alpha_frac": 0.6321520856,
"autogenerated": false,
"ratio": 4.249411764705882,
"c... |
__all__ = ["Capabilities", \
"Switches"]
from browser.status import *
from base.bind import Bind
from base.log import VLOG
class Switches(object):
def __init__(self):
self.switch_map = {}
def SetSwitch(self, name, value=""):
self.switch_map[name] = value
# In case of same key, |switches| w... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "misc/capabilities.py",
"copies": "1",
"size": "13867",
"license": "bsd-3-clause",
"hash": -4661816422217241000,
"line_mean": 40.7680722892,
"line_max": 150,
"alpha_frac": 0.6923631643,
"autogenerated": false,
"ratio": 3.709737827... |
# All card-related events take (self, card) / (self, card, index) as arguments
# so we can call them as follows:
#
# raise_strategy_card_events(self.board, 'construct_placed', card_name)
#
#
# All deck-related events take (self) / (self, index) as arguments,
# so we can call them as follows:
#
# raise_strategy_deck... | {
"repo_name": "obi1kenobi/ascension-bot",
"path": "src/events.py",
"copies": "1",
"size": "2653",
"license": "mit",
"hash": 7742021171424770000,
"line_mean": 42.4918032787,
"line_max": 96,
"alpha_frac": 0.7075009423,
"autogenerated": false,
"ratio": 3.188701923076923,
"config_test": false,
"h... |
__all__ = ['cd', 'ad', 'ld', 'lookback', 'age']
from math import sqrt,sinh,sin
DH = 2997.92458 #in Mpc/h
OM = 0.3
NZ = 10000
TH = 9.77813106 #in Gyr/h
def E(z,om,ol,ok):
zp1 = float(z) + 1.0
return sqrt((om*zp1 + ok)*zp1*zp1 + ol)
def chi(z,om,ol,ok,Nz=NZ):
dz = z/float(Nz)
return sum(map(lambda i: 1... | {
"repo_name": "yymao/slackbots",
"path": "cosmo.py",
"copies": "1",
"size": "1456",
"license": "mit",
"hash": -8030441340861647000,
"line_mean": 23.2666666667,
"line_max": 66,
"alpha_frac": 0.532967033,
"autogenerated": false,
"ratio": 2.044943820224719,
"config_test": false,
"has_no_keywords... |
__all__ = [ 'Cell' ]
import copy, itertools
from .molecules import Atom, Molecule, Cluster
import numpy as np
from matplotlib import pyplot as plt
try:
from applequist import particles
except ImportError:
pass
a0 = 0.52917721092
class Cell( np.ndarray ):
def __new__(cls,
my_min = [0.0, 0... | {
"repo_name": "fishstamp82/moltools",
"path": "moltools/dstruct.py",
"copies": "1",
"size": "9798",
"license": "mit",
"hash": 4659473820646595000,
"line_mean": 29.7147335423,
"line_max": 122,
"alpha_frac": 0.4456011431,
"autogenerated": false,
"ratio": 3.2124590163934426,
"config_test": false,
... |
__all__ = ["ChapterParser"]
from .story import Chapter, Story
from html.parser import HTMLParser
from urllib.request import urlopen
from urllib.error import HTTPError
import re
CHARSET_REGEX = re.compile(r"charset=([^ ]+)")
CHAPTER_ID_REGEX = re.compile(r"https://chyoa.com/[^.]+\.([0-9]+)")
CHYOA_CHAPTER_REGEX = re.c... | {
"repo_name": "sexypants/chyoa-scraper",
"path": "chyoa/parser.py",
"copies": "1",
"size": "4758",
"license": "mit",
"hash": 1817854312785977000,
"line_mean": 31.8137931034,
"line_max": 89,
"alpha_frac": 0.501261034,
"autogenerated": false,
"ratio": 4.108808290155441,
"config_test": false,
"h... |
__all__ = ["Chapter", "Story"]
from .util import abridge
class Chapter(object):
def __init__(self, url, name, description, id, author, text, question, choices):
self.url = url
self.name = name.replace('%', '%%')
self.id = id
self.author = author.replace('%', '%%')
self.text... | {
"repo_name": "sexypants/chyoa-scraper",
"path": "chyoa/story.py",
"copies": "1",
"size": "1130",
"license": "mit",
"hash": 2314980385330058000,
"line_mean": 35.4516129032,
"line_max": 98,
"alpha_frac": 0.5495575221,
"autogenerated": false,
"ratio": 3.5987261146496814,
"config_test": false,
"... |
"""All character-related routes.
If the user wants to browse/search characters, or look at how a character has
improved over time, they'll likely want something from here.
"""
from datetime import datetime, timedelta
from bottle import route, request, template, HTTPResponse
from sqlalchemy.orm.exc import NoResultFoun... | {
"repo_name": "proegssilb/tsw-stats",
"path": "pages/characterRoutes.py",
"copies": "1",
"size": "1696",
"license": "apache-2.0",
"hash": -7715193322439927000,
"line_mean": 35.8695652174,
"line_max": 77,
"alpha_frac": 0.7287735849,
"autogenerated": false,
"ratio": 4.315521628498728,
"config_tes... |
__all__ = ['chatcommand', 'execute_chat_command', 'save_matchsettings', '_register_chat_command']
import functools
import inspect
from .events import eventhandler, send_event
from .log import logger
from .asyncio_loop import loop
_registered_chat_commands = {} # dict of all registered chat commands
async def exe... | {
"repo_name": "juergenz/pie",
"path": "src/pie/chat_commands.py",
"copies": "1",
"size": "3649",
"license": "mit",
"hash": 291605473629515000,
"line_mean": 26.4436090226,
"line_max": 110,
"alpha_frac": 0.6464784873,
"autogenerated": false,
"ratio": 3.7931392931392933,
"config_test": false,
"h... |
__all__ = ["CherryAdmin", "CherryAdminView", "CherryAdminRawView"]
import os
import cherrypy
from nxtools import *
from .handler import CherryAdminHandler
from .context import CherryAdminContext
from .sessions import CherryAdminSessions
from .view import CherryAdminView, CherryAdminRawView
script_name = os.path.b... | {
"repo_name": "martastain/cherryadmin",
"path": "cherryadmin/__init__.py",
"copies": "1",
"size": "3696",
"license": "mit",
"hash": 607150420648549400,
"line_mean": 26.1764705882,
"line_max": 104,
"alpha_frac": 0.5446428571,
"autogenerated": false,
"ratio": 4.026143790849673,
"config_test": fal... |
__all__ = ['Chunk']
import os
import string
import subprocess
from tempfile import NamedTemporaryFile
from miles import Configuration
class Chunk:
"""Chunk of a short trajectory.
We refer to a trajectory started at a certain milestone and
stopped at a neighboring milestone as a short trajectory. Short
... | {
"repo_name": "clsb/miles",
"path": "miles/chunk.py",
"copies": "1",
"size": "3758",
"license": "mit",
"hash": 2833687872560316000,
"line_mean": 33.4770642202,
"line_max": 76,
"alpha_frac": 0.5830228845,
"autogenerated": false,
"ratio": 4.650990099009901,
"config_test": true,
"has_no_keywords... |
__all__ = ['ChunksBD']
import os
from typing import Optional
from miles import (BaseChunks, Configuration, delete_files, get_random_name)
class ChunksBD(BaseChunks):
"""Sequence of simple-brownian-dynamics trajectory chunks.
"""
def __init__(self, configuration: Configuration,
initial_... | {
"repo_name": "clsb/miles",
"path": "miles/chunks_bd.py",
"copies": "1",
"size": "1290",
"license": "mit",
"hash": -7040483465384221000,
"line_mean": 28.3181818182,
"line_max": 76,
"alpha_frac": 0.5821705426,
"autogenerated": false,
"ratio": 3.897280966767372,
"config_test": false,
"has_no_ke... |
# __all__ = ['ChunksMOIL']
#
# from typing import Optional
#
# from miles import (BaseChunks, Configuration, DCDReader, DVDReader, delete_files, get_random_name, path_ext_join) # noqa: E501
#
#
# class ChunksMOIL(BaseChunks):
# """Sequence of MOIL trajectory chunks.
#
# """
# def __init__(self, configurati... | {
"repo_name": "clsb/miles",
"path": "miles/chunks_moil.py",
"copies": "1",
"size": "1328",
"license": "mit",
"hash": 811007849493778200,
"line_mean": 34.8918918919,
"line_max": 129,
"alpha_frac": 0.5865963855,
"autogenerated": false,
"ratio": 2.9576837416481068,
"config_test": false,
"has_no_... |
__all__ = ['ChunksNAMD']
import shutil
from typing import Optional
from miles import (BaseChunks, Configuration, get_random_name, delete_files) # noqa: E501
class ChunksNAMD(BaseChunks):
"""Sequence of NAMD trajectory chunks.
"""
suffixes = {'coor', 'vel', 'xsc'}
extra_suffixes = {'colvars.traj'... | {
"repo_name": "clsb/miles",
"path": "miles/chunks_namd.py",
"copies": "1",
"size": "1521",
"license": "mit",
"hash": 6083378572946334000,
"line_mean": 30.0408163265,
"line_max": 90,
"alpha_frac": 0.5818540434,
"autogenerated": false,
"ratio": 3.81203007518797,
"config_test": true,
"has_no_key... |
__all__ = ["ChyoaTree", "TreeCharset", "Tree", "STANDARD_TREE_CHARSET", "ASCII_TREE_CHARSET"]
import json
import os
class TreeCharset(object):
def __init__(self, trunk, intersection, branch, corner):
self.trunk = trunk
self.intersection = intersection
self.branch = branch
self.corn... | {
"repo_name": "sexypants/chyoa-scraper",
"path": "chyoa/tree.py",
"copies": "1",
"size": "2316",
"license": "mit",
"hash": 3660345426783317500,
"line_mean": 27.1463414634,
"line_max": 93,
"alpha_frac": 0.5485268631,
"autogenerated": false,
"ratio": 3.8986486486486487,
"config_test": false,
"h... |
__all__ = ('City')
from building import Building
from pocketthrone.entities.unit import Unit
from pocketthrone.entities.event import *
from random import choice, seed
from pocketthrone.managers.pipe import L
from pocketthrone.managers.eventmanager import EventManager
# city wall and building positions (N = Wall, L =... | {
"repo_name": "herrschr/pocket-throne",
"path": "pocketthrone/entities/city.py",
"copies": "2",
"size": "14038",
"license": "bsd-2-clause",
"hash": 262325562302491460,
"line_mean": 27.9443298969,
"line_max": 270,
"alpha_frac": 0.6676877048,
"autogenerated": false,
"ratio": 2.890856672158155,
"c... |
__all__ = ['classAddMethod', 'Category']
from _objc import selector, classAddMethods, objc_class
def classAddMethod(cls, name, method):
"""
Add a single method to a class. 'name' is the ObjC selector
"""
if isinstance(method, selector):
sel = selector(method.callable,
selec... | {
"repo_name": "rays/ipodderx-core",
"path": "objc/_category.py",
"copies": "1",
"size": "1883",
"license": "mit",
"hash": 8560687958601338000,
"line_mean": 28.8888888889,
"line_max": 81,
"alpha_frac": 0.610196495,
"autogenerated": false,
"ratio": 4.075757575757576,
"config_test": false,
"has_... |
__all__ = ['ClassContextManager']
class ClassContextManager(object):
class __metaclass__(type):
def __get__(self, instance, owner):
self.parent = instance
return self
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def __enter__(... | {
"repo_name": "rocktavious/pyul",
"path": "pyul/coreUtils/classcontextmanager.py",
"copies": "1",
"size": "1089",
"license": "mit",
"hash": 4721371697524253000,
"line_mean": 24.3255813953,
"line_max": 53,
"alpha_frac": 0.5500459137,
"autogenerated": false,
"ratio": 3.9456521739130435,
"config_t... |
"""All classes in this module are read-only data classes and should not
have their values modified after being loaded from external files.
This module also contains various methods for retrieving data from these
classes.
"""
import pygame
from pygame.locals import Rect
def load_frame_durations(action):
"""Return... | {
"repo_name": "MarquisLP/Sidewalk-Champion",
"path": "lib/custom_data/character_data.py",
"copies": "1",
"size": "17789",
"license": "unlicense",
"hash": 7082967290084277000,
"line_mean": 47.8708791209,
"line_max": 72,
"alpha_frac": 0.502726404,
"autogenerated": false,
"ratio": 5.663482967207895,... |
__all__ = ['classification_report', 'find_best_thresholds', 'generate_pr_curves']
import logging
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.metrics import average_precision_score
from sklearn.metrics i... | {
"repo_name": "skylander86/ycml",
"path": "ycml/utils/analysis.py",
"copies": "1",
"size": "15721",
"license": "apache-2.0",
"hash": 905042473299407200,
"line_mean": 46.7841945289,
"line_max": 224,
"alpha_frac": 0.5892754914,
"autogenerated": false,
"ratio": 3.2215163934426227,
"config_test": f... |
__all__ = ['Client']
import inspect
from types import MethodType
from utils import get_context
import methods
class Client (object):
def __init__ (self, remote):
self._remote = remote
@property
def _path (self):
return ''
@property
def _parent (self):
return None
def b... | {
"repo_name": "mozilla/badgekit-api-python-client",
"path": "badgekitapiclient/client/__init__.py",
"copies": "1",
"size": "1082",
"license": "mpl-2.0",
"hash": 1205392558391357200,
"line_mean": 23.5909090909,
"line_max": 58,
"alpha_frac": 0.6025878004,
"autogenerated": false,
"ratio": 3.97794117... |
__all__ = ['Client']
import urlparse
import requests
from optimizely_ee import error
from optimizely_ee import resource
BASE_URL = 'https://www.optimizelyapis.com/experiment/v1/'
class Client(object):
ALLOWED_REQUESTS = ['get', 'post', 'put', 'delete']
def __init__(self, api_key, api_base=BASE_URL):
# set... | {
"repo_name": "experimentengine/optimizely-client-python",
"path": "optimizely_ee/client.py",
"copies": "1",
"size": "2793",
"license": "mit",
"hash": 4827919902081366000,
"line_mean": 39.4782608696,
"line_max": 116,
"alpha_frac": 0.7031865378,
"autogenerated": false,
"ratio": 3.7794316644113666,... |
__all__ = ['Client']
import urlparse
import requests
from optimizely import error
from optimizely import resource
BASE_URL = 'https://www.optimizelyapis.com/experiment/v1/'
class Client(object):
ALLOWED_REQUESTS = ['get', 'post', 'put', 'delete']
def __init__(self, api_key, api_base=BASE_URL):
# s... | {
"repo_name": "wlowry88/optimizely-client-python",
"path": "optimizely/client.py",
"copies": "1",
"size": "3041",
"license": "mit",
"hash": -8293665903882834000,
"line_mean": 43.0724637681,
"line_max": 124,
"alpha_frac": 0.6445248274,
"autogenerated": false,
"ratio": 4.137414965986395,
"config_... |
"""All client package classes."""
import os
import re
import shutil
from pathlib import Path
from cli.command_runner import CommandRunner
from cli.exceptions import CliError
def get_all_client_classes():
return [PythonPackage, GoPackage, CppPackage]
class ClientPackageMeta:
"""Decorators and the like for d... | {
"repo_name": "onshape-public/onshape-clients",
"path": "cli/cli/clientPackage.py",
"copies": "1",
"size": "9039",
"license": "mit",
"hash": -7571063695929092000,
"line_mean": 38.3,
"line_max": 162,
"alpha_frac": 0.6079212302,
"autogenerated": false,
"ratio": 3.8694349315068495,
"config_test": ... |
''' All CLI hooks are handled through here. '''
import click
from pyfiglet import Figlet
from lib import __version__
from lib.logger import init_logger
from lib.commands.deploy import Deploy
from lib.commands.invite import Invite
from lib.commands.register import Register
REGISTER_HELP_TEXT = 'Flag to indicate if a ... | {
"repo_name": "srishanbhattarai/Harbor-CLI",
"path": "packages/cli/lib/cli.py",
"copies": "1",
"size": "1938",
"license": "mpl-2.0",
"hash": -2728333397353033700,
"line_mean": 28.3636363636,
"line_max": 79,
"alpha_frac": 0.6991744066,
"autogenerated": false,
"ratio": 3.3763066202090593,
"config... |
__all__ = [ "Cmd" ]
import subprocess
import image
import tempfile
class Cmd(object):
"""
Generic wrapper for command line applications using medical images.
"""
def __init__( self, program, *args, **kwargs ):
self.program = program
self.arguments = list(args) # list
self.param... | {
"repo_name": "sk1712/IRTK",
"path": "wrapping/cython/irtk/cmd.py",
"copies": "5",
"size": "1801",
"license": "bsd-3-clause",
"hash": -192358063372776220,
"line_mean": 32.9811320755,
"line_max": 82,
"alpha_frac": 0.5130483065,
"autogenerated": false,
"ratio": 4.288095238095238,
"config_test": f... |
__all__ = ('CMD_STATUS', 'CMD_STATUS_NAME', 'CMD_BLOCKED', 'CMD_READY',
'CMD_ASSIGNED', 'CMD_RUNNING', 'CMD_FINISHING', 'CMD_DONE',
'CMD_ERROR', 'CMD_CANCELED', 'CMD_TIMEOUT',
'isFinalStatus', 'isRunningStatus')
CMD_STATUS = (CMD_BLOCKED,
CMD_READY,
C... | {
"repo_name": "smaragden/OpenRenderManagement",
"path": "src/octopus/core/enums/command.py",
"copies": "2",
"size": "1065",
"license": "bsd-3-clause",
"hash": -4411505830250308000,
"line_mean": 29.3235294118,
"line_max": 71,
"alpha_frac": 0.4563380282,
"autogenerated": false,
"ratio": 3.573825503... |
__all__ = ['cochain','Cochain','d','star','delta','laplace_beltrami','laplace_derham']
from scipy import sparse
from pydec.mesh import Simplex
class cochain:
"""
Represents a cochain associated with a simplical complex
The v member of the cochain is left uninitialized. This allows functions like
... | {
"repo_name": "whereisravi/pydec",
"path": "pydec/dec/cochain.py",
"copies": "7",
"size": "4875",
"license": "bsd-3-clause",
"hash": 6284509607934738000,
"line_mean": 33.5744680851,
"line_max": 126,
"alpha_frac": 0.5532307692,
"autogenerated": false,
"ratio": 3.3482142857142856,
"config_test": ... |
import numpy as np
def arc_distance(lon0=None, lat0=None, lon1=None, lat1=None, R=1.,
input_coords='radians'):
"""
Gets the arc distance between (lon0, lat0) and (lon1, lat1).
Either pair can be a pair or an array. R is the radius of the
sphere. Uses the formula from the spherical law... | {
"repo_name": "cossatot/partial_plates",
"path": "partial_plates/eulers.py",
"copies": "1",
"size": "5319",
"license": "mit",
"hash": -7673525483100078000,
"line_mean": 27.1428571429,
"line_max": 77,
"alpha_frac": 0.5775521715,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no... |
""" All code in this project follows the tutorials provided in the Simple RL series, part of which is found here:
https://medium.com/@awjuliani/super-simple-reinforcement-learning-tutorial-part-2-ded33892c724#.f0442wu0m """
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers import xavier_initial... | {
"repo_name": "demelin/learning_reinforcement_learning",
"path": "policy_gradient_agent.py",
"copies": "1",
"size": "7149",
"license": "mit",
"hash": 5935696233843110000,
"line_mean": 38.938547486,
"line_max": 113,
"alpha_frac": 0.6034410407,
"autogenerated": false,
"ratio": 3.9453642384105962,
... |
# Copyright (c) 2017 Giorgio Gonnella and CONTRIBUTORS
# Copyright (c) 2017 Center for Bioinformatics, University of Hamburg
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice ap... | {
"repo_name": "AlgoLab/pygfa",
"path": "benchmark/randomgraph.py",
"copies": "1",
"size": "4313",
"license": "mit",
"hash": 7196575962166185000,
"line_mean": 41.2843137255,
"line_max": 81,
"alpha_frac": 0.6116392302,
"autogenerated": false,
"ratio": 3.2066914498141266,
"config_test": false,
"... |
# All code provided from the http://gengo.com site, such as API example code
# and libraries, is provided under the New BSD license unless otherwise
# noted. Details are below.
#
# New BSD License
# Copyright (c) 2009-2012, myGengo, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with... | {
"repo_name": "shawnps/mygengo-python",
"path": "setup.py",
"copies": "2",
"size": "3416",
"license": "bsd-3-clause",
"hash": -7008599280766652000,
"line_mean": 33.16,
"line_max": 78,
"alpha_frac": 0.7019906323,
"autogenerated": false,
"ratio": 4.3076923076923075,
"config_test": false,
"has_n... |
#All code you gonna code in the terminal or W.ide
"""NUMBERS
The first type is integer, Example:
1, 5, 9, 10
type(1)
type(5)
The second type is float, Example:
3.14, 5.13e-2, 62.07, 1.0
type(1.0)
type(3.14)
type(5.13e-2)
The third type is complex, Example:
2 + 1j, 4.18 + 5j, 9 + 2.17j
type(2 + 3j)
type(4.18 + 5j)... | {
"repo_name": "maumg1196/PythonRandomExercices",
"path": "TypesofData.py",
"copies": "1",
"size": "2380",
"license": "mit",
"hash": 1324938788284602600,
"line_mean": 32.9142857143,
"line_max": 276,
"alpha_frac": 0.7459983151,
"autogenerated": false,
"ratio": 3.4011461318051577,
"config_test": f... |
__all__ = ['Collection', 'CollectionError', 'CollectionUnexpectedError']
from utils import errorutils
from model import Model
from backends.base import BaseBackend
class CollectionError(errorutils.UnexpectedError):
pass
class CollectionUnexpectedError(errorutils.UnexpectedError):
pass
class Singleton(... | {
"repo_name": "colevscode/quickdata",
"path": "quickdata/collection.py",
"copies": "1",
"size": "6026",
"license": "mit",
"hash": 545373248329501950,
"line_mean": 25.6637168142,
"line_max": 81,
"alpha_frac": 0.5730169267,
"autogenerated": false,
"ratio": 4.3477633477633475,
"config_test": false... |
__all__ = ['colorscheme', 'icon_theme', 'notify', 'widget_style']
from os import popen
from plugins.kde import *
from core import path, kde
@path.register_path_prefix
def KDEWALLPAPER():
paths = []
if kde.version() == 5:
wallpaper = popen("kf5-config --path wallpaper")
wallpaper = wallpaper.rea... | {
"repo_name": "nielsvm/kde4-profiles",
"path": "plugins/kde/__init__.py",
"copies": "1",
"size": "1147",
"license": "bsd-3-clause",
"hash": -6497953124740100000,
"line_mean": 32.7352941176,
"line_max": 65,
"alpha_frac": 0.5640802092,
"autogenerated": false,
"ratio": 3.7119741100323624,
"config_... |
__all__ = ["colors", "set_style"]
from PySide2 import QtWidgets
from . import project_globals as g
# see http://www.google.com/design/spec/style/color.html#color-color-palette
colors = {
"background": "#212121",
"go": "#009688",
"stop": "#F44336",
"set": "#009688",
"advanced": "#FFC107",
"tex... | {
"repo_name": "wright-group/PyCMDS",
"path": "pycmds/project/style.py",
"copies": "1",
"size": "2917",
"license": "mit",
"hash": -1836418147168966400,
"line_mean": 31.7752808989,
"line_max": 233,
"alpha_frac": 0.603359616,
"autogenerated": false,
"ratio": 3.6012345679012348,
"config_test": fals... |
__all__ = ['Column']
import struct
from .expr import Expr
class Column(object):
def __init__(self, name=None, type=None, size=None):
self.name = name
self.type = type
self.size = size
def __repr__(self):
return '<%s name: %r, type: %r, size: %s>' % (
self.__class_... | {
"repo_name": "yadb/yadb",
"path": "backup/store/column.py",
"copies": "1",
"size": "2842",
"license": "mit",
"hash": -8148891914683405000,
"line_mean": 25.3148148148,
"line_max": 63,
"alpha_frac": 0.4683321605,
"autogenerated": false,
"ratio": 3.729658792650919,
"config_test": false,
"has_no... |
__all__ = ['column_stack','row_stack', 'dstack','array_split','split','hsplit',
'vsplit','dsplit','apply_over_axes','expand_dims',
'apply_along_axis', 'kron', 'tile', 'get_array_wrap']
import numpy.core.numeric as _nx
from numpy.core.numeric import asarray, zeros, newaxis, outer, \
concatena... | {
"repo_name": "mbalasso/mynumpy",
"path": "numpy/lib/shape_base.py",
"copies": "11",
"size": "24366",
"license": "bsd-3-clause",
"hash": -8705056836733563000,
"line_mean": 28.041716329,
"line_max": 80,
"alpha_frac": 0.5083312813,
"autogenerated": false,
"ratio": 3.3511208912116626,
"config_test... |
# all combinations except those that do not produce some sort of
# chimeric protein are commented out
import itertools
import os
agfusion_db = os.path.join(
os.path.split(__file__)[0],
'data',
'agfusion.db'
)
AGFUSION_DB_URL = "https://s3.amazonaws.com/agfusion/agfusion."
# this is mostly contigent on t... | {
"repo_name": "murphycj/AGFusion",
"path": "agfusion/utils.py",
"copies": "1",
"size": "16452",
"license": "mit",
"hash": 7185319132329701000,
"line_mean": 69.3076923077,
"line_max": 152,
"alpha_frac": 0.715049842,
"autogenerated": false,
"ratio": 2.746119178768152,
"config_test": false,
"has... |
__all__ = ['combinations', 'permutations']
def combinations(L, n):
"""Generate combinations from a sequence of elements.
Returns a generator object that iterates over all
combinations of n elements from a sequence L.
Parameters
----------
L : list-like
Sequence of elements
n : in... | {
"repo_name": "alejospina/pydec",
"path": "pydec/math/combinatorial.py",
"copies": "6",
"size": "2147",
"license": "bsd-3-clause",
"hash": -852229113043876600,
"line_mean": 24.5595238095,
"line_max": 106,
"alpha_frac": 0.4634373544,
"autogenerated": false,
"ratio": 3.233433734939759,
"config_te... |
__all__ = ['combine_subsets', ]
# Data taken from https://code.google.com/p/googlefontdirectory/source/browse/tools/subset/subset.py#184
quotes = [
0x2013, # endash
0x2014, # emdash
0x2018, # quoteleft
0x2019, # quoteright
0x201A, # quotesinglbase
0x201C, # quotedblleft
0x201D, # quotedblr... | {
"repo_name": "vitalyvolkov/fontbakery",
"path": "checker/tools.py",
"copies": "1",
"size": "5477",
"license": "apache-2.0",
"hash": 7033846329131263000,
"line_mean": 36.5136986301,
"line_max": 108,
"alpha_frac": 0.6751871462,
"autogenerated": false,
"ratio": 2.0076979472140764,
"config_test": ... |
__all__ = ["combomethod", "ComboMethodError"]
import functools
class ComboMethodError(Exception):
"""Inappropriate initialization of the combo method descriptor."""
pass
class ComboMethod(object):
"""Combo method descriptor.
Descriptor is initializes eater by passing in the staticmethod or the
... | {
"repo_name": "alefnula/tea",
"path": "tea/decorators/__init__.py",
"copies": "1",
"size": "2970",
"license": "bsd-3-clause",
"hash": -8762230824345428000,
"line_mean": 28.7,
"line_max": 79,
"alpha_frac": 0.5885521886,
"autogenerated": false,
"ratio": 4.729299363057325,
"config_test": false,
... |
__all__ = ["command_center", "crystalite_farm", "adamantite_mine", "crystalite_silo",
"adamantite_storage", "vault", "laboratory", "craft_pad"]
from .tools import create_building
COMMAND_CENTER_BASIS = {
'alias': 'commandCenter-main',
'role': 'center',
'type': 'commandCenter',
'size': 4,
... | {
"repo_name": "CheckiO/EoC-battle-mocks",
"path": "battle_mocks/buildings.py",
"copies": "1",
"size": "5196",
"license": "mit",
"hash": 5375180759368006000,
"line_mean": 27.5494505495,
"line_max": 86,
"alpha_frac": 0.630100077,
"autogenerated": false,
"ratio": 2.67421513124035,
"config_test": f... |
__all__ = ['CommandKey', 'CommandGroup', 'CommandPoolKey']
@classmethod
def _create_flyweight_instance_if_needed(cls, *args, **kargs):
assert len(args) > 1
name = intern(args[1])
return cls.__instances.setdefault(name, super(type(cls), cls).__new__(*args, **kargs))
@classmethod
def _get_flyweights(cls):... | {
"repo_name": "sboisson/thickskin",
"path": "src/thickskin/registry.py",
"copies": "1",
"size": "1265",
"license": "mit",
"hash": -808220304685587600,
"line_mean": 22.8679245283,
"line_max": 90,
"alpha_frac": 0.6545454545,
"autogenerated": false,
"ratio": 3.3733333333333335,
"config_test": fals... |
__all__ = ['Command', 'Parameter', 'CommandOutcome']
from typing import List, Dict, Any, Optional, Type, Generic, \
TypeVar, Iterator
import random
import logging
import attr
from .connection import Message
from .specification import Specification
from .configuration import Configuration
from .state import State... | {
"repo_name": "squaresLab/Houston",
"path": "houston/command.py",
"copies": "1",
"size": "14054",
"license": "mit",
"hash": 1978678848537620500,
"line_mean": 34.0473815461,
"line_max": 115,
"alpha_frac": 0.5518001992,
"autogenerated": false,
"ratio": 4.3987480438184665,
"config_test": true,
"... |
__all__ = ['COMMON_MIME_MAPS', 'BaseStaticSiteRenderer']
# Since mimetypes.get_extension() gets the "first known" (alphabetically),
# we get supid behavior like "text/plain" mapping to ".bat". This list
# overrides some file types we will surely use, to eliminate a call to
# mimetypes.get_extension() except in unusua... | {
"repo_name": "mtigas/django-medusa",
"path": "django_medusa/renderers/base.py",
"copies": "4",
"size": "2156",
"license": "mit",
"hash": 6490160948408028000,
"line_mean": 30.2463768116,
"line_max": 75,
"alpha_frac": 0.6321892393,
"autogenerated": false,
"ratio": 4.346774193548387,
"config_test... |
#All community-made commands should go here. Write your command
#and make a pull request, and I'll try to implement it. I'll
#provide some examples here. Otherwise check out atbCommands.py
import requests
import time
import sys
import datetime
import csv
import random
import re
import json
import traceback
import os
im... | {
"repo_name": "magomez96/AdamTestBot",
"path": "src/Community/atbCommunity.py",
"copies": "1",
"size": "9617",
"license": "mit",
"hash": -7709301319690334000,
"line_mean": 42.3198198198,
"line_max": 183,
"alpha_frac": 0.5388374753,
"autogenerated": false,
"ratio": 4.295221080839661,
"config_tes... |
#All community-made commands should go here. Write your command
#and make a pull request, and I'll try to implement it. I'll
#provide some examples here. Otherwise check out atbCommands.py
import requests
import time
import sys
import datetime
import csv
import random
import re
import json
import traceback
... | {
"repo_name": "noisemaster/AdamTestBot",
"path": "src/Community/atbCommunity.py",
"copies": "1",
"size": "16512",
"license": "mit",
"hash": 6134199270723779000,
"line_mean": 43.7257617729,
"line_max": 193,
"alpha_frac": 0.5209910947,
"autogenerated": false,
"ratio": 4.368086795448531,
"config_t... |
__all__ = ['compare_datasets']
import pandas as pd
import numpy as np
SUFFIX_DF1 = '_df1'
SUFFIX_DF2 = '_df2'
def equals_condition(df1_columns_to_compare, df2_columns_to_compare):
condition = []
for col_x, col_y in zip(df1_columns_to_compare, df2_columns_to_compare):
condition.append(col_x + ' == '... | {
"repo_name": "marcusrehm/data-compare",
"path": "datacompare/__init__.py",
"copies": "1",
"size": "1929",
"license": "mit",
"hash": 1651145317202563300,
"line_mean": 36.8235294118,
"line_max": 94,
"alpha_frac": 0.5914981856,
"autogenerated": false,
"ratio": 3.3664921465968587,
"config_test": f... |
__all__ = ['Composer', 'ComposerError']
from .error import MarkedError
from .events import * # NOQA
from .nodes import * # NOQA
class ComposerError(MarkedError):
pass
class Composer:
def __init__(self):
pass
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
... | {
"repo_name": "wezhang/vim-setup",
"path": "bundle/powerline/powerline/lint/markedjson/composer.py",
"copies": "3",
"size": "3315",
"license": "apache-2.0",
"hash": -3205551130425678300,
"line_mean": 27.3333333333,
"line_max": 80,
"alpha_frac": 0.6995475113,
"autogenerated": false,
"ratio": 3.077... |
__all__ = ["compute_postscript", "format_dt"]
import datetime
import random
import typing as T
MatcherValue = T.Optional[T.Union[range, int]]
Matcher = T.Tuple[MatcherValue, MatcherValue, MatcherValue, MatcherValue]
POSTSCRIPTS: T.Dict[Matcher, T.Union[str, T.List[str]]] = {
# New Year's Day
(1, 1, 0, range(... | {
"repo_name": "slice/dogbot",
"path": "dog/ext/time/formatting.py",
"copies": "2",
"size": "2611",
"license": "mit",
"hash": -569603805019495940,
"line_mean": 28.0111111111,
"line_max": 84,
"alpha_frac": 0.5901953275,
"autogenerated": false,
"ratio": 3.5094086021505375,
"config_test": false,
... |
__all__ = ('config', 'parse', 'ENGINES', 'data_dir')
import os
import re
import json
try:
from urllib.parse import urlparse # Python 3
except ImportError:
from urlparse import urlparse # Python 2
from dj_paas_env import provider
ENGINES = {
'postgres': 'django.db.backends.postgresql_psycopg2',
'po... | {
"repo_name": "pbacterio/dj-paas-env",
"path": "dj_paas_env/database.py",
"copies": "1",
"size": "2488",
"license": "mit",
"hash": 5426331667121059000,
"line_mean": 29.7160493827,
"line_max": 79,
"alpha_frac": 0.606511254,
"autogenerated": false,
"ratio": 3.445983379501385,
"config_test": false... |
# All configuration for the CT monitor is done from this file!
# interval (in seconds) between updates
INTERVAL = 60
# Directories for various output files
OUTPUT_DIR = "output/"
# Output file for certificate data.
# Set to None to disable textfile writing
DEFAULT_CERT_FILE = None
# DEFAULT_CERT_FILE = OUTPUT_DIR +... | {
"repo_name": "gizmachi/ct_tools",
"path": "monitor_conf.py",
"copies": "1",
"size": "4038",
"license": "bsd-3-clause",
"hash": -5014394728623999000,
"line_mean": 37.4571428571,
"line_max": 407,
"alpha_frac": 0.7288261516,
"autogenerated": false,
"ratio": 1.8522935779816514,
"config_test": fals... |
# all configuration settings come from config.py
try:
import config
except ImportError:
print("Please copy template-config.py to config.py and configure appropriately !"); exit();
# this can be used to activate debugging
# debug_communication=1
debug_communication=0
try:
# for Python2
from Tkinter import *
... | {
"repo_name": "iwonahahn/iot-starterkit",
"path": "neo/examples/python/iot-starterkit-for-desktop/iot_starterkit_desktop.py",
"copies": "3",
"size": "5718",
"license": "apache-2.0",
"hash": -1024619214055302700,
"line_mean": 26.0995260664,
"line_max": 200,
"alpha_frac": 0.6843301854,
"autogenerated... |
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, us... | {
"repo_name": "OmkarPathak/pygorithm",
"path": "docs/conf.py",
"copies": "1",
"size": "2070",
"license": "mit",
"hash": 4564602931861495300,
"line_mean": 30.3636363636,
"line_max": 89,
"alpha_frac": 0.6637681159,
"autogenerated": false,
"ratio": 3.8121546961325965,
"config_test": false,
"has_... |
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext... | {
"repo_name": "otherlab/pcl",
"path": "doc/overview/content/conf.py",
"copies": "19",
"size": "4367",
"license": "bsd-3-clause",
"hash": -7510533759598691000,
"line_mean": 31.3481481481,
"line_max": 80,
"alpha_frac": 0.7137623082,
"autogenerated": false,
"ratio": 3.777681660899654,
"config_test... |
__all__ = ['ConsoleReactor']
import sys
from netrepr import NetRepr, RemoteObjectPool, RemoteObjectReference
from Foundation import *
class ConsoleReactor(NSObject):
def init(self):
self = super(ConsoleReactor, self).init()
self.pool = None
self.netReprCenter = None
self.connectio... | {
"repo_name": "ariabuckles/pyobjc-core",
"path": "Examples/NonFunctional/RemotePyInterpreter/ConsoleReactor.py",
"copies": "2",
"size": "4588",
"license": "mit",
"hash": -2420811932974356000,
"line_mean": 34.2923076923,
"line_max": 109,
"alpha_frac": 0.5876198779,
"autogenerated": false,
"ratio":... |
"""All constants/enumerations are available directly from `mal_scraper.x`"""
from collections import namedtuple
from enum import Enum, unique
Retrieved = namedtuple('Retrieved', ['meta', 'data'])
"""When successfully retrieving from a web-page
.. py:attribute:: meta
A dict of metadata::
{
'... | {
"repo_name": "QasimK/mal-scraper",
"path": "src/mal_scraper/consts.py",
"copies": "1",
"size": "3731",
"license": "mit",
"hash": -4276475426759896600,
"line_mean": 27.0526315789,
"line_max": 81,
"alpha_frac": 0.5719646207,
"autogenerated": false,
"ratio": 3.2359063313096272,
"config_test": fal... |
"""All constants related to the ZHA component."""
from __future__ import annotations
import enum
import logging
import bellows.zigbee.application
import voluptuous as vol
from zigpy.config import CONF_DEVICE_PATH # noqa: F401 # pylint: disable=unused-import
import zigpy_cc.zigbee.application
import zigpy_deconz.zigb... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/zha/core/const.py",
"copies": "1",
"size": "11888",
"license": "apache-2.0",
"hash": 2492736485050557400,
"line_mean": 29.7183462532,
"line_max": 88,
"alpha_frac": 0.7293068641,
"autogenerated": false,
"ratio": 2.824... |
"""All constants related to the ZHA component."""
import enum
import logging
from typing import List
import bellows.zigbee.application
from zigpy.config import CONF_DEVICE_PATH # noqa: F401 # pylint: disable=unused-import
import zigpy_cc.zigbee.application
import zigpy_deconz.zigbee.application
import zigpy_xbee.zigb... | {
"repo_name": "tchellomello/home-assistant",
"path": "homeassistant/components/zha/core/const.py",
"copies": "1",
"size": "10065",
"license": "apache-2.0",
"hash": 8801216952669594000,
"line_mean": 29.3162650602,
"line_max": 88,
"alpha_frac": 0.7281669151,
"autogenerated": false,
"ratio": 2.82169... |
"""All constants related to the ZHA component."""
import enum
import logging
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR
from homeassistant.components.cover import DOMAIN as COVER
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
from homeassistant.components.f... | {
"repo_name": "Teagan42/home-assistant",
"path": "homeassistant/components/zha/core/const.py",
"copies": "1",
"size": "7209",
"license": "apache-2.0",
"hash": 8451634478293702000,
"line_mean": 28.7892561983,
"line_max": 85,
"alpha_frac": 0.7439311971,
"autogenerated": false,
"ratio": 2.7101503759... |
"""All constants related to the ZHA component."""
import enum
import logging
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
from homeassistant.components.fan import DOMAIN as FAN
from homeassistant.components.light... | {
"repo_name": "jabesq/home-assistant",
"path": "homeassistant/components/zha/core/const.py",
"copies": "1",
"size": "5046",
"license": "apache-2.0",
"hash": 6951462692944911000,
"line_mean": 26.5737704918,
"line_max": 76,
"alpha_frac": 0.7063020214,
"autogenerated": false,
"ratio": 2.883428571428... |
"""All constants related to the ZHA component."""
import enum
DOMAIN = 'zha'
BAUD_RATES = [
2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000, 256000
]
DATA_ZHA = 'zha'
DATA_ZHA_CONFIG = 'config'
DATA_ZHA_BRIDGE_ID = 'zha_bridge_id'
DATA_ZHA_RADIO = 'zha_radio'
DATA_ZHA_DISPATCHERS = 'zha_dispatchers'... | {
"repo_name": "nugget/home-assistant",
"path": "homeassistant/components/zha/core/const.py",
"copies": "1",
"size": "3834",
"license": "apache-2.0",
"hash": 2523232175872065000,
"line_mean": 25.8111888112,
"line_max": 72,
"alpha_frac": 0.6841418884,
"autogenerated": false,
"ratio": 2.861194029850... |
"""All constants related to the ZHA component."""
DEVICE_CLASS = {}
SINGLE_CLUSTER_DEVICE_CLASS = {}
COMPONENT_CLUSTERS = {}
def populate_data():
"""Populate data using constants from bellows.
These cannot be module level, as importing bellows must be done in a
in a function.
"""
from bellows.zi... | {
"repo_name": "LinuxChristian/home-assistant",
"path": "homeassistant/components/zha/const.py",
"copies": "9",
"size": "1965",
"license": "apache-2.0",
"hash": -6817887734954338000,
"line_mean": 36.7884615385,
"line_max": 72,
"alpha_frac": 0.6524173028,
"autogenerated": false,
"ratio": 3.40554592... |
"""All constants related to the ZHA component."""
DEVICE_CLASS = {}
SINGLE_INPUT_CLUSTER_DEVICE_CLASS = {}
SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = {}
COMPONENT_CLUSTERS = {}
def populate_data():
"""Populate data using constants from bellows.
These cannot be module level, as importing bellows must be done in a
... | {
"repo_name": "persandstrom/home-assistant",
"path": "homeassistant/components/zha/const.py",
"copies": "2",
"size": "2895",
"license": "apache-2.0",
"hash": -3537158673797231600,
"line_mean": 40.9565217391,
"line_max": 72,
"alpha_frac": 0.6670120898,
"autogenerated": false,
"ratio": 3.4058823529... |
"""All constants related to the ZHA component."""
DEVICE_CLASS = {}
SINGLE_INPUT_CLUSTER_DEVICE_CLASS = {}
SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS = {}
CUSTOM_CLUSTER_MAPPINGS = {}
COMPONENT_CLUSTERS = {}
def populate_data():
"""Populate data using constants from bellows.
These cannot be module level, as importi... | {
"repo_name": "aronsky/home-assistant",
"path": "homeassistant/components/zha/const.py",
"copies": "2",
"size": "3232",
"license": "apache-2.0",
"hash": -8868122887720390000,
"line_mean": 40.974025974,
"line_max": 73,
"alpha_frac": 0.6729579208,
"autogenerated": false,
"ratio": 3.4493062966915686... |
__all__ = ('Consts',)
class Consts(object):
const_name_to_obj_name = staticmethod(lambda const_name: const_name.lower())
obj_name_to_const_name = staticmethod(lambda const_name: const_name.upper())
def __init__(self, choice=lambda x: x.label, **consts):
"""
:param choice: optional functio... | {
"repo_name": "glowka/const_choice",
"path": "const_choice/consts.py",
"copies": "1",
"size": "4271",
"license": "mit",
"hash": 8841040863426050000,
"line_mean": 37.1339285714,
"line_max": 115,
"alpha_frac": 0.5834699134,
"autogenerated": false,
"ratio": 3.896897810218978,
"config_test": false,... |
__all__ = ['ContactList']
import random
from contact import Contact
from print_colors import PrintColors
class ContactList(object):
def __init__(self):
self.items = []
self.items_id_map = {}
self.items_raddr_map = {}
def __len__(self):
return len(self.items)
def __iter__... | {
"repo_name": "mtasic85/routingtable",
"path": "contact_list.py",
"copies": "1",
"size": "2632",
"license": "mit",
"hash": 3009064387989034000,
"line_mean": 25.5858585859,
"line_max": 87,
"alpha_frac": 0.5262158055,
"autogenerated": false,
"ratio": 3.6759776536312847,
"config_test": false,
"h... |
__all__ = ['Contact']
class Contact(object):
def __init__(self, id=None, local_host=None, local_port=None, remote_host=None, remote_port=None, bootstrap=False, version=None):
self.id = id
self.local_host = local_host
self.local_port = local_port
self.remote_host = remote_host
... | {
"repo_name": "mtasic85/routingtable",
"path": "contact.py",
"copies": "1",
"size": "1059",
"license": "mit",
"hash": 1614035871938475800,
"line_mean": 31.0909090909,
"line_max": 133,
"alpha_frac": 0.5212464589,
"autogenerated": false,
"ratio": 3.922222222222222,
"config_test": false,
"has_no... |
__all__ = ["Container"]
from typing import List, Iterator, Dict, Optional, Union, Any, Tuple, Iterable
import copy
import os
import tempfile
import docker
import attr
from .bug import Bug
def _convert_tools(tools: Iterable[str]) -> Tuple[str, ...]:
return tuple(tools)
@attr.s(frozen=True)
class Container(obj... | {
"repo_name": "ChrisTimperley/AutomatedRepairBenchmarks.c",
"path": "bugzoo/core/container.py",
"copies": "3",
"size": "1325",
"license": "mit",
"hash": -4440814756706547700,
"line_mean": 23.537037037,
"line_max": 78,
"alpha_frac": 0.6,
"autogenerated": false,
"ratio": 3.8629737609329444,
"conf... |
__all__ = ["container", "service", "utils", "cli"]
LOCAL_ENV=".maestro"
GLOBAL_ENV="/var/lib/maestro"
# Maintain a list of environments on disk
# By default an environemnt is created in .maestro unless -g is specified to make it global.
# Global enviroments are stored in /var/lib/maestro. Permission setting will... | {
"repo_name": "toscanini/maestro",
"path": "maestro/__init__.py",
"copies": "2",
"size": "1236",
"license": "mit",
"hash": -4921311463823477000,
"line_mean": 30.6923076923,
"line_max": 104,
"alpha_frac": 0.7402912621,
"autogenerated": false,
"ratio": 4.204081632653061,
"config_test": false,
"... |
__all__ = ('ContentCoding', 'Request', 'StreamResponse', 'Response')
import asyncio
import binascii
import cgi
import collections
import datetime
import http.cookies
import io
import json
import math
import time
import warnings
import enum
from email.utils import parsedate
from types import MappingProxyType
from url... | {
"repo_name": "alexsdutton/aiohttp",
"path": "aiohttp/web_reqrep.py",
"copies": "4",
"size": "23996",
"license": "apache-2.0",
"hash": 759236743468634800,
"line_mean": 30.2855280313,
"line_max": 91,
"alpha_frac": 0.5589681614,
"autogenerated": false,
"ratio": 4.394871794871795,
"config_test": f... |
# All content provided by the loader
# must come from canonical sources
# found in the implementation of this server interface
# (within src/interfacing/ogs/)
# This module should not create *any* original content
# other than the loader
# Specifications of the keys the loader should provide
# can be found in src/in... | {
"repo_name": "juanchodepisa/sbtk",
"path": "SBTK_League_Helper/src/interfacing/ogs/loaders.py",
"copies": "1",
"size": "1730",
"license": "mit",
"hash": 1847776373533966600,
"line_mean": 29.9107142857,
"line_max": 87,
"alpha_frac": 0.6924855491,
"autogenerated": false,
"ratio": 4.158653846153846... |
__all__ = ['contHSRA']
import numpy as np
def contHSRA(wavelength, units='frequency'):
"""
Return the continuum spectrum of the HSRA model, obtained as a 3rd degree polynomial fit. This gives
a maximum error of 0.125%
Args:
wavelength (float): wavelength in Angstrom
units (str, op... | {
"repo_name": "aasensio/pyiacsun",
"path": "pyiacsun/util/contHSRA.py",
"copies": "1",
"size": "2161",
"license": "mit",
"hash": 598044820808124500,
"line_mean": 32.2615384615,
"line_max": 104,
"alpha_frac": 0.6122165664,
"autogenerated": false,
"ratio": 2.756377551020408,
"config_test": false,... |
__all__ = ('convert', 'default', 'round_units', 'decompose')
from .form import *
import cbpos
logger = cbpos.get_logger(__name__)
def convert(price_in_src, src, dst):
if price_in_src == 0:
return 0
if src == dst:
return price_in_src
logger.debug(u'Converting {} from {} to {}'.fo... | {
"repo_name": "coinbox/coinbox-mod-currency",
"path": "cbmod/currency/controllers/__init__.py",
"copies": "1",
"size": "1717",
"license": "mit",
"hash": -2734892821208616000,
"line_mean": 29.1228070175,
"line_max": 125,
"alpha_frac": 0.632498544,
"autogenerated": false,
"ratio": 3.59958071278826,... |
__all__ = ['convex_hull_image', 'convex_hull_object']
import numpy as np
from ..measure import grid_points_in_poly
from ._convex_hull import possible_hull
from ..measure._label import label
from ..util import unique_rows
def convex_hull_image(image):
"""Compute the convex hull image of a binary image.
The c... | {
"repo_name": "oew1v07/scikit-image",
"path": "skimage/morphology/convex_hull.py",
"copies": "18",
"size": "3680",
"license": "bsd-3-clause",
"hash": 5027189214484255000,
"line_mean": 29.9243697479,
"line_max": 96,
"alpha_frac": 0.6429347826,
"autogenerated": false,
"ratio": 3.691073219658977,
... |
__all__ = ['convex_hull_image', 'convex_hull_object']
import numpy as np
from ._pnpoly import grid_points_inside_poly
from ._convex_hull import possible_hull
from ..measure._label import label
from skimage.util import unique_rows
def convex_hull_image(image):
"""Compute the convex hull image of a binary image.
... | {
"repo_name": "SamHames/scikit-image",
"path": "skimage/morphology/convex_hull.py",
"copies": "1",
"size": "3693",
"license": "bsd-3-clause",
"hash": 7817687768553569000,
"line_mean": 30.0336134454,
"line_max": 96,
"alpha_frac": 0.6444624966,
"autogenerated": false,
"ratio": 3.6893106893106893,
... |
__all__ = ['convex_hull_image', 'convex_hull_object']
import numpy as np
from ._pnpoly import grid_points_inside_poly
from ._convex_hull import possible_hull
from skimage.morphology import label
from skimage.util import unique_rows
def convex_hull_image(image):
"""Compute the convex hull image of a binary image.... | {
"repo_name": "chintak/scikit-image",
"path": "skimage/morphology/convex_hull.py",
"copies": "1",
"size": "3695",
"license": "bsd-3-clause",
"hash": -4297090808601260500,
"line_mean": 30.0504201681,
"line_max": 96,
"alpha_frac": 0.6454668471,
"autogenerated": false,
"ratio": 3.6839481555334,
"c... |
__all__ = ['convex_hull_image']
import numpy as np
from ._pnpoly import points_inside_poly, grid_points_inside_poly
from ._convex_hull import possible_hull
def convex_hull_image(image):
"""Compute the convex hull image of a binary image.
The convex hull is the set of pixels included in the smallest convex
... | {
"repo_name": "emmanuelle/scikits.image",
"path": "skimage/morphology/convex_hull.py",
"copies": "2",
"size": "2032",
"license": "bsd-3-clause",
"hash": -2243648198975040800,
"line_mean": 29.7878787879,
"line_max": 96,
"alpha_frac": 0.6220472441,
"autogenerated": false,
"ratio": 3.571177504393673... |
__all__ = ['cooc_simple', 'cooc_advanced',
'tfidf_unweighted', 'tfidf_unweighted',
'cosine', 'pearson', 'leave_top_n']
import math
import numpy as np
from scipy import sparse
np.seterr(all='ignore',invalid='ignore')
#returns dense matrix: [x,y] = number of users rated both item x and item y
de... | {
"repo_name": "ksavenkov/recsys-001",
"path": "recsys/score.py",
"copies": "1",
"size": "17713",
"license": "mit",
"hash": 1650863023513355500,
"line_mean": 51.8746268657,
"line_max": 122,
"alpha_frac": 0.6218596511,
"autogenerated": false,
"ratio": 3.613423092615259,
"config_test": false,
"h... |
__all__ = ["CookieTracker", "parse_cookies"]
from .response_objects import Cookie
class CookieTracker:
"""
Class for holding cookies in sessions, adding statefullness to
the otherwise stateless general http method functions.
"""
def __init__(self):
self.domain_dict = {}
def get_add... | {
"repo_name": "theelous3/asks",
"path": "asks/cookie_utils.py",
"copies": "1",
"size": "2308",
"license": "mit",
"hash": -961789923268345000,
"line_mean": 31.5070422535,
"line_max": 69,
"alpha_frac": 0.5394280763,
"autogenerated": false,
"ratio": 4.234862385321101,
"config_test": false,
"has_... |
__all__ = ('Coord', 'TileMap')
from collections import defaultdict, namedtuple
from filters import is_tile
class TileMapStorage(object):
def __init__(self, width, height):
self.width = width
self.height = height
self.tiles = []
for y in range(self.height):
self.tiles.ap... | {
"repo_name": "adurdin/platformgen",
"path": "tilemap.py",
"copies": "1",
"size": "9181",
"license": "mit",
"hash": -6565937783902923000,
"line_mean": 32.1444043321,
"line_max": 102,
"alpha_frac": 0.5446029844,
"autogenerated": false,
"ratio": 3.6606858054226477,
"config_test": false,
"has_no... |
__all__ = ['copyfileobj']
import shutil
try:
from fadvise import posix_fadvise, POSIX_FADV_DONTNEED
def copyfileobj(fsrc, fdst, length=16*1024, advise_after=1024*1024):
"""
Reimplementation of shutil.copyfileobj that advises the OS to remove
parts of the source file from the OS's cac... | {
"repo_name": "ish/formish",
"path": "formish/_copyfile.py",
"copies": "1",
"size": "1533",
"license": "bsd-3-clause",
"hash": 4427966937457355000,
"line_mean": 35.5,
"line_max": 79,
"alpha_frac": 0.6040443575,
"autogenerated": false,
"ratio": 3.9612403100775193,
"config_test": false,
"has_no... |
__all__ = ["Core"]
from aioorm import AioDbFactory
class Core:
def __init__(self, app=None):
self.sqldatabases = {}
if app:
self.init_app(app)
else:
pass
def init_app(self, app):
if app.config.SQLDBURLS and isinstance(app.config.SQLDBURLS, dict):
... | {
"repo_name": "Sanic-Extensions/sanic-aioorm",
"path": "sanic_aioorm/core.py",
"copies": "1",
"size": "1854",
"license": "mit",
"hash": -4662702033595761000,
"line_mean": 32.3090909091,
"line_max": 92,
"alpha_frac": 0.5562227074,
"autogenerated": false,
"ratio": 3.906183368869936,
"config_test"... |
__all__ = 'coroutine', 'iscoroutinefunction', 'iscoroutine'
import collections.abc
import functools
import inspect
import os
import sys
import traceback
import types
import warnings
from . import base_futures
from . import constants
from . import format_helpers
from .log import logger
def _is_debug_mode():
# If... | {
"repo_name": "batermj/algorithm-challenger",
"path": "code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/asyncio/coroutines.py",
"copies": "22",
"size": "8797",
"license": "apache-2.0",
"hash": -3938871364576076300,
"line_mean": 31.7026022305,
"line_max": 99,
"alpha_f... |
__all__ = ['coroutine',
'iscoroutinefunction', 'iscoroutine',
'From', 'Return']
import functools
import inspect
import opcode
import os
import sys
import textwrap
import traceback
import types
from . import compat
from . import events
from . import futures
from .log import logger
# Opcode of "... | {
"repo_name": "haypo/trollius",
"path": "trollius/coroutines.py",
"copies": "1",
"size": "16296",
"license": "apache-2.0",
"hash": -6516959371329543000,
"line_mean": 31.8548387097,
"line_max": 79,
"alpha_frac": 0.5674398625,
"autogenerated": false,
"ratio": 4.1795332136445245,
"config_test": fa... |
__all__ = ['coroutine',
'iscoroutinefunction', 'iscoroutine']
import functools
import inspect
import opcode
import os
import sys
import traceback
import types
from ActualVim.lib.asyncio_inc import compat
from . import events
from . import futures
from .log import logger
# Opcode of "yield from" instructi... | {
"repo_name": "lunixbochs/actualvim",
"path": "lib/asyncio/coroutines.py",
"copies": "1",
"size": "10741",
"license": "mit",
"hash": 1032645758567754900,
"line_mean": 30.2238372093,
"line_max": 79,
"alpha_frac": 0.5806721907,
"autogenerated": false,
"ratio": 3.881821467293097,
"config_test": fa... |
__all__ = ['coroutine',
'iscoroutinefunction', 'iscoroutine']
import functools
import inspect
import opcode
import os
import sys
import traceback
import types
from . import compat
from . import events
from . import base_futures
from .log import logger
# Opcode of "yield from" instruction
_YIELD_FROM = op... | {
"repo_name": "yotchang4s/cafebabepy",
"path": "src/main/python/asyncio/coroutines.py",
"copies": "6",
"size": "10727",
"license": "bsd-3-clause",
"hash": 2107089602893681700,
"line_mean": 30.1831395349,
"line_max": 79,
"alpha_frac": 0.5801249184,
"autogenerated": false,
"ratio": 3.88377986965966... |
__all__ = ['coroutine',
'iscoroutinefunction', 'iscoroutine']
import functools
import inspect
import opcode
import os
import sys
import traceback
import types
from . import events
from . import futures
from .log import logger
_PY35 = sys.version_info >= (3, 5)
# Opcode of "yield from" instruction
_YIEL... | {
"repo_name": "munyirik/python",
"path": "cpython/Lib/asyncio/coroutines.py",
"copies": "3",
"size": "8669",
"license": "bsd-3-clause",
"hash": 4181148479544993000,
"line_mean": 30.5236363636,
"line_max": 79,
"alpha_frac": 0.5910716346,
"autogenerated": false,
"ratio": 3.8494671403197156,
"conf... |
__all__ = ['correlate']
import os
import numpy
import math
import pycuda.driver as cuda
import pycuda.autoinit
import pycuda.gpuarray
from pycuda.compiler import SourceModule
from .utils import gpu_func
from .enums import CorrelationModes, MAX_BLOCK_SIZE
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
CACHE_DIR... | {
"repo_name": "Captricity/sciguppy",
"path": "sciguppy/correlate.py",
"copies": "1",
"size": "1871",
"license": "mit",
"hash": 2100908676390892800,
"line_mean": 36.42,
"line_max": 98,
"alpha_frac": 0.6600748263,
"autogenerated": false,
"ratio": 2.6204481792717087,
"config_test": false,
"has_n... |
__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict']
# For bootstrapping reasons, the collection ABCs are defined in _abcoll.py.
# They should however be considered an integral part of collections.py.
from _abcoll import *
import _abcoll
__all__ += _abcoll.__all__
from _collections import deque, ... | {
"repo_name": "nzavagli/UnrealPy",
"path": "UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/Python-2.7.10/Lib/collections.py",
"copies": "23",
"size": "27261",
"license": "mit",
"hash": -2611871443919341600,
"line_mean": 36.3438356164,
"line_max": 99,
"alpha_f... |
__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict']
# For bootstrapping reasons, the collection ABCs are defined in _abcoll.py.
# They should however be considered an integral part of collections.py.
from _abcoll import *
import _abcoll
__all__ += _abcoll.__all__
from _collections import ... | {
"repo_name": "kleientertainment/ds_mod_tools",
"path": "pkg/win32/Python27/Lib/collections.py",
"copies": "2",
"size": "26576",
"license": "mit",
"hash": -4664490877256699000,
"line_mean": 36.3492063492,
"line_max": 99,
"alpha_frac": 0.5263019266,
"autogenerated": false,
"ratio": 4.2996278919268... |
__all__ = ['CounterHashingVectorizer', 'ListHashingVectorizer', 'ListCountVectorizer', 'ListNGramAnalyzer', 'ListTfidfVectorizer', 'SpaceTokenizerTransformer', '_list_analyzer']
import logging
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import HashingVectorizer
fro... | {
"repo_name": "skylander86/ycml",
"path": "ycml/transformers/text.py",
"copies": "1",
"size": "3736",
"license": "apache-2.0",
"hash": -4803786683296372000,
"line_mean": 29.1290322581,
"line_max": 177,
"alpha_frac": 0.6445396146,
"autogenerated": false,
"ratio": 3.8083588175331293,
"config_test... |
__all__ = ['Counter', 'OrderedDict']
# The code below is taken from the following ActiveState recipe:
#
# http://code.activestate.com/recipes/576611-counter-class/
#
# and was licensed under the MIT license.
try:
from collections import Counter
except ImportError:
from operator import itemgetter
from... | {
"repo_name": "JudoWill/glue",
"path": "glue/compat/collections.py",
"copies": "1",
"size": "11619",
"license": "bsd-3-clause",
"hash": 8955226114177224000,
"line_mean": 33.6835820896,
"line_max": 89,
"alpha_frac": 0.5083053619,
"autogenerated": false,
"ratio": 4.576211106734935,
"config_test":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.