text stringlengths 0 1.05M | meta dict |
|---|---|
# Brought to you by Jeremy Rubin, 2013
# Import all main libs
from Imports import *
# Import all handlers/models
from handlers_list import *
# Import Routes
import routes
class Application(tornado.web.Application):
def __init__(self):
handlers = routes.handlers
if config["devmode"]: handlers.appe... | {
"repo_name": "JeremyRubin/tornado-trails",
"path": "App.py",
"copies": "1",
"size": "1872",
"license": "mit",
"hash": 8592498008807476000,
"line_mean": 33.6851851852,
"line_max": 103,
"alpha_frac": 0.5507478632,
"autogenerated": false,
"ratio": 4.060737527114967,
"config_test": true,
"has_no... |
#Brought to you by Jeremy Rubin, 2013
import Tool
import argparse
import fileinput
import os
import sys
class NewHandler(object):
def __init__(self, arg):
opts = vars(args)
send = {"name":arg.name,
"target":"tornado_handlers",
"template":"python/handler.pyt",
"type":"Handler.py"}
print "Creating: "+... | {
"repo_name": "JeremyRubin/tornado-trails",
"path": "tools/NewResource.py",
"copies": "1",
"size": "1573",
"license": "mit",
"hash": -2562834744778540500,
"line_mean": 28.6981132075,
"line_max": 73,
"alpha_frac": 0.6592498411,
"autogenerated": false,
"ratio": 2.813953488372093,
"config_test": f... |
# Brownian motion -- an example of a multi-threaded Tkinter program.
from Tkinter import *
import random
import threading
import time
import sys
WIDTH = 400
HEIGHT = 300
SIGMA = 10
BUZZ = 2
RADIUS = 2
LAMBDA = 10
FILL = 'red'
stop = 0 # Set when main loop exits
def particle(canvas):
... | {
"repo_name": "vlinhd11/vlinhd11-android-scripting",
"path": "python/src/Demo/tkinter/guido/brownian.py",
"copies": "50",
"size": "1091",
"license": "apache-2.0",
"hash": -2208934835099418000,
"line_mean": 20.82,
"line_max": 68,
"alpha_frac": 0.5701191567,
"autogenerated": false,
"ratio": 3.18075... |
# % Brown numbers have the following properties:
# % (m,n) such that:
# % n!+1 = m^2
# % Paul Erdos postulated that there are only 3 sets.
# Import the math package
import math
import time
n = 2
# Babylonian method of checking for a square root
# Implement gmpy?
def is_square(apositiveint):
x = apositiveint /... | {
"repo_name": "lukasschwab/code-golf",
"path": "brownnumbers/brownNoser.py",
"copies": "1",
"size": "1048",
"license": "mit",
"hash": -8512609080019028000,
"line_mean": 25.8974358974,
"line_max": 70,
"alpha_frac": 0.6116412214,
"autogenerated": false,
"ratio": 2.952112676056338,
"config_test": ... |
"""browsepict - Display all "cicn" resources found"""
import FrameWork
import EasyDialogs
from Carbon import Res
from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
from Carbon import Icn
import macresource
#
# Resource definitions
ID_MAIN=512
MAIN_LIST=1
MAIN_SHOW=2
# Wh... | {
"repo_name": "vlinhd11/vlinhd11-android-scripting",
"path": "python/src/Mac/Demo/PICTbrowse/cicnbrowse.py",
"copies": "34",
"size": "4952",
"license": "apache-2.0",
"hash": -8594716485195986000,
"line_mean": 29.7577639752,
"line_max": 74,
"alpha_frac": 0.5825928918,
"autogenerated": false,
"rati... |
"""browsepict - Display all "ICON" resources found"""
import FrameWork
import EasyDialogs
from Carbon import Res
from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
from Carbon import Icn
import macresource
#
# Resource definitions
ID_MAIN=512
MAIN_LIST=1
MAIN_SHOW=2
# Wh... | {
"repo_name": "yqm/sl4a",
"path": "python/src/Mac/Demo/PICTbrowse/ICONbrowse.py",
"copies": "34",
"size": "4944",
"license": "apache-2.0",
"hash": -6544238846289256000,
"line_mean": 29.7080745342,
"line_max": 74,
"alpha_frac": 0.5819174757,
"autogenerated": false,
"ratio": 3.533952823445318,
"c... |
"""browsepict - Display all "PICT" resources found"""
import FrameWork
import EasyDialogs
from Carbon import Res
from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
import struct
import macresource
#
# Resource definitions
ID_MAIN=512
MAIN_LIST=1
MAIN_SHOW=2
# Where is th... | {
"repo_name": "liamgh/liamgreenhughes-sl4a-tf101",
"path": "python/src/Mac/Demo/PICTbrowse/PICTbrowse.py",
"copies": "34",
"size": "4063",
"license": "apache-2.0",
"hash": -6093649191655123000,
"line_mean": 28.0214285714,
"line_max": 72,
"alpha_frac": 0.5712527689,
"autogenerated": false,
"ratio"... |
"""browsepict - Display all "PICT" resources found"""
import FrameWork
import EasyDialogs
from Carbon import Res
from Carbon import Qd
from Carbon import Win
from Carbon import List
import struct
import macresource
#
# Resource definitions
ID_MAIN=512
MAIN_LIST=1
MAIN_SHOW=2
# Where is the picture window?
LEFT=200
T... | {
"repo_name": "tinchoss/Python_Android",
"path": "python/src/Mac/Demo/PICTbrowse/oldPICTbrowse.py",
"copies": "34",
"size": "4689",
"license": "apache-2.0",
"hash": 4720138504000451000,
"line_mean": 28.6772151899,
"line_max": 82,
"alpha_frac": 0.5653657496,
"autogenerated": false,
"ratio": 3.4376... |
BROWSER = 'chrome'
class XPATH:
LANGUAGE_BUTTON = "//*[contains(@class, 'language-name')]"
LANGUAGE_TEXT = None
LANGUAGE_POPUP = "//*[@class='Popup NavbarLanguage-popup _shown']"
CURRENCY_BUTTON = "//*[@class='currency-selected']"
CURRENCY_POPUP = "//*[@class='Popup NavbarCurrency-popup _shown']"
... | {
"repo_name": "TomLex/qabot",
"path": "variables/locators/common.py",
"copies": "1",
"size": "7446",
"license": "apache-2.0",
"hash": -7878820081565498000,
"line_mean": 80.8351648352,
"line_max": 220,
"alpha_frac": 0.6757990868,
"autogenerated": false,
"ratio": 2.945411392405063,
"config_test":... |
"""Browser overrides tests."""
import time
import mock
import pytest
def test_wait_for_condition_default(browser, splinter_browser_load_condition, splinter_browser_load_timeout):
"""Test that by default wait_until is successful."""
browser.wait_for_condition(
splinter_browser_load_condition,
... | {
"repo_name": "miohtama/pytest-splinter",
"path": "tests/mocked_browser/test_browser_overrides.py",
"copies": "2",
"size": "1237",
"license": "mit",
"hash": 291049306740662300,
"line_mean": 22.7884615385,
"line_max": 109,
"alpha_frac": 0.6604688763,
"autogenerated": false,
"ratio": 3.759878419452... |
"""BrowserPlus is a module which utilises lxml to provide simple methods to
scrape information from the mechanize browser.
Vincent Au (c) 2015
vinceau/browserplus
"""
import logging
from lxml import etree, html
from mechanize import Browser, LinkNotFoundError
from sys import stdout
__version__ = '0.0.1'
_log = loggi... | {
"repo_name": "xujun10110/browserplus",
"path": "browserplus/browserplus.py",
"copies": "2",
"size": "3952",
"license": "mit",
"hash": -7688533136799387000,
"line_mean": 33.3652173913,
"line_max": 79,
"alpha_frac": 0.5895748988,
"autogenerated": false,
"ratio": 4.040899795501023,
"config_test":... |
"""Browser screenshot tests."""
import pytest
import mock
from _pytest.config import Config
def test_browser_screenshot_normal(mocked_browser, testdir):
"""Test making screenshots on test failure.
Normal test run.
"""
testdir.inline_runsource("""
def test_screenshot(browser):
as... | {
"repo_name": "miohtama/pytest-splinter",
"path": "tests/mocked_browser/test_screenshot.py",
"copies": "1",
"size": "1795",
"license": "mit",
"hash": 5187485403268374000,
"line_mean": 36.3958333333,
"line_max": 106,
"alpha_frac": 0.6986072423,
"autogenerated": false,
"ratio": 3.8852813852813854,
... |
"""Browser steps for Gherkin"""
import os
from contextlib import contextmanager
from aloe import around, world
from selenium import webdriver
from xvfbwrapper import Xvfb
@around.all
@contextmanager
def with_browser():
"""Start a browser for the tests."""
if 'XVFB' in os.environ:
world.vdisplay = ... | {
"repo_name": "jricardo27/holiday_planner",
"path": "holiday_planner/features/steps/browser.py",
"copies": "1",
"size": "2330",
"license": "bsd-3-clause",
"hash": 4597326977952945000,
"line_mean": 25.1797752809,
"line_max": 80,
"alpha_frac": 0.6094420601,
"autogenerated": false,
"ratio": 4.116607... |
"""Browser to test web applications.
(from web.py)
"""
from .utils import re_compile
from .net import htmlunquote
from io import BytesIO, StringIO
import copy
from .py3helpers import PY2
#Welcome to the Py2->Py3 httplib/urllib reorganization nightmare.
if PY2:
get_selector = lambda x: x.get_selector()
get_h... | {
"repo_name": "TheXYZLAB/RaspCloudPrint",
"path": "web/browser.py",
"copies": "3",
"size": "8714",
"license": "mit",
"hash": -7568062992137935000,
"line_mean": 30.802919708,
"line_max": 107,
"alpha_frac": 0.5930686252,
"autogenerated": false,
"ratio": 3.9501359927470534,
"config_test": false,
... |
"""Browser to test web applications.
(from web.py)
"""
from utils import re_compile
from net import htmlunquote
import httplib, urllib, urllib2
import cookielib
import copy
from StringIO import StringIO
DEBUG = False
__all__ = [
"BrowserError",
"Browser", "AppBrowser",
"AppHandler"
]
class BrowserError(... | {
"repo_name": "philogb/jit",
"path": "webpy/web/browser.py",
"copies": "16",
"size": "7579",
"license": "mit",
"hash": 4146259301460216000,
"line_mean": 31.6681034483,
"line_max": 107,
"alpha_frac": 0.5822667898,
"autogenerated": false,
"ratio": 3.9453409682457052,
"config_test": false,
"has_... |
"""Browser to test web applications.
(from web.py)
"""
from utils import re_compile
from net import htmlunquote
import httplib, urllib, urllib2
import copy
from StringIO import StringIO
DEBUG = False
__all__ = [
"BrowserError",
"Browser", "AppBrowser",
"AppHandler"
]
class BrowserError(Exception):
p... | {
"repo_name": "hobbe/notifry-o",
"path": "appengine/web/browser.py",
"copies": "103",
"size": "7679",
"license": "apache-2.0",
"hash": -4644639682185705000,
"line_mean": 31.5381355932,
"line_max": 107,
"alpha_frac": 0.5801536658,
"autogenerated": false,
"ratio": 3.954170957775489,
"config_test"... |
"""Browser to test web applications.
(from web.py)
"""
from utils import re_compile
from net import htmlunquote
import httplib, urllib, urllib2
import copy
from StringIO import StringIO
DEBUG = False
__all__ = [
"BrowserError",
"Browser", "AppBrowser",
"AppHandler"
]
class BrowserError... | {
"repo_name": "ProfessionalIT/customers",
"path": "persianas_paludo/src/webapps/web/browser.py",
"copies": "2",
"size": "7915",
"license": "mit",
"hash": -8895494114171706000,
"line_mean": 31.5381355932,
"line_max": 107,
"alpha_frac": 0.562855338,
"autogenerated": false,
"ratio": 4.04652351738241... |
"""browser URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "mwort/modelmanager",
"path": "modelmanager/plugins/browser/urls.py",
"copies": "1",
"size": "1341",
"license": "bsd-3-clause",
"hash": 9012080601879031000,
"line_mean": 38.4411764706,
"line_max": 79,
"alpha_frac": 0.7099179717,
"autogenerated": false,
"ratio": 3.4296675191815855,
... |
### brpc
## query = bencode({'y':'q', 'q':'<method>', 'a':[<params>])
## response = bencode({'y':'r', 'r':<return value>}}
## fault = bencode({'y':'e','c':'<fault code>', 's':'<fault string>'
from xmlrpclib import Error, Fault
from types import TupleType
from BTL.bencode import bencode, bdecode
def dump_fault(code,... | {
"repo_name": "sauloal/linuxscripts",
"path": "apache/var/www/html/saulo/torrent/html/bin/clients/mainline/BTL/brpc.py",
"copies": "6",
"size": "2771",
"license": "mit",
"hash": 6033911449816607000,
"line_mean": 31.6,
"line_max": 99,
"alpha_frac": 0.5849873692,
"autogenerated": false,
"ratio": 3.... |
"""brp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | {
"repo_name": "chop-dbhi/biorepo-portal",
"path": "brp/urls.py",
"copies": "1",
"size": "1880",
"license": "bsd-2-clause",
"hash": 933654830146388100,
"line_mean": 40.7777777778,
"line_max": 79,
"alpha_frac": 0.6920212766,
"autogenerated": false,
"ratio": 3.514018691588785,
"config_test": false... |
"""br_rss URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"repo_name": "jeffbr13/br-rss",
"path": "br_rss/br_rss/urls.py",
"copies": "1",
"size": "1067",
"license": "mpl-2.0",
"hash": -5367255572994919000,
"line_mean": 41.68,
"line_max": 100,
"alpha_frac": 0.6916588566,
"autogenerated": false,
"ratio": 3.32398753894081,
"config_test": false,
"has_n... |
"""brs URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | {
"repo_name": "vuonghv/brs",
"path": "brs/urls.py",
"copies": "1",
"size": "1954",
"license": "mit",
"hash": 4058440931305972700,
"line_mean": 49.1025641026,
"line_max": 136,
"alpha_frac": 0.6775844422,
"autogenerated": false,
"ratio": 3.546279491833031,
"config_test": false,
"has_no_keywords... |
# Bruce A. Maxwell
# Spring 2015
# CS 251 Project 7 Clustering
#
# Executes PCA on the UCI activity recognition data set
# Identifies the # of eigenvectors required to represent at least 90% of the variation
# Clusters the projected data into 6 categories using the specified number of eigenvectors
# Classifies the data... | {
"repo_name": "bhwester/computer-science-projects",
"path": "data_analysis_and_visualization_system/classifier.py",
"copies": "1",
"size": "2374",
"license": "mit",
"hash": 2376746090476455000,
"line_mean": 27.2619047619,
"line_max": 99,
"alpha_frac": 0.5956192081,
"autogenerated": false,
"ratio"... |
# Bruce Maxwell
# Spring 2015
# CS 251 Project 8
#
# KNN class test
#
import sys
import data
import classifiers
def main(argv):
'''Builds two KNN classifiers and prints them out. The first uses all
of the exemplars, the second uses only 10.
'''
# usage
if len(argv) < 2:
print('Usage: py... | {
"repo_name": "bhwester/computer-science-projects",
"path": "data_analysis_and_visualization_system/knn_test1.py",
"copies": "1",
"size": "1226",
"license": "mit",
"hash": 2491859706913407500,
"line_mean": 21.2909090909,
"line_max": 82,
"alpha_frac": 0.5954323002,
"autogenerated": false,
"ratio":... |
# Bruce Maxwell
# Spring 2015
# CS 251 Project 8
#
# KNN class test
#
import sys
import data
import classifiers
def main(argv):
'''Reads in a training set and a test set and builds two KNN
classifiers. One uses all of the data, one uses 10
exemplars. Then it classifies the test data and prints out the
... | {
"repo_name": "bhwester/computer-science-projects",
"path": "data_analysis_and_visualization_system/knn_test2.py",
"copies": "1",
"size": "2596",
"license": "mit",
"hash": -3172593624499724300,
"line_mean": 31.45,
"line_max": 147,
"alpha_frac": 0.6036209553,
"autogenerated": false,
"ratio": 3.079... |
"""Brume CloudFormation checker."""
import json
import logging
import os
import sys
import click
import crayons
from six import string_types
LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
CFN_REF = "Ref"
CFN_GETATT = "Fn::GetAtt"
class Stack:
"""A CloudFormation Stack."""
de... | {
"repo_name": "flou/brume",
"path": "brume/checker.py",
"copies": "1",
"size": "9946",
"license": "mit",
"hash": 5878564758036019000,
"line_mean": 34.3950177936,
"line_max": 97,
"alpha_frac": 0.5439372612,
"autogenerated": false,
"ratio": 4.398938522777532,
"config_test": false,
"has_no_keywo... |
#BRUNO IOCHINS GRISCI
import json
import sys
import math
import os
def create_vocabulary(news):
vocabulary = []
for ide in news:
vocabulary = vocabulary + news[ide]["text"]
return set(vocabulary)
def count_labels(news):
n_positive_news = 0.0
n_negative_news = 0.0
for ide in news:
... | {
"repo_name": "rogersprates/word2vec-financial-sentiment",
"path": "pmi/pmi.py",
"copies": "1",
"size": "3966",
"license": "mit",
"hash": 5397394700741115000,
"line_mean": 33.4869565217,
"line_max": 177,
"alpha_frac": 0.6472516389,
"autogenerated": false,
"ratio": 3.1008600469116496,
"config_te... |
"""Brunold."""
# --- import --------------------------------------------------------------------------------------
import os
import pathlib
import numpy as np
from ._data import Data
from .. import exceptions as wt_exceptions
# --- define -------------------------------------------------------------------------... | {
"repo_name": "wright-group/WrightTools",
"path": "WrightTools/data/_brunold.py",
"copies": "1",
"size": "2301",
"license": "mit",
"hash": 3815339166498156000,
"line_mean": 28.5,
"line_max": 99,
"alpha_frac": 0.5523685354,
"autogenerated": false,
"ratio": 4.043936731107205,
"config_test": false... |
#Brunston Poon (c) 2015, MIT License
#adapted from falling_objects_template
#do not forget to source activate python2
from __future__ import print_function, division
from visual import *
from visual.graph import *
#Displays
displayer = display(title = "Display", width=500, height=500, center=(0,0,0))
graphVelocity = g... | {
"repo_name": "brupoon/advp",
"path": "falling_objects.py",
"copies": "2",
"size": "2455",
"license": "mit",
"hash": -3808805908859611000,
"line_mean": 36.196969697,
"line_max": 133,
"alpha_frac": 0.6044806517,
"autogenerated": false,
"ratio": 3.0122699386503067,
"config_test": false,
"has_no... |
#Brunston Poon (c) 2015, MIT License
#do not forget to source activate python2
from visual import *
#initialize *things*
ball = sphere(pos=(-5,0,0), radius=0.5, color=color.orange)
otheractive = True
elastic = False
percentage = 0.8 #percentage remaining after inelastic collision
if otheractive:
ball2 = sphere(po... | {
"repo_name": "brupoon/advphysic",
"path": "sphere_in_box.py",
"copies": "2",
"size": "3647",
"license": "mit",
"hash": 7335435901037935000,
"line_mean": 35.1089108911,
"line_max": 80,
"alpha_frac": 0.6098162874,
"autogenerated": false,
"ratio": 2.8075442648190916,
"config_test": false,
"has_... |
#Brunston Poon (c) 2015, MIT License
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
np.set_printoptions(suppress=True)
#data = np.loadtxt("gravity.csv",delimiter=",")
data = np.loadtxt("gravity.txt")
p, t = data[:,0], data[:,1]
#print("p:", p)
#print("t:", t)
v = []
for position in range(le... | {
"repo_name": "brupoon/advphysic",
"path": "gravity.py",
"copies": "2",
"size": "1257",
"license": "mit",
"hash": -6105012427136494000,
"line_mean": 31.2307692308,
"line_max": 80,
"alpha_frac": 0.6197295147,
"autogenerated": false,
"ratio": 2.412667946257198,
"config_test": false,
"has_no_key... |
"Code generator, part of the build process."
import os
import sys
import gettext
if os.path.exists("brushlib"):
sys.path.append("brushlib")
from os.path import basename
# workaround for https://gna.org/bugs/index.php?20281
# This MUST precede the brushsettings import:
# see https://github.com/mypaint/libmypaint/... | {
"repo_name": "b3sigma/libmypaint",
"path": "generate.py",
"copies": "1",
"size": "4978",
"license": "isc",
"hash": -7309333985519597000,
"line_mean": 34.5571428571,
"line_max": 109,
"alpha_frac": 0.6337886701,
"autogenerated": false,
"ratio": 3.604634322954381,
"config_test": false,
"has_no_... |
"Code generator, part of the build process."
import os
import sys
import gettext
if os.path.exists("brushlib"):
sys.path.append("brushlib")
import brushsettings
from os.path import basename
# workaround for https://gna.org/bugs/index.php?20281
def do_not_translate(domain, s):
return s
gettext.dgettext = do_... | {
"repo_name": "lordadamson/Journal",
"path": "libmypaint/generate.py",
"copies": "3",
"size": "4877",
"license": "mit",
"hash": -4997753212463286000,
"line_mean": 34.598540146,
"line_max": 109,
"alpha_frac": 0.6307156039,
"autogenerated": false,
"ratio": 3.6125925925925926,
"config_test": false... |
"""Brush Settings / States
This is used to generate brushsettings.h (see generate.py)
It is also imported at runtime.
"""
import os
import gettext
settings_hidden = 'color_h color_s color_v'.split()
settings_migrate = {
# old cname new cname scale function
'color_hue': ('chan... | {
"repo_name": "lordadamson/Journal",
"path": "libmypaint/brushsettings.py",
"copies": "4",
"size": "3853",
"license": "mit",
"hash": -6384872014754168000,
"line_mean": 31.3781512605,
"line_max": 124,
"alpha_frac": 0.6716844018,
"autogenerated": false,
"ratio": 3.3887423043095866,
"config_test":... |
# brutal apisecschema parser
# as documented by deroko @ http://xchg.info/wiki/index.php?title=ApiMapSet
# Ange Albertini BSD Licence 2011
import sys, struct
fn = sys.argv[1] if len(sys.argv) > 1 else r"c:\windows\system32\apisetschema.dll"
with open(fn, "rb") as f:
r = f.read()
SECTIONTABLESTART = 0x1b8
i... | {
"repo_name": "angea/corkami",
"path": "misc/python/apisetschema.py",
"copies": "1",
"size": "1526",
"license": "bsd-2-clause",
"hash": 7130172514158968000,
"line_mean": 39.2972972973,
"line_max": 129,
"alpha_frac": 0.6461336828,
"autogenerated": false,
"ratio": 3.0039370078740157,
"config_test... |
""" brutally stolen from:
https://mg.pov.lt/blog/unicode-emails-in-python.html
"""
from config import EMAIL_TO, EMAIL_SENDER
from smtplib import SMTP
from email.MIMEText import MIMEText
from email.Header import Header
from email.Utils import parseaddr, formataddr
def send_email(sender, recipient, subject, body):
... | {
"repo_name": "dsilvers/schedule-trolling",
"path": "send_email.py",
"copies": "1",
"size": "2239",
"license": "unlicense",
"hash": -3528403756895560700,
"line_mean": 33.984375,
"line_max": 79,
"alpha_frac": 0.69584636,
"autogenerated": false,
"ratio": 3.969858156028369,
"config_test": false,
... |
# Brute force algo sicne the constraints are pretty small
# Including standard libraries
import sys
'''
Function that solves the program
'''
def getMaxOr(candidates):
maxSkills = len(candidates[0])
# Player indices are hashed to the corresponding entry
a = [[] for x in range(maxSkills+1)]
for i in... | {
"repo_name": "tejasnikumbh/Algorithms",
"path": "Warmup/ACMICPC.py",
"copies": "1",
"size": "1273",
"license": "bsd-2-clause",
"hash": -7210875731580622000,
"line_mean": 25,
"line_max": 73,
"alpha_frac": 0.5891594658,
"autogenerated": false,
"ratio": 3.2724935732647813,
"config_test": false,
... |
# brute force implementation
def find_duplicate_element_brute_force(elements):
for id, element in enumerate(elements):
if(id+1 == len(elements)):
return None
for second_element in elements[id+1:]:
if element == second_element:
return element
return None
#... | {
"repo_name": "mre/the-coding-interview",
"path": "problems/duplicate-element/duplicate-element.py",
"copies": "1",
"size": "2385",
"license": "mit",
"hash": 1148296025865821200,
"line_mean": 32.5915492958,
"line_max": 103,
"alpha_frac": 0.6645702306,
"autogenerated": false,
"ratio": 3.8221153846... |
# BRUTE FORCE
# 19
# [0, 0, 1, 1]
# GREEDY
# 19
# [0, 0, 1, 1]
# ./knapsack/data/ks_19_0
# BRUTE FORCE
# 12248
# [0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]
# GREEDY
# 12066
# [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
from solver import parse_input
from branch_bound import solve_branch_b... | {
"repo_name": "chriselion/discreteopt",
"path": "knapsack/test_branch_bound.py",
"copies": "1",
"size": "1358",
"license": "mit",
"hash": -815467517080986600,
"line_mean": 23.2678571429,
"line_max": 64,
"alpha_frac": 0.5721649485,
"autogenerated": false,
"ratio": 2.5288640595903167,
"config_tes... |
# brute force, optimized later
class Solution(object):
def maximalSquare(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if len(matrix) == 0 or len(matrix[0]) == 0:
return 0
maxv = 0
for i in range(len(matrix)):
... | {
"repo_name": "cc13ny/algo",
"path": "leetcode/221-Maximal-Square/MaximalSquare_001.py",
"copies": "5",
"size": "1247",
"license": "mit",
"hash": 6404980879611682000,
"line_mean": 30.175,
"line_max": 53,
"alpha_frac": 0.3841218925,
"autogenerated": false,
"ratio": 4.035598705501618,
"config_tes... |
# brute-force search for access descriptor hash table
modes = [
"1",
"L", "LA",
"I", "I;16", "I;16L", "I;16B", "I;32L", "I;32B",
"F",
"P", "PA",
"RGB", "RGBA", "RGBa", "RGBX",
"CMYK",
"YCbCr",
"LAB", "HSV",
]
def hash(s, i):
# djb2 hash: multiply by 33 and xor character
... | {
"repo_name": "1upon0/rfid-auth-system",
"path": "GUI/printer/Pillow-2.7.0/Tests/make_hash.py",
"copies": "1",
"size": "1320",
"license": "apache-2.0",
"hash": 6018826017996084000,
"line_mean": 21.7586206897,
"line_max": 79,
"alpha_frac": 0.5265151515,
"autogenerated": false,
"ratio": 2.920353982... |
"""Brute force search over the space of deterministic policy functions for
algorithmic problems. Works for copy-v0. For stateful problems, way too slow.
(Would take around 35m years to find policies for RepeatCopy, DuplicatedInput,
etc., by my calculations.)
"""
import gym
import time
import logging
import itertools
i... | {
"repo_name": "colinmorris/openai-gym-sandbox",
"path": "algorithmic/brute_force.py",
"copies": "1",
"size": "5194",
"license": "mit",
"hash": -4967743097500664000,
"line_mean": 33.6266666667,
"line_max": 86,
"alpha_frac": 0.6723142087,
"autogenerated": false,
"ratio": 3.47192513368984,
"config... |
# brute force solution O(n^3)
# it works, but Time Limit Exceeded in leetcode
class Solution1:
# @param {integer[]} nums
# @return {integer}
def maxSubArray(self, nums):
if not nums:
return None
maxSum = nums[0]
for size in range(1, len(nums)+1):
for i in rang... | {
"repo_name": "chancyWu/leetcode",
"path": "src/maximum_subarray.py",
"copies": "1",
"size": "2437",
"license": "mit",
"hash": 432157994910088900,
"line_mean": 31.9324324324,
"line_max": 72,
"alpha_frac": 0.5235945835,
"autogenerated": false,
"ratio": 3.6373134328358208,
"config_test": false,
... |
# Brute force version. Just try all paths.
# This is not optimal, but I can't think of a smarter way to do it right now. :(
# Maybe something like building a binary tree and then going from bottom to top,
# so that we see which paths are possible
class Triangle():
def __init__(self, triangle):
self.triang... | {
"repo_name": "mre/the-coding-interview",
"path": "problems/euler/18/path_sum.py",
"copies": "1",
"size": "1356",
"license": "mit",
"hash": -8850979498770021000,
"line_mean": 25.5882352941,
"line_max": 80,
"alpha_frac": 0.5825958702,
"autogenerated": false,
"ratio": 2.544090056285178,
"config_t... |
""" brutus/models/user - user model """
from sqlalchemy import (Column, ForeignKey, Boolean,
Integer, String,
DateTime, Float)
from sqlalchemy.orm import relationship, backref
from brutus.models import Base
from brutus.models.org import Org
class Category(Base):
_... | {
"repo_name": "sarahjanesllc-labs/brutus",
"path": "brutus/models/product.py",
"copies": "1",
"size": "1268",
"license": "mit",
"hash": 2408235023541651000,
"line_mean": 28.488372093,
"line_max": 60,
"alpha_frac": 0.6443217666,
"autogenerated": false,
"ratio": 3.8078078078078077,
"config_test":... |
# Bryan Barrows
# CSC 110 - Winter 17
# HW 2 - Problem 3 (geometric series 1/2 + 1/4 + 1/8, ....)
# This function approx(x) expects a value for x which tells us how many
# terms of the geometric sequence we'd like to add.
# For example, approx(3) should = 0.875.
# HW 2, question 3, part a
def approx(x):
approx =... | {
"repo_name": "bbarrows89/CSC110_Projects",
"path": "bryanBarrowsHW2.py",
"copies": "1",
"size": "1698",
"license": "mit",
"hash": 3249318207635566000,
"line_mean": 28.7894736842,
"line_max": 104,
"alpha_frac": 0.6354534747,
"autogenerated": false,
"ratio": 3.5301455301455302,
"config_test": fa... |
# Bryan Barrows
# CSC 110 - Winter 17
# HW 3 - Problem 2b
# line2.py
# This program allows the user to draw a line segment and then displays some graphical
# and textual information about the line segment.
# This program adds a label to the window indicating what the midpoint of the line is.
from graphics import *
f... | {
"repo_name": "bbarrows89/CSC110_Projects",
"path": "line2.py",
"copies": "1",
"size": "1976",
"license": "mit",
"hash": -2637664855259723000,
"line_mean": 26.4444444444,
"line_max": 127,
"alpha_frac": 0.6265182186,
"autogenerated": false,
"ratio": 3.4305555555555554,
"config_test": false,
"h... |
# Bryan Barrows
# CSC 110 - Winter 17
# suess.py
# As I was exploring the chapter on graphics, there was an excellent example of "Red Fish, Blue Fish",
# which I took the liberty of playing with and exploring.
# I found it really cool how by definining so many variables within our drawFish method, it is possible
# to... | {
"repo_name": "bbarrows89/CSC110_Projects",
"path": "suess.py",
"copies": "1",
"size": "1314",
"license": "mit",
"hash": 4355396458563056600,
"line_mean": 32.6923076923,
"line_max": 103,
"alpha_frac": 0.6613394216,
"autogenerated": false,
"ratio": 2.531791907514451,
"config_test": false,
"has... |
# Bryan Barrows
# Week 4 Practice Exercise
# CSC 110 - 9830
# Jan 29th, 2017
# bryangraphic.py
# Specs for this project: must include a polygon, a shape besides polygon, a text caption, and some colors.
from graphics import *
def main():
win = GraphWin('Bryan Barrows', 420, 420)
win.setBackground("blue")
... | {
"repo_name": "bbarrows89/CSC110_Projects",
"path": "bryangraphic.py",
"copies": "1",
"size": "1031",
"license": "mit",
"hash": -2109084339888802000,
"line_mean": 25.4358974359,
"line_max": 107,
"alpha_frac": 0.6508244423,
"autogenerated": false,
"ratio": 2.8480662983425415,
"config_test": fals... |
# Bryan Barrows
# CSC 110 - Winter '17
# BMI Calculator
# Week 8 Practice Exercise - B
# bmi.py
# Building on the chapter material covering Decision Structures, we were asked
# to build a Python program that asks user for height & weight, then calculates
# their BMI. Finally, a decision structure is used to in... | {
"repo_name": "bbarrows89/CSC110_Projects",
"path": "bmi.py",
"copies": "1",
"size": "1420",
"license": "mit",
"hash": -8562352622982224000,
"line_mean": 28.8695652174,
"line_max": 79,
"alpha_frac": 0.5943661972,
"autogenerated": false,
"ratio": 3.7665782493368702,
"config_test": false,
"has_... |
# BrythonSOLUZIONClient.py
# Ver 0.9, June 23, 2014.
# (C) S. Tanimoto, 2014
from browser import doc, alert, html, console
#import PRIMEDesigner15VisForBrython
from PRIMEDesigner15VisForBrython import set_up_gui as set_up_user_interface
from PRIMEDesigner15VisForBrython import render_state
from PRIMEDesigner15VisForB... | {
"repo_name": "PRIMEDesigner15/PRIMEDesigner15",
"path": "BrythonSOLUZIONClient.py",
"copies": "1",
"size": "5229",
"license": "bsd-3-clause",
"hash": 1109386419267140200,
"line_mean": 27.5737704918,
"line_max": 109,
"alpha_frac": 0.7506215338,
"autogenerated": false,
"ratio": 3.1537997587454765,... |
# BrythonSOLUZIONClient.py
# Ver 0.9, June 23, 2014.
# (C) S. Tanimoto, 2014
from browser import doc, alert, html
from Mondrian import OPERATORS
OPSELECT = None
STATE_STACK = []
RESET_BUTTON = None
BACKTRACK_BUTTON = None
# Are you working?
if not 'PROBLEM_NAME' in globals():
PROBLEM_NAME = "Problems"
doc['pagetit... | {
"repo_name": "PRIMEDesigner15/PRIMEDesigner15",
"path": "BrythonSOLUZIONClientOld.py",
"copies": "1",
"size": "5254",
"license": "bsd-3-clause",
"hash": 2934481021884641000,
"line_mean": 31.8375,
"line_max": 89,
"alpha_frac": 0.7112676056,
"autogenerated": false,
"ratio": 3.505003335557038,
"c... |
"""Brython templating engine.
Templates in HTML pages can include:
- Python code blocks:
<tr b-code="for item in items">
...
</tr>
- Python expressions:
{message}
- tag attributes:
<option value="{name}", selected="{name===expected}">
- inclusion of subtemplates:
<div b-include="men... | {
"repo_name": "kikocorreoso/brython",
"path": "www/src/Lib/browser/template.py",
"copies": "2",
"size": "10901",
"license": "bsd-3-clause",
"hash": -7060449927376591000,
"line_mean": 33.6063492063,
"line_max": 78,
"alpha_frac": 0.5410512797,
"autogenerated": false,
"ratio": 4.320650019817677,
"... |
bs = "01000111010111100110001101101110010010010011100101011110010001110100011100111001010001110011100101000111001110010100011100111001010111100110001101101110010010010110111001001001001110010011010101011110011000110011100100110101011011100100100101101110010010010100011101011110001110010011010101101110010010010101111001... | {
"repo_name": "JDIS/write-ups",
"path": "nuitduhack-2016/invest/convert_key.py",
"copies": "1",
"size": "1632",
"license": "mit",
"hash": -5888913706646559000,
"line_mean": 43.1081081081,
"line_max": 775,
"alpha_frac": 0.7316176471,
"autogenerated": false,
"ratio": 2.503067484662577,
"config_te... |
# # B's Battle Ship
############################################
#This version is broken! Do not run
# Import appropriate modules , initialize program, and set constants
import pygame
from pygame.locals import *
import random
import sys
import math
pygame.init()
pygame.font.init()
canvas_size = (1024,768) # canvas ... | {
"repo_name": "bpraggastis/My-Battleship",
"path": "battleship1.py",
"copies": "1",
"size": "5313",
"license": "mit",
"hash": 4705932063339562000,
"line_mean": 29.36,
"line_max": 138,
"alpha_frac": 0.5618294749,
"autogenerated": false,
"ratio": 3.2695384615384615,
"config_test": false,
"has_n... |
# B's Battle Ship
######################### SET UP #################################
# import appropriate modules, initialize program,
# and set initial values for parameters
import pygame
from pygame.locals import *
import random
import sys
import math
pygame.init()
pygame.font.init()
canvas_size = (1250, 750)
c... | {
"repo_name": "bpraggastis/My-Battleship",
"path": "battleship2.py",
"copies": "1",
"size": "7239",
"license": "mit",
"hash": 636415617391074800,
"line_mean": 29.8085106383,
"line_max": 96,
"alpha_frac": 0.5364000553,
"autogenerated": false,
"ratio": 3.3748251748251747,
"config_test": false,
... |
# B's Battle Ship - this version creates player board and randomly generates fleet for the enemy.
######################### SET UP #################################
# import appropriate modules, initialize program,
# and set initial values for parameters
import pygame
from pygame.locals import *
import random
impor... | {
"repo_name": "bpraggastis/My-Battleship",
"path": "battleship4.py",
"copies": "1",
"size": "10306",
"license": "mit",
"hash": 2269735044374196700,
"line_mean": 32.355987055,
"line_max": 111,
"alpha_frac": 0.5600620997,
"autogenerated": false,
"ratio": 3.391247120763409,
"config_test": false,
... |
from bs4 import BeautifulSoup
import urllib
import time
# open list of brooklyn addresses that have made heat complaints in last 5 years
with open('2010_2015_brooklyn_complaints.csv') as in_file:
for line in in_file:
try:
# read in line, split based on , delimiter
parts = line.split(",")
indexEnd = parts... | {
"repo_name": "emilyfuhrman/data-science",
"path": "src/bs_bin.py",
"copies": "2",
"size": "1474",
"license": "mit",
"hash": -2569067259291948500,
"line_mean": 35.85,
"line_max": 119,
"alpha_frac": 0.670963365,
"autogenerated": false,
"ratio": 3.1563169164882225,
"config_test": false,
"has_no... |
"""BSBLAN platform to control a compatible Climate Device."""
from datetime import timedelta
import logging
from typing import Any, Callable, Dict, List, Optional
from bsblan import BSBLan, BSBLanError, Info, State
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const ... | {
"repo_name": "tboyce021/home-assistant",
"path": "homeassistant/components/bsblan/climate.py",
"copies": "8",
"size": "7087",
"license": "apache-2.0",
"hash": -2805040071785520600,
"line_mean": 28.6527196653,
"line_max": 83,
"alpha_frac": 0.6233949485,
"autogenerated": false,
"ratio": 3.62506393... |
"""BSBLAN platform to control a compatible Climate Device."""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Any, Callable
from bsblan import BSBLan, BSBLanError, Info, State
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.... | {
"repo_name": "w1ll1am23/home-assistant",
"path": "homeassistant/components/bsblan/climate.py",
"copies": "3",
"size": "7092",
"license": "apache-2.0",
"hash": -2274468993370953500,
"line_mean": 28.4273858921,
"line_max": 83,
"alpha_frac": 0.6228144388,
"autogenerated": false,
"ratio": 3.62947799... |
"""BSBLAN platform to control a compatible Climate Device."""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Any
from bsblan import BSBLan, BSBLanError, Info, State
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.co... | {
"repo_name": "kennedyshead/home-assistant",
"path": "homeassistant/components/bsblan/climate.py",
"copies": "2",
"size": "7125",
"license": "apache-2.0",
"hash": -6162599716838244000,
"line_mean": 28.4421487603,
"line_max": 83,
"alpha_frac": 0.6254035088,
"autogenerated": false,
"ratio": 3.64263... |
# for Python 3 compatibility
from __future__ import print_function
import argparse
from datetime import datetime as dt
from datetime import time as t
from datetime import timedelta as td
import json
import random
import sys
from urllib2 import urlopen
import uuid
HOURS = range(0,24)
VERY_LIKELY = [7, 8, 11, 12, 6, ... | {
"repo_name": "tidepool-org/deprecated-data-model",
"path": "demo-data/demo_data.py",
"copies": "1",
"size": "22462",
"license": "bsd-2-clause",
"hash": 2383338093128720400,
"line_mean": 30.638028169,
"line_max": 332,
"alpha_frac": 0.5681150387,
"autogenerated": false,
"ratio": 3.734951779181909,... |
# for Python 3 compatibility
from __future__ import print_function
# because raw_input got renamed in Python 3.something
try:
input = raw_input
except NameError:
pass
import argparse
import json
import os
import shutil
import subprocess
REGISTRY='./web/_data/registry.yml'
EXAMPLES='./web/example/'
WEBPACK_COMMO... | {
"repo_name": "tidepool-org/tideline",
"path": "dev/gallery.py",
"copies": "1",
"size": "5443",
"license": "bsd-2-clause",
"hash": 7065295730944682000,
"line_mean": 31.2071005917,
"line_max": 139,
"alpha_frac": 0.6470696307,
"autogenerated": false,
"ratio": 3.4980719794344473,
"config_test": fa... |
import sys
from elasticapm.base import Client, get_client # noqa: F401
from elasticapm.conf import setup_logging # noqa: F401
from elasticapm.instrumentation.control import instrument, uninstrument # noqa: F401
from elasticapm.traces import ( # noqa: F401
capture_span,
get_span_id,
get_trace_id,
ge... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/__init__.py",
"copies": "1",
"size": "2692",
"license": "bsd-3-clause",
"hash": 8276634321782006000,
"line_mean": 40.4153846154,
"line_max": 106,
"alpha_frac": 0.7459138187,
"autogenerated": false,
"ratio": 4.035982008995502,
"conf... |
import base64
import os
import re
from functools import partial
from elasticapm.conf import constants
from elasticapm.utils import compat, encoding
try:
from functools import partialmethod
partial_types = (partial, partialmethod)
except ImportError:
# Python 2
partial_types = (partial,)
default_po... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/utils/__init__.py",
"copies": "1",
"size": "6518",
"license": "bsd-3-clause",
"hash": -165038435718247600,
"line_mean": 32.4256410256,
"line_max": 117,
"alpha_frac": 0.6498926051,
"autogenerated": false,
"ratio": 3.8341176470588234,
... |
from celery import signals, states
import elasticapm
from elasticapm.conf import constants
from elasticapm.utils import get_name_from_func
class CeleryFilter(object):
def filter(self, record):
if record.funcName in ("_log_error",):
return 0
else:
return 1
def register_... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/contrib/celery/__init__.py",
"copies": "1",
"size": "4024",
"license": "bsd-3-clause",
"hash": 1173709437504574000,
"line_mean": 40.4845360825,
"line_max": 119,
"alpha_frac": 0.7241550696,
"autogenerated": false,
"ratio": 4.032064128... |
from __future__ import absolute_import
import django
from django.conf import settings as django_settings
from django.core.exceptions import DisallowedHost
from django.db import DatabaseError
from django.http import HttpRequest
from elasticapm import get_client as _get_client
from elasticapm.base import Client
from ... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/contrib/django/client.py",
"copies": "1",
"size": "12389",
"license": "bsd-3-clause",
"hash": 3134290324240965000,
"line_mean": 38.3301587302,
"line_max": 110,
"alpha_frac": 0.5976269271,
"autogenerated": false,
"ratio": 3.9205696202... |
from __future__ import absolute_import
import logging
import sys
import traceback
import warnings
from elasticapm import get_client
from elasticapm.base import Client
from elasticapm.traces import execution_context
from elasticapm.utils import compat, wrapt
from elasticapm.utils.encoding import to_unicode
from elas... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/handlers/logging.py",
"copies": "1",
"size": "10842",
"license": "bsd-3-clause",
"hash": 3339655073336462000,
"line_mean": 36.1301369863,
"line_max": 102,
"alpha_frac": 0.6101272828,
"autogenerated": false,
"ratio": 4.326416600159617... |
from __future__ import absolute_import
import logging
import sys
import warnings
from django.conf import settings as django_settings
from elasticapm import get_client
from elasticapm.handlers.logging import LoggingHandler as BaseLoggingHandler
from elasticapm.utils.logging import get_logger
logger = get_logger("e... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/contrib/django/handlers.py",
"copies": "1",
"size": "3410",
"license": "bsd-3-clause",
"hash": 4811683547447296000,
"line_mean": 39.1176470588,
"line_max": 117,
"alpha_frac": 0.7114369501,
"autogenerated": false,
"ratio": 4.321926489... |
from __future__ import absolute_import
import logging
import threading
from django.apps import apps
from django.conf import settings as django_settings
import elasticapm
from elasticapm.conf import constants
from elasticapm.contrib.django.client import client, get_client
from elasticapm.utils import build_name_wit... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/contrib/django/middleware/__init__.py",
"copies": "1",
"size": "8837",
"license": "bsd-3-clause",
"hash": 8244753552957876000,
"line_mean": 40.8815165877,
"line_max": 119,
"alpha_frac": 0.6613103995,
"autogenerated": false,
"ratio": ... |
from __future__ import absolute_import
import logging
import flask
from flask import request, signals
import elasticapm
import elasticapm.instrumentation.control
from elasticapm import get_client
from elasticapm.base import Client
from elasticapm.conf import constants, setup_logging
from elasticapm.contrib.flask.u... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/contrib/flask/__init__.py",
"copies": "1",
"size": "8548",
"license": "bsd-3-clause",
"hash": 4248902440053175300,
"line_mean": 39.8995215311,
"line_max": 117,
"alpha_frac": 0.6572297613,
"autogenerated": false,
"ratio": 4.2997987927... |
from __future__ import absolute_import
import sys
import traceback
import logbook
from elasticapm.base import Client
from elasticapm.utils import compat
from elasticapm.utils.encoding import to_unicode
LOOKBOOK_LEVELS = {
logbook.DEBUG: "debug",
logbook.INFO: "info",
logbook.NOTICE: "info",
logboo... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/handlers/logbook.py",
"copies": "1",
"size": "4340",
"license": "bsd-3-clause",
"hash": -6805482642017074000,
"line_mean": 38.0990990991,
"line_max": 101,
"alpha_frac": 0.6502304147,
"autogenerated": false,
"ratio": 4.263261296660118... |
import inspect
from elasticapm.base import Client
class Middleware(object):
"""ElasticAPM middleware for ZeroRPC.
>>> elasticapm = Middleware(service_name='..', secret_token='...')
>>> zerorpc.Context.get_instance().register_middleware(elasticapm)
Exceptions detected server-side in ZeroRPC will b... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/contrib/zerorpc/__init__.py",
"copies": "1",
"size": "3902",
"license": "bsd-3-clause",
"hash": -5564745387940889000,
"line_mean": 45.4523809524,
"line_max": 91,
"alpha_frac": 0.6796514608,
"autogenerated": false,
"ratio": 4.38426966... |
import logging
import logging.handlers
import math
import os
import re
import socket
import threading
from elasticapm.conf.constants import BASE_SANITIZE_FIELD_NAMES
from elasticapm.utils import compat, starmatch_to_regex
from elasticapm.utils.logging import get_logger
from elasticapm.utils.threading import Interval... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/conf/__init__.py",
"copies": "1",
"size": "31267",
"license": "bsd-3-clause",
"hash": -3555627645041526000,
"line_mean": 39.0345710627,
"line_max": 119,
"alpha_frac": 0.6315604311,
"autogenerated": false,
"ratio": 4.117329470634711,
... |
import random
import sys
from elasticapm.conf.constants import EXCEPTION_CHAIN_MAX_DEPTH
from elasticapm.utils import compat, varmap
from elasticapm.utils.encoding import keyword_field, shorten, to_unicode
from elasticapm.utils.logging import get_logger
from elasticapm.utils.stacks import get_culprit, get_stack_info... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/events.py",
"copies": "1",
"size": "8323",
"license": "bsd-3-clause",
"hash": -643098387993519100,
"line_mean": 38.0751173709,
"line_max": 101,
"alpha_frac": 0.5935359846,
"autogenerated": false,
"ratio": 4.227018791264602,
"config... |
import sys
from elasticapm.utils import get_url_dict
from elasticapm.utils.wsgi import get_current_url, get_environ, get_headers
class ElasticAPM(object):
"""
A WSGI middleware which will attempt to capture any
uncaught exceptions and send them to ElasticAPM.
>>> from elasticapm.base import Client... | {
"repo_name": "beniwohli/apm-agent-python",
"path": "elasticapm/middleware.py",
"copies": "1",
"size": "2944",
"license": "bsd-3-clause",
"hash": 8437865717553402000,
"line_mean": 38.2533333333,
"line_max": 81,
"alpha_frac": 0.6728940217,
"autogenerated": false,
"ratio": 4.460606060606061,
"con... |
"""A collection of bandwidth estimators for Kernel Density Estimation"""
from __future__ import division
from __future__ import print_function
__author__ = "Felix Simkovic"
__date__ = "31 Mar 2018"
__version__ = "1.0.1"
import abc
import numpy as np
ABC = abc.ABCMeta('ABC', (object, ), {})
class BandwidthBase(ABC... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/misc/bandwidth.py",
"copies": "1",
"size": "5934",
"license": "bsd-3-clause",
"hash": -3727809648429974000,
"line_mean": 30.0680628272,
"line_max": 120,
"alpha_frac": 0.6338051904,
"autogenerated": false,
"ratio": 3.64720344191764,
"config_test"... |
"""Amino acid specific distance calculator"""
__author__ = 'Felix Simkovic'
__date__ = '13 Aug 2018'
__version__ = '1.0'
class DynamicDistances(object):
"""Dynamic distance calculator
Description
-----------
The data stored in this class corresponds to Supplementary Table 3
in [1]_.
Example... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/misc/distances.py",
"copies": "1",
"size": "23081",
"license": "bsd-3-clause",
"hash": 5696835605383363000,
"line_mean": 22.7214799589,
"line_max": 94,
"alpha_frac": 0.258567653,
"autogenerated": false,
"ratio": 3.1355794049721504,
"config_test"... |
"""A module containing generic Figure related objects"""
__author__ = "Felix Simkovic"
__date__ = "08 Jan 2018"
__version__ = "0.2"
import matplotlib.collections as mcoll
import matplotlib.pyplot as plt
import os
import warnings
class Figure(object):
"""A Figure class to store common features"""
def __init... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/figure.py",
"copies": "1",
"size": "6022",
"license": "bsd-3-clause",
"hash": -1366381928918863400,
"line_mean": 38.3594771242,
"line_max": 127,
"alpha_frac": 0.6104284291,
"autogenerated": false,
"ratio": 4.184850590687978,
"config_test": ... |
"""A module to produce a contact map chord diagram"""
from __future__ import division
from __future__ import print_function
__author__ = "Felix Simkovic"
__date__ = "13 Feb 2017"
__version__ = "0.1"
import matplotlib.pyplot as plt
import numpy as np
from conkit.core.mappings import ContactMatchState
from conkit.mis... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/contactmapchord.py",
"copies": "1",
"size": "8676",
"license": "bsd-3-clause",
"hash": -9056752556411786000,
"line_mean": 43.7216494845,
"line_max": 128,
"alpha_frac": 0.5918626095,
"autogenerated": false,
"ratio": 3.6089850249584026,
"conf... |
"""A module to produce a contact map plot"""
from __future__ import division
from __future__ import print_function
__author__ = "Felix Simkovic"
__date__ = "10 Jan 2018"
__version__ = "1.0"
import matplotlib.collections as mcoll
import matplotlib.pyplot as plt
import numpy as np
from conkit.core.struct import Gap
f... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/contactmap.py",
"copies": "1",
"size": "10874",
"license": "bsd-3-clause",
"hash": 5381476091933696000,
"line_mean": 38.3985507246,
"line_max": 120,
"alpha_frac": 0.6212065477,
"autogenerated": false,
"ratio": 3.912918315940986,
"config_tes... |
"""A module to produce a domain boundary plot"""
from __future__ import division
from __future__ import print_function
__author__ = "Felix Simkovic"
__date__ = "23 Feb 2017"
__version__ = "0.1"
import matplotlib.pyplot as plt
import numpy as np
from conkit.misc import deprecate
from conkit.plot.figure import Figure... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/contactdensity.py",
"copies": "1",
"size": "5833",
"license": "bsd-3-clause",
"hash": -771440382395173200,
"line_mean": 34.7852760736,
"line_max": 117,
"alpha_frac": 0.6605520315,
"autogenerated": false,
"ratio": 3.987012987012987,
"config_... |
"""A module to produce a precision evaluation plot"""
from __future__ import division
__author__ = "Felix Simkovic"
__date__ = "07 Feb 2017"
__version__ = "0.1"
import matplotlib.pyplot as plt
import numpy as np
from conkit.misc import deprecate
from conkit.plot.figure import Figure
from conkit.plot.tools import Co... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/precisionevaluation.py",
"copies": "1",
"size": "8049",
"license": "bsd-3-clause",
"hash": 7189005968718835000,
"line_mean": 34.7733333333,
"line_max": 112,
"alpha_frac": 0.6397067959,
"autogenerated": false,
"ratio": 4.069261880687563,
"co... |
"""A module to produce a sequence coverage plot"""
from __future__ import division
from __future__ import print_function
__author__ = "Felix Simkovic"
__date__ = "07 Feb 2017"
__version__ = "0.1"
import matplotlib.pyplot as plt
import numpy as np
from conkit.misc import deprecate
from conkit.plot.figure import Figu... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/sequencecoverage.py",
"copies": "1",
"size": "5668",
"license": "bsd-3-clause",
"hash": -8059472220272968000,
"line_mean": 37.5578231293,
"line_max": 119,
"alpha_frac": 0.672900494,
"autogenerated": false,
"ratio": 4.143274853801169,
"confi... |
"""Command line facility for ConKit scripts"""
__author__ = "Felix Simkovic"
__date__ = "14 Apr 2017"
__version__ = "0.1"
import logging
import sys
def setup_logging(level='info', logfile=None):
"""Set up logging to the console for the root logger.
Parameters
----------
level : str, optional
... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/command_line/__init__.py",
"copies": "1",
"size": "4259",
"license": "bsd-3-clause",
"hash": 3527096166483837400,
"line_mean": 37.7181818182,
"line_max": 108,
"alpha_frac": 0.6849025593,
"autogenerated": false,
"ratio": 4.315096251266464,
"confi... |
"""Energy function templates for restraint generation"""
__author__ = 'Felix Simkovic'
__date__ = '13 Aug 2018'
__version__ = '1.0'
from multiprocessing import Pool
from conkit.io import read
from conkit.misc.selectalg import SUBSELECTION_ALGORITHMS
from conkit.misc.selectalg import SubselectionAlgorithm
class Str... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/misc/selector.py",
"copies": "1",
"size": "4948",
"license": "bsd-3-clause",
"hash": -5857515157742526000,
"line_mean": 37.3565891473,
"line_max": 105,
"alpha_frac": 0.6804769604,
"autogenerated": false,
"ratio": 4.16849199663016,
"config_test":... |
"""Energy function templates for restraint generation"""
__author__ = 'Felix Simkovic'
__date__ = '13 Aug 2018'
__version__ = '1.0'
import inspect
import numpy as np
class SubselectionAlgorithm(object):
"""A class to collect all subselection algorithms"""
@staticmethod
def _numpify(data):
"""Co... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/misc/selectalg.py",
"copies": "1",
"size": "4990",
"license": "bsd-3-clause",
"hash": -33524591673585224,
"line_mean": 30.582278481,
"line_max": 108,
"alpha_frac": 0.6426853707,
"autogenerated": false,
"ratio": 4.536363636363636,
"config_test": ... |
"""Energy function templates for restraint generation"""
__author__ = 'Felix Simkovic'
__date__ = '13 Aug 2018'
__version__ = '1.0'
class RosettaFunctionConstructs(object):
"""Storage for string formats of different Rosetta energy function constructs
For more information on the different energy functions, p... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/misc/energyfunction.py",
"copies": "1",
"size": "4866",
"license": "bsd-3-clause",
"hash": 1299827848203239700,
"line_mean": 38.8852459016,
"line_max": 103,
"alpha_frac": 0.6802301685,
"autogenerated": false,
"ratio": 3.9305331179321485,
"config... |
"""Internal utility functions"""
__author__ = "Felix Simkovic"
__date__ = "16 Feb 2017"
__version__ = "0.1"
import numpy as np
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactfile import ContactFile
from conkit.core.sequence import Sequence
from conkit.co... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/plot/tools.py",
"copies": "1",
"size": "6281",
"license": "bsd-3-clause",
"hash": 7537098718064337000,
"line_mean": 28.3504672897,
"line_max": 108,
"alpha_frac": 0.6311096959,
"autogenerated": false,
"ratio": 3.7364663890541343,
"config_test": f... |
"""Internal utility functions"""
__author__ = "Felix Simkovic"
__date__ = "20 Nov 2016"
__version__ = "0.1"
import io
import sys
import tempfile
def create_tmp_f(content=None, mode='w'):
"""Create a temporary file
Parameters
----------
mode : str, optional
Write-mode [default: 'w']
conte... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/_iotools.py",
"copies": "1",
"size": "3667",
"license": "bsd-3-clause",
"hash": 7189015801675724000,
"line_mean": 27.874015748,
"line_max": 80,
"alpha_frac": 0.6634851377,
"autogenerated": false,
"ratio": 4.229527104959631,
"config_test": fal... |
"""I/O interface for file reading, writing and conversions"""
__author__ = 'Felix Simkovic'
__date__ = '13 Aug 2018'
__version__ = '0.2'
import importlib
from conkit.io._cache import PARSER_CACHE
from conkit.io._iotools import open_f_handle
# Accessed by some modules - might be deprecated in the future
CONTACT_FILE... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/__init__.py",
"copies": "1",
"size": "5996",
"license": "bsd-3-clause",
"hash": -1394561560573985300,
"line_mean": 33.4597701149,
"line_max": 89,
"alpha_frac": 0.6672781855,
"autogenerated": false,
"ratio": 3.819108280254777,
"config_test": f... |
"""Module containing code for caching all parsers
Description
-----------
This module is an import caching facility used for the I/O package in ConKit.
To allow fast access to individual modules required for :func:`read <conkit.io.read>`, :func:`write <conkit.io.write>`
and :func:`convert <conkit.io.convert>` functio... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/_cache.py",
"copies": "1",
"size": "5689",
"license": "bsd-3-clause",
"hash": -8259208406592845000,
"line_mean": 37.7006802721,
"line_max": 118,
"alpha_frac": 0.6306908068,
"autogenerated": false,
"ratio": 3.9727653631284916,
"config_test": f... |
"""
Parent classes for all parser classes
"""
__author__ = "Felix Simkovic"
__date__ = "04 Oct 2016"
__version__ = "0.1"
import abc
ABC = abc.ABCMeta('ABC', (object, ), {})
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactfile import ContactFile
from conk... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/_parser.py",
"copies": "1",
"size": "3071",
"license": "bsd-3-clause",
"hash": -2509598835138840000,
"line_mean": 33.1222222222,
"line_max": 80,
"alpha_frac": 0.7111690003,
"autogenerated": false,
"ratio": 4.4701601164483264,
"config_test": f... |
"""
Parser module specific to bbcontacts predictions
"""
__author__ = "Felix Simkovic"
__date__ = "23 Jul 2018"
__version__ = "0.2"
import re
from conkit.io._parser import ContactFileParser
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactfile import Conta... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/bbcontacts.py",
"copies": "1",
"size": "4310",
"license": "bsd-3-clause",
"hash": -5091877601306530000,
"line_mean": 35.218487395,
"line_max": 106,
"alpha_frac": 0.6535962877,
"autogenerated": false,
"ratio": 4.371196754563894,
"config_test":... |
"""
Parser module specific to BCL::Contact predictions
"""
__author__ = "Felix Simkovic"
__date__ = "12 Dec 2016"
__version__ = "0.1"
import re
from conkit.io._parser import ContactFileParser
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactfile import Con... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/bclcontact.py",
"copies": "1",
"size": "3606",
"license": "bsd-3-clause",
"hash": -5575464358631603000,
"line_mean": 34.0097087379,
"line_max": 106,
"alpha_frac": 0.6713810316,
"autogenerated": false,
"ratio": 4.349819059107358,
"config_test"... |
"""
Parser module specific to CASP-RR predictions
"""
__author__ = "Felix Simkovic"
__date__ = "03 Aug 2016"
__version__ = "1.0"
import collections
import re
from conkit.io._parser import ContactFileParser
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactf... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/casp.py",
"copies": "1",
"size": "8972",
"license": "bsd-3-clause",
"hash": -6153869275482154000,
"line_mean": 42.5533980583,
"line_max": 118,
"alpha_frac": 0.5629736959,
"autogenerated": false,
"ratio": 3.9576532862814293,
"config_test": fal... |
"""
Parser module specific to CCMpred predictions
"""
from __future__ import division
__author__ = "Felix Simkovic"
__date__ = "03 Aug 2016"
__version__ = "0.1"
import numpy as np
import sys
from conkit.io._parser import ContactFileParser
from conkit.core.contact import Contact
from conkit.core.contactmap import Co... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/ccmpred.py",
"copies": "1",
"size": "5272",
"license": "bsd-3-clause",
"hash": 4248245565032903700,
"line_mean": 34.8639455782,
"line_max": 115,
"alpha_frac": 0.6437784522,
"autogenerated": false,
"ratio": 4.138147566718995,
"config_test": fa... |
"""
Parser module specific to CLUSTAL sequence files
"""
__author__ = 'Felix Simkovic'
__date__ = '30 Jul 2018'
__version__ = '0.1'
import collections
from conkit.io._parser import SequenceFileParser
from conkit.core.sequence import Sequence
from conkit.core.sequencefile import SequenceFile
class ClustalParser(Seq... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/clustal.py",
"copies": "1",
"size": "4391",
"license": "bsd-3-clause",
"hash": -6920296200447946000,
"line_mean": 34.128,
"line_max": 104,
"alpha_frac": 0.6214985197,
"autogenerated": false,
"ratio": 4.373505976095617,
"config_test": false,
... |
"""
Parser module specific to ComsatIO predictions
"""
__author__ = "Felix Simkovic"
__date__ = "12 Oct 2016"
__version__ = "0.1"
import re
from conkit.io._parser import ContactFileParser
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactfile import Contact... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/membrain.py",
"copies": "1",
"size": "4528",
"license": "bsd-3-clause",
"hash": -2852151543626177000,
"line_mean": 34.375,
"line_max": 112,
"alpha_frac": 0.6351590106,
"autogenerated": false,
"ratio": 4.154128440366972,
"config_test": false,
... |
"""
Parser module specific to COMSAT predictions
"""
__author__ = "Felix Simkovic"
__date__ = "03 Aug 2016"
__version__ = "0.1"
import re
from conkit.io._parser import ContactFileParser
from conkit.core.contact import Contact
from conkit.core.contactmap import ContactMap
from conkit.core.contactfile import ContactFi... | {
"repo_name": "fsimkovic/conkit",
"path": "conkit/io/comsat.py",
"copies": "1",
"size": "4188",
"license": "bsd-3-clause",
"hash": -6241030522821949000,
"line_mean": 33.0487804878,
"line_max": 106,
"alpha_frac": 0.6377745941,
"autogenerated": false,
"ratio": 4.251776649746193,
"config_test": fa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.