text stringlengths 0 1.05M | meta dict |
|---|---|
__all__ = ["get_centroids"]
import numpy as np
from .label_clusters import label_clusters
from .label_stats import label_stats
def get_centroids(image, clustparam=0):
"""
Reduces a variate/statistical/network image to a set of centroids
describing the center of each stand-alone non-zero component in the... | {
"repo_name": "ANTsX/ANTsPy",
"path": "ants/utils/get_centroids.py",
"copies": "1",
"size": "1500",
"license": "apache-2.0",
"hash": -5582113283343429000,
"line_mean": 24.4237288136,
"line_max": 77,
"alpha_frac": 0.614,
"autogenerated": false,
"ratio": 3.51288056206089,
"config_test": false,
... |
__all__ = ["get_config", "get_defaults", "dump_defaults", "get_imagecrawler", "parse_yaml_file",
"ImageCrawlerSetupError"]
from os.path import dirname, join as path_join, realpath
from typing import Any, Dict, Optional
from nichtparasoup.core.imagecrawler import BaseImageCrawler
_SCHEMA_FILE = realpath(pa... | {
"repo_name": "k4cg/nichtparasoup",
"path": "nichtparasoup/config/__init__.py",
"copies": "1",
"size": "2764",
"license": "mit",
"hash": -1896548258880934700,
"line_mean": 35.8533333333,
"line_max": 118,
"alpha_frac": 0.6751085384,
"autogenerated": false,
"ratio": 3.530012771392082,
"config_tes... |
__all__ = ['get_config_vars', 'get_path']
try:
# Python 2.7 or >=3.2
from sysconfig import get_config_vars, get_path
except ImportError:
from distutils.sysconfig import get_config_vars, get_python_lib
def get_path(name):
if name not in ('platlib', 'purelib'):
raise ValueError("Name ... | {
"repo_name": "SurfasJones/djcmsrc3",
"path": "venv/lib/python2.7/site-packages/setuptools/py31compat.py",
"copies": "10",
"size": "1184",
"license": "mit",
"hash": -6427629324895659000,
"line_mean": 31,
"line_max": 73,
"alpha_frac": 0.6021959459,
"autogenerated": false,
"ratio": 4.36900369003690... |
__all__ = ['get_current_request']
import logging
import sys
from typing import Optional, Union
from starlette.requests import Request
from starlette.types import Receive, Scope
log = logging.getLogger(__name__)
if sys.version_info[:2] == (3, 6):
# Backport PEP 567
try:
import aiocontextvars
exce... | {
"repo_name": "rollbar/pyrollbar",
"path": "rollbar/contrib/starlette/requests.py",
"copies": "1",
"size": "1825",
"license": "mit",
"hash": 7898874865958705000,
"line_mean": 22.7012987013,
"line_max": 78,
"alpha_frac": 0.6471232877,
"autogenerated": false,
"ratio": 4.176201372997712,
"config_t... |
__all__ = ["get_day_boxoffice"]
import tushare as ts
from flask import json
TRANS = {"AvgPrice": "平均票价",
"AvpPeoPle": "场均人次",
"BoxOffice": "单日票房(万)",
"BoxOffice_Up": "环比变化 (%)",
"IRank": "排名",
"MovieDay": "上映天数",
"MovieName": "影片名",
"SumBoxOffice": "累计票房... | {
"repo_name": "FinaceInfo/Chinese-box-office-info",
"path": "app/boxoffice/day_boxoffice.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": -2256031181057465900,
"line_mean": 31.21875,
"line_max": 96,
"alpha_frac": 0.5053346266,
"autogenerated": false,
"ratio": 2.801630434782609,
"co... |
__all__ = ["get_day_cinema"]
import tushare as ts
from flask import json
TRANS = {"Attendance": "上座率",
"AvgPeople": "场均人次",
"CinemaName": "影院名称",
"RowNum": "排名",
"TodayAudienceCount": "当日观众人数",
"TodayBox": "当日票房",
"TodayShowCount": "当日场次",
"price": "场均票价... | {
"repo_name": "FinaceInfo/Chinese-box-office-info",
"path": "app/boxoffice/day_cinema.py",
"copies": "1",
"size": "1257",
"license": "mit",
"hash": -1355990365481550600,
"line_mean": 29.4871794872,
"line_max": 81,
"alpha_frac": 0.4911690496,
"autogenerated": false,
"ratio": 3.056555269922879,
"... |
__all__ = ['getDpi', 'getContext', 'getPreset', 'getScreenContext']
import matplotlib as mpl
from math import sqrt
def getDpi():
return 72.27
_screenDpi = 96
_screenFontSize = 12
_goldenRatio = (1 + sqrt(5)) / 2
_presets = {
'revtex12-single': (468, 10.95, None), # Single-column revtex; 12pt.
'mnras': (2... | {
"repo_name": "willvousden/mpltex",
"path": "mpltex/mpltex.py",
"copies": "1",
"size": "3207",
"license": "mit",
"hash": 8623044847310524000,
"line_mean": 28.9719626168,
"line_max": 91,
"alpha_frac": 0.6239476146,
"autogenerated": false,
"ratio": 3.4483870967741934,
"config_test": false,
"has... |
__all__ = ["GET_FIRST_CLIENT_RECT", \
"GET_LOCATION_IN_VIEW", \
"GET_PAGE_ZOOM", \
"IS_ELEMENT_CLICKABLE", \
"TOUCH_SINGLE_TAP", \
"CLEAR", \
"CLEAR_LOCAL_STORAGE", \
"CLEAR_SESSION_STORAGE", \
"CLICK", \
"EXECUTE_ASYNC_S... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "third_party/atoms.py",
"copies": "1",
"size": "417522",
"license": "bsd-3-clause",
"hash": 1296076906491238000,
"line_mean": 76.404894327,
"line_max": 78,
"alpha_frac": 0.5750571227,
"autogenerated": false,
"ratio": 2.19697543726... |
__all__ = ['get', 'get_pinyin', 'get_initial']
import os
# init pinyin dict
pinyin_dict = {}
dat = os.path.join(os.path.dirname(__file__), "Mandarin.dat")
with open(dat) as f:
for line in f:
k, v = line.strip().split('\t')
pinyin_dict[k] = v.lower().split(" ")[0][:-1]
from ._compat import u
de... | {
"repo_name": "vsooda/pinyin",
"path": "pinyin/pinyin.py",
"copies": "1",
"size": "1108",
"license": "mit",
"hash": -5194804949830055000,
"line_mean": 24.1818181818,
"line_max": 75,
"alpha_frac": 0.619133574,
"autogenerated": false,
"ratio": 3.1839080459770117,
"config_test": false,
"has_no_k... |
__all__ = ['getMainBranch', 'a2z', 'z2a', 'readHlist', 'SimulationAnalysis', \
'TargetHalo', 'getDistance', 'iter_grouped_subhalos_indices']
import os
import re
import math
import gzip
from itertools import izip
from urllib import urlretrieve
from collections import deque
import numpy as np
_islistlike = lamb... | {
"repo_name": "manodeep/yymao-helpers",
"path": "helpers/SimulationAnalysis.py",
"copies": "1",
"size": "18602",
"license": "mit",
"hash": 6404298002456840000,
"line_mean": 36.2785571142,
"line_max": 136,
"alpha_frac": 0.5173637243,
"autogenerated": false,
"ratio": 3.5724985596312657,
"config_t... |
__all__ = ["get_month_boxoffice"]
import tushare as ts
from flask import json
TRANS = {"Irank": "排名",
"MovieName": '电影名称',
"WomIndex": '口碑指数',
"avgboxoffice": '平均票价',
"avgshowcount": "场均人次",
"box_pro": '月度占比',
"boxoffice": "单月票房(万)",
"days": "月内天数",
... | {
"repo_name": "FinaceInfo/Chinese-box-office-info",
"path": "app/boxoffice/month_boxoffice.py",
"copies": "1",
"size": "1101",
"license": "mit",
"hash": -8501913709367740000,
"line_mean": 30.2424242424,
"line_max": 96,
"alpha_frac": 0.5101842871,
"autogenerated": false,
"ratio": 2.971181556195965... |
__all__ = ['getMUSICregion']
from SimulationAnalysis import readHlist
from readGadgetSnapshot import readGadgetSnapshot
from findLagrangianVolume import findLagrangianVolume
_fmt = lambda a: ', '.join(map(str, a))
def getMUSICregion(target_id, rvir_mult, hlist, snapshot_prefix, ic_prefix,\
edges_file=None):
... | {
"repo_name": "manodeep/yymao-helpers",
"path": "helpers/getMUSICregion.py",
"copies": "1",
"size": "1047",
"license": "mit",
"hash": -431601617417047700,
"line_mean": 31.71875,
"line_max": 76,
"alpha_frac": 0.6160458453,
"autogenerated": false,
"ratio": 2.982905982905983,
"config_test": false,... |
__all__ = ["get_netloc_port", "requote_uri", "timeout_manager"]
from urllib.parse import quote
from functools import wraps
from anyio import fail_after
from .errors import RequestTimeout
async def timeout_manager(timeout, coro, *args):
try:
async with fail_after(timeout):
return await coro... | {
"repo_name": "theelous3/asks",
"path": "asks/utils.py",
"copies": "1",
"size": "2460",
"license": "mit",
"hash": 7855551274579279000,
"line_mean": 27.6046511628,
"line_max": 78,
"alpha_frac": 0.5922764228,
"autogenerated": false,
"ratio": 3.813953488372093,
"config_test": false,
"has_no_keyw... |
__all__ = ['getSDSSid']
import re
from urllib import urlopen
_re1 = re.compile('http://skyserver\.sdss3\.org/dr8/en/tools/explore/obj\.asp\?(ra=[+-]?\d+\.\d+)&(dec=[+-]?\d+\.\d+)')
_re2 = re.compile('<td align=\'center\' width=\'33%\' class=\'t\'>(\d+)</td>')
_url1 = 'http://www.nsatlas.org/getAtlas.html?search=ns... | {
"repo_name": "manodeep/yymao-helpers",
"path": "helpers/getSDSSid.py",
"copies": "1",
"size": "1685",
"license": "mit",
"hash": -2529281338476514300,
"line_mean": 34.1041666667,
"line_max": 123,
"alpha_frac": 0.5863501484,
"autogenerated": false,
"ratio": 3.0748175182481754,
"config_test": fal... |
__all__ = ['getSnapshotEdges', 'getParticlesWithinSphere']
import os
import numpy as np
from fast3tree import fast3tree
from readGadgetSnapshot import readGadgetSnapshot
def getSnapshotEdges(snapshot_prefix, output_file=None, single_type=-1, lgadget=False):
print "[Info] Calculating the edges of each snapshot file... | {
"repo_name": "manodeep/yymao-helpers",
"path": "helpers/findSpheresInSnapshots.py",
"copies": "1",
"size": "5323",
"license": "mit",
"hash": -8954748401139274000,
"line_mean": 34.7248322148,
"line_max": 87,
"alpha_frac": 0.5540108961,
"autogenerated": false,
"ratio": 3.324797001873829,
"config... |
__all__ = ['get_statements', 'get_statements_for_paper',
'get_statements_by_hash', 'submit_curation']
from indra.util import clockit
from indra.statements import stmts_from_json, Complex, SelfModification, \
ActiveForm, Translocation, Conversion
from indra.sources.indra_db_rest.processor import IndraDB... | {
"repo_name": "johnbachman/belpy",
"path": "indra/sources/indra_db_rest/api.py",
"copies": "1",
"size": "16246",
"license": "mit",
"hash": -8000564772349501000,
"line_mean": 48.2303030303,
"line_max": 80,
"alpha_frac": 0.6649021298,
"autogenerated": false,
"ratio": 4.275263157894737,
"config_te... |
__all__ = ['get_valid_residue', 'activity_types',
'amino_acids', 'amino_acids_reverse',
'InvalidLocationError', 'InvalidResidueError']
import os
def get_valid_residue(residue):
"""Check if the given string represents a valid amino acid residue."""
if residue is not None and amino_acids.... | {
"repo_name": "bgyori/indra",
"path": "indra/statements/resources.py",
"copies": "4",
"size": "1860",
"license": "bsd-2-clause",
"hash": -2829514765963313700,
"line_mean": 32.2142857143,
"line_max": 79,
"alpha_frac": 0.6091397849,
"autogenerated": false,
"ratio": 3.3214285714285716,
"config_tes... |
__all__ = ["GitHubHooks"]
from flask import request, Response
from .base import Hook
class GitHubHooks(Hook):
def ok(self):
return Response()
def deploy(self, app, env):
payload = request.get_json()
event = request.headers.get("X-GitHub-Event")
if event != "push":
... | {
"repo_name": "getsentry/freight",
"path": "freight/hooks/github.py",
"copies": "1",
"size": "1335",
"license": "apache-2.0",
"hash": 1515199527182206500,
"line_mean": 26.2448979592,
"line_max": 70,
"alpha_frac": 0.5243445693,
"autogenerated": false,
"ratio": 4.145962732919255,
"config_test": f... |
__all__ = ["GithubNotifier"]
from flask import current_app
from freight import http
from freight.models import App, Task, TaskStatus
from .base import Notifier, NotifierEvent
class GithubNotifier(Notifier):
def get_options(self):
return {"repo": {"required": True}, "api_root": {"required": False}}
... | {
"repo_name": "getsentry/freight",
"path": "freight/notifiers/github.py",
"copies": "1",
"size": "2151",
"license": "apache-2.0",
"hash": -6391701396802450000,
"line_mean": 33.6935483871,
"line_max": 87,
"alpha_frac": 0.5908879591,
"autogenerated": false,
"ratio": 4.043233082706767,
"config_tes... |
__all__ = ["GitVcs"]
import os
from urllib.parse import urlparse
from .base import Vcs, CommandError, UnknownRevision
class GitVcs(Vcs):
binary_path = "git"
def get_default_env(self):
return {"GIT_SSH": self.ssh_connect_path}
def get_default_revision(self):
return "master"
@prope... | {
"repo_name": "getsentry/freight",
"path": "freight/vcs/git.py",
"copies": "1",
"size": "1907",
"license": "apache-2.0",
"hash": 3918890006389340700,
"line_mean": 29.2698412698,
"line_max": 87,
"alpha_frac": 0.5359202937,
"autogenerated": false,
"ratio": 3.814,
"config_test": false,
"has_no_k... |
__all__ = ["GO", "riboseq", "rnaseq", "general", 'which', 'qtools',
'mapping', 'annotations', 'expr_db', 'conservation']
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Utilities for dealing with processes.
"""
import os
def which(name, flags=os.X_OK):
"""
C... | {
"repo_name": "YeoLab/gscripts",
"path": "gscripts/__init__.py",
"copies": "1",
"size": "1715",
"license": "mit",
"hash": 4139222376335739400,
"line_mean": 30.7592592593,
"line_max": 79,
"alpha_frac": 0.6379008746,
"autogenerated": false,
"ratio": 3.6723768736616704,
"config_test": false,
"ha... |
__all__ = ['GotoLoiter', 'ArmDisarm']
import time
import geopy
import geopy.distance
from pymavlink import mavutil
from .sandbox import Sandbox
from .connection import CommandLong
from ..state import State
from ..environment import Environment
from ..valueRange import ContinuousValueRange, DiscreteValueRange
from ..... | {
"repo_name": "squaresLab/Houston",
"path": "houston/ardu/common.py",
"copies": "1",
"size": "2209",
"license": "mit",
"hash": -4949612154999521000,
"line_mean": 24.9882352941,
"line_max": 78,
"alpha_frac": 0.5753734722,
"autogenerated": false,
"ratio": 3.8551483420593367,
"config_test": false,... |
__all__ = ['GoTo']
import dronekit
import geopy.distance
from ..connection import CommandLong
from ...configuration import Configuration
from ...state import State
from ...environment import Environment
from ...command import Command, Parameter
from ...specification import Idle, Specification
from ...valueRange impor... | {
"repo_name": "squaresLab/Houston",
"path": "houston/ardu/rover/goto.py",
"copies": "1",
"size": "1940",
"license": "mit",
"hash": 3088568571071058400,
"line_mean": 30.2903225806,
"line_max": 73,
"alpha_frac": 0.5706185567,
"autogenerated": false,
"ratio": 4.163090128755365,
"config_test": fals... |
__all__ = ['GoTo']
import random
import dronekit
import geopy
from pymavlink.mavutil import mavlink
from ..connection import CommandLong
from ..common import GotoLoiter
from ...connection import Message
from ...specification import Specification
from ...configuration import Configuration
from ...command import Comman... | {
"repo_name": "squaresLab/Houston",
"path": "houston/ardu/copter/goto.py",
"copies": "1",
"size": "3090",
"license": "mit",
"hash": 7724019581158283000,
"line_mean": 30.2121212121,
"line_max": 74,
"alpha_frac": 0.5650485437,
"autogenerated": false,
"ratio": 4.238683127572016,
"config_test": fal... |
__all__ = ["GP"]
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as optim
import logging
from scipy.linalg import cholesky, cho_solve
from copy import copy, deepcopy
from .ext import gp_c
logger = logging.getLogger("gp.gp")
DTYPE = np.float64
EPS = np.finfo(DTYPE).eps
MIN = np.log(np.exp2(... | {
"repo_name": "jhamrick/gaussian_processes",
"path": "gp/gp.py",
"copies": "1",
"size": "18238",
"license": "mit",
"hash": -7794982078190343000,
"line_mean": 25.0542857143,
"line_max": 311,
"alpha_frac": 0.5055378879,
"autogenerated": false,
"ratio": 3.6770161290322583,
"config_test": false,
... |
__all__ = ['GroundingMapper', 'load_grounding_map', 'default_grounding_map',
'default_agent_map', 'default_ignores', 'default_misgrounding_map',
'default_mapper', 'gm']
import os
import csv
import json
import logging
from copy import deepcopy
from indra.statements import Agent
from indra.databases... | {
"repo_name": "bgyori/indra",
"path": "indra/preassembler/grounding_mapper/mapper.py",
"copies": "3",
"size": "21810",
"license": "bsd-2-clause",
"hash": 4177120529789061000,
"line_mean": 41.1856866538,
"line_max": 80,
"alpha_frac": 0.5930765704,
"autogenerated": false,
"ratio": 4.144811858608894... |
__all__ = ['gt', 'lt', 'gte', 'lte', 'Condition']
class Condition(object):
"""This is a base class to represent a SQL filtering condition. These
can be used in a Query.filter clause to implement various equality
statements. For example, take the following query:
Select('person').filter(age=30)
... | {
"repo_name": "jmohr/conrad",
"path": "conrad/query/condition.py",
"copies": "1",
"size": "2852",
"license": "bsd-3-clause",
"hash": 1778318936059549000,
"line_mean": 35.1012658228,
"line_max": 76,
"alpha_frac": 0.696002805,
"autogenerated": false,
"ratio": 4.3944530046224966,
"config_test": fa... |
__all__ = ["GUID"]
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
"""
Platform-independent GUID type.
Uses Postgresql's UUID type, otherwise uses
CHAR(32), storing as stringified hex values.
"""
impl =... | {
"repo_name": "getsentry/zeus",
"path": "zeus/db/types/guid.py",
"copies": "1",
"size": "1134",
"license": "apache-2.0",
"hash": -1369357002260683000,
"line_mean": 21.68,
"line_max": 52,
"alpha_frac": 0.5784832451,
"autogenerated": false,
"ratio": 4.4296875,
"config_test": false,
"has_no_keyw... |
__all__ = ['GuiManager']
import string
from kivy.uix.relativelayout import RelativeLayout
from kivy.core.window import Window
from pocketthrone.entities.event import *
from pocketthrone.managers.eventmanager import EventManager
from pocketthrone.gui import *
from pocketthrone.gui.sidebar import SideBar
from pocketthr... | {
"repo_name": "herrschr/prey-game",
"path": "pocketthrone/managers/guimanager.py",
"copies": "2",
"size": "4769",
"license": "bsd-2-clause",
"hash": -7315537606431949000,
"line_mean": 31.4421768707,
"line_max": 123,
"alpha_frac": 0.7058083456,
"autogenerated": false,
"ratio": 3.1666666666666665,
... |
__all__ = ['guinieranalysis']
import os
import ipy_table
import matplotlib.pyplot as plt
import numpy as np
from IPython.core.getipython import get_ipython
from IPython.display import display
from .atsas import autorg, gnom, datgnom, shanum, datporod
from .io import getsascurve
from .utils import writemarkdown
def... | {
"repo_name": "awacha/credolib",
"path": "credolib/interpretation.py",
"copies": "1",
"size": "8006",
"license": "bsd-3-clause",
"hash": -3152037280334478000,
"line_mean": 48.7267080745,
"line_max": 120,
"alpha_frac": 0.55770672,
"autogenerated": false,
"ratio": 3.1669303797468356,
"config_test... |
__all__ = ['HaloAbundanceFunction', 'calc_number_densities', 'calc_number_densities_in_bins']
import numpy as np
def _to_float(x, default=np.nan, take_log=False):
try:
xf = float(x)
except (ValueError, TypeError):
return default
return np.log(xf) if take_log else xf
def calc_number_densiti... | {
"repo_name": "manodeep/yymao-abundancematching",
"path": "AbundanceMatching/HaloAbundanceFunction.py",
"copies": "1",
"size": "4246",
"license": "mit",
"hash": 9039384364462621000,
"line_mean": 30.2205882353,
"line_max": 96,
"alpha_frac": 0.5574658502,
"autogenerated": false,
"ratio": 3.48604269... |
"""All handlers for CtC projects."""
from google.appengine.api import users
from google.appengine.ext import ndb
from ctc.helpers import csrf
from ctc.helpers import templates
from ctc.models import collaborator as collaborator_model
from ctc.models import project as project_model
from ctc.models import user as user_... | {
"repo_name": "samking/code-the-change-projects",
"path": "ctc/handlers.py",
"copies": "1",
"size": "9519",
"license": "apache-2.0",
"hash": -822188518445125900,
"line_mean": 40.2077922078,
"line_max": 80,
"alpha_frac": 0.6478621704,
"autogenerated": false,
"ratio": 3.744689221085759,
"config_t... |
"""All handy, general utility functionality used throughout the package."""
import os
import os.path as osp
import sys
import fnmatch
import shutil
def load_module_path(path, name=None, remove_byte_version=False):
"""Load a python module source file python version aware."""
name = name if name else osp.split... | {
"repo_name": "mwort/modelmanager",
"path": "modelmanager/utils.py",
"copies": "1",
"size": "5762",
"license": "bsd-3-clause",
"hash": 7205272031292890000,
"line_mean": 32.8941176471,
"line_max": 78,
"alpha_frac": 0.5675112808,
"autogenerated": false,
"ratio": 4.0865248226950355,
"config_test":... |
# All harcoded (names, paths etc), refactor it if needed
sln_file = '''
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject\MyProject.vcx... | {
"repo_name": "mropert/conan",
"path": "conans/test/utils/visual_project_files.py",
"copies": "5",
"size": "11404",
"license": "mit",
"hash": 2123945521751548200,
"line_mean": 44.0750988142,
"line_max": 179,
"alpha_frac": 0.7218519818,
"autogenerated": false,
"ratio": 3.529557412565769,
"config... |
__all__ = ['HardwareSupportError', 'GLSLError', 'MAX_COLOR_ATTACHMENTS',
'require_extension', 'hardware_info']
from pyglet import gl
import pyglet.gl.gl_info as gli
import ctypes
MAX_COLOR_ATTACHMENTS = gl.GLint()
gl.glGetIntegerv(gl.GL_MAX_COLOR_ATTACHMENTS,
ctypes.byref(MAX_COLOR_ATTACHM... | {
"repo_name": "certik/scikits.gpu",
"path": "scikits/gpu/config.py",
"copies": "2",
"size": "1617",
"license": "mit",
"hash": -7016757183093346000,
"line_mean": 30.0961538462,
"line_max": 72,
"alpha_frac": 0.670995671,
"autogenerated": false,
"ratio": 3.43312101910828,
"config_test": false,
"... |
__all__ = ['HashCol']
import sqlobject.col
class DbHash:
""" Presents a comparison object for hashes, allowing plain text to be
automagically compared with the base content. """
def __init__( self, hash, hashMethod ):
self.hash = hash
self.hashMethod = hashMethod
def __cmp__( self, o... | {
"repo_name": "lightcode/SeriesWatcher",
"path": "serieswatcher/sqlobject/include/hashcol.py",
"copies": "4",
"size": "2140",
"license": "mit",
"hash": -1040658354955363100,
"line_mean": 33.5161290323,
"line_max": 84,
"alpha_frac": 0.6009345794,
"autogenerated": false,
"ratio": 4.083969465648855,... |
__all__ = ['HDO6104']
from auspex.log import logger
from .instrument import SCPIInstrument, StringCommand, FloatCommand, IntCommand, Command
import numpy as np
import time
class HDO6104(SCPIInstrument):
channel_enabled = Command(scpi_string="C{channel}:TRA",
additional_args=["channel"],value_map={True... | {
"repo_name": "BBN-Q/Auspex",
"path": "src/auspex/instruments/lecroy.py",
"copies": "1",
"size": "2020",
"license": "apache-2.0",
"hash": -374128563342368200,
"line_mean": 45.976744186,
"line_max": 127,
"alpha_frac": 0.6653465347,
"autogenerated": false,
"ratio": 3.3223684210526314,
"config_tes... |
__all__ = ["HeapSnapshotTaker"]
from devtools_event_listener import DevToolsEventListener
from status import *
from base.log import VLOG
# Take the heap snapshot.
class HeapSnapshotTaker(DevToolsEventListener):
def __init__(self, client):
self.client = client
self.client.AddListener(self)
self.snapshot... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "browser/heap_snapshot_taker.py",
"copies": "1",
"size": "3030",
"license": "bsd-3-clause",
"hash": 3854860914793223000,
"line_mean": 35.0714285714,
"line_max": 98,
"alpha_frac": 0.6623762376,
"autogenerated": false,
"ratio": 3.72... |
__all__ = ('HeapStorage',)
import struct
from pyoram.util.virtual_heap import SizedVirtualHeap
from pyoram.storage.block_storage import (BlockStorageInterface,
BlockStorageTypeFactory)
class HeapStorageInterface(object):
def __enter__(self):
return self
def ... | {
"repo_name": "ghackebeil/PyORAM",
"path": "src/pyoram/storage/heap_storage.py",
"copies": "1",
"size": "8257",
"license": "mit",
"hash": 692533584230819000,
"line_mean": 32.9794238683,
"line_max": 73,
"alpha_frac": 0.53130677,
"autogenerated": false,
"ratio": 4.489940184883088,
"config_test": ... |
__all__ = ['HelloWorldBinaryLabelsClassifier', 'HelloWorldMultiLabelsClassifier']
import numpy as np
from sklearn.svm import SVC
from ycml.classifiers import BinaryLabelsClassifier, MultiLabelsClassifier, MulticlassLabelsClassifier
class HelloWorldBinaryLabelsClassifier(BinaryLabelsClassifier):
def fit_binariz... | {
"repo_name": "skylander86/ycml",
"path": "helloworld/classifiers.py",
"copies": "1",
"size": "1936",
"license": "apache-2.0",
"hash": -2603075957997008400,
"line_mean": 32.3793103448,
"line_max": 102,
"alpha_frac": 0.6751033058,
"autogenerated": false,
"ratio": 3.4144620811287476,
"config_test... |
"""All helpers for the URL."""
import urllib2
from mimetypes import MimeTypes
from ..base import FORMAT
from ..exceptions import URLError
def check_url(url):
"""
Check if URL is accessible and what data format it is.
Parameters
----------
url : str
URL to check.
Returns
------... | {
"repo_name": "ExCiteS/geokey-webresources",
"path": "geokey_webresources/helpers/url_helpers.py",
"copies": "1",
"size": "1674",
"license": "mit",
"hash": 1982329427628254700,
"line_mean": 26.9,
"line_max": 77,
"alpha_frac": 0.5758661888,
"autogenerated": false,
"ratio": 4.405263157894737,
"co... |
__all__ = ['Hero']
class Hero(object):
'''Represents a hero in the game.
Attributes:
id (int): the hero's id.
name (string): the bot's name.
user_id (string): the bot's id (None in training mode).
elo (int): the bot's ELO (None in training mode).
crashed (bool): True if... | {
"repo_name": "renatopp/vindinium-python",
"path": "vindinium/models/hero.py",
"copies": "1",
"size": "1552",
"license": "mit",
"hash": -2982725426382311000,
"line_mean": 35.0930232558,
"line_max": 63,
"alpha_frac": 0.5128865979,
"autogenerated": false,
"ratio": 3.5596330275229358,
"config_test... |
__all__ = ["HostInfo"]
from panda3d.core import HashVal, Filename, PandaSystem, DocumentSpec, Ramfile
from panda3d.core import HTTPChannel, ConfigVariableInt
from panda3d import core
from direct.p3d.PackageInfo import PackageInfo
from direct.p3d.FileSpec import FileSpec
from direct.directnotify.DirectNotifyGlobal impo... | {
"repo_name": "mgracer48/panda3d",
"path": "direct/src/p3d/HostInfo.py",
"copies": "1",
"size": "30006",
"license": "bsd-3-clause",
"hash": -8872493868360692000,
"line_mean": 38.9547270306,
"line_max": 121,
"alpha_frac": 0.5731187096,
"autogenerated": false,
"ratio": 4.665837350334318,
"config_... |
__all__ = ['hough']
from itertools import izip
import numpy as np
def _hough(img, theta=None):
if img.ndim != 2:
raise ValueError('The input image must be 2-D')
if theta is None:
theta = np.linspace(-np.pi / 2, np.pi / 2, 180)
# compute the vertical bins (the distances)
d = np.ceil(n... | {
"repo_name": "GaelVaroquaux/scikits.image",
"path": "scikits/image/transform/hough_transform.py",
"copies": "1",
"size": "2790",
"license": "bsd-3-clause",
"hash": -4555680245915931000,
"line_mean": 24.8333333333,
"line_max": 62,
"alpha_frac": 0.5967741935,
"autogenerated": false,
"ratio": 3.613... |
__all__ = ['hough', 'probabilistic_hough']
from itertools import izip as zip
import numpy as np
from ._hough_transform import _probabilistic_hough
def _hough(img, theta=None):
if img.ndim != 2:
raise ValueError('The input image must be 2-D')
if theta is None:
theta = np.linspace(-np.pi / 2,... | {
"repo_name": "emmanuelle/scikits.image",
"path": "skimage/transform/hough_transform.py",
"copies": "2",
"size": "4158",
"license": "bsd-3-clause",
"hash": -827837782941171600,
"line_mean": 27.875,
"line_max": 96,
"alpha_frac": 0.6195286195,
"autogenerated": false,
"ratio": 3.7125,
"config_test... |
__all__ = ('HoverBehavior', )
from kivy.properties import BooleanProperty, NumericProperty, ObjectProperty
from kivy.weakproxy import WeakProxy
from kivy.core.window import Window
class HoverBehavior(object):
'''
The HoverBehavior `mixin <https://en.wikipedia.org/wiki/Mixin>`_ provides
Hover behavior. Wh... | {
"repo_name": "Bakterija/mmplayer",
"path": "mmplayer/kivy_soil/hover_behavior/__init__.py",
"copies": "1",
"size": "5148",
"license": "mit",
"hash": -8676318573573915000,
"line_mean": 36.035971223,
"line_max": 80,
"alpha_frac": 0.6182983683,
"autogenerated": false,
"ratio": 4.237037037037037,
... |
__all__ = ['HPX_grid_step', 'HPX_grid_size', 'FITS_to_HPPX']
import numpy as np
from scipy import sparse
# Kapteyn software contains tie-ins to WCS standard.
try:
from kapteyn import wcs
except ImportError:
print ("kapteyn package required: download at\n"
"http://www.astro.rug.nl/software/kapteyn/"... | {
"repo_name": "jakevdp/spheredb",
"path": "spheredb/conversions.py",
"copies": "1",
"size": "5861",
"license": "bsd-3-clause",
"hash": 7092915956995665000,
"line_mean": 34.737804878,
"line_max": 76,
"alpha_frac": 0.5942671899,
"autogenerated": false,
"ratio": 3.1732539252842447,
"config_test": ... |
__all__ = ['HTTPView', 'TCPView']
from again.utils import unique_hex
from .utils.helpers import default_preflight_response
from .utils.ordered_class_member import OrderedClassMembers
class BaseView:
'''base class for views'''
_host = None
@property
def host(self):
return self._host
@ho... | {
"repo_name": "technomaniac/trellio",
"path": "trellio/views.py",
"copies": "2",
"size": "2073",
"license": "mit",
"hash": -8676553279200657000,
"line_mean": 27.0135135135,
"line_max": 104,
"alpha_frac": 0.5904486252,
"autogenerated": false,
"ratio": 4.017441860465116,
"config_test": false,
"... |
__all__ = ['HttpWhoHas']
from gevent import monkey; monkey.patch_all() # flake8: noqa
import gevent
from gevent.queue import Queue
from random import sample
import urllib2
import logging
class DefaultErrorHandler(urllib2.HTTPDefaultErrorHandler):
def http_error_default(self, req, fp, code, msg, headers):
... | {
"repo_name": "ktosiu/katana",
"path": "katana/httpwhohas.py",
"copies": "1",
"size": "5522",
"license": "mpl-2.0",
"hash": -1780310059016073200,
"line_mean": 36.8219178082,
"line_max": 96,
"alpha_frac": 0.5579500181,
"autogenerated": false,
"ratio": 4.186504927975739,
"config_test": false,
"... |
__all__ = ['HttpWhoHas']
from gevent import monkey; monkey.patch_all() # flake8: noqa
import gevent
from gevent.queue import Queue
from random import sample
import urllib.request, urllib.error, urllib.parse
import logging
class DefaultErrorHandler(urllib.request.HTTPDefaultErrorHandler):
def http_error_defau... | {
"repo_name": "sebest/katana",
"path": "katana/httpwhohas.py",
"copies": "1",
"size": "5634",
"license": "mpl-2.0",
"hash": 4968513432039562000,
"line_mean": 37.5890410959,
"line_max": 96,
"alpha_frac": 0.5631877884,
"autogenerated": false,
"ratio": 4.201342281879195,
"config_test": false,
"h... |
__all__ = ['HyperparameterGridsearchMixin']
import logging
from joblib import Parallel, delayed
from sklearn.metrics import accuracy_score
from sklearn.model_selection import ParameterGrid
from sklearn.model_selection import train_test_split
from ycml.utils import get_class_from_module_path
logger = logging.getLog... | {
"repo_name": "skylander86/ycml",
"path": "ycml/classifiers/gridsearch.py",
"copies": "1",
"size": "3151",
"license": "apache-2.0",
"hash": 683475633627162000,
"line_mean": 41.5810810811,
"line_max": 216,
"alpha_frac": 0.684544589,
"autogenerated": false,
"ratio": 3.668218859138533,
"config_tes... |
''' Alliance vs. Horde Game Mode, based on an idea that a friend of mine suggested to me once. Draft cards randomly from the entire set with the only restriction being that they are (1) a class card or (2) not a class card BUT of a certain faction (Horde/Alliance). Definitions of card factions have been customly patche... | {
"repo_name": "AlexSafatli/HearthstoneDrafter",
"path": "modes/allianceVsHorde.py",
"copies": "1",
"size": "2002",
"license": "mit",
"hash": -4646840250615443000,
"line_mean": 44.5,
"line_max": 398,
"alpha_frac": 0.6448551449,
"autogenerated": false,
"ratio": 3.633393829401089,
"config_test": f... |
__all__ = ["Image", "ImageCollection"]
from typing import Any, Set
from uuid import uuid4
ImageUri = str
SourceUri = str
class Image(object):
"""Describe an image
`uri`
The absolute URI of the image. This basically identifies the Image and makes it unique.
This absolute URI must include: ... | {
"repo_name": "k4cg/nichtparasoup",
"path": "nichtparasoup/core/image.py",
"copies": "1",
"size": "2453",
"license": "mit",
"hash": -6929420835666320000,
"line_mean": 32.1486486486,
"line_max": 116,
"alpha_frac": 0.5923359152,
"autogenerated": false,
"ratio": 3.9185303514377,
"config_test": fal... |
__all__ = ['Image', 'imread', 'imread_collection', 'imsave', 'imshow', 'show',
'push', 'pop']
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
import os
import re
import tempfile
from io import BytesIO
import numpy as np
import six
from skimage.io._plugins i... | {
"repo_name": "almarklein/scikit-image",
"path": "skimage/io/_io.py",
"copies": "1",
"size": "6424",
"license": "bsd-3-clause",
"hash": 695960431952372000,
"line_mean": 24.2913385827,
"line_max": 78,
"alpha_frac": 0.6016500623,
"autogenerated": false,
"ratio": 4.078730158730159,
"config_test": ... |
# all imports needed by the client
from direct.showbase.DirectObject import DirectObject
from direct.distributed.ClientRepository import ClientRepository
from pandac.PandaModules import URLSpec
class DungeonClientRepository(ClientRepository):
"""the main client repository class"""
def __init__(self):
... | {
"repo_name": "grimfang/owp_dungeon_crawler",
"path": "src/client/client.py",
"copies": "1",
"size": "3309",
"license": "mit",
"hash": 1157125451503840000,
"line_mean": 40.3625,
"line_max": 72,
"alpha_frac": 0.6452100332,
"autogenerated": false,
"ratio": 4.325490196078431,
"config_test": false,... |
# all imports
import sqlite3
from flask import Flask, request, session, g, redirect, url_for,\
abort, render_template, flash
from contextlib import closing
# configuration
DATABASE = '/temp/bloggify.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'default'
# create our little applic... | {
"repo_name": "ledrui/blogify",
"path": "bloggify.py",
"copies": "1",
"size": "2105",
"license": "mit",
"hash": 5855447274542126000,
"line_mean": 26.3376623377,
"line_max": 111,
"alpha_frac": 0.6332541568,
"autogenerated": false,
"ratio": 3.5738539898132426,
"config_test": false,
"has_no_keyw... |
# all imports
import sqlite3
import os
from flask import Flask , request , session , g , redirect , url_for , \
abort , render_template , flash
from contextlib import closing
# Database configuration
DATABASE = os.environ['OPENSHIFT_DATA_DIR'] + 'flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'ad... | {
"repo_name": "coursemdetw/flaskr_on_openshift",
"path": "wsgi/flaskr.py",
"copies": "1",
"size": "2111",
"license": "apache-2.0",
"hash": -4971371700237716000,
"line_mean": 25.0617283951,
"line_max": 72,
"alpha_frac": 0.6750355282,
"autogenerated": false,
"ratio": 3.0998531571218795,
"config_t... |
__all__ = ['imread', 'imread_collection', 'imsave', 'imshow', 'show',
'push', 'pop']
from scikits.image.io._plugins import call as call_plugin
from scikits.image.color import rgb2grey
import numpy as np
# Shared image queue
_image_stack = []
def push(img):
"""Push an image onto the shared image stack.... | {
"repo_name": "GaelVaroquaux/scikits.image",
"path": "scikits/image/io/io.py",
"copies": "1",
"size": "4461",
"license": "bsd-3-clause",
"hash": 6169115537938402000,
"line_mean": 25.2411764706,
"line_max": 76,
"alpha_frac": 0.6030038108,
"autogenerated": false,
"ratio": 4.173058933582787,
"conf... |
__all__ = ['imread', 'imread_collection']
import numpy as np
import scikits.image.io as io
try:
import pyfits
except ImportError:
raise ImportError("PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/software_hardware/pyfits\n"
"for further instructions.")
def imre... | {
"repo_name": "GaelVaroquaux/scikits.image",
"path": "scikits/image/io/_plugins/fits_plugin.py",
"copies": "1",
"size": "4494",
"license": "bsd-3-clause",
"hash": -988224040351516900,
"line_mean": 29.9931034483,
"line_max": 78,
"alpha_frac": 0.6279483756,
"autogenerated": false,
"ratio": 4.219718... |
__all__ = ['imread', 'imread_collection']
import numpy as np
import skimage.io as io
try:
import pyfits
except ImportError:
raise ImportError("PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/software_hardware/pyfits\n"
"for further instructions.")
def imread(fna... | {
"repo_name": "emmanuelle/scikits.image",
"path": "skimage/io/_plugins/fits_plugin.py",
"copies": "2",
"size": "4655",
"license": "bsd-3-clause",
"hash": 2907905309740414000,
"line_mean": 30.4527027027,
"line_max": 78,
"alpha_frac": 0.6212674544,
"autogenerated": false,
"ratio": 4.231818181818181... |
__all__ = ['imread', 'imread_collection']
import skimage.io as io
try:
from astropy.io import fits as pyfits
except ImportError:
try:
import pyfits
except ImportError:
raise ImportError("PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/software_hard... | {
"repo_name": "SamHames/scikit-image",
"path": "skimage/io/_plugins/fits_plugin.py",
"copies": "9",
"size": "4727",
"license": "bsd-3-clause",
"hash": -3250211166962519000,
"line_mean": 30.5133333333,
"line_max": 78,
"alpha_frac": 0.6194203512,
"autogenerated": false,
"ratio": 4.250899280575539,
... |
__all__ = ['imread', 'imread_collection']
import skimage.io as io
try:
import pyfits
except ImportError:
raise ImportError("PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/software_hardware/pyfits\n"
"for further instructions.")
def imread(fname, dtype=None):
... | {
"repo_name": "almarklein/scikit-image",
"path": "skimage/io/_plugins/fits_plugin.py",
"copies": "2",
"size": "4636",
"license": "bsd-3-clause",
"hash": -4676620609502751000,
"line_mean": 30.537414966,
"line_max": 78,
"alpha_frac": 0.6205780846,
"autogenerated": false,
"ratio": 4.233789954337899,... |
__all__ = ['imread', 'imsave']
import numpy as np
from six import string_types
from PIL import Image
from ...util import img_as_ubyte, img_as_uint
from ...external.tifffile import imread as tif_imread, imsave as tif_imsave
def imread(fname, dtype=None, img_num=None, **kwargs):
"""Load an image from file.
P... | {
"repo_name": "newville/scikit-image",
"path": "skimage/io/_plugins/pil_plugin.py",
"copies": "1",
"size": "8171",
"license": "bsd-3-clause",
"hash": -3443627217807784000,
"line_mean": 29.1512915129,
"line_max": 96,
"alpha_frac": 0.5841390283,
"autogenerated": false,
"ratio": 3.685611186287776,
... |
__all__ = ['imread', 'imsave']
import numpy as np
from six import string_types
from PIL import Image
from ...util import img_as_ubyte, img_as_uint
from .tifffile_plugin import imread as tif_imread, imsave as tif_imsave
def imread(fname, dtype=None, img_num=None, **kwargs):
"""Load an image from file.
Param... | {
"repo_name": "Midafi/scikit-image",
"path": "skimage/io/_plugins/pil_plugin.py",
"copies": "5",
"size": "8721",
"license": "bsd-3-clause",
"hash": 6582274928026409000,
"line_mean": 29.493006993,
"line_max": 93,
"alpha_frac": 0.5774567137,
"autogenerated": false,
"ratio": 3.6859678782755707,
"c... |
__all__ = ['imread', 'imsave']
import numpy as np
from six import string_types
from PIL import Image
from ...util import img_as_ubyte, img_as_uint
def imread(fname, dtype=None, img_num=None, **kwargs):
"""Load an image from file.
Parameters
----------
fname : str or file
File name or file-li... | {
"repo_name": "pratapvardhan/scikit-image",
"path": "skimage/io/_plugins/pil_plugin.py",
"copies": "15",
"size": "7726",
"license": "bsd-3-clause",
"hash": 7467518209125070000,
"line_mean": 28.7153846154,
"line_max": 93,
"alpha_frac": 0.56549314,
"autogenerated": false,
"ratio": 3.743217054263566... |
__all__ = ['imread']
import numpy as np
try:
from PIL import Image
except ImportError:
raise ImportError("The Python Image Library could not be found. "
"Please refer to http://pypi.python.org/pypi/PIL/ "
"for further instructions.")
def imread(fname, dtype=None):
... | {
"repo_name": "GaelVaroquaux/scikits.image",
"path": "scikits/image/io/_plugins/pil_plugin.py",
"copies": "1",
"size": "2886",
"license": "bsd-3-clause",
"hash": -7233221457519247000,
"line_mean": 25.7222222222,
"line_max": 78,
"alpha_frac": 0.5838530839,
"autogenerated": false,
"ratio": 3.594022... |
__all__ = ['Index']
import os
import sys
import mmap
import struct
class Index(object):
def __init__(self, sstable, t, columns, path=None):
self.sstable = sstable
self.t = t
self.columns = columns
self.mm = None
self.f = None
def get_path(self):
table = self.ss... | {
"repo_name": "yadb/yadb",
"path": "backup/store/index.py",
"copies": "1",
"size": "6298",
"license": "mit",
"hash": -986041783436472700,
"line_mean": 26.7444933921,
"line_max": 74,
"alpha_frac": 0.4680851064,
"autogenerated": false,
"ratio": 3.530269058295964,
"config_test": false,
"has_no_k... |
__all__ = ['IndraDBRestSearchProcessor', 'IndraDBRestHashProcessor']
import logging
from copy import deepcopy
from threading import Thread
from datetime import datetime
from collections import OrderedDict, defaultdict
from indra.statements import stmts_from_json, get_statement_by_name, \
get_all_descendants
from... | {
"repo_name": "johnbachman/belpy",
"path": "indra/sources/indra_db_rest/processor.py",
"copies": "1",
"size": "23664",
"license": "mit",
"hash": -2581718736399459300,
"line_mean": 43.3977485929,
"line_max": 80,
"alpha_frac": 0.6271974307,
"autogenerated": false,
"ratio": 4.341221794166208,
"con... |
__all__ = ["infantry_bot", "heavy_bot", "rocket_bot"]
from .tools import create_unit
INFANTRY_BOT_BASIS = {
'c_size': 1,
'firing_range': 4,
'rate_of_fire': 1,
'speed': 5,
'type': 'infantryBot'
}
INFANTRY_BOTS = {
1: dict(damage_per_shot=50, hit_points=120, **INFANTRY_BOT_BASIS),
2: dict(d... | {
"repo_name": "CheckiO/EoC-battle-mocks",
"path": "battle_mocks/units.py",
"copies": "1",
"size": "1404",
"license": "mit",
"hash": -2247354539715590000,
"line_mean": 23.6315789474,
"line_max": 70,
"alpha_frac": 0.6160968661,
"autogenerated": false,
"ratio": 2.3837011884550083,
"config_test": f... |
__all__ = ["InitLogging", \
"VLOG", \
"DEBUG", \
"INFO", \
"WARNING", \
"ERROR", \
"CRITICAL"]
import time
import sys
import logging
import copy
DEFAULT_LOGGER_NAME = "\033[1;42m" + "Log" + "\033[1;0m"
DEBUG = 0
INFO = 1
WARNING = 2
ERROR = 3
CRITICAL ... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "base/log.py",
"copies": "1",
"size": "2586",
"license": "bsd-3-clause",
"hash": -5982681547423919000,
"line_mean": 31.325,
"line_max": 106,
"alpha_frac": 0.6573859242,
"autogenerated": false,
"ratio": 3.0822407628128725,
"confi... |
__all__ = ['inject', 'signature']
import os
import sys
def _ensure_path(p):
p = os.path.realpath(p)
if isinstance(p, unicode):
p = p.encode(sys.getfilesystemencoding())
return p
def inject(pid, bundle, useMainThread=True):
"""Loads the given MH_BUNDLE in the target process identified by pid""... | {
"repo_name": "rays/ipodderx-core",
"path": "objc/_functions.py",
"copies": "1",
"size": "1236",
"license": "mit",
"hash": -1470164344321094100,
"line_mean": 27.0909090909,
"line_max": 93,
"alpha_frac": 0.6359223301,
"autogenerated": false,
"ratio": 3.850467289719626,
"config_test": false,
"h... |
"""All in one NTM. Encapsulation of all components."""
import torch
from torch import nn
from .ntm import NTM
from .controller import LSTMController
from .head import NTMReadHead, NTMWriteHead
from .memory import NTMMemory
class EncapsulatedNTM(nn.Module):
def __init__(self, num_inputs, num_outputs,
... | {
"repo_name": "loudinthecloud/pytorch-ntm",
"path": "ntm/aio.py",
"copies": "1",
"size": "2311",
"license": "bsd-3-clause",
"hash": -637902669801121200,
"line_mean": 34.0151515152,
"line_max": 97,
"alpha_frac": 0.622674167,
"autogenerated": false,
"ratio": 3.923599320882852,
"config_test": fals... |
__all__ = ['input', 'middleware']
''' a middleware to build http params '''
'''#makingitpossible no file uploads handled yet '''
import io, cgi, collections
def middleware(app):
def process_fieldstorage(fieldstorage):
''' not processing file uploads '''
return isinstance(fieldstorage, list) and [process_... | {
"repo_name": "web-i/ripplet",
"path": "ripple/middlewares/input.py",
"copies": "1",
"size": "1064",
"license": "mit",
"hash": -9081010112236003000,
"line_mean": 37,
"line_max": 117,
"alpha_frac": 0.6898496241,
"autogenerated": false,
"ratio": 3.668965517241379,
"config_test": false,
"has_no_... |
__all__ = ['INPUT', 'OUTPUT', 'INOUT']
__all__ += ['flip']
__all__ += ['Port']
INPUT = 'input'
OUTPUT = 'output'
INOUT = 'inout'
def flip(direction):
assert direction in [INPUT, OUTPUT, INOUT]
if direction == INPUT: return OUTPUT
elif direction == OUTPUT: return INPUT
elif direction == INOUT: ret... | {
"repo_name": "bjmnbraun/icestick_fastio",
"path": "thirdparty/magma/magma/port.py",
"copies": "1",
"size": "5066",
"license": "mit",
"hash": 5612266653857670000,
"line_mean": 27.1444444444,
"line_max": 87,
"alpha_frac": 0.5276352152,
"autogenerated": false,
"ratio": 3.7721518987341773,
"config... |
__all__ = ["install"]
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.showbase.PythonUtil import fastRepr
import sys
import traceback
notify = directNotify.newCategory("ExceptionVarDump")
reentry = 0
def _varDump__init__(self, *args, **kArgs):
global reentry
if reentry > 0:
... | {
"repo_name": "brakhane/panda3d",
"path": "direct/src/showbase/ExceptionVarDump.py",
"copies": "1",
"size": "6972",
"license": "bsd-3-clause",
"hash": 1340529052280700000,
"line_mean": 33.86,
"line_max": 103,
"alpha_frac": 0.5499139415,
"autogenerated": false,
"ratio": 4.184873949579832,
"confi... |
__all__ = ["install"]
from panda3d.core import *
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.showbase.PythonUtil import fastRepr
import sys
import traceback
notify = directNotify.newCategory("ExceptionVarDump")
reentry = 0
def _varDump__init__(self, *args, **kArgs):
global reentr... | {
"repo_name": "tobspr/panda3d",
"path": "direct/src/showbase/ExceptionVarDump.py",
"copies": "10",
"size": "6999",
"license": "bsd-3-clause",
"hash": -2859432944781279700,
"line_mean": 33.8208955224,
"line_max": 103,
"alpha_frac": 0.5507929704,
"autogenerated": false,
"ratio": 4.176014319809069,
... |
__all__ = ['intAllen']
from scipy.interpolate import interp1d
import numpy as np
def intAllen(wavelength, mu):
"""
Return the intensity at a given wavelength and mu as tabulated by Allen
"""
CLight = 2.99792458e10
HPlanck = 6.62606876e-27
l = 1e4 * np.asarray([0.20,0.22,0.24,0.26,0.28,0.30,0.32,0.34,0.36,0.37... | {
"repo_name": "aasensio/pyiacsun",
"path": "pyiacsun/util/intAllen.py",
"copies": "2",
"size": "1381",
"license": "mit",
"hash": -1789956382318096000,
"line_mean": 48.3571428571,
"line_max": 151,
"alpha_frac": 0.5908761767,
"autogenerated": false,
"ratio": 1.6227967097532314,
"config_test": fal... |
__all__ = ["integrate_velocity_field"]
from .process_args import _int_antsProcessArguments
from .. import utils
def integrate_velocity_field(
reference_image,
velocity_field_filename,
deformation_field_filename,
time_0=0,
time_1=1,
delta_time=0.01,
):
"""
Integrate a velocityfield
... | {
"repo_name": "ANTsX/ANTsPy",
"path": "ants/utils/ants_integrate_velocity_field.py",
"copies": "1",
"size": "2435",
"license": "apache-2.0",
"hash": 7797265809526752000,
"line_mean": 29.8227848101,
"line_max": 102,
"alpha_frac": 0.6135523614,
"autogenerated": false,
"ratio": 3.4985632183908044,
... |
__all__ = ["interact"]
import jnupy
import sys
def input(prompt=None):
if prompt is not None:
print(prompt, end="")
result = jnupy.input()
if result is None:
raise EOFError
return result
def mp_repl_continue_with_input(line):
# check for blank input
if not line:
... | {
"repo_name": "EcmaXp/micropython",
"path": "opencom/lib/code.py",
"copies": "1",
"size": "3157",
"license": "mit",
"hash": -7980299781826150000,
"line_mean": 28.7830188679,
"line_max": 152,
"alpha_frac": 0.5388026608,
"autogenerated": false,
"ratio": 3.9760705289672544,
"config_test": false,
... |
"""All internal ansible-lint rules."""
import glob
import importlib.util
import logging
import os
import re
from collections import defaultdict
from importlib.abc import Loader
from time import sleep
from typing import List
import ansiblelint.utils
from ansiblelint.errors import MatchError
from ansiblelint.skip_utils ... | {
"repo_name": "ansible/ansible-lint",
"path": "lib/ansiblelint/rules/__init__.py",
"copies": "1",
"size": "8648",
"license": "mit",
"hash": -2846238959904863000,
"line_mean": 31.6339622642,
"line_max": 84,
"alpha_frac": 0.5513413506,
"autogenerated": false,
"ratio": 4.23921568627451,
"config_te... |
__all__ = ['interp1d', 'interp2d', 'lagrange', 'PPoly', 'BPoly', 'NdPPoly',
'RegularGridInterpolator', 'interpn']
import itertools
import warnings
import functools
import operator
import numpy as np
from numpy import (array, transpose, searchsorted, atleast_1d, atleast_2d,
ravel, poly1d,... | {
"repo_name": "pizzathief/scipy",
"path": "scipy/interpolate/interpolate.py",
"copies": "2",
"size": "98262",
"license": "bsd-3-clause",
"hash": 5529917065104486000,
"line_mean": 34.8358862144,
"line_max": 112,
"alpha_frac": 0.5433840142,
"autogenerated": false,
"ratio": 3.9134174997013025,
"co... |
__all__ = ['interp1d', 'interp2d', 'lagrange', 'PPoly', 'BPoly', 'NdPPoly',
'RegularGridInterpolator', 'interpn']
import itertools
import warnings
import numpy as np
from numpy import (array, transpose, searchsorted, atleast_1d, atleast_2d,
ravel, poly1d, asarray, intp)
import scipy.spe... | {
"repo_name": "e-q/scipy",
"path": "scipy/interpolate/interpolate.py",
"copies": "3",
"size": "98660",
"license": "bsd-3-clause",
"hash": 7530266625394910000,
"line_mean": 34.8112522686,
"line_max": 112,
"alpha_frac": 0.5433711737,
"autogenerated": false,
"ratio": 3.913060722643081,
"config_tes... |
__all__ = ["interrogator",
"editor",
"plotter",
"conc",
"save_result",
"quickview",
"load_result",
"load_all_results",
"as_regex",
"new_project",
"download_large_file",
"extract_cnlp",
"... | {
"repo_name": "SigridK/corpkit",
"path": "corpkit/__init__.py",
"copies": "1",
"size": "1479",
"license": "mit",
"hash": 7947299037182606000,
"line_mean": 26.3888888889,
"line_max": 61,
"alpha_frac": 0.645030426,
"autogenerated": false,
"ratio": 3.563855421686747,
"config_test": false,
"has_n... |
__all__ = [ 'Interval' ]
class Interval(object):
'''Interval - Arbitrary half-closed interval of the form [start, end)'''
def __init__(self, start, end):
self.start = start
self.end = end
def __call__(self, value):
return (1. - value) * self.start + value * self.end
def __str... | {
"repo_name": "bracket/handsome",
"path": "handsome/Interval.py",
"copies": "2",
"size": "1108",
"license": "bsd-2-clause",
"hash": 2796126675688250400,
"line_mean": 26.0243902439,
"line_max": 76,
"alpha_frac": 0.5586642599,
"autogenerated": false,
"ratio": 3.9014084507042255,
"config_test": fa... |
__all__ = ['InvalidData', 'Step', 'ProcessManager']
class InvalidData(Exception):
"""
Raised for by step validation process
"""
pass
class Step(object):
"""
A single step in a multistep process
"""
def __str__(self):
raise NotImplementedError() # pragma: no cover
def va... | {
"repo_name": "taedori81/satchless",
"path": "satchless/process/__init__.py",
"copies": "1",
"size": "1318",
"license": "bsd-3-clause",
"hash": 6791970173784787000,
"line_mean": 22.1228070175,
"line_max": 61,
"alpha_frac": 0.5440060698,
"autogenerated": false,
"ratio": 4.437710437710438,
"confi... |
__all__ = [ "isbinary", "isiterable" ]
def _inttobyte(i):
"""Takes an integer in the 8-bit range and returns a single-character byte
object.
"""
return bytes((i,))
_text_characters = (b''.join(_inttobyte(i) for i in range(32, 127)) +
b'\n\r\t\f\b')
def isbinary(fileobj, blocksize=512):
"... | {
"repo_name": "dnkbln/pyfea",
"path": "pyfea/util/lang.py",
"copies": "1",
"size": "1318",
"license": "bsd-2-clause",
"hash": -4400307424770789400,
"line_mean": 30.380952381,
"line_max": 78,
"alpha_frac": 0.6517450683,
"autogenerated": false,
"ratio": 3.7443181818181817,
"config_test": false,
... |
# all is object
def hi(name = 'yasoob'):
return "hi " + name
print(hi())
greet = hi
print(greet())
del hi
# print(hi())
print(greet())
def hi2(name = 'yasoob'):
print("now you are inside the hi2() function")
def greet2():
return "now you are in the greet2() function"
def welcom... | {
"repo_name": "cragwen/hello-world",
"path": "py/interpy/7_decorator.py",
"copies": "1",
"size": "4372",
"license": "unlicense",
"hash": 3596551916420476400,
"line_mean": 19.2407407407,
"line_max": 82,
"alpha_frac": 0.6045288198,
"autogenerated": false,
"ratio": 3.3630769230769233,
"config_test... |
# Allison Schubauer and Daisy Hernandez
# Created: 5/21/2013
# Last Updated: 6/13/2013
# For JCAP
from PyQt4 import QtGui, QtCore
from datareader import DATA_HEADINGS
import graph
import profilecreator
import date_helpers
import time
""" window that displays a single graph area and various
customization options "... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "graphwindow_data.py",
"copies": "1",
"size": "14461",
"license": "bsd-3-clause",
"hash": -3953909299645438000,
"line_mean": 38.4032697548,
"line_max": 92,
"alpha_frac": 0.6059746905,
"autogenerated": false,
"ratio": 3.7905635648754914,... |
# Allison Schubauer and Daisy Hernandez
# Created: 5/23/2013
# Last Updated: 6/12/2013
# For JCAP
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from navigation_toolbar import NavigationToolbar
from matplotlib.figure import Figure
from pylab import matplotlib
i... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "graph.py",
"copies": "1",
"size": "9703",
"license": "bsd-3-clause",
"hash": -7857562158026725000,
"line_mean": 42.9049773756,
"line_max": 99,
"alpha_frac": 0.5814696486,
"autogenerated": false,
"ratio": 3.89991961414791,
"config_tes... |
# Allison Schubauer and Daisy Hernandez
# Created: 5/23/2013
# Last Updated: 6/13/2013
# For JCAP
import csv
from PyQt4 import QtCore
DATA_DICT = {}
DATA_HEADINGS = {}
""" thread that reads data from file """
class DataReader(QtCore.QThread):
# initialize signal to data processor when a full line has been read
... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "datareader.py",
"copies": "1",
"size": "3396",
"license": "bsd-3-clause",
"hash": 4845752237751468000,
"line_mean": 35.1276595745,
"line_max": 88,
"alpha_frac": 0.5683156655,
"autogenerated": false,
"ratio": 4.445026178010472,
"confi... |
# Allison Schubauer and Daisy Hernandez
# Created: 5/23/2013
# Last Updated: 6/14/2013
# For JCAP
from PyQt4 import QtGui, QtCore
import datareader
import cPickle as pickle
""" widget to make profiles """
class ProfileCreator(QtGui.QWidget):
""" sets up the Widget """
def __init__(self):
super(Profil... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "profilecreator.py",
"copies": "1",
"size": "4657",
"license": "bsd-3-clause",
"hash": 4864857003453955000,
"line_mean": 38.1344537815,
"line_max": 96,
"alpha_frac": 0.5819196908,
"autogenerated": false,
"ratio": 4.534566699123661,
"c... |
# Allison Schubauer and Daisy Hernandez
# Created: 5/28/2013
# Last Updated: 6/12/2013
# For JCAP
from PyQt4 import QtCore, QtGui
import sys
import graph
""" window that displays profile after loading """
class ProfileWindow(QtGui.QMainWindow):
""" takes in name that profile was saved under and list of
v... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "profilewindow.py",
"copies": "1",
"size": "4022",
"license": "bsd-3-clause",
"hash": -5871331414505426000,
"line_mean": 36.2407407407,
"line_max": 93,
"alpha_frac": 0.6111387369,
"autogenerated": false,
"ratio": 4.329386437029063,
"c... |
# Allison Schubauer and Daisy Hernandez
# Created: 5/28/2013
# Last Updated: 6/13/2013
# For JCAP
from PyQt4 import QtGui
from dictionary_helpers import getCol
import datareader
import depositionwindow_data
import graphwindow_data
import profilewindow
import profilecreator
import os
import filename_handler
import proc... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "mainmenu.py",
"copies": "1",
"size": "19949",
"license": "bsd-3-clause",
"hash": 9168197558977492000,
"line_mean": 40.7343096234,
"line_max": 96,
"alpha_frac": 0.6107574315,
"autogenerated": false,
"ratio": 4.431141714793426,
"config... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/05/2013
# Last Updated: 6/14/2013
# For JCAP
from elements import ELEMENTS
# holds important information associated with data file
FILE_INFO = {'Element':'', 'Source':'', 'Supply':'', 'TiltDeg':[],
'Z_mm':[]}
""" gets information for FILE_INFO from na... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "filename_handler.py",
"copies": "1",
"size": "2059",
"license": "bsd-3-clause",
"hash": -3334506848038253000,
"line_mean": 39.3725490196,
"line_max": 78,
"alpha_frac": 0.5998057309,
"autogenerated": false,
"ratio": 3.7988929889298895,
... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/05/2013
# Last Updated: 6/14/2013
# For JCAP
import numpy as np
from PyQt4 import QtCore
from dictionary_helpers import *
import date_helpers
import filename_handler
import datareader
# global dictionary holds all processed (z, x, y, rate) data for the experiment
D... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "process_deposition_data.py",
"copies": "1",
"size": "8789",
"license": "bsd-3-clause",
"hash": 6554170663608306000,
"line_mean": 39.8790697674,
"line_max": 105,
"alpha_frac": 0.5967686881,
"autogenerated": false,
"ratio": 3.81632653061... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/06/2013
# Last Updated: 6/14/2013
# For JCAP
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.colors as colors
import matplotlib.cm as cm
import process_de... | {
"repo_name": "johnmgregoire/JCAPdepositionmonitor",
"path": "depgraph.py",
"copies": "1",
"size": "7104",
"license": "bsd-3-clause",
"hash": 1233300438427275300,
"line_mean": 42.5828220859,
"line_max": 92,
"alpha_frac": 0.6013513514,
"autogenerated": false,
"ratio": 4.094524495677233,
"config_... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/24/2013
# Last Updated: 6/25/2013
# For JCAP
import logging, logging.handlers
class ErrorHandler():
def __init__(self, name, loggingfile, loglevel = logging.DEBUG):
# setting up the logger and the messages allowed to be logged
self.logger =... | {
"repo_name": "johnmgregoire/2013JCAPDataProcess",
"path": "error_handling.py",
"copies": "1",
"size": "2861",
"license": "bsd-3-clause",
"hash": 3142959647258650000,
"line_mean": 37.6621621622,
"line_max": 98,
"alpha_frac": 0.6620062915,
"autogenerated": false,
"ratio": 4.023909985935302,
"con... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/24/2013
# Last Updated: 6/27/2013
# For JCAP
# functions for converting our formatted data dictionaries to
# and from JSON files
import os
import csv
import json
import numpy
import datetime
#SAVEPATH = os.path.expanduser("~/Desktop/Working Folder/AutoAnalysisJSO... | {
"repo_name": "johnmgregoire/2013JCAPDataProcess",
"path": "jsontranslator.py",
"copies": "1",
"size": "3547",
"license": "bsd-3-clause",
"hash": 7143248503535186000,
"line_mean": 33.7745098039,
"line_max": 129,
"alpha_frac": 0.6123484635,
"autogenerated": false,
"ratio": 3.683281412253375,
"co... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/25/2013
# Last Updated: 6/26/2013
# For JCAP
import sys, os
from PyQt4 import QtCore, QtGui
from time import strftime, localtime
import re
class MainMenu(QtGui.QMainWindow):
def __init__(self):
super(MainMenu, self).__init__()
self.versionName =... | {
"repo_name": "johnmgregoire/2013JCAPDataProcess",
"path": "commitmenu.py",
"copies": "1",
"size": "5474",
"license": "bsd-3-clause",
"hash": 6886603468258203000,
"line_mean": 40.1578947368,
"line_max": 116,
"alpha_frac": 0.6251370113,
"autogenerated": false,
"ratio": 4.233565351894819,
"config... |
# Allison Schubauer and Daisy Hernandez
# Created: 6/26/2013
# Last Updated: 7/25/2013
# For JCAP
"""
runs functions to produce figures of merit automatically, and
replaces dictionaries of data produced by old versions with
updated data
"""
import sys, os
import argparse
import cPickle as pickle
from mul... | {
"repo_name": "johnmgregoire/2013JCAPDataProcess",
"path": "fomautomator.py",
"copies": "1",
"size": "14469",
"license": "bsd-3-clause",
"hash": -6962008753702540000,
"line_mean": 46.2843137255,
"line_max": 134,
"alpha_frac": 0.628516138,
"autogenerated": false,
"ratio": 4.3011296076099885,
"co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.