text stringlengths 0 1.05M | meta dict |
|---|---|
__all__ = [
"t"
]
from Optizelle.Utility import *
from Optizelle.Properties import *
from Optizelle.Enumerated import *
def allocateVectors(self,X,x):
"""Allocates memory for the state vectors"""
self.x=X.init(x)
self.grad=X.init(x)
self.dx=X.init(x)
self.x_old=X.init(x)
self.grad_old=X.in... | {
"repo_name": "OptimoJoe/Optizelle",
"path": "src/python/Optizelle/Unconstrained/State.py",
"copies": "1",
"size": "7613",
"license": "bsd-2-clause",
"hash": 5174906473665832000,
"line_mean": 31.6738197425,
"line_max": 79,
"alpha_frac": 0.6203861815,
"autogenerated": false,
"ratio": 4.08422746781... |
__all__ = [
"t"
]
import Optizelle.Unconstrained.Functions
from Optizelle.Properties import *
from Optizelle.Functions import *
class t(Optizelle.Unconstrained.Functions.t):
"""All the functions required by an optimization algorithm"""
def __init__(self):
super(t,self).__init__()
self._g=V... | {
"repo_name": "OptimoJoe/Optizelle",
"path": "src/python/Optizelle/EqualityConstrained/Functions.py",
"copies": "1",
"size": "1026",
"license": "bsd-2-clause",
"hash": -7977901696843889000,
"line_mean": 30.0909090909,
"line_max": 77,
"alpha_frac": 0.6530214425,
"autogenerated": false,
"ratio": 3.... |
__all__ = [
"t"
]
import Optizelle.Unconstrained.State
from Optizelle.Utility import *
from Optizelle.Properties import *
from Optizelle.Enumerated import *
def allocateVectors(self,X,Y,x,y):
"""Allocates memory for the state vectors"""
self.y=Y.init(y)
self.dy=Y.init(y)
self.g_x=Y.init(y)
sel... | {
"repo_name": "OptimoJoe/Optizelle",
"path": "src/python/Optizelle/EqualityConstrained/State.py",
"copies": "1",
"size": "11573",
"license": "bsd-2-clause",
"hash": 4637180416278640000,
"line_mean": 39.044982699,
"line_max": 93,
"alpha_frac": 0.6446902273,
"autogenerated": false,
"ratio": 3.69154... |
__all__ = [
"t"
]
import Optizelle.Unconstrained.State
from Optizelle.Utility import *
from Optizelle.Properties import *
from Optizelle.Enumerated import *
def allocateVectors(self,X,Z,x,z):
"""Allocates memory for the state vectors"""
self.z=Z.init(z)
self.dz=Z.init(z)
self.h_x=Z.init(z)
class ... | {
"repo_name": "OptimoJoe/Optizelle",
"path": "src/python/Optizelle/InequalityConstrained/State.py",
"copies": "1",
"size": "2465",
"license": "bsd-2-clause",
"hash": -8112444528863901000,
"line_mean": 29.8125,
"line_max": 79,
"alpha_frac": 0.6267748479,
"autogenerated": false,
"ratio": 3.80989180... |
__all__ = [
'to_issue_dict'
]
def to_issue_dict(issue):
"""
:rtype: ``dict``
"""
split = issue.permalink().split(' - ', 1)
url = split[0]
if issue.fields.resolution:
resolution = issue.fields.resolution.name
else:
resolution = None
if issue.fields.reporter:
... | {
"repo_name": "pinterb/st2contrib",
"path": "packs/jira/actions/lib/formatters.py",
"copies": "5",
"size": "1035",
"license": "apache-2.0",
"hash": 240800907307637470,
"line_mean": 23.0697674419,
"line_max": 52,
"alpha_frac": 0.5748792271,
"autogenerated": false,
"ratio": 3.791208791208791,
"co... |
__all__ = [
'to_issue_dict',
'to_comment_dict'
]
def to_issue_dict(issue):
"""
:rtype: ``dict``
"""
split = issue.permalink().split(' - ', 1)
url = split[0]
if issue.fields.resolution:
resolution = issue.fields.resolution.name
else:
resolution = None
if issue.... | {
"repo_name": "psychopenguin/st2contrib",
"path": "packs/jira/actions/lib/formatters.py",
"copies": "7",
"size": "1221",
"license": "apache-2.0",
"hash": 4566777338414358000,
"line_mean": 21.2,
"line_max": 52,
"alpha_frac": 0.5601965602,
"autogenerated": false,
"ratio": 3.7339449541284404,
"con... |
__all__ = (
'TokenList',
)
import collections
from .errors import TokenTypeError
class TokenList(collections.Sized, collections.Iterable, collections.Container):
def __init__(self, init=None, *, token_type=None):
if token_type is None:
token_type = object
self._token_type = token_... | {
"repo_name": "simone-campagna/petra",
"path": "petra/token_list.py",
"copies": "1",
"size": "2481",
"license": "apache-2.0",
"hash": 223850138077393380,
"line_mean": 28.1882352941,
"line_max": 111,
"alpha_frac": 0.5272067715,
"autogenerated": false,
"ratio": 4.248287671232877,
"config_test": f... |
__all__ = [
'TopoReader',
'GravObsReader',
'GravGradReader',
'MagObsReader',
'GeologyMapper',
]
__displayname__ = 'General Tools'
import numpy as np
import pandas as pd
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
from .. import _helpers, interface
from ..base import FilterPr... | {
"repo_name": "banesullivan/ParaViewGeophysics",
"path": "PVGeo/ubc/general.py",
"copies": "1",
"size": "10897",
"license": "bsd-3-clause",
"hash": 6850066694521328000,
"line_mean": 34.8453947368,
"line_max": 127,
"alpha_frac": 0.5795172983,
"autogenerated": false,
"ratio": 3.875177809388336,
"... |
__all__ = (
'translate_to_snakes',
)
from petra.annotation import Vars, InputFlush, Test, Inhibitor, OutputFlush, Expr
from petra.errors import TranslationError
import snakes.nets as snakes_module
def _input_annotation_to_snakes(snakes, annotation):
if isinstance(annotation, Inhibitor):
return snake... | {
"repo_name": "simone-campagna/petra",
"path": "petra/utils/translate.py",
"copies": "1",
"size": "2917",
"license": "apache-2.0",
"hash": 2157462448963947500,
"line_mean": 37.3815789474,
"line_max": 116,
"alpha_frac": 0.6465546795,
"autogenerated": false,
"ratio": 3.920698924731183,
"config_te... |
__all__ = ['ntriples_parser', 'nquads_parser', 'turtle_parser']
from collections import defaultdict, namedtuple, OrderedDict
from lepl import *
from lxml import etree
import re
from threading import local
from urlparse import urljoin
from pymantic.util import normalize_iri
import pymantic.primitives
def discrete_pair... | {
"repo_name": "SYSTAP/blazegraph-python",
"path": "pymantic/parsers.py",
"copies": "4",
"size": "29945",
"license": "bsd-3-clause",
"hash": -5999987292491661000,
"line_mean": 41.3550212164,
"line_max": 431,
"alpha_frac": 0.5500417432,
"autogenerated": false,
"ratio": 3.7525062656641603,
"config... |
__all__ = [
"xlfunc",
"xlret",
"xlarg",
"xlsub"
]
def xlfunc(f = None, **kwargs):
def inner(f):
if not hasattr(f, "__xlfunc__"):
xlf = f.__xlfunc__ = {}
xlf = f.__xlfunc__ = {}
xlf["name"] = f.__name__
xlf["sub"] = False
xlf["xlwings"] = kwargs.get("xlwings", None)
xlargs = xlf["args"] = []
... | {
"repo_name": "Tusky/excelpython",
"path": "addin/xlpython/__init__.py",
"copies": "3",
"size": "2555",
"license": "bsd-2-clause",
"hash": 174530615854132060,
"line_mean": 24.0588235294,
"line_max": 139,
"alpha_frac": 0.5800391389,
"autogenerated": false,
"ratio": 2.642192347466391,
"config_tes... |
__all__ = [
'ubcMeshReaderBase',
'ModelAppenderBase',
]
__displayname__ = 'Base Classes'
# Outside Imports:
import os
import numpy as np
import vtk
from .. import _helpers, base
###############################################################################
# UBC Mesh Reader Base
class ubcMeshReaderBase(... | {
"repo_name": "banesullivan/ParaViewGeophysics",
"path": "PVGeo/ubc/two_file_base.py",
"copies": "1",
"size": "12901",
"license": "bsd-3-clause",
"hash": 2306600373077320700,
"line_mean": 35.86,
"line_max": 88,
"alpha_frac": 0.5609642663,
"autogenerated": false,
"ratio": 3.9817901234567903,
"co... |
__all__ = ["NullCrawler", "Random3Crawler"]
from typing import Optional
from nichtparasoup.core import Crawler, _CrawlerWeight, _IsImageAddable, _OnImageAdded
from nichtparasoup.core.image import Image
from nichtparasoup.core.imagecrawler import BaseImageCrawler
class _LoggingCrawler(Crawler):
def __init__(self... | {
"repo_name": "k4cg/nichtparasoup",
"path": "tests/test_10_nichtparasoup/test_core/mockable_crawler.py",
"copies": "1",
"size": "1097",
"license": "mit",
"hash": 1188192445941171200,
"line_mean": 28.6486486486,
"line_max": 86,
"alpha_frac": 0.643573382,
"autogenerated": false,
"ratio": 3.428125,
... |
__all__ = ['Null']
class NullType(object):
'''An SQL-like Null object: allows most (if not all) operations on it to succeed.
>>> repr(Null)
'(Null)'
>>> Null(3,x=3)
(Null)
>>> [Null==Null, Null!=None, Null<Null, Null>=3]
[(Null), (Null), (Null), (Null)]
>>> [Null[3], Null.foo]
[(Nu... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/576562_Yet_another_Null_object/recipe-576562.py",
"copies": "1",
"size": "2137",
"license": "mit",
"hash": -5297756056126307000,
"line_mean": 31.3787878788,
"line_max": 85,
"alpha_frac": 0.4576509125,
"autogenerated": false,
"ratio": 3.151... |
__all__ = [
'Unavailable',
# Circuit breaker.
'TristateBreakers',
'NO_BREAK',
# Rate limit.
'unlimited',
'TokenBucket',
# Retry.
'no_retry',
'ExponentialBackoff',
]
import collections
import enum
import logging
import time
from g1.asyncs.bases import timers
from g1.bases import... | {
"repo_name": "clchiou/garage",
"path": "py/g1/http/clients/g1/http/clients/policies.py",
"copies": "1",
"size": "8292",
"license": "mit",
"hash": -2229832402979022300,
"line_mean": 27.4948453608,
"line_max": 78,
"alpha_frac": 0.5933429812,
"autogenerated": false,
"ratio": 3.8765778401122017,
"... |
__all__ = [
"WBAPIUnauthorizedError",
"WBAPI"
]
import requests
from requests.exceptions import HTTPError as WBAPIHTTPError
from requests.packages.urllib3.util import Retry
from requests.adapters import HTTPAdapter
from urlparse import urljoin
from functools import wraps
class WBAPIUnauthorizedError(WBAPIHT... | {
"repo_name": "hmrc/wristband-frontend",
"path": "wb_api/__init__.py",
"copies": "1",
"size": "3302",
"license": "apache-2.0",
"hash": -2709421653575760000,
"line_mean": 30.1509433962,
"line_max": 112,
"alpha_frac": 0.5899454876,
"autogenerated": false,
"ratio": 3.92627824019025,
"config_test":... |
__all__ = [
'WePayWarning', 'WePayError', 'WePayHTTPError', 'WePayClientError',
'WePayServerError', 'WePayConnectionError'
]
class WePayWarning(UserWarning):
pass
class WePayError(Exception):
"""Raised whenever WePay API call was not successfull. `WePay API Errors
Documentation <https://www.wepa... | {
"repo_name": "lehins/python-wepay",
"path": "wepay/exceptions.py",
"copies": "1",
"size": "3650",
"license": "mit",
"hash": -4276097600300843000,
"line_mean": 28.9180327869,
"line_max": 89,
"alpha_frac": 0.6216438356,
"autogenerated": false,
"ratio": 4.078212290502793,
"config_test": false,
... |
__all__ = (
'Worker',
)
import sys
import time
import logging
import threading
from Queue import Queue, Empty
from pyramid.request import Request
import model as M
from .task import Task, Function
log = logging.getLogger(__name__)
exc_log = logging.getLogger('exc_logger')
class Worker(object):
def __init_... | {
"repo_name": "synappio/chapman",
"path": "chapman/worker.py",
"copies": "1",
"size": "5376",
"license": "mit",
"hash": 4127523853321743400,
"line_mean": 30.6235294118,
"line_max": 79,
"alpha_frac": 0.51171875,
"autogenerated": false,
"ratio": 4.280254777070064,
"config_test": false,
"has_no_... |
__all__ = [
'WriteRectilinearGridToUBC',
'WriteImageDataToUBC',
]
__displayname__ = 'Writers'
import os
import numpy as np
from .. import interface
from ..base import WriterBase
class ubcTensorMeshWriterBase(WriterBase):
"""A base class to assist in writing data bjects to the UBC Tensor Mesh
forma... | {
"repo_name": "banesullivan/ParaViewGeophysics",
"path": "PVGeo/ubc/write.py",
"copies": "1",
"size": "5502",
"license": "bsd-3-clause",
"hash": 3906998049047916500,
"line_mean": 30.2613636364,
"line_max": 81,
"alpha_frac": 0.5756088695,
"autogenerated": false,
"ratio": 3.577373211963589,
"conf... |
__all___ = [
'YubicoError',
'StatusCodeError',
'InvalidClientIdError',
'InvalidValidationResponse',
'SignatureVerificationError'
]
class YubicoError(Exception):
""" Base class for Yubico related exceptions. """
pass
class StatusCodeError(YubicoError):
def __init__(self, status_code):... | {
"repo_name": "Yubico/python-yubico-client-dpkg",
"path": "yubico_client/yubico_exceptions.py",
"copies": "1",
"size": "1465",
"license": "bsd-3-clause",
"hash": 6885111900151873000,
"line_mean": 27.7254901961,
"line_max": 77,
"alpha_frac": 0.628668942,
"autogenerated": false,
"ratio": 4.23410404... |
__all___ = [
'YubicoError',
'StatusCodeError',
'InvalidClientIdError',
'SignatureVerificationError'
]
class YubicoError(Exception):
""" Base class for Yubico related exceptions. """
pass
class StatusCodeError(YubicoError):
def __init__(self, status_code):
self.status_code = statu... | {
"repo_name": "meddius/yubisaslauthd",
"path": "yubico/yubico_exceptions.py",
"copies": "1",
"size": "1140",
"license": "bsd-3-clause",
"hash": -1026294211435872100,
"line_mean": 28.2307692308,
"line_max": 77,
"alpha_frac": 0.6219298246,
"autogenerated": false,
"ratio": 4.1454545454545455,
"con... |
__all__ = ['oagprop', 'staticproperty']
class oagprop(object):
"""Responsible for maitaining _oagcache on decorated properties"""
def __init__(self, fget=None, fset=None, fdel=None, doc=None):
self.fget = fget
self.fset = fset
self.fdel = fdel
if doc is None and fget is not None... | {
"repo_name": "kchoudhu/openarc",
"path": "openarc/_util.py",
"copies": "1",
"size": "1433",
"license": "bsd-3-clause",
"hash": 9122870412233465000,
"line_mean": 36.7368421053,
"line_max": 107,
"alpha_frac": 0.5624563852,
"autogenerated": false,
"ratio": 3.9916434540389973,
"config_test": false... |
__all__ = ['ObjectFeatureUnion', 'ListConcatTransformer']
from collections import OrderedDict
import numpy as np
from . import PureTransformer
class ObjectFeatureUnion(PureTransformer):
"""Extract a given key from dictionary object."""
def __init__(self, *args, as_dict=True, **kwargs):
kwargs.setd... | {
"repo_name": "skylander86/ycml",
"path": "ycml/transformers/union.py",
"copies": "1",
"size": "2719",
"license": "apache-2.0",
"hash": 6174945584202147000,
"line_mean": 27.0309278351,
"line_max": 83,
"alpha_frac": 0.5211474807,
"autogenerated": false,
"ratio": 4.281889763779527,
"config_test":... |
__all__ = ('object_property', 'bool_property',
'array_property', 'set_property', 'dict_property')
from objc import ivar, selector, _C_ID, _C_NSBOOL, _C_BOOL, NULL, _C_NSUInteger
from objc import lookUpClass
import collections
from copy import copy as copy_func
import sys
NSSet = lookUpClass('NSSet')
NSObject ... | {
"repo_name": "ariabuckles/pyobjc-core",
"path": "Lib/objc/_properties.py",
"copies": "3",
"size": "35435",
"license": "mit",
"hash": -5151348366853060000,
"line_mean": 29.7062391681,
"line_max": 136,
"alpha_frac": 0.5395512911,
"autogenerated": false,
"ratio": 4.276490465846005,
"config_test":... |
"""Allocators determine which flights should be bundled in a formation."""
from lib.intervals import Interval, group
from lib import sim, debug
from lib.debug import print_line as p
from models import Formation
import config
from lib.geo.segment import Segment
class FormationAllocator(object):
"""Abstract Alloca... | {
"repo_name": "mauzeh/formation-flight",
"path": "formation_flight/formation/allocators.py",
"copies": "1",
"size": "4534",
"license": "mit",
"hash": -7763255979906869000,
"line_mean": 36.1639344262,
"line_max": 78,
"alpha_frac": 0.5805028672,
"autogenerated": false,
"ratio": 4.1749539594843466,
... |
''' AllocModel.py
'''
from __future__ import division
class AllocModel(object):
######################################################### Constructors
#########################################################
def __init__(self, inferType):
self.inferType = inferType
def set_prior(self, **kwargs):
pas... | {
"repo_name": "daeilkim/refinery",
"path": "refinery/bnpy/bnpy-dev/bnpy/allocmodel/AllocModel.py",
"copies": "1",
"size": "2941",
"license": "mit",
"hash": -5028250390491278000,
"line_mean": 30.9673913043,
"line_max": 78,
"alpha_frac": 0.4243454607,
"autogenerated": false,
"ratio": 4.959527824620... |
# All of Django's wonderful imports
from django.shortcuts import render_to_response, redirect, HttpResponse
from django.template import RequestContext
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.template.defaultfilters import slugify
from django.template.loader imp... | {
"repo_name": "oswalpalash/OctaveCodeShare",
"path": "scipy_central/submission/views.py",
"copies": "1",
"size": "44356",
"license": "bsd-3-clause",
"hash": -5858101192499315000,
"line_mean": 42.4011741683,
"line_max": 101,
"alpha_frac": 0.5369510326,
"autogenerated": false,
"ratio": 4.4069547938... |
__all__ = ['Offset']
import os
import sys
import mmap
import struct
class Offset(object):
'''
Offset is class that finds out position of row at given index
'''
def __init__(self, sstable, t, path=None):
self.sstable = sstable
self.t = t
self.mm = None
self.f = None
... | {
"repo_name": "yadb/yadb",
"path": "backup/store/offset.py",
"copies": "1",
"size": "1356",
"license": "mit",
"hash": 753632426339009200,
"line_mean": 21.6166666667,
"line_max": 68,
"alpha_frac": 0.5221238938,
"autogenerated": false,
"ratio": 3.476923076923077,
"config_test": false,
"has_no_k... |
"""All of our database stuff.
"""
import sqlite3
import os
# Makes/opens database relative to this file.
db_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "wrestlers.db3")
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# When we first init this module, create what we need.
cursor.execut... | {
"repo_name": "jeremyosborne/python",
"path": "general/wrestling/db.py",
"copies": "1",
"size": "2283",
"license": "mit",
"hash": -7282393078876713000,
"line_mean": 25.2413793103,
"line_max": 84,
"alpha_frac": 0.6009636443,
"autogenerated": false,
"ratio": 3.7860696517412937,
"config_test": fal... |
import os, time, re
import sublime
import sublime_plugin
import glob
import os
import shutil
import pprint
from xml.etree import ElementTree
current_path = None
class CreateJrubyfxProjectCommand(sublime_plugin.WindowCommand):
def run(self):
self.doCommand()
def doCommand(self):
if not self.... | {
"repo_name": "edubkendo/SublimeJRubyFXML",
"path": "JRubyFXML.py",
"copies": "1",
"size": "15922",
"license": "mit",
"hash": 1589108028923368000,
"line_mean": 35.6045977011,
"line_max": 118,
"alpha_frac": 0.5884939078,
"autogenerated": false,
"ratio": 3.9101178781925343,
"config_test": false,
... |
# Copyright (c) 2012 Nick Lloyd
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... | {
"repo_name": "nlloyd/SubliminalCollaborator",
"path": "libs/sub_collab/peer/basic.py",
"copies": "1",
"size": "33047",
"license": "apache-2.0",
"hash": -8426019828940414000,
"line_mean": 41.1517857143,
"line_max": 150,
"alpha_frac": 0.6201168033,
"autogenerated": false,
"ratio": 3.99214786180236... |
# All of the functions allow formats to be a dtype
__all__ = ['record', 'recarray', 'format_parser']
import numeric as sb
from defchararray import chararray
import numerictypes as nt
import types
import os
import sys
ndarray = sb.ndarray
_byteorderconv = {'b':'>',
'l':'<',
'n':'='... | {
"repo_name": "santisiri/popego",
"path": "envs/ALPHA-POPEGO/lib/python2.5/site-packages/numpy-1.0.4-py2.5-linux-x86_64.egg/numpy/core/records.py",
"copies": "1",
"size": "19390",
"license": "bsd-3-clause",
"hash": 1869564355852155400,
"line_mean": 31.9761904762,
"line_max": 84,
"alpha_frac": 0.54842... |
#All of the graphs-related functionality for MapGeist
#Based on NetworkX, the Python library for dealing with
#graphs
from networkx import (Graph, minimum_spanning_tree,)
def generate_complete_graph(nodes, distance_matrix):
"""
Returns a NetworkX 'Graph' instance given the following-
1. The list of nodes ... | {
"repo_name": "sachinrjoglekar/MapGeist",
"path": "mapgeist/graphs/graph_functions.py",
"copies": "1",
"size": "1124",
"license": "mit",
"hash": -8380887761824499000,
"line_mean": 27.1,
"line_max": 64,
"alpha_frac": 0.6663701068,
"autogenerated": false,
"ratio": 4.014285714285714,
"config_test"... |
"""All of the kinds of traces in UConnRCMPy"""
# System imports
# Third-party imports
import numpy as np
import cantera as ct
from scipy import signal as sig
from scipy.interpolate import UnivariateSpline
from scipy.stats import linregress
# Local imports
from .constants import (one_atm_in_bar,
... | {
"repo_name": "bryanwweber/UConnRCMPy",
"path": "uconnrcmpy/traces.py",
"copies": "1",
"size": "20363",
"license": "bsd-3-clause",
"hash": 1302995466280997000,
"line_mean": 36.6395563771,
"line_max": 111,
"alpha_frac": 0.6166085547,
"autogenerated": false,
"ratio": 3.953212968355659,
"config_te... |
#All of the non-trivial parts of this program (the frequency extraction) is code from Justin Peel
#At http://stackoverflow.com/questions/2648151/python-frequency-detection Thanks a bunch!
import pyaudio
import wave
import numpy as np
from notes import note_map
import logging
import time
logging.basicConfig(level=log... | {
"repo_name": "parkercoleman/home_tweet_home",
"path": "audio_parser.py",
"copies": "1",
"size": "3377",
"license": "mit",
"hash": 6064977294938241000,
"line_mean": 28.1206896552,
"line_max": 97,
"alpha_frac": 0.6106011253,
"autogenerated": false,
"ratio": 3.3535253227408144,
"config_test": fal... |
# All of the other examples directly embed the Javascript and CSS code for
# Bokeh's client-side runtime into the HTML. This leads to the HTML files
# being rather large. An alternative is to ask Bokeh to produce HTML that
# has a relative link to the Bokeh Javascript and CSS. This is easy to
# do; you just pass in ... | {
"repo_name": "matbra/bokeh",
"path": "examples/plotting/file/relative_paths.py",
"copies": "45",
"size": "1085",
"license": "bsd-3-clause",
"hash": 7441038244425854000,
"line_mean": 37.75,
"line_max": 82,
"alpha_frac": 0.730875576,
"autogenerated": false,
"ratio": 3.4227129337539433,
"config_t... |
"""All of the various asynchronous message producers."""
import json
from messaging import config
from messaging.message_producer import MessageProducer
from messaging.singleton_mixin import SingletonMixin
class CommandProducer(SingletonMixin):
"""Forwards commands."""
def __init__(self):
super(Com... | {
"repo_name": "bskari/sparkfun-avc",
"path": "messaging/async_producers.py",
"copies": "1",
"size": "3765",
"license": "mit",
"hash": -4989430901875622000,
"line_mean": 30.375,
"line_max": 79,
"alpha_frac": 0.592563081,
"autogenerated": false,
"ratio": 4.174057649667406,
"config_test": false,
... |
#All of this can be performed with inbuilt functions
#Basically this is an useless program, written only for
#learning purposes
count = raw_input("Enter the number of values to be computed on:")
count = int(count)
#Here are the function declarations
def maximumNo(uList):
largestNo = None
for item in uList:
if la... | {
"repo_name": "ashgang/RandomAlgos",
"path": "Python/minMaxSum.py",
"copies": "1",
"size": "1571",
"license": "apache-2.0",
"hash": -180249006893982140,
"line_mean": 26.0862068966,
"line_max": 70,
"alpha_frac": 0.7148313176,
"autogenerated": false,
"ratio": 2.9810246679316887,
"config_test": fa... |
#All of this code is awful and needs to be re-written at some point.
#The line drawing functions have been reimplemented in other modules,
#so I'm not entirely sure how often these are called.
class line_diag:
def __init__(self, start, end):
self.path = []
if start == end: return None
self.start = list(start... | {
"repo_name": "flags/Reactor-3",
"path": "drawing.py",
"copies": "1",
"size": "4086",
"license": "mit",
"hash": 6114127590774948000,
"line_mean": 18.9365853659,
"line_max": 144,
"alpha_frac": 0.5736661772,
"autogenerated": false,
"ratio": 2.4718693284936477,
"config_test": false,
"has_no_keyw... |
# all of us
from cmd import *
from Database import sql_database
from FileManagement.filehandler import *
from graph import *
import sys
class Interpreter(Cmd):
# Kris
def __init__(self, database_name):
Cmd.__init__(self)
self.file_handler = FileHandler()
self.database ... | {
"repo_name": "Comikris/Assignment_Interpreter",
"path": "interpreter.py",
"copies": "1",
"size": "13219",
"license": "apache-2.0",
"hash": 6336291241495619000,
"line_mean": 40.2332268371,
"line_max": 108,
"alpha_frac": 0.5588168545,
"autogenerated": false,
"ratio": 4.23821737736454,
"config_te... |
#All of visualization code for MapGeist
from time import sleep
import pygraphviz as PG
import os
def _is_tree(G):
"""
Checks if the NetworkX Graph G is a tree.
"""
from networkx import (number_of_nodes, number_of_edges,
is_connected)
if number_of_nodes(G) != number_of_edg... | {
"repo_name": "sachinrjoglekar/MapGeist",
"path": "mapgeist/visualization/functions.py",
"copies": "1",
"size": "1958",
"license": "mit",
"hash": -5994442372613942000,
"line_mean": 30.5806451613,
"line_max": 66,
"alpha_frac": 0.6475995914,
"autogenerated": false,
"ratio": 3.7653846153846153,
"c... |
__all__ = ['oldtype2dtype', 'convtypecode', 'convtypecode2', 'oldtypecodes']
import numpy as N
oldtype2dtype = {'1': N.dtype(N.byte),
's': N.dtype(N.short),
# 'i': N.dtype(N.intc),
# 'l': N.dtype(int),
# 'b': N.dtype(N.ubyte),
'w': N.dt... | {
"repo_name": "santisiri/popego",
"path": "envs/ALPHA-POPEGO/lib/python2.5/site-packages/numpy-1.0.4-py2.5-linux-x86_64.egg/numpy/oldnumeric/typeconv.py",
"copies": "1",
"size": "1595",
"license": "bsd-3-clause",
"hash": -8861997918272358000,
"line_mean": 25.5833333333,
"line_max": 76,
"alpha_frac": ... |
__all__ = ['OligoAnnealing']
def annealing_score_n(x,y):
if (x=='A' and y=='T') or (x=='T' and y=='A'):
return 2
elif (x=='G' and y=='C') or (x=='C' and y=='G'):
return 4
else:
return 0
class AnnealingState:
def __init__(self, p, q, score, index, scores):
self.p = p
... | {
"repo_name": "mizuy/seqtool",
"path": "seqtool/nucleotide/annealing.py",
"copies": "1",
"size": "4044",
"license": "mit",
"hash": 5311961299929754000,
"line_mean": 29.4060150376,
"line_max": 124,
"alpha_frac": 0.3746290801,
"autogenerated": false,
"ratio": 2.5417976115650536,
"config_test": fa... |
__all__ = 'Once', 'For', 'Every', 'Hertz', 'After', 'Continu', 'Model'
from collections import defaultdict
def test():
m = Model(3*1000)
out = []
d = out.append
count = 0
def add():
nonlocal count
count += 1
m.add_action(lambda:d(m.steps), Once())
m.add_action(lambda:d(m.st... | {
"repo_name": "lennart96/neurons",
"path": "model.py",
"copies": "1",
"size": "5109",
"license": "isc",
"hash": -2665846652795409400,
"line_mean": 27.3833333333,
"line_max": 71,
"alpha_frac": 0.5325895479,
"autogenerated": false,
"ratio": 3.6649928263988523,
"config_test": false,
"has_no_keyw... |
__all__ = ['on', 'when', 'decode_escapes', 'get_dict_path']
import re
import codecs
import copy
ESCAPE_SEQUENCE_RE = re.compile(r'''
( \\U........ # 8-digit hex escapes
| \\u.... # 4-digit hex escapes
| \\x.. # 2-digit hex escapes
| \\[0-7]{1,3} # Octal escapes
| \\N\... | {
"repo_name": "AlexYukikaze/JSONx",
"path": "JSONx/utils.py",
"copies": "1",
"size": "1442",
"license": "mit",
"hash": 4844074744746173000,
"line_mean": 27.2745098039,
"line_max": 81,
"alpha_frac": 0.5353675451,
"autogenerated": false,
"ratio": 3.534313725490196,
"config_test": false,
"has_no... |
"""AlloPred - Predict allosteric pockets on proteins
Usage:
python $ALLOPRED_DIR/run_allopred.py in_file act_res.txt
Arguments are the input file prefix and the active site residue file.
The working directory must contain the input PDB file (in_file.pdb) and the fpocket output directory (in_file_out).
The environment... | {
"repo_name": "jgreener64/allopred",
"path": "run_allopred.py",
"copies": "1",
"size": "11049",
"license": "mit",
"hash": 3582375095768818700,
"line_mean": 33.1018518519,
"line_max": 164,
"alpha_frac": 0.6766223188,
"autogenerated": false,
"ratio": 3.1027801179443975,
"config_test": false,
"h... |
__all__ = ['optimalSVHT']
import numpy as np
def optimalSVHT(matrix):
"""
Returns the optimal threshold of the singular values of a matrix, i.e., it computes the optimal number
of singular values to keep or the optimal rank of the matrix.
Given a matrix Y=X+sigma*Z, with Y the observed matrix, X the matrix that w... | {
"repo_name": "aasensio/pyAndres",
"path": "optimalSVHT.py",
"copies": "1",
"size": "2312",
"license": "mit",
"hash": 5771860972406984000,
"line_mean": 38.2033898305,
"line_max": 135,
"alpha_frac": 0.7197231834,
"autogenerated": false,
"ratio": 3.1327913279132793,
"config_test": false,
"has_n... |
__all__ = ['Option', 'Configuration', 'option']
from typing import Type, FrozenSet, Dict, Any
import attr
import logging
from . import exceptions
logger = logging.getLogger(__name__) # type: logging.Logger
logger.setLevel(logging.DEBUG)
@attr.s(frozen=True)
class Option(object):
"""
Describes a configurat... | {
"repo_name": "squaresLab/Houston",
"path": "houston/configuration.py",
"copies": "1",
"size": "5071",
"license": "mit",
"hash": 2108550771146111500,
"line_mean": 33.7328767123,
"line_max": 105,
"alpha_frac": 0.5450601459,
"autogenerated": false,
"ratio": 4.073092369477911,
"config_test": true,... |
__all__ = ['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 operator import itemgetter as _itemgetter, eq as _eq
from itertools import r... | {
"repo_name": "baseblack/ReproWeb",
"path": "3rdParty/python/ordereddict.py",
"copies": "1",
"size": "7155",
"license": "bsd-2-clause",
"hash": -5961520905938475000,
"line_mean": 34.9547738693,
"line_max": 85,
"alpha_frac": 0.5693920335,
"autogenerated": false,
"ratio": 4.198943661971831,
"conf... |
__all__ = ['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 operator import itemgetter as _itemgetter
from keyword import iskeyword as ... | {
"repo_name": "enthought/depsolver",
"path": "depsolver/compat/_collections.py",
"copies": "1",
"size": "7765",
"license": "bsd-3-clause",
"hash": 1244417524683258400,
"line_mean": 33.2070484581,
"line_max": 85,
"alpha_frac": 0.5577591758,
"autogenerated": false,
"ratio": 4.099788806758184,
"co... |
__all__ = ('OrderedDict',)
try:
from collections import OrderedDict
except ImportError:
# http://code.activestate.com/recipes/576693/
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeE... | {
"repo_name": "r3gis3r/android2po",
"path": "android2po/compat.py",
"copies": "1",
"size": "3293",
"license": "bsd-2-clause",
"hash": 3718322584942820000,
"line_mean": 30.6730769231,
"line_max": 83,
"alpha_frac": 0.4691770422,
"autogenerated": false,
"ratio": 4.355820105820106,
"config_test": f... |
__all__ = ('override_settings',)
try:
from django.test.utils import override_settings
except ImportError:
# we are in Django 1.3
from django.conf import settings, UserSettingsHolder
from django.utils.functional import wraps
class override_settings(object):
"""
Acts as either a dec... | {
"repo_name": "treyhunner/django-crispy-forms",
"path": "crispy_forms/tests/utils.py",
"copies": "25",
"size": "2494",
"license": "mit",
"hash": -4779961259839020000,
"line_mean": 35.6764705882,
"line_max": 77,
"alpha_frac": 0.5609462711,
"autogenerated": false,
"ratio": 4.899803536345776,
"con... |
__all__ = ('override_settings', 'setup')
try:
from django import setup
except ImportError:
def setup():
pass
try:
from django.test.runner import DiscoverRunner
except ImportError:
# Django 1.5 or earlier. Fallback to a patched version of the old runner.
# Should be removed when dropping ... | {
"repo_name": "uranusjr/django-crispy-forms-ng",
"path": "crispy_forms/tests/utils.py",
"copies": "1",
"size": "3572",
"license": "mit",
"hash": 6399384676496187000,
"line_mean": 32.6981132075,
"line_max": 80,
"alpha_frac": 0.5904255319,
"autogenerated": false,
"ratio": 4.591259640102828,
"conf... |
# allowable multiple choice node and edge features
allowable_features = {
'possible_atomic_num_list' : list(range(1, 119)) + ['misc'],
'possible_chirality_list' : [
'CHI_UNSPECIFIED',
'CHI_TETRAHEDRAL_CW',
'CHI_TETRAHEDRAL_CCW',
'CHI_OTHER'
],
'possible_degree_list' : [0... | {
"repo_name": "snap-stanford/ogb",
"path": "ogb/utils/features.py",
"copies": "1",
"size": "6795",
"license": "mit",
"hash": 8965827276664335000,
"line_mean": 39.9397590361,
"line_max": 108,
"alpha_frac": 0.6441501104,
"autogenerated": false,
"ratio": 3.181179775280899,
"config_test": false,
... |
# Allow access to command-line arguments
import sys
import pyrow
# Import the core and GUI elements of Qt
from PyQt4.Qt import *
class PM3(QWidget):
def __init__(self):
super(PM3,self).__init__()
self.pmCount = 0
self.strokeCount = 0
self.display = ""
self.distance =0
d... | {
"repo_name": "chrisreynolds/RaspiRow",
"path": "RaspiRowMain.py",
"copies": "1",
"size": "3782",
"license": "bsd-2-clause",
"hash": -5584557144017902000,
"line_mean": 32.7678571429,
"line_max": 92,
"alpha_frac": 0.5780010576,
"autogenerated": false,
"ratio": 3.300174520069808,
"config_test": f... |
"""Allow a simple way to ensure execution is confined to one thread.
This module defines the Affinity data type that runs code on a single thread.
An instance of the class will execute functions only on the thread that made
the object in the first place. The class is useful in a GUI's main loop."""
__author__ = 'Step... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578151_affinitypy/recipe-578151.py",
"copies": "1",
"size": "2633",
"license": "mit",
"hash": -7013793165825529000,
"line_mean": 32.3291139241,
"line_max": 80,
"alpha_frac": 0.5267755412,
"autogenerated": false,
"ratio": 4.603146853146853,... |
"""allow bash-completion for argparse with argcomplete if installed
needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
to find the magic string, so _ARGCOMPLETE env. var is never set, and
this does not need special code.
Function try_argcomplete(parser) should be called directly before
the call to Argume... | {
"repo_name": "pfctdayelise/pytest",
"path": "src/_pytest/_argcomplete.py",
"copies": "4",
"size": "3724",
"license": "mit",
"hash": -1166359100735830500,
"line_mean": 33.1651376147,
"line_max": 74,
"alpha_frac": 0.6922663802,
"autogenerated": false,
"ratio": 4.1331853496115425,
"config_test": ... |
"""Allow bash-completion for argparse with argcomplete if installed.
Needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
to find the magic string, so _ARGCOMPLETE env. var is never set, and
this does not need special code).
Function try_argcomplete(parser) should be called directly before
the call to Arg... | {
"repo_name": "RonnyPfannschmidt/pytest",
"path": "src/_pytest/_argcomplete.py",
"copies": "4",
"size": "3810",
"license": "mit",
"hash": 6918198904568441000,
"line_mean": 31.5641025641,
"line_max": 82,
"alpha_frac": 0.698687664,
"autogenerated": false,
"ratio": 4.061833688699361,
"config_test"... |
"""Allow basic operations with XML"""
import xml.etree.ElementTree as ET
import os
COLLADA_SCHEMA_TEXT = "{http://www.collada.org/2005/11/COLLADASchema}"
INPUT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) + "/input/"
OUTPUT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) + "/output/"
TREE = 0
ROOT ... | {
"repo_name": "StanleySweet/0AD-Skeleton-Generator",
"path": "skeleton_generator.py",
"copies": "1",
"size": "6313",
"license": "mit",
"hash": -2284567141942363400,
"line_mean": 34.8693181818,
"line_max": 134,
"alpha_frac": 0.5930619357,
"autogenerated": false,
"ratio": 3.550618672665917,
"conf... |
"""allow deleting of rooms
Revision ID: f8f1883f81af
Revises: ff700db83195
Create Date: 2019-10-10 15:24:33.797124
"""
from alembic import op
import sqlalchemy as sa
import pycroft
# revision identifiers, used by Alembic.
revision = 'f8f1883f81af'
down_revision = 'ff700db83195'
branch_labels = None
depends_on = Non... | {
"repo_name": "agdsn/pycroft",
"path": "pycroft/model/alembic/versions/f8f1883f81af_allow_deleting_of_rooms.py",
"copies": "1",
"size": "1685",
"license": "apache-2.0",
"hash": -9169940880612791000,
"line_mean": 42.2051282051,
"line_max": 123,
"alpha_frac": 0.6617210682,
"autogenerated": false,
"... |
"""Allow dragging tabs or pressing keys to change their order."""
from __future__ import annotations
import tkinter
from functools import partial
from porcupine import get_main_window, get_tab_manager, tabs
def on_drag(event: tkinter.Event[tabs.TabManager]) -> str | None:
if event.widget.identify(event.x, event... | {
"repo_name": "Akuli/porcupine",
"path": "porcupine/plugins/tab_order.py",
"copies": "1",
"size": "4244",
"license": "mit",
"hash": 7622730780100572000,
"line_mean": 33.2258064516,
"line_max": 104,
"alpha_frac": 0.6267672008,
"autogenerated": false,
"ratio": 3.5396163469557966,
"config_test": f... |
"""Allow dragging tabs out of the Porcupine window."""
from __future__ import annotations
import logging
import os
import pickle
import subprocess
import sys
import tempfile
import threading
import tkinter
from typing import Any, Tuple, Union
from porcupine import get_main_window, get_parsed_args, get_tab_manager, me... | {
"repo_name": "Akuli/editor",
"path": "porcupine/plugins/poppingtabs.py",
"copies": "1",
"size": "7905",
"license": "mit",
"hash": -1896532285347874800,
"line_mean": 37.0048076923,
"line_max": 115,
"alpha_frac": 0.6107526882,
"autogenerated": false,
"ratio": 3.7446707721459025,
"config_test": f... |
# Allow flashing of the RPi LED
# Provided the following have been run as root on the command line:
# echo none > /sys/class/leds/led0/trigger
# chmod a+w /sys/class/leds/led0/brightness
import os.path
import time
def has_led_control():
return os.path.isfile('/sys/class/leds/led0/brightness')
def led_on():... | {
"repo_name": "jhclark/tattletale",
"path": "tattletaleled.py",
"copies": "1",
"size": "2230",
"license": "apache-2.0",
"hash": -7881620281091023000,
"line_mean": 29.9722222222,
"line_max": 118,
"alpha_frac": 0.6255605381,
"autogenerated": false,
"ratio": 3.0801104972375692,
"config_test": fals... |
"""Allow for Spring and Intro eval relationships
Revision ID: 5615d58892a1
Revises: 6f6b843e2b8f
Create Date: 2017-04-27 15:40:40.640402
"""
# revision identifiers, used by Alembic.
revision = '5615d58892a1'
down_revision = '6f6b843e2b8f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### comma... | {
"repo_name": "RamZallan/conditional",
"path": "migrations/versions/5615d58892a1_.py",
"copies": "2",
"size": "1467",
"license": "mit",
"hash": 6487796911301676000,
"line_mean": 39.75,
"line_max": 111,
"alpha_frac": 0.6973415133,
"autogenerated": false,
"ratio": 3.4845605700712587,
"config_test... |
"""Allow FRB populations to be explored interactively.
Can be run with:
$ bokeh serve --show code/plot.py --args <pop_example.csv>
in which all csv-files with populations can be given after ``--args``, and as
well as the optional arguments of ``-noshow`` and ``-notns``, to
respectively not show the resulting plo... | {
"repo_name": "davidgardenier/frbpoppy",
"path": "frbpoppy/plot.py",
"copies": "1",
"size": "12466",
"license": "mit",
"hash": 7143589314570015000,
"line_mean": 31.8759894459,
"line_max": 77,
"alpha_frac": 0.4737560193,
"autogenerated": false,
"ratio": 3.991031390134529,
"config_test": false,
... |
"""Allow index to be used for comment sorting
Revision ID: 8c2635571571
Revises: 664a23bbc217
Create Date: 2018-10-21 17:47:05.349531
"""
# revision identifiers, used by Alembic.
revision = '8c2635571571'
down_revision = '664a23bbc217'
from alembic import op # lgtm[py/unused-import]
import sqlalchemy as sa # lgt... | {
"repo_name": "Weasyl/weasyl",
"path": "libweasyl/libweasyl/alembic/versions/8c2635571571_allow_index_to_be_used_for_comment_.py",
"copies": "1",
"size": "2503",
"license": "apache-2.0",
"hash": -5556658209213680000,
"line_mean": 55.8863636364,
"line_max": 167,
"alpha_frac": 0.721534159,
"autogener... |
"""Allowing reporting_start_end_dates to be null
Revision ID: 9acf8cc4e454
Revises: df2f541291a5
Create Date: 2017-07-11 14:14:03.356183
"""
# revision identifiers, used by Alembic.
revision = '9acf8cc4e454'
down_revision = 'df2f541291a5'
branch_labels = None
depends_on = None
from alembic import op
import sqlalche... | {
"repo_name": "fedspendingtransparency/data-act-broker-backend",
"path": "dataactcore/migrations/versions/9acf8cc4e454_allowing_reporting_start_end_dates_to_.py",
"copies": "1",
"size": "1912",
"license": "cc0-1.0",
"hash": 3374500906245179000,
"line_mean": 29.3492063492,
"line_max": 75,
"alpha_frac"... |
"""allowlist rename
Revision ID: eeb702f77d7d
Revises: 8a44a4364f5a
Create Date: 2020-10-15 13:29:38.853574
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'eeb702f77d7d'
down_revision = '8a44a4364f5a'
branch_labels = None
depends_on = None
def upgrade(engine... | {
"repo_name": "mit-ll/python-keylime",
"path": "keylime/migrations/versions/eeb702f77d7d_allowlist_rename.py",
"copies": "1",
"size": "1286",
"license": "bsd-2-clause",
"hash": -5445349523617915000,
"line_mean": 25.7916666667,
"line_max": 146,
"alpha_frac": 0.6874027994,
"autogenerated": false,
"... |
"""Allow parameters when extending.
Based on https://djangosnippets.org/snippets/447/. Modified for use
with variables.
"""
from django import template
from django.template.loader_tags import do_extends
import tokenize
import io
register = template.Library()
class XExtendsNode(template.Node):
"""Allow paramet... | {
"repo_name": "jscott1989/happening",
"path": "src/happening/templatetags/xextends.py",
"copies": "2",
"size": "1752",
"license": "mit",
"hash": -8312010145151559000,
"line_mean": 26.8095238095,
"line_max": 72,
"alpha_frac": 0.573630137,
"autogenerated": false,
"ratio": 4.141843971631205,
"conf... |
"""Allow safety to be executable through `python -m safety`."""
from __future__ import absolute_import
import os
import sys
import sysconfig
LIBPATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "lib")
def get_site_packages():
prefixes = {sys.prefix, sysconfig.get_config_var('prefix')}
try:
... | {
"repo_name": "kennethreitz/pipenv",
"path": "tasks/vendoring/safety/__main__.py",
"copies": "1",
"size": "1256",
"license": "mit",
"hash": -8426330673509959000,
"line_mean": 26.9111111111,
"line_max": 73,
"alpha_frac": 0.6265923567,
"autogenerated": false,
"ratio": 3.4600550964187327,
"config_... |
"""Allow safety to be executable through `python -m safety`."""
from __future__ import absolute_import
import os
import sys
import sysconfig
PATCHED_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PIPENV_DIR = os.path.dirname(PATCHED_DIR)
VENDORED_DIR = os.path.join("PIPENV_DIR", "vendor")
def ge... | {
"repo_name": "kennethreitz/pipenv",
"path": "pipenv/patched/safety/__main__.py",
"copies": "1",
"size": "1485",
"license": "mit",
"hash": -5411513497470724000,
"line_mean": 28.1176470588,
"line_max": 87,
"alpha_frac": 0.6430976431,
"autogenerated": false,
"ratio": 3.2781456953642385,
"config_t... |
# Allows a mentor to ssh into a DigitalOcean droplet. This is designed to be
# executed on the target machine.
#
# This script takes the username of the mentor as an argument:
#
# $ python3 add_mentor.py <mentor's username>
#
# Alternatively you can pass in --remove to remove their SSH key from the
# machine:
#
# $ pyt... | {
"repo_name": "eeshangarg/zulip",
"path": "tools/droplets/add_mentor.py",
"copies": "6",
"size": "2243",
"license": "apache-2.0",
"hash": -5965207919732918000,
"line_mean": 28.9066666667,
"line_max": 97,
"alpha_frac": 0.6272848863,
"autogenerated": false,
"ratio": 3.488335925349922,
"config_tes... |
# Allows a mentor to ssh into a Digital Ocean droplet. This is designed to be
# executed on the target machine.
#
# This script takes the username of the mentor as an argument:
#
# $ python3 add_mentor.py <mentor's username>
#
# Alternatively you can pass in --remove to remove their ssh key from the
# machine:
#
# $ py... | {
"repo_name": "shubhamdhama/zulip",
"path": "tools/droplets/add_mentor.py",
"copies": "3",
"size": "2289",
"license": "apache-2.0",
"hash": -7705882464026787000,
"line_mean": 29.9324324324,
"line_max": 91,
"alpha_frac": 0.619921363,
"autogenerated": false,
"ratio": 3.5324074074074074,
"config_t... |
# Allows a mentor to ssh into a DigitalOcean droplet. This is designed to be
# executed on the target machine.
#
# This script takes the username of the mentor as an argument:
#
# $ python3 add_mentor.py <mentor's username>
#
# Alternatively you can pass in --remove to remove their SSH key from the
# machine:
#
# $ pyt... | {
"repo_name": "showell/zulip",
"path": "tools/droplets/add_mentor.py",
"copies": "2",
"size": "2273",
"license": "apache-2.0",
"hash": 5640861156219217000,
"line_mean": 29.7162162162,
"line_max": 91,
"alpha_frac": 0.6190057193,
"autogenerated": false,
"ratio": 3.529503105590062,
"config_test": ... |
# Allows a mentor to ssh into a Digital Ocean droplet. This is designed to be
# executed on the target machine.
#
# This script takes the username of the mentor as an argument:
#
# $ python3 add_mentor.py <mentor's username>
#
# Alternatively you can pass in --remove to remove their ssh key from the
# machine:
#
# $ py... | {
"repo_name": "mahim97/zulip",
"path": "tools/droplets/add_mentor.py",
"copies": "16",
"size": "2330",
"license": "apache-2.0",
"hash": 5087274952683895000,
"line_mean": 30.0666666667,
"line_max": 91,
"alpha_frac": 0.6197424893,
"autogenerated": false,
"ratio": 3.579109062980031,
"config_test":... |
"""Allows creation and manipulation of python objects representing html, css and javascript elements.
Available predefined objects for html elements:
<html>, <head>, <body>, <title>, <meta>, <link>,
<p>, <h1> to <h6>, <a>, <div>, <script>, <img>,
<ul>, <ol>, <li>, <table>, <tr>, <th>, <td>, <hr>,
<br>,... | {
"repo_name": "mikister/webgen",
"path": "webgen/dom.py",
"copies": "1",
"size": "21958",
"license": "mit",
"hash": 7141873671371173000,
"line_mean": 30.5488505747,
"line_max": 113,
"alpha_frac": 0.5828399672,
"autogenerated": false,
"ratio": 3.9699873440607485,
"config_test": false,
"has_no_... |
"""Allow selecting multiple lines and indenting them all at once."""
from porcupine import get_tab_manager, tabs, utils
setup_before = ['tabs2spaces'] # see tabs2spaces.py
def on_tab_key(event, shifted):
try:
start_index, end_index = map(str, event.widget.tag_ranges('sel'))
except ValueError as... | {
"repo_name": "PurpleMyst/porcupine",
"path": "porcupine/plugins/indent_block.py",
"copies": "1",
"size": "1466",
"license": "mit",
"hash": -3346402221056442400,
"line_mean": 33.0930232558,
"line_max": 79,
"alpha_frac": 0.6002728513,
"autogenerated": false,
"ratio": 3.4988066825775657,
"config_... |
'''Allows executing and formatting ReQL queries and JSON responses'''
from __future__ import print_function
import json
import datetime
import traceback
import os
import sys
import termios
import tty
import re
import functools
import base64
from pygments import highlight
from pygments.lexers import JsonLexer, PythonL... | {
"repo_name": "deontologician/reql_cli",
"path": "reqlcli/__init__.py",
"copies": "1",
"size": "8840",
"license": "mit",
"hash": -6249369954303568000,
"line_mean": 30.9133574007,
"line_max": 80,
"alpha_frac": 0.5771493213,
"autogenerated": false,
"ratio": 4.227642276422764,
"config_test": false... |
#Allows for creation of new inputs and outputs
from mongoobject import RecursiveMongoObject
import uuid
from bson.objectid import ObjectId
class IO(RecursiveMongoObject):
@staticmethod
def create():
return {
"_id": ObjectId(uuid.uuid4().hex[:24]),
"meta": {}, #Metadata of the... | {
"repo_name": "dkumor/meDB",
"path": "datastore/users/inputoutput.py",
"copies": "1",
"size": "2228",
"license": "mit",
"hash": -4258496223690594000,
"line_mean": 25.843373494,
"line_max": 103,
"alpha_frac": 0.5408438061,
"autogenerated": false,
"ratio": 3.111731843575419,
"config_test": false,... |
# Allows for Note objects to initialized via a given frequency and volume
# Imported for use in the module Note_Library.py
# Taken from < https://gist.github.com/ohsqueezy/6540433 >
##############################################################
# Generate a 440 Hz square waveform in Pygame by building an array of sam... | {
"repo_name": "cornell-cup/cs-minibot-platform",
"path": "python-interface/src/MiniBotFramework/Sound/pygame_play_tone.py",
"copies": "1",
"size": "1497",
"license": "apache-2.0",
"hash": 6682653252137785000,
"line_mean": 32.2666666667,
"line_max": 87,
"alpha_frac": 0.6205744823,
"autogenerated": f... |
"""Allows for quick movement between git branches, for long branch names."""
import argparse
import subprocess
import sys
from contextlib import contextmanager
from enum import Enum
from typing import List
from typing import Optional
from typing import Tuple
from ..core import color
from ..core import git
from ..excep... | {
"repo_name": "domanchi/gitfu",
"path": "gitfu/standalone/switch_git_branch.py",
"copies": "1",
"size": "6411",
"license": "mit",
"hash": -7860603707468189000,
"line_mean": 27.6205357143,
"line_max": 97,
"alpha_frac": 0.6268912806,
"autogenerated": false,
"ratio": 4.099104859335038,
"config_tes... |
"""Allows for triggering GPIO lines on FTDI based boards."""
import time
import pylibftdi
class FtdiButtons:
"""Allows for triggering GPIO lines on FTDI based boards."""
def __init__(self, ftdi_serial_number, button_map, polarity=False):
"""Initializes the FtdiButtons with the properties provided.
The ... | {
"repo_name": "google/gazoo-device",
"path": "gazoo_device/switchboard/ftdi_buttons.py",
"copies": "1",
"size": "7041",
"license": "apache-2.0",
"hash": 7502745569071379000,
"line_mean": 30.5739910314,
"line_max": 76,
"alpha_frac": 0.6321545235,
"autogenerated": false,
"ratio": 3.8224755700325734... |
"""Allows livesettings to be "locked down" and no longer use the settings page or the database
for settings retrieval.
"""
import logging
from django.conf import settings as djangosettings
from django.contrib.sites.models import Site
__all__ = ['get_overrides']
def _safe_get_siteid(site):
if not site:
tr... | {
"repo_name": "oblalex/django-xlivesettings",
"path": "xlivesettings/overrides.py",
"copies": "1",
"size": "1864",
"license": "bsd-3-clause",
"hash": -6474655173163482000,
"line_mean": 31.701754386,
"line_max": 94,
"alpha_frac": 0.5971030043,
"autogenerated": false,
"ratio": 3.899581589958159,
... |
"""Allows livesettings to be "locked down" and no longer use the settings page or the database
for settings retrieval.
"""
from django.conf import settings as djangosettings
from django.contrib.sites.models import Site
import logging
__all__ = ['get_overrides']
def _safe_get_siteid(site):
if not site:
tr... | {
"repo_name": "pombredanne/django-livesettings",
"path": "livesettings/overrides.py",
"copies": "3",
"size": "1873",
"license": "bsd-3-clause",
"hash": -4129011167181125600,
"line_mean": 31.8596491228,
"line_max": 94,
"alpha_frac": 0.5942338494,
"autogenerated": false,
"ratio": 3.918410041841004,... |
# allows modules to be imported from the ./dependencies directory
import sys
sys.path.insert(0, './dependencies')
# for calling external APIs
import requests
import json
def lambda_handler(event, context):
""" Route the incoming request based on type (LaunchRequest, IntentRequest,
etc.) The JSON body of the r... | {
"repo_name": "ikottman/alexa-skills",
"path": "is_streaming/main.py",
"copies": "1",
"size": "5663",
"license": "unlicense",
"hash": -664783094762002200,
"line_mean": 33.962962963,
"line_max": 103,
"alpha_frac": 0.6208723292,
"autogenerated": false,
"ratio": 3.9490934449093444,
"config_test": ... |
# allows modules to be imported from the ./dependencies directory
import sys
sys.path.insert(0, './dependencies')
# for calling external APIs
import requests
import json
# for handling KMS secret decryption
import os
import boto3
from base64 import b64decode
# get and decode secrets from KMS
ENCRYPTED_KEY = os.envir... | {
"repo_name": "ikottman/alexa-skills",
"path": "office_hours/office_hours.py",
"copies": "1",
"size": "6237",
"license": "unlicense",
"hash": -4367586624101451000,
"line_mean": 36.8,
"line_max": 116,
"alpha_frac": 0.6185666186,
"autogenerated": false,
"ratio": 4.152463382157124,
"config_test": ... |
"""Allows mouse wheel to work within matplotlib
http://stackoverflow.com/questions/11551049/matplotlib-plot-zooming-with-scroll-wheel
"""
from matplotlib.pyplot import figure, show
import numpy
class ZoomPan:
def __init__(self):
self.press = None
self.cur_xlim = None
self.cur_ylim = None
... | {
"repo_name": "biokit/biokit",
"path": "biokit/dev/mpl_focus.py",
"copies": "1",
"size": "3225",
"license": "bsd-2-clause",
"hash": -7794963521827931000,
"line_mean": 29.7142857143,
"line_max": 85,
"alpha_frac": 0.5457364341,
"autogenerated": false,
"ratio": 3.5092491838955384,
"config_test": f... |
# Allows player to choose their next move
from show import *
def chooser(x_or_o, board):
while True:
show(board)
try:
x_or_o_input = input("Select a spot[%s]> " % x_or_o)
x_or_o_input = int(x_or_o_input)
# Subtract 1 to accomodate for indexing vs regular
... | {
"repo_name": "jessebikman/Tictactoe-colorama",
"path": "chooser.py",
"copies": "1",
"size": "1263",
"license": "mit",
"hash": 5985769104496948000,
"line_mean": 30.575,
"line_max": 72,
"alpha_frac": 0.5106888361,
"autogenerated": false,
"ratio": 4.370242214532872,
"config_test": false,
"has_n... |
""" Allows production of cutlists for a given set of required pieces, given
a set of available stock sizes.
"""
import collections
from .stock import Stock
# simple structure to keep track of a specific piece
Piece = collections.namedtuple('Piece', 'id, length')
class Planner(object):
""" Object that can produc... | {
"repo_name": "alanc10n/py-cutplanner",
"path": "cutplanner/planner.py",
"copies": "1",
"size": "2004",
"license": "mit",
"hash": 2501005921870436400,
"line_mean": 31.8524590164,
"line_max": 75,
"alpha_frac": 0.621257485,
"autogenerated": false,
"ratio": 3.9140625,
"config_test": false,
"has_... |
"""Allows reading temperatures from ecoal/esterownik.pl controller."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import TEMP_CELSIUS
from . import AVAILABLE_SENSORS, DATA_ECOAL_BOILER
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the ecoal ... | {
"repo_name": "w1ll1am23/home-assistant",
"path": "homeassistant/components/ecoal_boiler/sensor.py",
"copies": "5",
"size": "1632",
"license": "apache-2.0",
"hash": -8282250350400701000,
"line_mean": 30.3846153846,
"line_max": 78,
"alpha_frac": 0.6507352941,
"autogenerated": false,
"ratio": 3.760... |
"""Allows reading temperatures from ecoal/esterownik.pl controller."""
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from . import AVAILABLE_SENSORS, DATA_ECOAL_BOILER
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the ecoal sensors."... | {
"repo_name": "tboyce021/home-assistant",
"path": "homeassistant/components/ecoal_boiler/sensor.py",
"copies": "9",
"size": "1617",
"license": "apache-2.0",
"hash": -8390926505367633000,
"line_mean": 30.0961538462,
"line_max": 78,
"alpha_frac": 0.6474953618,
"autogenerated": false,
"ratio": 3.743... |
"""Allows reading temperatures from ecoal/esterownik.pl controller."""
import logging
from homeassistant.components.ecoal_boiler import (
DATA_ECOAL_BOILER, AVAILABLE_SENSORS, )
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
DEPE... | {
"repo_name": "HydrelioxGitHub/home-assistant",
"path": "homeassistant/components/ecoal_boiler/sensor.py",
"copies": "2",
"size": "1749",
"license": "apache-2.0",
"hash": 7123816952604687000,
"line_mean": 29.1551724138,
"line_max": 78,
"alpha_frac": 0.653516295,
"autogenerated": false,
"ratio": 3... |
"""Allows reading temperatures from ecoal/esterownik.pl controller."""
import logging
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from . import AVAILABLE_SENSORS, DATA_ECOAL_BOILER
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['ecoal_boiler']
def setup_plat... | {
"repo_name": "jamespcole/home-assistant",
"path": "homeassistant/components/ecoal_boiler/sensor.py",
"copies": "1",
"size": "1705",
"license": "apache-2.0",
"hash": -2432014744900283000,
"line_mean": 28.3965517241,
"line_max": 78,
"alpha_frac": 0.6504398827,
"autogenerated": false,
"ratio": 3.69... |
# Allows rendering a given tilespec
from multiple_tiles_affine_renderer import MultipleTilesAffineRenderer
from single_tile_affine_renderer import SingleTileAffineRenderer
import json
import numpy as np
import sys
sys.path.append('../')
import models
class TilespecAffineRenderer:
def __init__(self, tilespec):
... | {
"repo_name": "Rhoana/rh_aligner",
"path": "old/renderer/tilespec_affine_renderer.py",
"copies": "1",
"size": "1375",
"license": "mit",
"hash": -1797301617322527500,
"line_mean": 37.1944444444,
"line_max": 157,
"alpha_frac": 0.6516363636,
"autogenerated": false,
"ratio": 3.9173789173789175,
"co... |
# Allows rendering a given tilespec
from multiple_tiles_renderer import MultipleTilesRenderer
from single_tile_renderer import SingleTileRenderer
import json
import numpy as np
import sys
sys.path.append('../')
import models
class TilespecRenderer:
def __init__(self, tilespec):
self.single_tiles = [Singl... | {
"repo_name": "Rhoana/rh_aligner",
"path": "old/renderer/tilespec_renderer.py",
"copies": "1",
"size": "1280",
"license": "mit",
"hash": 3278240346951653000,
"line_mean": 34.5555555556,
"line_max": 157,
"alpha_frac": 0.63671875,
"autogenerated": false,
"ratio": 3.9628482972136223,
"config_test"... |
"""Allows running Celery tasks asynchronously using the Tornado IOLoop."""
from tornado import concurrent
from tornado import ioloop
from tornado import stack_context
import logging
import time
logger = logging.getLogger(__name__)
class CeleryPoller(object):
def __init__(self, poll_freq):
self._poll_fr... | {
"repo_name": "tdryer/feeder",
"path": "feedreader/celery_poller.py",
"copies": "1",
"size": "2139",
"license": "mit",
"hash": 3463264437872493600,
"line_mean": 36.5263157895,
"line_max": 76,
"alpha_frac": 0.5848527349,
"autogenerated": false,
"ratio": 4.590128755364807,
"config_test": false,
... |
# Allows the admin to close individual opened ports from django
# Delete rule from table.filter chain input
# Add the deny rule
import iptc
# Delete the input rule from table
def delete_identical_rule(client_ip, service_port):
chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "INPUT")
for rule in chain.rule... | {
"repo_name": "bb111189/CryptoKnocker",
"path": "CryptoKnocker/libs/port_operations/closeIndividualPort.py",
"copies": "2",
"size": "1798",
"license": "mit",
"hash": -1553334561083069200,
"line_mean": 31.1071428571,
"line_max": 97,
"alpha_frac": 0.6568409344,
"autogenerated": false,
"ratio": 3.43... |
"""Allows the creation of a sensor that breaks out state_attributes."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASSES_SCHEMA,
DOMAIN as SENSOR_DOMAIN,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
SensorEntity,
)
from homeassistant.co... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/template/sensor.py",
"copies": "2",
"size": "9782",
"license": "apache-2.0",
"hash": 6994978403340724000,
"line_mean": 30.9673202614,
"line_max": 119,
"alpha_frac": 0.6274790431,
"autogenerated": false,
"ratio": 3.99... |
"""Allows the creation of a sensor that breaks out state_attributes."""
import logging
from typing import Optional
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASSES_SCHEMA,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
AT... | {
"repo_name": "postlund/home-assistant",
"path": "homeassistant/components/template/sensor.py",
"copies": "4",
"size": "9527",
"license": "apache-2.0",
"hash": 8923949257607735000,
"line_mean": 32.4280701754,
"line_max": 86,
"alpha_frac": 0.5847591057,
"autogenerated": false,
"ratio": 4.447712418... |
"""Allows the creation of a sensor that breaks out state_attributes."""
import logging
from typing import Optional
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.sensor import ENTITY_ID_FORMAT, \
PLATFORM_SCHEMA, DEVICE_CLASSES_SCHEMA
from homeassistant.const import... | {
"repo_name": "molobrakos/home-assistant",
"path": "homeassistant/components/template/sensor.py",
"copies": "7",
"size": "8662",
"license": "apache-2.0",
"hash": 4834357881655330000,
"line_mean": 37.3274336283,
"line_max": 79,
"alpha_frac": 0.5864696375,
"autogenerated": false,
"ratio": 4.3880445... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.