text stringlengths 0 1.05M | meta dict |
|---|---|
"""bookmarks 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-b... | {
"repo_name": "technolotrix/django_by_example",
"path": "bookmarks/bookmarks/urls.py",
"copies": "1",
"size": "1150",
"license": "mit",
"hash": 4954994989216201000,
"line_mean": 36.1290322581,
"line_max": 77,
"alpha_frac": 0.6965217391,
"autogenerated": false,
"ratio": 3.605015673981191,
"confi... |
# bookmark/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import BookmarkItem
# from star.models import StarItem, StarItemList, StarItemManager
import wevote_functions.admin
from voter.models import voter_has_authority
from admin_tools.views import redirect_to_sign_in_page
fr... | {
"repo_name": "jainanisha90/WeVoteServer",
"path": "bookmark/views_admin.py",
"copies": "1",
"size": "5735",
"license": "mit",
"hash": -6099071298653922000,
"line_mean": 47.2016806723,
"line_max": 113,
"alpha_frac": 0.623016565,
"autogenerated": false,
"ratio": 3.616015132408575,
"config_test":... |
"""booksbeyondmagazine 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... | {
"repo_name": "raptattention/booksbeyondmagazine",
"path": "src/booksbeyondmagazine/urls.py",
"copies": "1",
"size": "1452",
"license": "mit",
"hash": -3791687303234652700,
"line_mean": 41.7058823529,
"line_max": 91,
"alpha_frac": 0.7052341598,
"autogenerated": false,
"ratio": 3.515738498789346,
... |
# books.py
import ctypes
import os
from mobibook import MobiBook
from customexceptions import *
# Drive types
DRIVE_UNKNOWN = 0 # The drive type cannot be determined.
DRIVE_NO_ROOT_DIR = 1 # The root path is invalbookID; for example, there is no volume mounted at the specified path.
DRIVE_REMOVABLE = 2 # The... | {
"repo_name": "szarroug3/X-Ray-Creator-2",
"path": "kindle/books.py",
"copies": "1",
"size": "4076",
"license": "mit",
"hash": -6187821488908925000,
"line_mean": 32.4180327869,
"line_max": 119,
"alpha_frac": 0.5814524043,
"autogenerated": false,
"ratio": 3.8856053384175406,
"config_test": false... |
"""bookstore_project 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')... | {
"repo_name": "GzkV/bookstore_project",
"path": "bookstore_project/urls.py",
"copies": "1",
"size": "1408",
"license": "mit",
"hash": 6622400520419579000,
"line_mean": 37.0540540541,
"line_max": 79,
"alpha_frac": 0.7137784091,
"autogenerated": false,
"ratio": 3.511221945137157,
"config_test": f... |
"""bookstore 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-b... | {
"repo_name": "siawyoung/bookstore",
"path": "bookstore/urls.py",
"copies": "1",
"size": "1306",
"license": "mit",
"hash": -201237741512010020,
"line_mean": 32.5128205128,
"line_max": 93,
"alpha_frac": 0.6852986217,
"autogenerated": false,
"ratio": 3.314720812182741,
"config_test": false,
"ha... |
bool = 16
bytea = 17
char = 18
name = 19
int8 = 20
int2 = 21
int2vector = 22
int4 = 23
regproc = 24
text = 25
oid = 26
tid = 27
xid = 28
cid = 29
oidvector = 30
smgr = 210
point = 600
lseg = 601
path = 602
box = 603
polygon = 604
line = 628
_line = 629
cidr = 650
_cidr = 651
float4 = 700
float8 = 701
abstime = 702
relt... | {
"repo_name": "rdbhost/Rdbhdb",
"path": "lib/rdbhdb/pgoid.py",
"copies": "1",
"size": "2900",
"license": "mit",
"hash": 4601930117587528000,
"line_mean": 13.2156862745,
"line_max": 20,
"alpha_frac": 0.5679310345,
"autogenerated": false,
"ratio": 2.3125996810207337,
"config_test": false,
"has_... |
"""Bool class.
Represents a boolean using a widget.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with thi... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/html/widgets/widget_bool.py",
"copies": "1",
"size": "2471",
"license": "mit",
"hash": 4108436845180107000,
"line_mean": 32.8493150685,
"line_max": 78,
"alpha_frac": 0.547956293,
"autogenerated": false,
"ratio": 5.022357723577236,
... |
"""Bool class.
Represents a boolean using a widget.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from .domwidget import DOMWidget
from .widget import register
from traitlets import Unicode, Bool, CaselessStrEnum
class _Bool(DOMWidget):
"""A base class... | {
"repo_name": "fzheng/codejam",
"path": "lib/python2.7/site-packages/ipywidgets/widgets/widget_bool.py",
"copies": "2",
"size": "2746",
"license": "mit",
"hash": -6507187579095344000,
"line_mean": 32.0843373494,
"line_max": 97,
"alpha_frac": 0.658776402,
"autogenerated": false,
"ratio": 3.8138888... |
"""Bool class.
Represents a boolean using a widget.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from .widget import DOMWidget, register
from traitlets import Unicode, Bool, CaselessStrEnum
class _Bool(DOMWidget):
"""A base class for creating widgets ... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "Lib/site-packages/ipywidgets/widgets/widget_bool.py",
"copies": "1",
"size": "2364",
"license": "mit",
"hash": -249704045185198500,
"line_mean": 30.52,
"line_max": 84,
"alpha_frac": 0.6429780034,
"autogenerated": false,
"ratio": 4.097053726169844,
"... |
'''booldec, a solver for boolean decision problems that maximize an
objective function, subject to constraints.
'''
# Copyright (c) 2014 Robert Schwarz
import pulp
class Problem(object):
'''An optimization problem with boolean decisions'''
def __init__(self, name=''):
self._vars = {} # maps name... | {
"repo_name": "leethargo/booldec",
"path": "booldec.py",
"copies": "1",
"size": "5522",
"license": "mit",
"hash": -2794318559911415300,
"line_mean": 29.0108695652,
"line_max": 77,
"alpha_frac": 0.5445490764,
"autogenerated": false,
"ratio": 3.795189003436426,
"config_test": false,
"has_no_key... |
"""Boolean algebra module for SymPy"""
from __future__ import print_function, division
from collections import defaultdict
from itertools import product
from sympy.core.basic import Basic
from sympy.core.numbers import Number
from sympy.core.decorators import deprecated
from sympy.core.operations import LatticeOp
fro... | {
"repo_name": "kmacinnis/sympy",
"path": "sympy/logic/boolalg.py",
"copies": "3",
"size": "30111",
"license": "bsd-3-clause",
"hash": -7115548276408723000,
"line_mean": 26.1759927798,
"line_max": 78,
"alpha_frac": 0.5526883863,
"autogenerated": false,
"ratio": 3.6779039941370466,
"config_test":... |
"""Boolean algebra module for SymPy"""
from sympy.core.basic import Basic
from sympy.core.operations import LatticeOp
from sympy.core.function import Application, sympify
class Boolean(Basic):
"""A boolean object is an object for which logic operations make sense."""
__slots__ = []
def __and__(self, othe... | {
"repo_name": "pernici/sympy",
"path": "sympy/logic/boolalg.py",
"copies": "1",
"size": "9303",
"license": "bsd-3-clause",
"hash": 6983132735833860000,
"line_mean": 25.887283237,
"line_max": 115,
"alpha_frac": 0.5651940234,
"autogenerated": false,
"ratio": 3.8158326497128794,
"config_test": fal... |
"""Boolean algebra module for SymPy"""
from sympy.core import Basic, Function, sympify, Symbol
from sympy.utilities import flatten, make_list
from sympy.core.operations import LatticeOp
class BooleanFunction(Function):
"""Boolean function is a function that lives in a boolean space
It is used as base class fo... | {
"repo_name": "fperez/sympy",
"path": "sympy/logic/boolalg.py",
"copies": "1",
"size": "6849",
"license": "bsd-3-clause",
"hash": 5858509438445313000,
"line_mean": 26.1785714286,
"line_max": 86,
"alpha_frac": 0.5771645496,
"autogenerated": false,
"ratio": 3.732425068119891,
"config_test": false... |
"""Boolean algebra module for SymPy"""
from sympy.core import Basic, Function, sympify, Symbol
from sympy.utilities import flatten
class BooleanFunction(Function):
"""Boolean function is a function that lives in a boolean space
It is used as base class for And, Or, Not, etc.
"""
pass
class And(Boolea... | {
"repo_name": "KevinGoodsell/sympy",
"path": "sympy/logic/boolalg.py",
"copies": "2",
"size": "7566",
"license": "bsd-3-clause",
"hash": 2060572292898015200,
"line_mean": 28.1,
"line_max": 86,
"alpha_frac": 0.5666137986,
"autogenerated": false,
"ratio": 3.721593703885883,
"config_test": false,
... |
"""Boolean algebra module for SymPy"""
from sympy.core import Basic, Function, sympify, Symbol
from sympy.utilities import make_list
from sympy.core.operations import LatticeOp
class BooleanFunction(Function):
"""Boolean function is a function that lives in a boolean space
It is used as base class for And, Or... | {
"repo_name": "tovrstra/sympy",
"path": "sympy/logic/boolalg.py",
"copies": "1",
"size": "7152",
"license": "bsd-3-clause",
"hash": -8526985223503456000,
"line_mean": 26.5076923077,
"line_max": 115,
"alpha_frac": 0.5756431767,
"autogenerated": false,
"ratio": 3.7230609057782407,
"config_test": ... |
BOOLEAN_CAPABILITIES = [
( 'auto_left_margin', 'bw', 'bw', 'cub1 wraps from column 0 to last column'),
( 'auto_right_margin', 'am', 'am', 'terminal has automatic margins'),
( 'no_esc_ctlc', 'xsb', 'xb', 'beehive (f1=escape, f2=ctrl C)'),
(... | {
"repo_name": "riquito/richinput",
"path": "richinput/terminfo_index.py",
"copies": "1",
"size": "43344",
"license": "apache-2.0",
"hash": -5913217576836851000,
"line_mean": 87.6380368098,
"line_max": 142,
"alpha_frac": 0.4017165006,
"autogenerated": false,
"ratio": 3.304162219850587,
"config_t... |
# Boolean denoting whether authentication is required to access the API.
AUTH_REQUIRED = False
# Boolean denoting whether Cross-Origin Resource Sharing is enabled.
CORS_ENABLED = False
# List/tuple of hosts for the Access-Control-Allow-Origin response header.
# If cross-origin request is received from an origin not i... | {
"repo_name": "rv816/serrano_night",
"path": "serrano/conf/global_settings.py",
"copies": "1",
"size": "3750",
"license": "bsd-2-clause",
"hash": -5283774382735456000,
"line_mean": 48.3421052632,
"line_max": 78,
"alpha_frac": 0.7824,
"autogenerated": false,
"ratio": 4.032258064516129,
"config_t... |
# Boolean expressions is an expression that is either true or false
# Relational operators are != > < >= <= ==
# Logical operator is one of the operations that combinds boolean expressions: and or not
# Conditional statement is a statment that controls the flow of execution depending on some condition
# Compound s... | {
"repo_name": "diana2199-cmis/diana2199-cmis-cs2",
"path": "practicequiz.py",
"copies": "1",
"size": "3105",
"license": "cc0-1.0",
"hash": 7783975019603036000,
"line_mean": 90.3235294118,
"line_max": 355,
"alpha_frac": 0.776489533,
"autogenerated": false,
"ratio": 4.474063400576369,
"config_tes... |
boolean_field_false = {'type': 'boolean', 'default': False}
boolean_field_true = {'type': 'boolean', 'default': True}
integer_field = {'type': 'integer'}
float_field = {'type': 'float'}
list_field = {'type': 'list'}
string_field = {'type': 'string'}
unique_string_field = {'type': 'string', 'unique': True}
required_stri... | {
"repo_name": "gwob/Maarifa",
"path": "tapi/taarifa_api/schemas.py",
"copies": "1",
"size": "6626",
"license": "apache-2.0",
"hash": -6973816465369030000,
"line_mean": 30.1079812207,
"line_max": 79,
"alpha_frac": 0.5490492001,
"autogenerated": false,
"ratio": 3.8999411418481458,
"config_test": ... |
# Boolean geometry in 0 dimensions
# stage 0
# binary operators
#
# and
# 0 & 0 => 0
# 0 & 1 => 0
# 1 & 0 => 0
# 1 & 1 => 1
#
# or
# 0 | 0 => 0
# 0 | 1 => 1
# 1 | 0 => 1
# 1 | 1 => 1
#
# xor
# 0 ^ 0 => 0
# 0 ^ 1 => 1
# 1 ^ 0 => 1
# 1 ^ 1 => 0
#
#
# language expressions are made from binary operators
# examples
#
# 1 ^... | {
"repo_name": "donbright/piliko",
"path": "bool0/bool0.py",
"copies": "1",
"size": "6337",
"license": "bsd-3-clause",
"hash": -4164812547813512700,
"line_mean": 22.9353612167,
"line_max": 119,
"alpha_frac": 0.6258935663,
"autogenerated": false,
"ratio": 2.4361455108359134,
"config_test": true,
... |
## Boolean Logic // take a string of boolean logic statements ##
## evaluate and return ##
##
## Order of operations matter!! ##
##
## NOT, AND, OR, XOR ##
##
## 'NOT' == '!' ## This NOT That -- 1 NOT 0 // 0 NOT 1
## 'AND' == '*' ## If both are T('1') then T('1')
## 'OR' == '|' ## If either is T('1') then T('1'... | {
"repo_name": "tijko/Boolean-Calculator",
"path": "boolcal.py",
"copies": "1",
"size": "2012",
"license": "mit",
"hash": -8820488955578197000,
"line_mean": 33.6896551724,
"line_max": 99,
"alpha_frac": 0.4463220676,
"autogenerated": false,
"ratio": 3.314662273476112,
"config_test": false,
"has... |
"""Boolean matrices as collections of row and column vectors."""
import bitsets
__all__ = ['Relation']
Vector = bitsets.bases.MemberBits
"""Single row or column of a boolean matrix as bit vector."""
class Vectors(bitsets.series.Tuple):
"""Paired collection of rows or columns of a boolean matrix relation.
... | {
"repo_name": "xflr6/concepts",
"path": "concepts/matrices.py",
"copies": "1",
"size": "4645",
"license": "mit",
"hash": 7821418835063812000,
"line_mean": 29.3594771242,
"line_max": 98,
"alpha_frac": 0.4930032293,
"autogenerated": false,
"ratio": 3.9364406779661016,
"config_test": false,
"has... |
## Boolean Operators ##
# Q3
def both_positive(x, y):
"""
Returns True if both x and y are positive.
>>> both_positive(-1, 1)
False
>>> both_positive(1, 1)
True
"""
"*** YOUR CODE HERE ***"
return x > 0 and y > 0
## if Statements ##
# Q7
# The code below causes an error when it ... | {
"repo_name": "tavaresdong/courses-notes",
"path": "ucb_cs61A/lab/lab02/lab02.py",
"copies": "3",
"size": "1605",
"license": "mit",
"hash": -1517040536950939600,
"line_mean": 16.8333333333,
"line_max": 69,
"alpha_frac": 0.5121495327,
"autogenerated": false,
"ratio": 3.1782178217821784,
"config_... |
## Boolean Operators ##
# Q4
def gets_discount(x, y):
""" Returns True if this is a combination of a senior citizen
and a child, False otherwise.
>>> gets_discount(65, 12)
True
>>> gets_discount(9, 70)
True
>>> gets_discount(40, 45)
False
>>> gets_discount(40, 75)
False
>>>... | {
"repo_name": "tavaresdong/cs61a-projects",
"path": "lab/lab02/lab02_extra.py",
"copies": "3",
"size": "2389",
"license": "mit",
"hash": -8332511712390710000,
"line_mean": 19.0756302521,
"line_max": 65,
"alpha_frac": 0.4688154039,
"autogenerated": false,
"ratio": 3.2997237569060776,
"config_tes... |
"""Boolean Parser library."""
from boolparser.core import *
def test_parser():
import sys
test_string = """a>1
a<1
a>=1
a<=1
a<1 & (b>2 | c<2)
a==1 & b<-2
a==1 & ! b
(a==b)
(a==b) & (c>1)
((a==b) & (c>1)) | d<=2
(a==b) & (c>1) | d<=2
(((a==b) & (c>1)) & (d<=2) & e>=1.5)
((a==b) & (c>1)) & (d<=2) & e>=1.5
((a=... | {
"repo_name": "eelsirhc/boolparser",
"path": "src/boolparser/__init__.py",
"copies": "1",
"size": "1119",
"license": "bsd-3-clause",
"hash": 8967462314478110000,
"line_mean": 23.8666666667,
"line_max": 106,
"alpha_frac": 0.4441465594,
"autogenerated": false,
"ratio": 2.4701986754966887,
"config... |
# boolean practice, exc 28, page 96
def query():
tf = input("Will This Evalate to True? ")
guess = tf
return guess
pass
def guesses(guess, result):
# print "Your recorded answer was:\n ", guess, "\n",
if guess == result:
print "CORRECT, this evaluates to:", result, "\n"
else:
print "UH-OH, this evaluates to... | {
"repo_name": "Baumelbi/IntroPython2016",
"path": "students/sheree/session_02/homework/LPTHW-EXC-28.py",
"copies": "3",
"size": "5262",
"license": "unlicense",
"hash": 4011256747994159000,
"line_mean": 22.9181818182,
"line_max": 109,
"alpha_frac": 0.6189661726,
"autogenerated": false,
"ratio": 2.... |
#Booleans and Conditionals
#A Boolean value is a value that is either True or False.
#A Boolean expression is an expression that evaluates to give True or False.
print 3 < 4 # "Is 3 less than 4?"
print 3 > 4 # "Is 3 greater than 4?"
#Here are some comparison operators that are built-in.
print 10 < 6 #... | {
"repo_name": "Nethermaker/school-projects",
"path": "intro/booleans_and_conditionals.py",
"copies": "1",
"size": "5101",
"license": "mit",
"hash": 4619012615167814000,
"line_mean": 23.6331658291,
"line_max": 99,
"alpha_frac": 0.624779455,
"autogenerated": false,
"ratio": 3.441970310391363,
"co... |
BOOLEAN_SWITCH_VALUES = {'true': True, 'false': False};
HELP_SWITCHES = ['-h', '-?', '/?', '/h', '--help'];
HELP_SWITCH_NAMES = ['h', '?', '?', 'h', 'help'];
class CommandLineOptions():
def __init__(self, application_name, arguments=[], switches=[],
help_message=None, help_notes=None):
assert applica... | {
"repo_name": "BestPig/skybuild",
"path": "command_line_options.py",
"copies": "1",
"size": "9216",
"license": "bsd-3-clause",
"hash": -5217708406773067000,
"line_mean": 37.2170212766,
"line_max": 119,
"alpha_frac": 0.6090494792,
"autogenerated": false,
"ratio": 3.7925925925925927,
"config_test... |
# bool(v)
from request_data import request
from collections import Counter
def gen_key(property, event=False):
for tobject in request(event=event):
for key, value in tobject.items():
if key.lower().startswith(property):
yield key
def gen_value(property, event=False):
prop... | {
"repo_name": "Aluriak/24hducode2016",
"path": "src/source_tourinsoft/Visite.py",
"copies": "1",
"size": "1707",
"license": "unlicense",
"hash": 5945659032165367000,
"line_mean": 27.45,
"line_max": 76,
"alpha_frac": 0.5916813122,
"autogenerated": false,
"ratio": 3.38019801980198,
"config_test":... |
"""BoolWidget class.
Represents a boolean using a widget.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed wi... | {
"repo_name": "omni5cience/django-inlineformfield",
"path": ".tox/py27/lib/python2.7/site-packages/IPython/html/widgets/widget_bool.py",
"copies": "6",
"size": "1274",
"license": "mit",
"hash": 7572650283709708000,
"line_mean": 36.4705882353,
"line_max": 85,
"alpha_frac": 0.4568288854,
"autogenerat... |
"""boomerang 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-... | {
"repo_name": "vsemionov/boomerang",
"path": "boomerang/urls.py",
"copies": "1",
"size": "1183",
"license": "mit",
"hash": -8935026432837678000,
"line_mean": 31.8611111111,
"line_max": 79,
"alpha_frac": 0.6762468301,
"autogenerated": false,
"ratio": 3.5313432835820895,
"config_test": false,
"... |
#BoostARoota_Better.py
## newest
#
#Basic algorithm runs and works just fine (BoostARoota.py)
#
#This script adds in a few features to the function. The plan:
#widening feature set, create functions for:
#PCA - Done
#Ordinal and OHE for categorical - OHE Done
#Specifying the eval metric
... | {
"repo_name": "ZRiddle/BoostARoota",
"path": "Dev_Testing/BoostARootaOld.py",
"copies": "1",
"size": "6972",
"license": "mit",
"hash": -1533569223563878100,
"line_mean": 35.1243523316,
"line_max": 112,
"alpha_frac": 0.5854847963,
"autogenerated": false,
"ratio": 3.9636156907333713,
"config_test... |
"""
Study the boost.
G{packagetree mHTM}
"""
__docformat__ = 'epytext'
# Native imports
import cPickle, random, csv, os, time, json
# Third party imports
import numpy as np
import bottleneck as bn
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
# Program imports
from mHTM.r... | {
"repo_name": "tehtechguy/mHTM",
"path": "dev/sp_math_pub/boost_experiment.py",
"copies": "1",
"size": "11796",
"license": "mit",
"hash": -8973424034394797000,
"line_mean": 24.0397350993,
"line_max": 79,
"alpha_frac": 0.6292811122,
"autogenerated": false,
"ratio": 2.797249229309936,
"config_tes... |
import sys
class header_generator:
def __init__(self, max_params):
self.max_params = max_params
def generate(self):
self.generate_factory_hpp()
self.generate_counted_factory_hpp()
self.generate_shared_library_hpp()
self.generate_factory_map_hpp("factory", "", "", "", """
factory_con... | {
"repo_name": "kdar/quakeslash",
"path": "externals/boost.extension/libs/extension/scripts/GenerateHeaders.py",
"copies": "1",
"size": "16292",
"license": "mit",
"hash": 1090369347800483600,
"line_mean": 31.584,
"line_max": 176,
"alpha_frac": 0.5573287503,
"autogenerated": false,
"ratio": 3.58223... |
"""
Boost experimentations.
G{packagetree mHTM}
"""
# Native imports
from itertools import izip
import os
import cPickle
# Third-Party imports
import numpy as np
# Program imports
from mHTM.plot import plot_surface_video, plot_surface
def compute_boost(duty_cycle, min_duty_cycle, max_boost=10):
... | {
"repo_name": "tehtechguy/mHTM",
"path": "dev/sp_math_pub/boost.py",
"copies": "1",
"size": "2675",
"license": "mit",
"hash": 3594713908631333000,
"line_mean": 25.5773195876,
"line_max": 77,
"alpha_frac": 0.6444859813,
"autogenerated": false,
"ratio": 2.7864583333333335,
"config_test": false,
... |
"""Boost the strength of an icebreaker."""
from csrv.model.actions import action
from csrv.model import appropriations
from csrv.model import cost
from csrv.model import errors
from csrv.model import events
from csrv.model import game_object
from csrv.model import modifiers
from csrv.model import parameters
class Bo... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/actions/boost_breaker_strength.py",
"copies": "1",
"size": "1367",
"license": "apache-2.0",
"hash": -5484625019996261000,
"line_mean": 31.5476190476,
"line_max": 80,
"alpha_frac": 0.7073884418,
"autogenerated": false,
"ratio": 3.523195876... |
"""Bootcamp application constants"""
from enum import Enum
SUBMISSION_VIDEO = "videointerviewsubmission"
SUBMISSION_QUIZ = "quizsubmission"
VALID_SUBMISSION_TYPE_CHOICES = [
(SUBMISSION_VIDEO, "Video Interview"),
(SUBMISSION_QUIZ, "Quiz"),
]
SUBMISSION_TYPE_STATE = {
SUBMISSION_VIDEO: "AWAITING_VIDEO_INT... | {
"repo_name": "mitodl/bootcamp-ecommerce",
"path": "applications/constants.py",
"copies": "1",
"size": "2708",
"license": "bsd-3-clause",
"hash": 2653757317986648600,
"line_mean": 31.2380952381,
"line_max": 111,
"alpha_frac": 0.7433530281,
"autogenerated": false,
"ratio": 3.0256983240223465,
"c... |
"""bootcamp 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-... | {
"repo_name": "qulc/bootcamp",
"path": "bootcamp/urls.py",
"copies": "2",
"size": "2156",
"license": "mit",
"hash": -1280878476211900400,
"line_mean": 38.9259259259,
"line_max": 95,
"alpha_frac": 0.7142857143,
"autogenerated": false,
"ratio": 3.717241379310345,
"config_test": false,
"has_no_k... |
# Bootloader unsets _MEIPASS2 for child processes so that if the program
# invokes another PyInstaller one-file program as subprocess, this
# subprocess will not fooled into thinking that it is already unpacked.
#
# This test checks if it is really unset.
import os
import sys
def _get_meipass_value():
if sys.pla... | {
"repo_name": "supercheetah/diceroller",
"path": "pyinstaller/buildtests/basic/test_get_meipass2_value.py",
"copies": "2",
"size": "1085",
"license": "artistic-2.0",
"hash": -5536245447816182000,
"line_mean": 23.1111111111,
"line_max": 78,
"alpha_frac": 0.6552995392,
"autogenerated": false,
"rati... |
# Bootloader unsets _MEIPASS2 for child processes to allow running
# PyInstaller binaries inside pyinstaller binaries.
# This is ok for mac or unix with fork() system call.
# But on Windows we need to overcome missing fork() fuction.
#
# See http://www.pyinstaller.org/wiki/Recipe/Multiprocessing
import multiprocessing.... | {
"repo_name": "supercheetah/diceroller",
"path": "pyinstaller/buildtests/basic/test_onefile_multiprocess.py",
"copies": "1",
"size": "2008",
"license": "artistic-2.0",
"hash": 1781493789056880400,
"line_mean": 32.4666666667,
"line_max": 73,
"alpha_frac": 0.609561753,
"autogenerated": false,
"rati... |
# boot.py -- run on boot-up
import os
import machine
from machine import Pin
from network import WLAN, Bluetooth
from config import *
# Disable debug logging by default, may be enabled later on in config.py
DEBUG = False
# Configure USB Serial
uart = machine.UART(0, 115200)
os.dupterm(uart)
# Turn off Bluetooth
bt =... | {
"repo_name": "ttn-be/ttnmapper",
"path": "boot.py",
"copies": "1",
"size": "1334",
"license": "mit",
"hash": 2360480800755393500,
"line_mean": 22.8214285714,
"line_max": 72,
"alpha_frac": 0.6364317841,
"autogenerated": false,
"ratio": 2.9578713968957873,
"config_test": false,
"has_no_keyword... |
# boot.py -- run on boot-up
#
# This is some common initialization that I like to keep around.
import pyb
import micropython
import sys
#pyb.main('main.py') # main script to run after this one
before_mode = pyb.usb_mode()
pyb.usb_mode('CDC') # act as a serial only
after_mode = pyb.usb_mode()
#pyb.usb_mode('CDC+MSC') ... | {
"repo_name": "dhylands/upy-examples",
"path": "boot-cdc-only.py",
"copies": "1",
"size": "1057",
"license": "mit",
"hash": 2030849506054304000,
"line_mean": 26.1025641026,
"line_max": 67,
"alpha_frac": 0.6281929991,
"autogenerated": false,
"ratio": 2.86449864498645,
"config_test": false,
"ha... |
# boot_service.py
import sys
import os
import servicemanager
import win32service
import win32serviceutil
import winerror
# We assume that py2exe has magically set service_module_names
# to the module names that expose the services we host.
service_klasses = []
try:
service_module_names
except NameError:
print "... | {
"repo_name": "windyuuy/opera",
"path": "chromium/src/third_party/python_26/Lib/site-packages/py2exe/boot_service.py",
"copies": "20",
"size": "7327",
"license": "bsd-3-clause",
"hash": 9086381878546203000,
"line_mean": 35.635,
"line_max": 100,
"alpha_frac": 0.5421045448,
"autogenerated": false,
... |
# boot_service.py
import sys
import os
import servicemanager
import win32service
import win32serviceutil
import winerror
# We assume that py2exe has magically set service_module_names
# to the module names that expose the services we host.
service_klasses = []
try:
service_module_names
except NameError:... | {
"repo_name": "pupboss/xndian",
"path": "deploy/site-packages/py2exe/boot_service.py",
"copies": "1",
"size": "7527",
"license": "mit",
"hash": -4282306387628233000,
"line_mean": 35.635,
"line_max": 100,
"alpha_frac": 0.527700279,
"autogenerated": false,
"ratio": 4.6377079482439925,
"config_tes... |
""" Bootstrap 3 grid extension fo Python Markdown
"""
from markdown.util import etree
from markdown import Extension
from markdown.treeprocessors import Treeprocessor
class AttrColTreeProcessor(Treeprocessor):
""" The attr_cols element tree processor. """
CONF_DEFAULTS = {
'columns': 12,
'at... | {
"repo_name": "CTPUG/mdx_attr_cols",
"path": "mdx_attr_cols.py",
"copies": "1",
"size": "2778",
"license": "isc",
"hash": 2632156663707995600,
"line_mean": 30.5681818182,
"line_max": 73,
"alpha_frac": 0.5575953924,
"autogenerated": false,
"ratio": 4.2607361963190185,
"config_test": false,
"ha... |
""" Bootstrap3 image field widget """
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
class Bootstrap3ImageSelector(forms.TextInput):
""" A image which can be clicked on and reveals a select... | {
"repo_name": "dploeger/django-bootstrap3-images",
"path": "widgets.py",
"copies": "1",
"size": "7692",
"license": "bsd-2-clause",
"hash": -3539221648688650000,
"line_mean": 21.3799392097,
"line_max": 76,
"alpha_frac": 0.4217368695,
"autogenerated": false,
"ratio": 4.035676810073452,
"config_te... |
"""Bootstrap AWS to enable simple up/down of bcbio with Ansible scripts.
"""
from __future__ import print_function
import argparse
import datetime
import os
import shutil
import string
import requests
import yaml
from bcbiovm.aws import iam, vpc
def setup_cmd(awsparser):
parser = awsparser.add_parser("ansible",... | {
"repo_name": "chapmanb/bcbio-nextgen-vm",
"path": "bcbiovm/aws/ansible_inputs.py",
"copies": "1",
"size": "3563",
"license": "mit",
"hash": -8491151290043449000,
"line_mean": 40.9176470588,
"line_max": 101,
"alpha_frac": 0.6017401067,
"autogenerated": false,
"ratio": 3.5665665665665665,
"confi... |
"""bootstrap.bootstrap: provides entry point main()."""
import sys
import click
import pika
from .stuff import Stuff
__version__ = "0.0.1"
@click.version_option(version=__version__)
@click.group()
def main():
"""Testor"""
pass
# print("Executing bootstrap version %s." % __version__)
# print("List of a... | {
"repo_name": "vychodnar/serial-zwave",
"path": "serial-adapter/bootstrap/bootstrap.py",
"copies": "1",
"size": "1825",
"license": "mit",
"hash": 7042742416759483000,
"line_mean": 26.6515151515,
"line_max": 85,
"alpha_frac": 0.6564383562,
"autogenerated": false,
"ratio": 3.2942238267148016,
"co... |
# BOOTSTRAP CODE
import os
import time
import argparse
if "JSBRANCH" in os.environ:
branch = os.environ["JSBRANCH"]
else:
branch = "master"
if not "TMPDIR" in os.environ:
raise RuntimeError("TMPDIR should be there")
tmpdir = os.environ["TMPDIR"]
os.chdir(tmpdir)
print("bootstrap installtools in dir %... | {
"repo_name": "Jumpscale/jumpscale_core8",
"path": "install/bootstrap.py",
"copies": "1",
"size": "1221",
"license": "apache-2.0",
"hash": 8366661301546750000,
"line_mean": 22.4807692308,
"line_max": 125,
"alpha_frac": 0.7436527437,
"autogenerated": false,
"ratio": 3.3636363636363638,
"config_t... |
"""Bootstrap command line module"""
import argparse
import json
import logging
import numpy as np
from egta import bootstrap
from egta.script import schedspec
def add_parser(subparsers):
"""Create bootstrap parser"""
parser = subparsers.add_parser(
"bootstrap",
aliases=["boot"],
help... | {
"repo_name": "egtaonline/quiesce",
"path": "egta/script/bootstrap.py",
"copies": "1",
"size": "6401",
"license": "apache-2.0",
"hash": 5292482232925118000,
"line_mean": 33.6,
"line_max": 87,
"alpha_frac": 0.5870957663,
"autogenerated": false,
"ratio": 3.7128770301624128,
"config_test": false,
... |
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(1337)
fs = 12
theta = 0.7
Ns = [10, 100]
for i in range(len(Ns)):
N = Ns[i]
B = 10000
X = np.random.randn(1,N) < theta
bmle = np.mean(X)
mleBoot = np.zeros((1,B))
for j in range(B):
Xb = np.random.randn(1,N) ... | {
"repo_name": "probml/pyprobml",
"path": "scripts/bootstrapDemoBer.py",
"copies": "1",
"size": "1606",
"license": "mit",
"hash": -6259698890806473000,
"line_mean": 31.14,
"line_max": 123,
"alpha_frac": 0.5927770859,
"autogenerated": false,
"ratio": 2.6241830065359477,
"config_test": false,
"h... |
# Bootstrap distribute unless already installed
from distribute_setup import use_setuptools
use_setuptools()
import os
import sys
from setuptools import setup, find_packages
import NAME
# Shortcut for publishing to Pypi
# Source: https://github.com/kennethreitz/tablib/blob/develop/setup.py
if sys.argv[-1] == "publis... | {
"repo_name": "robinandeer/scout",
"path": "setup.py",
"copies": "1",
"size": "1740",
"license": "mit",
"hash": 4160434096201379000,
"line_mean": 22.5135135135,
"line_max": 70,
"alpha_frac": 0.6367816092,
"autogenerated": false,
"ratio": 3.6864406779661016,
"config_test": false,
"has_no_keywo... |
# Bootstrap entry into stagehand.main.
#
# Here we aim to be compatible with both Python 2 and Python 3 so that if the
# user's version isn't compatible, we can actually report that.
import sys
import os
if sys.platform == 'win32' and 'pythonw' in sys.executable.lower():
# If we are running under pythonw... | {
"repo_name": "jtackaberry/stagehand",
"path": "stagehand/bootstrap.py",
"copies": "1",
"size": "1964",
"license": "mit",
"hash": 6563674041600079000,
"line_mean": 33.7090909091,
"line_max": 92,
"alpha_frac": 0.6486761711,
"autogenerated": false,
"ratio": 3.7480916030534353,
"config_test": fals... |
"""Bootstrap for running a Django app."""
# Standard Python imports.
import os
import sys
import logging
import __builtin__
# Google App Hosting imports.
from google.appengine.ext.webapp import util
# Remove the standard version of Django before using it.
for k in [k for k in sys.modules if k.startswith('django')]:
... | {
"repo_name": "mozaffari/cssjanus",
"path": "django_bootstrap.py",
"copies": "4",
"size": "1548",
"license": "apache-2.0",
"hash": -8906990271656463000,
"line_mean": 28.2075471698,
"line_max": 75,
"alpha_frac": 0.7357881137,
"autogenerated": false,
"ratio": 3.54233409610984,
"config_test": fals... |
"""Bootstrap for running a Django app under Google App Engine.
The site-specific code is all in other files: settings.py, urls.py,
models.py, views.py. And in fact, only 'settings' is referenced here
directly -- everything else is controlled from there.
"""
#! coding: utf-8
# Standard Python imports.
import logging... | {
"repo_name": "AloneRoad/Inforlearn",
"path": "main.py",
"copies": "1",
"size": "3381",
"license": "apache-2.0",
"hash": -5489225005521066000,
"line_mean": 30.0183486239,
"line_max": 76,
"alpha_frac": 0.7048210589,
"autogenerated": false,
"ratio": 3.5292275574112737,
"config_test": false,
"ha... |
#bootstrap h0 for timespread against percentiles
#modules----------------------------------------
import random
import pickle
import scipy.stats.mstats as ssm
import numpy as np
import bisect
#functions-------------------------------------
def sample_wr(population, k):
"Chooses k random elements (with ... | {
"repo_name": "tomstafford/axongame",
"path": "ps_fig3boot.py",
"copies": "1",
"size": "2651",
"license": "mit",
"hash": 3638610255591206400,
"line_mean": 33.3466666667,
"line_max": 87,
"alpha_frac": 0.627687665,
"autogenerated": false,
"ratio": 3.3943661971830985,
"config_test": false,
"has_... |
"""Bootstrap implementation for linux."""
from __future__ import absolute_import
import errno
import abc
import logging
import os
import tempfile
import jinja2
import treadmill
from .. import _bootstrap_base
from ... import admin
from ... import context
from ... import fs
_LOGGER = logging.getLogger(__name__)
... | {
"repo_name": "toenuff/treadmill",
"path": "lib/python/treadmill/osmodules/linux/bootstrap.py",
"copies": "1",
"size": "7269",
"license": "apache-2.0",
"hash": -5666286979239311000,
"line_mean": 32.0409090909,
"line_max": 78,
"alpha_frac": 0.5530334296,
"autogenerated": false,
"ratio": 4.15371428... |
# Bootstrap installation of Distribute
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup, find_packages
from hyde.version import __version__
from distutils.util import convert_path
from fnmatch import fnmatchcase
import os
import sys
PROJECT = 'hyde'
try:
long_description = ... | {
"repo_name": "Ali-Razmjoo/hyde",
"path": "setup.py",
"copies": "3",
"size": "6105",
"license": "mit",
"hash": -4147761178697438000,
"line_mean": 34.4941860465,
"line_max": 86,
"alpha_frac": 0.5023751024,
"autogenerated": false,
"ratio": 4.485672299779574,
"config_test": false,
"has_no_keywor... |
"""Bootstrap"""
from __future__ import absolute_import, unicode_literals
import logging
import sys
from operator import eq, lt
from virtualenv.util.path import Path
from virtualenv.util.six import ensure_str
from virtualenv.util.subprocess import Popen, subprocess
from .bundle import from_bundle
from .util import Ve... | {
"repo_name": "pypa/virtualenv",
"path": "src/virtualenv/seed/wheels/acquire.py",
"copies": "2",
"size": "4472",
"license": "mit",
"hash": -8524839751638665000,
"line_mean": 35.958677686,
"line_max": 113,
"alpha_frac": 0.6283542039,
"autogenerated": false,
"ratio": 3.736006683375104,
"config_te... |
"""Bootstrap"""
from __future__ import absolute_import, unicode_literals
import logging
import sys
import traceback
from contextlib import contextmanager
from subprocess import CalledProcessError
from threading import Lock, Thread
from virtualenv.info import fs_supports_symlink
from virtualenv.seed.embed.base_embed i... | {
"repo_name": "pypa/virtualenv",
"path": "src/virtualenv/seed/embed/via_app_data/via_app_data.py",
"copies": "2",
"size": "6032",
"license": "mit",
"hash": 4227174061026579500,
"line_mean": 42.0857142857,
"line_max": 113,
"alpha_frac": 0.550397878,
"autogenerated": false,
"ratio": 4.6579150579150... |
# Bootstrap our local extensions first.
# TODO: Requires that both ${LLVM_INSTALL}/python and ./build are on
# PYTHONPATH
import runners
from mlir.ir import *
from mlir.passmanager import *
import mlir.all_passes_registration
class Transform:
"""Base class for all parametrized transformations."""
def __call__... | {
"repo_name": "google/iree-llvm-sandbox",
"path": "runners/test/python/transforms.py",
"copies": "1",
"size": "3306",
"license": "apache-2.0",
"hash": -838200008044607700,
"line_mean": 29.6111111111,
"line_max": 94,
"alpha_frac": 0.554446461,
"autogenerated": false,
"ratio": 3.5095541401273884,
... |
## BootstrappedDeepQNetwork.py
##
## Bootstrapped Deep Q Network.
##
import tensorflow as tf
import numpy as np
import os
from models.optimizer import ClippedRMSPropOptimizer
class BootstrappedDeepQNetwork(object):
# def __init__(self, frame_shape, shared_hidden_layers, head_layers, num_actions, num_heads, sess,... | {
"repo_name": "danathughes/AtariRL",
"path": "models/BootstrappedDeepQNetwork.py",
"copies": "1",
"size": "4476",
"license": "mit",
"hash": -5592937411801022000,
"line_mean": 29.8689655172,
"line_max": 111,
"alpha_frac": 0.6036639857,
"autogenerated": false,
"ratio": 3.905759162303665,
"config_... |
## bootstrapped_dqn_agent.py
##
## Agent which implements a Bootstrapped Deep Q Network as a control policy
##
import numpy as np
import os
import tensorflow as tf
from models import operations
class Bootstrapped_DQN_Agent:
"""
Agent which implements a Bootstrapped DQN to learn a policy
"""
def __init__(self, f... | {
"repo_name": "danathughes/AtariRL",
"path": "agents/bootstrapped_dqn_agent.py",
"copies": "1",
"size": "4259",
"license": "mit",
"hash": 7701140325627339000,
"line_mean": 24.8181818182,
"line_max": 113,
"alpha_frac": 0.6966424043,
"autogenerated": false,
"ratio": 3.1385408990420043,
"config_te... |
'''bootstrapping classes
make sure class and special instance are only loaded once,
even when atypes is reloaded
'''
from __future__ import absolute_import
bsclasses_names_spaces = globals()
from ..collections import OrderedDict, OrderedSet
class TypeBase(object):
def __invert__(self):
return com... | {
"repo_name": "matthagy/Jamenson",
"path": "jamenson/runtime/atypes/bsclasses.py",
"copies": "1",
"size": "2246",
"license": "apache-2.0",
"hash": 2276936975881409500,
"line_mean": 23.4130434783,
"line_max": 81,
"alpha_frac": 0.589937667,
"autogenerated": false,
"ratio": 3.8791018998272886,
"co... |
# bootstrapping setuptools
import ez_setup
ez_setup.use_setuptools()
import os
import sys
import textwrap
from distutils.errors import *
from distutils.command.clean import clean as _clean
from distutils.cmd import Command
from setuptools import setup
from distutils import log
from distutils.core import setup
class... | {
"repo_name": "AloneRoad/Inforlearn",
"path": ".google_appengine/lib/antlr3/setup.py",
"copies": "30",
"size": "8652",
"license": "apache-2.0",
"hash": 6616478302667500000,
"line_mean": 28.937716263,
"line_max": 78,
"alpha_frac": 0.4916782247,
"autogenerated": false,
"ratio": 4.602127659574468,
... |
""" Bootstraps instance of Docker container for PRISONER demonstration.
Requests Facebook app ID and secret, shows url for demo app
"""
import platform
root_path = "/usr/bin/prisoner-demo/" # docker
#root_path = "" # local
if __name__ == "__main__":
print "PRISONER Demonstration"
print "====================... | {
"repo_name": "uoscompsci/PRISONER",
"path": "examples/dockerdemo/demo_bootstrap.py",
"copies": "1",
"size": "1619",
"license": "bsd-3-clause",
"hash": -6492512022205326000,
"line_mean": 34.9777777778,
"line_max": 146,
"alpha_frac": 0.6571957999,
"autogenerated": false,
"ratio": 3.854761904761905... |
# Bootstraps the Roots instance with the default
# set of the necessary objects
import datetime
site = Site.objects.get_current()
# Create the admin user
admin = User.objects.create(
username="admin",
email="admin@example.com",
is_staff=True,
is_superuser=True,
)
admin.set_password('admin')
admin.sav... | {
"repo_name": "matus-stehlik/roots",
"path": "scripts/bootstrap.py",
"copies": "3",
"size": "2590",
"license": "mit",
"hash": -487983406791483300,
"line_mean": 21.3275862069,
"line_max": 75,
"alpha_frac": 0.7181467181,
"autogenerated": false,
"ratio": 3.514246947082768,
"config_test": false,
... |
"""Bootstraps the TyphoonAE environment.
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import os
import shutil
import sys
import tempfile
import urllib2
tmpeggs = tempfile... | {
"repo_name": "Petraea/jsonbot",
"path": "files/buildout/bootstrap.py",
"copies": "1",
"size": "1389",
"license": "mit",
"hash": 5934236417771976000,
"line_mean": 25.2075471698,
"line_max": 75,
"alpha_frac": 0.6695464363,
"autogenerated": false,
"ratio": 3.1857798165137616,
"config_test": true,... |
"""Bootstrap tests"""
from __future__ import absolute_import, division, print_function
import os
import doctest
import unittest
import tempfile
import hashlib
import sys
from shutil import rmtree
import bootstrap
class Stage0DataTestCase(unittest.TestCase):
"""Test Case for stage0_data"""
def setUp(self):
... | {
"repo_name": "ltratt/rust",
"path": "src/bootstrap/bootstrap_test.py",
"copies": "4",
"size": "3821",
"license": "apache-2.0",
"hash": -6182418068782669000,
"line_mean": 34.7102803738,
"line_max": 96,
"alpha_frac": 0.634650615,
"autogenerated": false,
"ratio": 3.5810684161199626,
"config_test"... |
"""Bootstrap the 'hidden_extensions' setting for the XML syntax.
The XML package includes a `XML.sublime-settings` file
that sets `hidden_extensions` to include some of the extensions
we want to highlight with our package.
There is currently no other way to override this,
so we manually override this extension list
in... | {
"repo_name": "SublimeText/AAAPackageDev",
"path": "plugins/xml_hidden_extensions_hotfix.py",
"copies": "2",
"size": "3144",
"license": "mit",
"hash": 8530440503503294000,
"line_mean": 38.7974683544,
"line_max": 97,
"alpha_frac": 0.6984732824,
"autogenerated": false,
"ratio": 3.5405405405405403,
... |
"""BoPress 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": "tinyms/bopress",
"path": "BoPress/urls.py",
"copies": "1",
"size": "2301",
"license": "apache-2.0",
"hash": 4202070154976570000,
"line_mean": 44.1176470588,
"line_max": 100,
"alpha_frac": 0.7501086484,
"autogenerated": false,
"ratio": 3.373900293255132,
"config_test": false,
"h... |
#Bored waiting for the proxy to come back up
import random
from time import sleep
from math import sqrt
class item:
def __init__(self):
self.name = "Nothing"
self.quality = -1
self.cost = 0
self.power = 0
self.ilevel = 0
def getQualityAbbr(self):
if self.qualit... | {
"repo_name": "sabarjp/bored",
"path": "bored.py",
"copies": "1",
"size": "26534",
"license": "mit",
"hash": -5254393823556782000,
"line_mean": 38.3679525223,
"line_max": 237,
"alpha_frac": 0.543905932,
"autogenerated": false,
"ratio": 3.394831115660184,
"config_test": false,
"has_no_keywords... |
"""Borg pattern
Share state among instances.
"""
class Borg(object):
"""All instances of Borg share state with themselves and with all instances
of Borg's subclasses, unless _shared_state is overriden in that class."""
_shared_state = {}
def __init__(self, name):
self.__dict__ = self._share... | {
"repo_name": "jackaljack/design-patterns",
"path": "borg.py",
"copies": "1",
"size": "2210",
"license": "mit",
"hash": -6820798229447165000,
"line_mean": 22.5106382979,
"line_max": 87,
"alpha_frac": 0.5909502262,
"autogenerated": false,
"ratio": 3.5135135135135136,
"config_test": false,
"has... |
# Boris Borcic 2006
# Quick and concise Python 2.5 sudoku solver
#
# Adapted for Brython by Pierre Quentel
# Load pre-computed tables
# Don't use the stdlib module json (much too slow), use Javascript object
# JSON instead
from browser import window
json = window.JSON
src = open('sudoku.json').read()
data = json.pars... | {
"repo_name": "kikocorreoso/brython",
"path": "www/gallery/sudoku.py",
"copies": "2",
"size": "1626",
"license": "bsd-3-clause",
"hash": -739906705142718100,
"line_mean": 28.0357142857,
"line_max": 105,
"alpha_frac": 0.5731857319,
"autogenerated": false,
"ratio": 2.7842465753424657,
"config_tes... |
# Boris Borcic 2006
# Quick and concise Python 2.5 sudoku solver
#
# Adapted for Brython by Pierre Quentel
# load pre-computed tables
import json
data = json.loads(open('sudoku.json').read())
w2q = data['w2q']
q2w = data['q2w']
w2q2w = data['w2q2w']
class Completed(Exception) : pass
def sudoku99(problem) :
given... | {
"repo_name": "firmlyjin/brython",
"path": "www/gallery/sudoku.py",
"copies": "16",
"size": "1493",
"license": "bsd-3-clause",
"hash": -9059244082900557000,
"line_mean": 28.86,
"line_max": 105,
"alpha_frac": 0.5572672472,
"autogenerated": false,
"ratio": 2.729433272394881,
"config_test": false,... |
# Borrador del plot
import matplotlib.pyplot as plt
from sys import argv
script, file_path = argv
f = open(file_path, 'r')
num_acceptors = []
quenching_eff = []
while True:
a = f.readline()
if '| Nº acceptors' in a:
f.readline()
while True:
a = f.readline()
if '-' in ... | {
"repo_name": "pewen/ten",
"path": "tools/plot.py",
"copies": "1",
"size": "1524",
"license": "mit",
"hash": -8577327080428349000,
"line_mean": 25.7192982456,
"line_max": 89,
"alpha_frac": 0.5226526592,
"autogenerated": false,
"ratio": 2.681338028169014,
"config_test": false,
"has_no_keywords... |
# Borrowed from Alex Martelli's sort from Python cookbook using inlines
# 2x over fastest Python version -- again, maybe not worth the effort...
# Then again, 2x is 2x...
#
# C:\home\eric\wrk\scipy\weave\examples>python dict_sort.py
# Dict sort of 1000 items for 300 iterations:
# speed in python: 0.2509999275... | {
"repo_name": "jonycgn/scipy",
"path": "scipy/weave/examples/dict_sort.py",
"copies": "100",
"size": "3235",
"license": "bsd-3-clause",
"hash": 5155834656726119000,
"line_mean": 23.5075757576,
"line_max": 72,
"alpha_frac": 0.5387944359,
"autogenerated": false,
"ratio": 3.0290262172284645,
"conf... |
# Borrowed from bcolz.chunked_eval
# Should be adapted to return either a value in a column, or a boolean in a bitmap.
# Should also provide an eval/select progressive module.
import numpy as np
from .column import BaseColumn
def _getvars(expression, user_dict):
"""Get the variables in `expression`."""
cex... | {
"repo_name": "jdfekete/progressivis",
"path": "progressivis/table/eval.py",
"copies": "1",
"size": "4306",
"license": "bsd-2-clause",
"hash": -4342996485017270300,
"line_mean": 32.905511811,
"line_max": 83,
"alpha_frac": 0.545517882,
"autogenerated": false,
"ratio": 4.069943289224953,
"config_... |
# Borrowed from django.contrib.auth.hashes v1.11
import binascii
import hmac
import hashlib
import importlib
import warnings
import random
import time
import re
from collections import OrderedDict
UNUSABLE_PASSWORD_PREFIX = '!' # This will never be a valid encoded hash
UNUSABLE_PASSWORD_SUFFIX_LENGTH = 40 # number o... | {
"repo_name": "getfleety/coralillo",
"path": "coralillo/hashing.py",
"copies": "1",
"size": "10935",
"license": "mit",
"hash": -786987868310534800,
"line_mean": 34.9703947368,
"line_max": 106,
"alpha_frac": 0.6523090992,
"autogenerated": false,
"ratio": 4.34964200477327,
"config_test": false,
... |
"""Borrowed from Django."""
from threading import Lock
class LazyObject(object):
"""
A wrapper for another class that can be used to delay instantiation of the
wrapped class.
By subclassing, you have the opportunity to intercept and alter the
instantiation. If you don't need to do that, use Simpl... | {
"repo_name": "peplin/astral",
"path": "astral/utils/functional.py",
"copies": "1",
"size": "1519",
"license": "mit",
"hash": -5944874536856522000,
"line_mean": 28.2115384615,
"line_max": 78,
"alpha_frac": 0.564845293,
"autogenerated": false,
"ratio": 4.494082840236686,
"config_test": false,
... |
# Borrowed from Django, which is BSD licensed, which had received permission
# to include it.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'):
raise ValueError("'package' not set to a string")
dot = l... | {
"repo_name": "toastdriven/piecrust",
"path": "piecrust/utils/importlib.py",
"copies": "1",
"size": "1254",
"license": "bsd-3-clause",
"hash": 5308998202163813000,
"line_mean": 32.8918918919,
"line_max": 78,
"alpha_frac": 0.6052631579,
"autogenerated": false,
"ratio": 4.510791366906475,
"config... |
import glob, itertools, os, sys, time
try:
import _thread
except ImportError:
import _dummy_thread as thread
# This import does nothing, but it's necessary to avoid some race conditions
# in the threading module. See http://code.djangoproject.com/ticket/2330 .
try:
import threading
except ImportError:
... | {
"repo_name": "akheron/stango",
"path": "stango/autoreload.py",
"copies": "1",
"size": "6915",
"license": "mit",
"hash": -5572264322772864000,
"line_mean": 37.8483146067,
"line_max": 92,
"alpha_frac": 0.6801156905,
"autogenerated": false,
"ratio": 4.287042777433354,
"config_test": false,
"has... |
#Borrowed from ePad error popup done by ylee
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.box import Box
from efl.elementary.icon import Icon
from efl.elementary.button import Button
from efl.elementary.image import Image
from efl.elementary.popup import Popup
fr... | {
"repo_name": "JeffHoogland/bodhi3packages",
"path": "python-elm-extensions/usr/lib/python2.7/dist-packages/elmextensions/StandardPopup.py",
"copies": "3",
"size": "2570",
"license": "bsd-3-clause",
"hash": 4257840347073947000,
"line_mean": 37.9393939394,
"line_max": 79,
"alpha_frac": 0.6210116732,
... |
# Borrowed from http://djangosnippets.org/snippets/2199/
#
# Digg-like page numbering using inclusion tag
from django import template
register = template.Library()
@register.inclusion_tag('pagination.html', takes_context=True)
def pagination(context, page, begin_pages=2, end_pages=2, before_current_pages=4, after_cu... | {
"repo_name": "bartosh/layerindex-web",
"path": "layerindex/templatetags/pagination.py",
"copies": "2",
"size": "1683",
"license": "mit",
"hash": 2952699169298655700,
"line_mean": 31.3653846154,
"line_max": 105,
"alpha_frac": 0.6244800951,
"autogenerated": false,
"ratio": 3.558139534883721,
"co... |
# Borrowed from http://en.wikibooks.org/wiki/Algorithm_implementation/Statistics/Fleiss%27_kappa on 3/18/2011
DEBUG = True
def computeKappa(mat):
""" Computes the Kappa value
@param n Number of rating per subjects (number of human raters)
@param mat Matrix[subjects][categories]
@return The... | {
"repo_name": "marcua/qurk_experiments",
"path": "qurkexp/join/fleiss.py",
"copies": "1",
"size": "2136",
"license": "bsd-3-clause",
"hash": -7314163482136940000,
"line_mean": 24.734939759,
"line_max": 109,
"alpha_frac": 0.5051498127,
"autogenerated": false,
"ratio": 2.991596638655462,
"config_... |
import re
from django.db.models import Q
def normalize_query(query_string,
findterms=re.compile(r'"([^"]+)"|(\S+)').findall,
normspace=re.compile(r'\s{2,}').sub):
''' Splits the query string in invidual keywords, getting rid of unecessary spaces
and grouping quoted ... | {
"repo_name": "bartosh/layerindex-web",
"path": "layerindex/simplesearch.py",
"copies": "2",
"size": "1501",
"license": "mit",
"hash": 2717994926597616000,
"line_mean": 37.4871794872,
"line_max": 96,
"alpha_frac": 0.600266489,
"autogenerated": false,
"ratio": 3.8,
"config_test": false,
"has_n... |
# "Borrowed" from https://github.com/cbmi/avocado/blob/2.x/avocado/core/loader.py
import inspect
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class Registry(object):
"Simple class ... | {
"repo_name": "chop-dbhi/django-dicom-review",
"path": "dicom_review/loader.py",
"copies": "1",
"size": "3557",
"license": "bsd-2-clause",
"hash": 4008846498554400000,
"line_mean": 35.2959183673,
"line_max": 99,
"alpha_frac": 0.6030362665,
"autogenerated": false,
"ratio": 4.531210191082803,
"co... |
# borrowed from https://github.com/OlavHN/bnlstm, updated for r1.0
import math
import numpy as np
import tensorflow as tf
try:
from tensorflow.contrib.rnn import RNNCell
except ImportError:
RNNCell = tf.nn.rnn_cell.RNNCel
class LSTMCell(RNNCell):
"""Vanilla LSTM implemented with same initializations as BN-LST... | {
"repo_name": "conversationai/conversationai-models",
"path": "hierarchical_attention_research/han_model/bn_lstm.py",
"copies": "1",
"size": "4984",
"license": "apache-2.0",
"hash": 7855230998758678000,
"line_mean": 29.7654320988,
"line_max": 80,
"alpha_frac": 0.6091492777,
"autogenerated": false,
... |
# borrowed from: https://github.com/pypa/sampleproject/blob/master/setup.py
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'REA... | {
"repo_name": "godfryd/gamepadinfo",
"path": "setup.py",
"copies": "1",
"size": "2027",
"license": "mit",
"hash": -7587366955572336000,
"line_mean": 31.6935483871,
"line_max": 79,
"alpha_frac": 0.6546620622,
"autogenerated": false,
"ratio": 3.9901574803149606,
"config_test": false,
"has_no_ke... |
# borrowed from https://pypi.python.org/pypi/stemming/1.0 (public domain)
"""An implementation of the Porter2 stemming algorithm.
See http://snowball.tartarus.org/algorithms/english/stemmer.html
Adapted from pyporter2 by Michael Dirolf.
This algorithm is more correct but (at least in this implementation)
several tim... | {
"repo_name": "adbreind/rye",
"path": "gutenrye/porter2.py",
"copies": "1",
"size": "8479",
"license": "mit",
"hash": 8548143515226254000,
"line_mean": 28.2413793103,
"line_max": 87,
"alpha_frac": 0.4814246963,
"autogenerated": false,
"ratio": 3.3633478778262593,
"config_test": false,
"has_no... |
# updates the copyright information for all .cs files
# usage: call recursive_traversal, with the following parameters
# parent directory, old copyright text content, new copyright text content
import os
excludedir = ["../.sass-cache", "../.tmp", "../node_modules", "../assets/bower_components"]
def update_source(fi... | {
"repo_name": "cloudcompass/stackbutton",
"path": "scripts/add_copyright.py",
"copies": "1",
"size": "1634",
"license": "apache-2.0",
"hash": 3378993926264544000,
"line_mean": 33.7659574468,
"line_max": 105,
"alpha_frac": 0.6401468788,
"autogenerated": false,
"ratio": 3.544468546637744,
"config... |
"""Borrowed from mixtape's movie scripts"""
import os
import numpy as np
import mdtraj as md
from numpy import reshape, shape, zeros, arange
from numpy.linalg import norm
def load_timeseries(filenames, atom_indices, topology):
X = []
i = []
f = []
for file in filenames:
t = md.load(file)
... | {
"repo_name": "rbharath/switch",
"path": "Switch/movies.py",
"copies": "1",
"size": "1679",
"license": "bsd-2-clause",
"hash": -8191770671074981000,
"line_mean": 31.9215686275,
"line_max": 75,
"alpha_frac": 0.6408576534,
"autogenerated": false,
"ratio": 3.0035778175313057,
"config_test": false,... |
# Borrowed from rdb-tools
import sys
import struct
from .crc64 import crc64
try:
import lzf
except ImportError:
lzf = None
__all__ = ['parse_rdb']
REDIS_RDB_6BITLEN = 0
REDIS_RDB_14BITLEN = 1
REDIS_RDB_32BITLEN = 0x80
REDIS_RDB_64BITLEN = 0x81
REDIS_RDB_ENCVAL = 3
REDIS_RDB_OPCODE_AUX = 250
REDIS_RDB_OPCODE... | {
"repo_name": "happybits/redisimp",
"path": "redisimp/rdbparser.py",
"copies": "1",
"size": "10334",
"license": "mit",
"hash": 1287556539244845000,
"line_mean": 31.4968553459,
"line_max": 76,
"alpha_frac": 0.54296497,
"autogenerated": false,
"ratio": 3.3132414235331837,
"config_test": false,
... |
# borrowed from Selwin Ong:
# http://ui.co.id/blog/asynchronous-send_mail-in-django
import Queue
import threading
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
mail_sent_queue = Queue.Queue()
class EmailThread(threading.Thread):
def __init__(self, subject, body, from_ema... | {
"repo_name": "danirus/django-inviteme",
"path": "inviteme/utils.py",
"copies": "1",
"size": "1061",
"license": "bsd-2-clause",
"hash": -8586224396609428000,
"line_mean": 31.1515151515,
"line_max": 99,
"alpha_frac": 0.6870876532,
"autogenerated": false,
"ratio": 3.5844594594594597,
"config_test... |
# borrowed from Selwin Ong:
# http://ui.co.id/blog/asynchronous-send_mail-in-django
try:
import Queue as queue # python2
except ImportError:
import queue as queue # python3
import threading
from django.core.mail import EmailMultiAlternatives
mail_sent_queue = queue.Queue()
class EmailThread(threading.Thre... | {
"repo_name": "CantemoInternal/django-comments-xtd",
"path": "django_comments_xtd/utils.py",
"copies": "1",
"size": "1351",
"license": "bsd-2-clause",
"hash": -6995586587140599000,
"line_mean": 29.0222222222,
"line_max": 99,
"alpha_frac": 0.6728349371,
"autogenerated": false,
"ratio": 3.871060171... |
# borrowed from Selwin Ong:
# http://ui.co.id/blog/asynchronous-send_mail-in-django
try:
import Queue as queue # python2
except ImportError:
import queue as queue # python3
import threading
from django.core.mail import EmailMultiAlternatives
mail_sent_queue = queue.Queue()
class EmailThread(threading.Th... | {
"repo_name": "petekalo/django-contactme",
"path": "django_contactme/utils.py",
"copies": "2",
"size": "1197",
"license": "mit",
"hash": -1965680289400222700,
"line_mean": 29.6923076923,
"line_max": 78,
"alpha_frac": 0.6349206349,
"autogenerated": false,
"ratio": 3.8,
"config_test": false,
"h... |
# Borrowed from stackoverflow, CC-BY-SA Licenced per TOS
# http://stackoverflow.com/a/19145256
from flask.globals import _app_ctx_stack, _request_ctx_stack
from werkzeug.urls import url_parse
from werkzeug.exceptions import NotFound
def route_from(url, method=None):
appctx = _app_ctx_stack.top
reqctx = _reque... | {
"repo_name": "m0zes/raspi_ir_relay",
"path": "flask_from_url.py",
"copies": "1",
"size": "1229",
"license": "bsd-3-clause",
"hash": 3165719900065982500,
"line_mean": 42.8928571429,
"line_max": 84,
"alpha_frac": 0.6273393002,
"autogenerated": false,
"ratio": 4.267361111111111,
"config_test": fa... |
# Borrowed from SublimeXiKi
# https://github.com/lunixbochs/SublimeXiki/blob/st3/edit.py
import sublime
import sublime_plugin
from sys import version_info
PY3K = version_info >= (3, 0, 0)
try:
sublime.edit_storage
except AttributeError:
sublime.edit_storage = {}
class EditStep:
def __init__(self, cmd, *... | {
"repo_name": "jcartledge/sublime-worksheet",
"path": "edit.py",
"copies": "1",
"size": "1864",
"license": "mit",
"hash": 3292391653900288000,
"line_mean": 23.5263157895,
"line_max": 66,
"alpha_frac": 0.5681330472,
"autogenerated": false,
"ratio": 3.543726235741445,
"config_test": false,
"has... |
# Borrowed under the terms of the MIT license
# https://github.com/MihaiBalint/Sanic-HTTPAuth/blob/master/LICENSE
# Borrowed code from werkzeug: https://github.com/pallets/werkzeug
import base64
import hmac
import logging
import sanic.response
import sys
from sanic.request import Request
from urllib.request import par... | {
"repo_name": "menpo/landmarkerio-server",
"path": "landmarkerio/http_auth/sanic_httpauth_compat.py",
"copies": "1",
"size": "9914",
"license": "bsd-3-clause",
"hash": 3167546086682003000,
"line_mean": 31.3986928105,
"line_max": 82,
"alpha_frac": 0.6067177728,
"autogenerated": false,
"ratio": 4.0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.