text stringlengths 0 1.05M | meta dict |
|---|---|
#add your custom response handler class to this module
import sys,json,csv,io
from pysnmp.entity.rfc3413 import mibvar
#the default handler , does nothing , just passes the raw output directly to STDOUT
class DefaultResponseHandler:
def __init__(self,**args):
pass
def __call__(self, respo... | {
"repo_name": "Jaykul/SplunkModularInputsPythonFramework",
"path": "implementations/snmp/bin/responsehandlers.py",
"copies": "3",
"size": "4127",
"license": "apache-2.0",
"hash": 1244122111152573000,
"line_mean": 39.4705882353,
"line_max": 144,
"alpha_frac": 0.5350133269,
"autogenerated": false,
... |
# Add your metrics here
import pdb
import math
import scipy.stats
from itertools import chain
from parse import parse_sbm_results, parse_chip_seq, parse_merlin
from plots import plot_p_vals, plot_p_vals_both
def score_gene_weights(test_vals, true_vals, genes, tfs_to_genes):
keys = set(test_vals.keys()) & set(true... | {
"repo_name": "kevintee/Predicting-Gene-Networks",
"path": "src/metrics.py",
"copies": "1",
"size": "3027",
"license": "mit",
"hash": 2830796900812586500,
"line_mean": 30.53125,
"line_max": 82,
"alpha_frac": 0.5996035679,
"autogenerated": false,
"ratio": 3.1109969167523124,
"config_test": true,... |
# Add your Python code here. E.g.
from microbit import *
from bitbot import *
from neopixel import *
def dark_left():
return not button_b.is_pressed()
def dark_right():
return not button_a.is_pressed()
np = NeoPixel(pin13,12)
for i in range(0,12):
np[i] = (30,10,0)
np.show()
while True:
... | {
"repo_name": "mathisgerdes/microbit-macau",
"path": "Baptist/Jason/car_driving_with_movement_changing_color.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": 794072955607178800,
"line_mean": 18.8076923077,
"line_max": 36,
"alpha_frac": 0.4742468416,
"autogenerated": false,
"ratio": 3... |
# Add your Python code here. E.g.
from microbit import *
from bitbot import *
from neopixel import *
np = NeoPixel(pin13,12)
for i in range(0,12):
np[i] = (40,0,40)
np.show()
def dark_left():
return not button_b.is_pressed()
def dark_right():
return not button_a.is_pressed()
while True:
if ... | {
"repo_name": "mathisgerdes/microbit-macau",
"path": "Baptist/Hannah/car_driving_with_movement.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": -3683501386880767000,
"line_mean": 17.375,
"line_max": 37,
"alpha_frac": 0.472303207,
"autogenerated": false,
"ratio": 3.0353982300884956,
... |
"""A decision forest toy example.
Trains and evaluates a decision forest classifier on a 2-D point cloud.
"""
import argparse
import datetime
import os
import re
import sys
import numpy as np
from PIL import Image, ImageDraw
import sklearn.ensemble as sk_ensemble
sys.path.insert(0, os.path.join(os.path.dirname(sys.... | {
"repo_name": "istb-mia/MIALab",
"path": "bin/toy_example.py",
"copies": "1",
"size": "9158",
"license": "apache-2.0",
"hash": 3607636775924592600,
"line_mean": 31.020979021,
"line_max": 119,
"alpha_frac": 0.5958724612,
"autogenerated": false,
"ratio": 3.9474137931034483,
"config_test": true,
... |
# A deck with 26 red and 26 black.
# Payoff: Red = +1, Black = -1
# Can stop any time.
# Find the best strategy
# Stop when payoff reach k and remaining cards only x left
import random
class Deck:
def __init__(self, plus, minus):
self.plus_cards = plus
self.minus_cards = minus
def draw(self... | {
"repo_name": "laichunpongben/machine_learning",
"path": "deck.py",
"copies": "1",
"size": "1280",
"license": "apache-2.0",
"hash": 513666909234187600,
"line_mean": 26.2340425532,
"line_max": 68,
"alpha_frac": 0.5796875,
"autogenerated": false,
"ratio": 3.506849315068493,
"config_test": false,
... |
"""A decoder for LZPT compressed image files"""
# Kernel source: arch/arm/include/asm/mach/warmboot.h
# Kernel source: arch/arm/mach-cxd90014/include/mach/cmpr.h
import io
from stat import *
from . import *
from .. import lz77
from ..io import *
from ..util import *
# struct wbi_lzp_hdr
LzptHeader = Struct('LzptHead... | {
"repo_name": "ma1co/fwtool.py",
"path": "fwtool/archive/lzpt.py",
"copies": "1",
"size": "1468",
"license": "mit",
"hash": 8148032675510572000,
"line_mean": 22.6774193548,
"line_max": 126,
"alpha_frac": 0.6927792916,
"autogenerated": false,
"ratio": 2.906930693069307,
"config_test": false,
"... |
''' A decorator-based method of constructing IPython magics with `argparse`
option handling.
New magic functions can be defined like so::
from IPython.core.magic_arguments import (argument, magic_arguments,
parse_argstring)
@magic_arguments()
@argument('-o', '--option', help='An optional argument... | {
"repo_name": "marcoantoniooliveira/labweb",
"path": "oscar/lib/python2.7/site-packages/IPython/core/magic_arguments.py",
"copies": "2",
"size": "7640",
"license": "bsd-3-clause",
"hash": -7192829777159592000,
"line_mean": 30.0569105691,
"line_max": 97,
"alpha_frac": 0.6189790576,
"autogenerated": ... |
# A decorator that lets you require HTTP basic authentication from visitors.
# Kevin Kelley <kelleyk@kelleyk.net> 2011
# Use however makes you happy, but if it breaks, you get to keep both pieces.
# Post with explanation, commentary, etc.:
# http://kelleyk.com/post/7362319243/easy-basic-http-authentication-with-tornad... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577893_Securely_processing_Twilio_requests/recipe-577893.py",
"copies": "1",
"size": "3838",
"license": "mit",
"hash": -3116494462635759000,
"line_mean": 46.3827160494,
"line_max": 110,
"alpha_frac": 0.6406982804,
"autogenerated": false,
"... |
""" A decorator that solves the problem of default parameter values that become global data structures.
:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Date: 2016-10-01
:Copyright: 2016-2018, Karr Lab
:License: MIT
"""
from functools import wraps
# a map from parameter name prefix or suffix to data type
prefix_... | {
"repo_name": "KarrLab/wc_utils",
"path": "wc_utils/util/decorate_default_data_struct.py",
"copies": "1",
"size": "5088",
"license": "mit",
"hash": 3963795341919177700,
"line_mean": 44.4285714286,
"line_max": 104,
"alpha_frac": 0.6778694969,
"autogenerated": false,
"ratio": 4.330212765957447,
"... |
"""A dedicated command line parser.
Remark: We do not use the parsers from the standard
library because they do not fit our needs
(especially passing arbitrary arguments to the
processed documents).
"""
class CmdLineArguments:
def __init__(self):
self.input_filename = None
self.output_directory = ... | {
"repo_name": "fredokun/tango",
"path": "src/tangolib/cmdparse.py",
"copies": "1",
"size": "4309",
"license": "mit",
"hash": 575910177794071040,
"line_mean": 27.9194630872,
"line_max": 99,
"alpha_frac": 0.5595265723,
"autogenerated": false,
"ratio": 3.8542039355992843,
"config_test": false,
"... |
"""A deep MNIST classifier using convolutional layers.
See extensive documentation at
https://www.tensorflow.org/get_started/mnist/pros
"""
# Disable linter warnings to maintain consistency with tutorial.
# pylint: disable=invalid-name
# pylint: disable=g-bad-import-order
from __future__ import absolute_import, divisi... | {
"repo_name": "jclee81/sktacc",
"path": "sktps/ml/cnn_mnist.py",
"copies": "1",
"size": "5585",
"license": "apache-2.0",
"hash": 2219649487831803100,
"line_mean": 32.4431137725,
"line_max": 80,
"alpha_frac": 0.630438675,
"autogenerated": false,
"ratio": 3.213463751438435,
"config_test": false,
... |
# A demo for the IDsObjectPicker interface.
import win32clipboard
import pythoncom
from win32com.adsi import adsi
from win32com.adsi.adsicon import *
cf_objectpicker = win32clipboard.RegisterClipboardFormat(CFSTR_DSOP_DS_SELECTION_LIST)
def main():
hwnd = 0
# Create an instance of the object picker.
p... | {
"repo_name": "fernandoacorreia/DjangoWAWSLogging",
"path": "DjangoWAWSLogging/env/Lib/site-packages/pywin32-218-py2.7-win32.egg/win32comext/adsi/demos/objectPicker.py",
"copies": "35",
"size": "1981",
"license": "mit",
"hash": 939214841134219300,
"line_mean": 33.1551724138,
"line_max": 86,
"alpha_fr... |
# a demonstration of buble sort and merge sort, p is a list of integers
# swap the values if p[i+1] < p[i]
def bubblesort(p):
for j in range(len(p)):
for i in range(len(p)-1):
if p[i] > p[i+1]:
temp = p[i]
p[i] = p[i+1]
p[i+1] = temp
return... | {
"repo_name": "crazyhottommy/some-unorganized-old-scripts",
"path": "python_scripts/bubble_and_merge_sort.py",
"copies": "1",
"size": "1817",
"license": "mit",
"hash": 2407485614822675500,
"line_mean": 26.9538461538,
"line_max": 123,
"alpha_frac": 0.456796918,
"autogenerated": false,
"ratio": 3.7... |
"""A demonstration of LKD that display all files opened by hooking nt!NtCreateFile"""
import sys
import time
import ctypes
import os
if os.getcwd().endswith("example"):
sys.path.append(os.path.realpath(".."))
else:
sys.path.append(os.path.realpath("."))
import windows
import windows.native_exec.simple_x86 as ... | {
"repo_name": "sogeti-esec-lab/LKD",
"path": "example/hook_ntcreatefile.py",
"copies": "1",
"size": "5443",
"license": "bsd-3-clause",
"hash": -7455503920256696000,
"line_mean": 35.2866666667,
"line_max": 131,
"alpha_frac": 0.6288811317,
"autogenerated": false,
"ratio": 3.2476133651551313,
"con... |
""" A demonstration of relationship """
import yarom as Y
import xlrd
Y.connect({'rdf.namespace':'http://example.com/cherries/'})
class SciName(Y.DataObject):
datatypeProperties = ['genus', 'species']
def identifier_augment(self):
return self.make_identifier_from_properties('genus','species')
d... | {
"repo_name": "mwatts15/YAROM",
"path": "examples/cherry/cherry.py",
"copies": "1",
"size": "1743",
"license": "bsd-3-clause",
"hash": -5317273855962437000,
"line_mean": 29.5789473684,
"line_max": 80,
"alpha_frac": 0.6546184739,
"autogenerated": false,
"ratio": 2.9897084048027445,
"config_test"... |
''' A demonstration of the neural network machine learning algorithm. '''
import random
import nlplib
# Neural network connection weights are initialized pseudorandomly, this call makes the results deterministic.
# This isn't necessary but, can be useful for testing.
random.seed(0)
if __name__ == '__main__' :
... | {
"repo_name": "rectangletangle/nlplib",
"path": "src/nlplib/demos/neuralnetworkusage.py",
"copies": "1",
"size": "1866",
"license": "bsd-2-clause",
"hash": 2036678680077529300,
"line_mean": 28.619047619,
"line_max": 119,
"alpha_frac": 0.6066452304,
"autogenerated": false,
"ratio": 3.6023166023166... |
"""A demonstration of the ``Session`` API."""
from __future__ import print_function
import oraide
EARNESTNESS = """\
ALGERNON: Well, that is exactly what dentists always do. Now, go on!
Tell me the whole thing. I may mention that I have always
suspected you of being a confirmed and secret Bunbur... | {
"repo_name": "ddbeck/oraide",
"path": "examples/session.py",
"copies": "1",
"size": "1145",
"license": "bsd-3-clause",
"hash": 4943809093727507000,
"line_mean": 26.2619047619,
"line_max": 72,
"alpha_frac": 0.6489082969,
"autogenerated": false,
"ratio": 3.347953216374269,
"config_test": false,
... |
# A demo of a fairly complex dialog.
#
# Features:
# * Uses a "dynamic dialog resource" to build the dialog.
# * Uses a ListView control.
# * Dynamically resizes content.
# * Uses a second worker thread to fill the list.
# * Demostrates support for windows XP themes.
# If you are on Windows XP, and specify a '--noxp' ... | {
"repo_name": "nvoron23/arangodb",
"path": "3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/win32/Demos/win32gui_dialog.py",
"copies": "17",
"size": "14934",
"license": "apache-2.0",
"hash": 292307085896390500,
"line_mean": 38.9304812834,
"line_max": 172,
"alpha_frac": 0.6026516673,
"aut... |
# A demo of a fairly complex dialog.
#
# Features:
# * Uses a "dynamic dialog resource" to build the dialog.
# * Uses a ListView control.
# * Dynamically resizes content.
# * Uses a second worker thread to fill the list.
# * Demostrates support for windows XP themes.
# If you are on Windows XP, and specify a ... | {
"repo_name": "zhanqxun/cv_fish",
"path": "win32/Demos/win32gui_dialog.py",
"copies": "4",
"size": "15197",
"license": "apache-2.0",
"hash": -3355804236979198000,
"line_mean": 38.7426273458,
"line_max": 172,
"alpha_frac": 0.5837336316,
"autogenerated": false,
"ratio": 3.37111801242236,
"config_... |
# A demo of an Application object that has some custom print functionality.
# If you desire, you can also run this from inside Pythonwin, in which
# case it will do the demo inside the Pythonwin environment.
# This sample was contributed by Roger Burnham.
from pywin.mfc import docview, dialog, afxres
from pywin.fram... | {
"repo_name": "espadrine/opera",
"path": "chromium/src/third_party/python_26/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py",
"copies": "17",
"size": "6401",
"license": "bsd-3-clause",
"hash": 464001732823876400,
"line_mean": 31.9948453608,
"line_max": 75,
"alpha_frac": 0.5366349008,
"a... |
# A Demo of a service that takes advantage of the additional notifications
# available in later Windows versions.
# Note that all output is written as event log entries - so you must install
# and start the service, then look at the event log for messages as events
# are generated.
# Events are generated for U... | {
"repo_name": "zhanqxun/cv_fish",
"path": "win32/Demos/service/serviceEvents.py",
"copies": "4",
"size": "4215",
"license": "apache-2.0",
"hash": 5142379637609959000,
"line_mean": 45.8977272727,
"line_max": 104,
"alpha_frac": 0.6491103203,
"autogenerated": false,
"ratio": 4.1486220472440944,
"c... |
# A demo of basic SSPI authentication.
# There is a 'client' context and a 'server' context - typically these will
# be on different machines (here they are in the same process, but the same
# concepts apply)
import sspi
import win32security, sspicon, win32api
def lookup_ret_code(err):
for k,v in list(sspicon.__di... | {
"repo_name": "zooba/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32/Demos/security/sspi/simple_auth.py",
"copies": "6",
"size": "2806",
"license": "apache-2.0",
"hash": 2881978227339506700,
"line_mean": 38.5211267606,
"line_max": 120,
"alpha_frac": 0.7647897363,
"au... |
# A demo of gradients through scipy.integrate.odeint,
# estimating the dynamics of a system given a trajectory.
from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as npo
import autograd.numpy as np
from autograd import grad
from autograd.scipy.in... | {
"repo_name": "hips/autograd",
"path": "examples/ode_net.py",
"copies": "3",
"size": "4001",
"license": "mit",
"hash": -1364545704255379000,
"line_mean": 31.5284552846,
"line_max": 81,
"alpha_frac": 0.583604099,
"autogenerated": false,
"ratio": 3.019622641509434,
"config_test": false,
"has_no... |
# A demo of the win32rcparser module and using win32gui
import win32gui
import win32api
import win32con
import win32rcparser
import commctrl
import sys, os
this_dir = os.path.abspath(os.path.dirname(__file__))
g_rcname = os.path.abspath(
os.path.join( this_dir, "..", "test", "win32rcparser", "test.rc"))
if n... | {
"repo_name": "DavidGuben/rcbplayspokemon",
"path": "app/pywin32-220/win32/Demos/win32rcparser_demo.py",
"copies": "9",
"size": "2749",
"license": "mit",
"hash": 5554341244143640000,
"line_mean": 34.7012987013,
"line_max": 98,
"alpha_frac": 0.6329574391,
"autogenerated": false,
"ratio": 3.1274175... |
# A demo of the win32rcparser module and using win32gui
import win32gui
import win32api
import win32con
import win32rcparser
import commctrl
import sys, os
# We use the .rc file in our 'test' directory.
try:
__file__
except NameError: # pre 2.3
__file__ = sys.argv[0]
this_dir = os.path.abspath(os.path.dirnam... | {
"repo_name": "pekeler/arangodb",
"path": "3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/win32/Demos/win32rcparser_demo.py",
"copies": "17",
"size": "2862",
"license": "apache-2.0",
"hash": 951010072097081200,
"line_mean": 33.4819277108,
"line_max": 96,
"alpha_frac": 0.6313766597,
"aut... |
# A demo of the win32rcparser module and using win32gui
import win32gui
import win32api
import win32con
import win32rcparser
import commctrl
import sys, os
this_dir = os.path.abspath(os.path.dirname(__file__))
g_rcname = os.path.abspath(
os.path.join( this_dir, "..", "test", "win32rcparser", "test.... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32/Demos/win32rcparser_demo.py",
"copies": "2",
"size": "2826",
"license": "bsd-3-clause",
"hash": 4633528497174179000,
"line_mean": 34.7012987013,
"line_max": 98,
"alpha_frac": 0.6157112527,
"autogenerated": false,
"ratio": 3.17... |
# A demo of using the RAS API from Python
import sys
import string
import win32ras
# The error raised if we can not
class ConnectionError(Exception):
pass
def Connect(rasEntryName, numRetries = 5):
"""Make a connection to the specified RAS entry.
Returns a tuple of (bool, handle) on success.
- bool is 1 if a n... | {
"repo_name": "lafayette/JBTT",
"path": "framework/python/Lib/site-packages/win32/scripts/rasutil.py",
"copies": "21",
"size": "2417",
"license": "mit",
"hash": 8349554509861688000,
"line_mean": 26.4659090909,
"line_max": 87,
"alpha_frac": 0.7103847745,
"autogenerated": false,
"ratio": 3.14713541... |
# A demo of using the RAS API from Python
import sys
import win32ras
# The error raised if we can not
class ConnectionError(Exception):
pass
def Connect(rasEntryName, numRetries = 5):
"""Make a connection to the specified RAS entry.
Returns a tuple of (bool, handle) on success.
- bool is 1 if a new connection ... | {
"repo_name": "Microsoft/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32/scripts/rasutil.py",
"copies": "7",
"size": "2388",
"license": "apache-2.0",
"hash": -5255958321600893000,
"line_mean": 26.4482758621,
"line_max": 87,
"alpha_frac": 0.7047738693,
"autogenerated"... |
# A demo of using the RAS API from Python
import sys
import string
import win32ras
# The error raised if we can not
class ConnectionError(Exception):
pass
def Connect(rasEntryName, numRetries = 5):
"""Make a connection to the specified RAS entry.
Returns a tuple of (bool, handle) on success.
- boo... | {
"repo_name": "chvrga/outdoor-explorer",
"path": "java/play-1.4.4/python/Lib/site-packages/win32/scripts/rasutil.py",
"copies": "4",
"size": "2505",
"license": "mit",
"hash": 5243727107563799000,
"line_mean": 26.4659090909,
"line_max": 87,
"alpha_frac": 0.6854291417,
"autogenerated": false,
"rati... |
# A demo of using the RAS API from Python
import sys
import win32ras
# The error raised if we can not
class ConnectionError(Exception):
pass
def Connect(rasEntryName, numRetries = 5):
"""Make a connection to the specified RAS entry.
Returns a tuple of (bool, handle) on success.
- bool is 1 if a new... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32/scripts/rasutil.py",
"copies": "4",
"size": "2466",
"license": "bsd-3-clause",
"hash": 1064099792854080600,
"line_mean": 26.3448275862,
"line_max": 87,
"alpha_frac": 0.6816707218,
"autogenerated": false,
"ratio": 3.22774869109... |
"""A demo of using win32net.NetValidatePasswordPolicy.
Example usage:
% NetValidatePasswordPolicy.py --password=foo change
which might return:
> Result of 'change' validation is 0: The operation completed successfully.
or depending on the policy:
> Result of 'change' validation is 2245: The password does not meet ... | {
"repo_name": "aurelijusb/arangodb",
"path": "3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/win32/Demos/NetValidatePasswordPolicy.py",
"copies": "17",
"size": "3629",
"license": "apache-2.0",
"hash": 6831963372227602000,
"line_mean": 34.9306930693,
"line_max": 92,
"alpha_frac": 0.5905208... |
"""A demo of using win32net.NetValidatePasswordPolicy.
Example usage:
% NetValidatePasswordPolicy.py --password=foo change
which might return:
> Result of 'change' validation is 0: The operation completed successfully.
or depending on the policy:
> Result of 'change' validation is 2245: The password doe... | {
"repo_name": "zhanqxun/cv_fish",
"path": "win32/Demos/NetValidatePasswordPolicy.py",
"copies": "4",
"size": "3708",
"license": "apache-2.0",
"hash": -6767162657413190000,
"line_mean": 34.7128712871,
"line_max": 92,
"alpha_frac": 0.5725458468,
"autogenerated": false,
"ratio": 4.623441396508728,
... |
# A demo plugin for Microsoft Excel
#
# This addin simply adds a new button to the main Excel toolbar,
# and displays a message box when clicked. Thus, it demonstrates
# how to plug in to Excel itself, and hook Excel events.
#
#
# To register the addin, simply execute:
# excelAddin.py
# This will install the COM ser... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/win32com/demos/excelAddin.py",
"copies": "10",
"size": "5943",
"license": "mit",
"hash": -9039546329836360000,
"line_mean": 41.7553956835,
"line_max": 154,
"alpha_frac": 0.7048628639,
"autogenerated": false,
"ratio": ... |
# A demo plugin for Microsoft Outlook (NOT Outlook Express)
#
# This addin simply adds a new button to the main Outlook toolbar,
# and displays a message box when clicked. Thus, it demonstrates
# how to plug in to Outlook itself, and hook outlook events.
#
# Additionally, each time a new message arrives in the Inbox, ... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/win32com/demos/outlookAddin.py",
"copies": "5",
"size": "4628",
"license": "mit",
"hash": -7694411452974078000,
"line_mean": 39.5964912281,
"line_max": 121,
"alpha_frac": 0.7100259291,
"autogenerated": false,
"ratio":... |
# A demo run on one image
import torch
import os
from skimage import io, transform
import numpy as np
import time
import datetime
from model.model import WSL, load_pretrained
import data_utils.load_voc as load_voc
import argparse
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from ... | {
"repo_name": "zhangyuygss/WSL",
"path": "demo.py",
"copies": "1",
"size": "1719",
"license": "bsd-3-clause",
"hash": -8451970019987063000,
"line_mean": 30.2545454545,
"line_max": 79,
"alpha_frac": 0.7143688191,
"autogenerated": false,
"ratio": 2.7996742671009773,
"config_test": false,
"has_n... |
# A demo which creates a view and a frame which displays a PPM format bitmap
#
# This hasnnt been run in a while, as I dont have many of that format around!
import win32ui
import win32con
import win32api
import string
class DIBView:
def __init__(self, doc, dib):
self.dib = dib
self.view = win32ui.CreateView(doc)... | {
"repo_name": "abaditsegay/arangodb",
"path": "3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py",
"copies": "17",
"size": "1930",
"license": "apache-2.0",
"hash": 4464716752998944300,
"line_mean": 26.9855072464,
"line_max": 77,
"alpha_frac": 0.6953367876,
... |
"""A demo which runs object detection on camera frames.
"""
import argparse
import collections
import colorsys
import itertools
import time
from coral.cloudiot.core import CloudIot
from edgetpu.detection.engine import DetectionEngine
from edgetpuvision import svg
from edgetpuvision import utils
from edgetpuvision.apps... | {
"repo_name": "google-coral/project-cloud-monitor",
"path": "edge/detect_cloudiot.py",
"copies": "1",
"size": "8226",
"license": "apache-2.0",
"hash": -535258722781447230,
"line_mean": 38.3588516746,
"line_max": 99,
"alpha_frac": 0.5408460977,
"autogenerated": false,
"ratio": 3.567215958369471,
... |
""" A Design Of Experiment (DOE) changes one or several component parameters to create a model
"""
import itertools as it
from io import StringIO
from pathlib import Path
from typing import Any, Dict, List, Union
from omegaconf import OmegaConf
from pp.config import CONFIG
sample = """
does:
cutback_taper_te_40... | {
"repo_name": "gdsfactory/gdsfactory",
"path": "pp/doe.py",
"copies": "1",
"size": "3974",
"license": "mit",
"hash": -2968411002781651000,
"line_mean": 27.3857142857,
"line_max": 94,
"alpha_frac": 0.590840463,
"autogenerated": false,
"ratio": 3.655933762649494,
"config_test": false,
"has_no_k... |
""" A Design Of Experiment (DOE) changes one or several component parameters to create a model
"""
import itertools as it
from omegaconf import OmegaConf
from pp.config import CONFIG
sample = """
does:
cutback_taper_te_400:
component: cutback_taper_te
settings:
wg_width: [0.4]
length:... | {
"repo_name": "psiq/gdsfactory",
"path": "pp/doe.py",
"copies": "1",
"size": "3697",
"license": "mit",
"hash": 553985606263701700,
"line_mean": 26.7969924812,
"line_max": 142,
"alpha_frac": 0.5912902353,
"autogenerated": false,
"ratio": 3.6495557749259624,
"config_test": false,
"has_no_keywor... |
"""A device that can be attached to"""
from Device import *
class Attachable(Device):
def __init__(self):
"""
Create a device that can be attached to.
"""
Device.__init__(self)
self.menu.addAction("Restart", self.restart)
self.menu.addAction("Stop", sel... | {
"repo_name": "michaelkourlas/gini",
"path": "frontend/src/gbuilder/Core/Attachable.py",
"copies": "1",
"size": "1911",
"license": "mit",
"hash": 783184875960331600,
"line_mean": 31.5614035088,
"line_max": 94,
"alpha_frac": 0.4563055992,
"autogenerated": false,
"ratio": 4.507075471698113,
"conf... |
"""A device that can have interfaces"""
from Device import *
from Attachable import *
class Interfaceable(Attachable):
def __init__(self):
"""
Create a device that can have interfaces.
"""
Attachable.__init__(self)
self.adjacentRouterList = []
self.adj... | {
"repo_name": "michaelkourlas/gini",
"path": "frontend/src/gbuilder/Core/Interfaceable.py",
"copies": "1",
"size": "10393",
"license": "mit",
"hash": 4355973467313571300,
"line_mean": 35.3848920863,
"line_max": 111,
"alpha_frac": 0.5122678726,
"autogenerated": false,
"ratio": 4.904672015101463,
... |
"""A device that can have interfaces"""
from Device import *
class Interfaceable(Device):
def __init__(self):
"""
Create a device that can have interfaces.
"""
Device.__init__(self)
self.menu.addAction("Restart", self.restart)
self.menu.addAction("Stop"... | {
"repo_name": "anrl/gini",
"path": "frontend/src/gbuilder/Core/Interfaceable.py",
"copies": "3",
"size": "12118",
"license": "mit",
"hash": -6877220150569378000,
"line_mean": 35.1717791411,
"line_max": 111,
"alpha_frac": 0.501898003,
"autogenerated": false,
"ratio": 4.849139655862345,
"config_t... |
"""A D* experiment with 28x28 grid.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from __future__ import print_function
import os
import cPickle as pickle
import numpy as np
import rlvision
from rlvision import utils
from rlvision.grid import GridSampler
from rlvision.utils import process_map_data
from rlvisio... | {
"repo_name": "ToniRV/Learning-to-navigate-without-a-map",
"path": "rlvision/exps/dstar_28_exp.py",
"copies": "1",
"size": "3008",
"license": "mit",
"hash": -2841952516788036600,
"line_mean": 30.6631578947,
"line_max": 76,
"alpha_frac": 0.5950797872,
"autogenerated": false,
"ratio": 3.20340788072... |
"""A D* experiment with 8x8 grid.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from __future__ import print_function
import os
import cPickle as pickle
import numpy as np
import rlvision
from rlvision import utils
from rlvision.grid import GridSampler
from rlvision.utils import process_map_data
from rlvision.... | {
"repo_name": "ToniRV/Learning-to-navigate-without-a-map",
"path": "rlvision/exps/dstar_8_exp.py",
"copies": "1",
"size": "3006",
"license": "mit",
"hash": -6544320378367725000,
"line_mean": 30.6421052632,
"line_max": 74,
"alpha_frac": 0.5938123752,
"autogenerated": false,
"ratio": 3.191082802547... |
# A dfs-based algorithm that finds the largest connected components of a graph, and prints out the largest 5 of them
import time
start = time.time()
time.clock()
graph = '2.txt'
# graph = 'scc.txt'
# assuming that the edge list is sorted, this gets its number of nodes
num_lines = sum(1 for line in open(graph))
with... | {
"repo_name": "guzey/coursera-algorithms",
"path": "week2-1-kosaraju/kosaraju_ugly.py",
"copies": "1",
"size": "4630",
"license": "mit",
"hash": -4776396129258308000,
"line_mean": 34.6230769231,
"line_max": 116,
"alpha_frac": 0.6084233261,
"autogenerated": false,
"ratio": 3.290689410092395,
"co... |
# Ad-hoc algorithm for copy-move forgery detection in images.
# Implemented by - vasiliauskas.agnius@gmail.com
# Robust match algorithm steps:
# 1. Blur image for eliminating image details
# 2. Convert image to degraded palette
# 3. Decompose image into small NxN pixel blocks
# 4. Alphabetically order these blocks ... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/576689_Copymove_forgery/recipe-576689.py",
"copies": "1",
"size": "7950",
"license": "mit",
"hash": -7362409823070134000,
"line_mean": 32.829787234,
"line_max": 196,
"alpha_frac": 0.6779874214,
"autogenerated": false,
"ratio": 3.0136467020... |
"""adhoc filters
Revision ID: bddc498dd179
Revises: afb7730f6a9c
Create Date: 2018-06-13 14:54:47.086507
"""
# revision identifiers, used by Alembic.
revision = 'bddc498dd179'
down_revision = '80a67c5192fa'
from collections import defaultdict
import json
import uuid
from alembic import op
from sqlalchemy.ext.decl... | {
"repo_name": "timifasubaa/incubator-superset",
"path": "superset/migrations/versions/bddc498dd179_adhoc_filters.py",
"copies": "2",
"size": "2689",
"license": "apache-2.0",
"hash": 8186284493724957000,
"line_mean": 26.7216494845,
"line_max": 72,
"alpha_frac": 0.5184083302,
"autogenerated": false,
... |
"""Ad-hoc implementation of quaternion operators using numpy.
Copyright (c) 2014, Garth Zeglin. All rights reserved. Licensed under the terms
of the BSD 3-clause license as included in LICENSE.
All quaternions are represented as a 4 element numpy ndarray, following a (w,x,y,z) convention.
All operators are pure Pyt... | {
"repo_name": "CMU-dFabLab/dfab",
"path": "python/dfab/geometry/quaternion.py",
"copies": "1",
"size": "3137",
"license": "bsd-3-clause",
"hash": 4134244651876270600,
"line_mean": 30.0594059406,
"line_max": 95,
"alpha_frac": 0.5164169589,
"autogenerated": false,
"ratio": 3.025072324011572,
"con... |
# Ad hoc script to fix problem of legacy illumina files
# read 1 and read 2 are in the same file,
# read 1 first, but in random order and with orphans
# the script pairs up the reads into two separate outputfiles
# restoring the order
# orphans go into a separate file
# run as python split_in_pairs.py file.fastq
impo... | {
"repo_name": "lexnederbragt/sequencetools",
"path": "split_in_pairs.py",
"copies": "1",
"size": "2939",
"license": "unlicense",
"hash": 7844279014013377000,
"line_mean": 30.2659574468,
"line_max": 78,
"alpha_frac": 0.6230010208,
"autogenerated": false,
"ratio": 2.924378109452736,
"config_test"... |
""" adiabatic tapers from CSV files
"""
import pathlib
from pathlib import Path
from typing import Tuple
import pp
from pp.component import Component
from pp.load_csv import load_csv
data_path = pathlib.Path(__file__).parent / "csv_data"
def taper_from_csv(
csv_path: Path,
wg_layer: int = 1,
clad_offset... | {
"repo_name": "gdsfactory/gdsfactory",
"path": "pp/components/taper_from_csv.py",
"copies": "1",
"size": "2218",
"license": "mit",
"hash": -4403924633935120400,
"line_mean": 23.6444444444,
"line_max": 84,
"alpha_frac": 0.6091073039,
"autogenerated": false,
"ratio": 2.6217494089834514,
"config_t... |
""" adiabatic tapers from CSV files
"""
import pathlib
import pp
data_path = pathlib.Path(__file__).parent / "csv_data"
def taper_from_csv(csv_path, wg_layer=1, clad_offset=3, clad_layer=pp.LAYER.WGCLAD):
taper_data = pp.load_csv(csv_path)
# taper_data = pd.read_csv(csv_path)
# print(taper_data)
xs ... | {
"repo_name": "psiq/gdsfactory",
"path": "pp/components/taper_from_csv.py",
"copies": "1",
"size": "1943",
"license": "mit",
"hash": -3334166929318280000,
"line_mean": 22.987654321,
"line_max": 84,
"alpha_frac": 0.5949562532,
"autogenerated": false,
"ratio": 2.52665799739922,
"config_test": fal... |
"""A dialog window to change the filter options.
"""
import datetime
from PySide import QtCore, QtGui
import photo.idxfilter
from photo.geo import GeoPosition
class GeoPosEdit(QtGui.QLineEdit):
"""A QLineEdit with a suitable size for a GeoPosition.
"""
def sizeHint(self):
sh = super().sizeHint()
... | {
"repo_name": "RKrahl/photo-tools",
"path": "photo/qt/filterDialog.py",
"copies": "1",
"size": "7344",
"license": "apache-2.0",
"hash": -504135239210858700,
"line_mean": 33.4788732394,
"line_max": 79,
"alpha_frac": 0.6252723312,
"autogenerated": false,
"ratio": 3.9891363389462247,
"config_test"... |
"""A Dialog Window to display the result of a :class:`jukeboxcore.action.ActionCollection`."""
import abc
from PySide import QtGui, QtCore
from jukeboxcore.gui.main import JB_Dialog, JB_MainWindow
from jukeboxcore.gui.actionreport import create_action_model
from jukeboxcore.gui.widgetdelegate import WidgetDelegate, W... | {
"repo_name": "JukeboxPipeline/jukebox-core",
"path": "src/jukeboxcore/gui/widgets/actionreportdialog.py",
"copies": "1",
"size": "11181",
"license": "bsd-3-clause",
"hash": 3114866749236286500,
"line_mean": 32.0798816568,
"line_max": 108,
"alpha_frac": 0.6398354351,
"autogenerated": false,
"rati... |
"""A dialog window to set and remove tags.
"""
import math
from PySide import QtCore, QtGui
class TagSelectDialog(QtGui.QDialog):
def __init__(self, taglist):
super().__init__()
self.checkLayout = QtGui.QGridLayout()
self.settags(taglist)
self.entry = QtGui.QLineEdit()
... | {
"repo_name": "RKrahl/photo-tools",
"path": "photo/qt/tagSelectDialog.py",
"copies": "1",
"size": "2755",
"license": "apache-2.0",
"hash": 3099390495574285000,
"line_mean": 34.3205128205,
"line_max": 75,
"alpha_frac": 0.5916515426,
"autogenerated": false,
"ratio": 3.8912429378531073,
"config_te... |
"""A dialog window to show some informations on the current image.
"""
from PySide import QtCore, QtGui
from photo.exif import Exif
class ImageInfoDialog(QtGui.QDialog):
def __init__(self, basedir):
super().__init__()
self.basedir = basedir
infoLayout = QtGui.QGridLayout()
camer... | {
"repo_name": "RKrahl/photo-tools",
"path": "photo/qt/imageInfoDialog.py",
"copies": "1",
"size": "3954",
"license": "apache-2.0",
"hash": -5526188542468301000,
"line_mean": 41.9782608696,
"line_max": 74,
"alpha_frac": 0.6641375822,
"autogenerated": false,
"ratio": 3.857560975609756,
"config_te... |
# A Dialog with a ScrolledText widget.
import Pmw
class TextDialog(Pmw.Dialog):
def __init__(self, parent = None, **kw):
# Define the megawidget options.
INITOPT = Pmw.INITOPT
optiondefs = (
('borderx', 10, INITOPT),
('bordery', 10, INITOPT),
)
self.defineoptions(kw, optiondefs)
# I... | {
"repo_name": "leuschel/logen",
"path": "old_logen/pylogen/Pmw/Pmw_1_2/lib/PmwTextDialog.py",
"copies": "6",
"size": "1069",
"license": "apache-2.0",
"hash": 394956710383247800,
"line_mean": 27.1315789474,
"line_max": 62,
"alpha_frac": 0.6772684752,
"autogenerated": false,
"ratio": 3.191044776119... |
# A dice rolling bot for use on Discord servers
# LICENSE: This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
# @category Tools
# @copyright Copyright (c) 2016 Robert Thayer (http://www.gamergadgets.net)
# @version 1.1
# @link http://www.gamergadge... | {
"repo_name": "Chaithi/Discord-Dice-Roller-Bot",
"path": "diceBot.py",
"copies": "1",
"size": "7993",
"license": "mit",
"hash": 6726080524876891000,
"line_mean": 40.2010309278,
"line_max": 463,
"alpha_frac": 0.5715000626,
"autogenerated": false,
"ratio": 3.6885094600830644,
"config_test": false... |
# A dictionary allowing the conversion of each unit to its base unit.
# An entry consists of the unit's name, a constant number and a constant
# factor that need to be added and multiplied to convert the unit into
# the base unit in the last parameter.
UNITS = {'bit': [0, 1, 'bit'],
'byte': [0, 8, 'bit'],
... | {
"repo_name": "susansls/zulip",
"path": "contrib_bots/bots/converter/utils.py",
"copies": "18",
"size": "6179",
"license": "apache-2.0",
"hash": -4990694794507015000,
"line_mean": 41.3219178082,
"line_max": 120,
"alpha_frac": 0.4573555592,
"autogenerated": false,
"ratio": 2.924278277330809,
"co... |
"""A dictionary-equipped extractive QA model."""
import logging
logger = logging.getLogger(__name__)
import theano
from theano import tensor
from theano.gradient import disconnected_grad
from theano.sandbox.rng_mrg import MRG_RandomStreams
from collections import OrderedDict
import blocks.config
from blocks.bricks i... | {
"repo_name": "tombosc/dict_based_learning",
"path": "dictlearn/extractive_qa_model.py",
"copies": "1",
"size": "12133",
"license": "mit",
"hash": -8711173015976748000,
"line_mean": 42.024822695,
"line_max": 97,
"alpha_frac": 0.6197972472,
"autogenerated": false,
"ratio": 3.850523643287845,
"co... |
"""A dictionary-equipped language model."""
import theano
from theano import tensor
from blocks.bricks import (Initializable, Linear, NDimensionalSoftmax, MLP,
Tanh, Rectifier)
from blocks.bricks.base import application
from blocks.bricks.recurrent import LSTM
from blocks.bricks.lookup impor... | {
"repo_name": "tombosc/dict_based_learning",
"path": "dictlearn/language_model.py",
"copies": "1",
"size": "11639",
"license": "mit",
"hash": -6561552889433868000,
"line_mean": 41.9483394834,
"line_max": 110,
"alpha_frac": 0.5759085832,
"autogenerated": false,
"ratio": 3.9955372468245796,
"conf... |
# a dictionary of critics and their ratings of a small
# set of movies
# copied from Segaran: Collective Intelligence (2006) Ch.2
critics={
'Lisa Rose': {
'Lady in the Water': 2.5,
'Snakes on a Plane': 3.5,
'Just My Luck': 3.0,
'Superman Returns': 3.5,
'You, Me and Dupree': 2... | {
"repo_name": "pgchamberlin/sommelier",
"path": "recommendations.py",
"copies": "1",
"size": "8877",
"license": "mit",
"hash": 6912271908352344000,
"line_mean": 29.6103448276,
"line_max": 164,
"alpha_frac": 0.6092148248,
"autogenerated": false,
"ratio": 3.3612268080272623,
"config_test": false,... |
# A dictionary of filter classes, keyed by their name attributes.
FILTER_REGISTRY = {}
class FilterRegistry(type):
"""
Metaclass used to automatically register new filter classes in our filter
registry. Enables shorthand filter notation.
>>> from es_fluent.builder import QueryBuilder
>>> ... | {
"repo_name": "planetlabs/es_fluent",
"path": "es_fluent/filters/__init__.py",
"copies": "1",
"size": "2824",
"license": "apache-2.0",
"hash": 5872935133497850000,
"line_mean": 25.641509434,
"line_max": 79,
"alpha_frac": 0.6140226629,
"autogenerated": false,
"ratio": 4.086830680173661,
"config_... |
# A dictionary of movie critics and their ratings of a small
from math import sqrt
# function for calculating (Euclidean Distance Score) distance-based similarity score for person1 and person2
def similarity_distance(input_recs, person1, person2):
# Gather list of shared_items
shared_items = {}
for item_ke... | {
"repo_name": "jpbinary/Programming-Collective-Intelligence",
"path": "recommendations.py",
"copies": "1",
"size": "3700",
"license": "mit",
"hash": 5979811604911848000,
"line_mean": 44.1341463415,
"line_max": 109,
"alpha_frac": 0.6410810811,
"autogenerated": false,
"ratio": 2.9411764705882355,
... |
# A dictionary of movie critics and their ratings of a small
# set of movies
critics = {'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5, 'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5, 'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Plane': 3... | {
"repo_name": "jefflyn/buddha",
"path": "src/recommendations/recommend.py",
"copies": "1",
"size": "3938",
"license": "artistic-2.0",
"hash": -935624347580134400,
"line_mean": 34.4774774775,
"line_max": 177,
"alpha_frac": 0.6584560691,
"autogenerated": false,
"ratio": 2.963130173062453,
"config... |
# A dictionary of movie critics and their ratings of a small
# set of movies
critics={'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Plane': ... | {
"repo_name": "stefanseibert/DataMining",
"path": "experiment02/movies/recommendations.py",
"copies": "2",
"size": "8805",
"license": "mit",
"hash": 1139695102216838400,
"line_mean": 34.9428571429,
"line_max": 128,
"alpha_frac": 0.6501987507,
"autogenerated": false,
"ratio": 3.53472501003613,
"... |
# A dictionary of movie critics and their ratings of a small
# set of movies
critics={
'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Plane': 3... | {
"repo_name": "escray/PCI",
"path": "recommendations.py",
"copies": "1",
"size": "2895",
"license": "mit",
"hash": 8325683860180090000,
"line_mean": 31.8977272727,
"line_max": 81,
"alpha_frac": 0.6531951641,
"autogenerated": false,
"ratio": 2.7234242709313263,
"config_test": false,
"has_no_ke... |
# A dictionary of movie critics and their ratings of a small
# set of movies
from math import sqrt
critics = {'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,
'The Night Listener'... | {
"repo_name": "przemek1990/machine-learning",
"path": "src/machine_learning/collaborative_filtering/recommendations.py",
"copies": "1",
"size": "3791",
"license": "apache-2.0",
"hash": -7556080987227400000,
"line_mean": 39.7741935484,
"line_max": 108,
"alpha_frac": 0.541018201,
"autogenerated": fal... |
# A dictionary of movie critics and their ratings of a small
# set of movies
critics={'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Pla... | {
"repo_name": "YeEmrick/learning",
"path": "PCI/PCI_Code/chapter2/recommendations.py",
"copies": "5",
"size": "5856",
"license": "apache-2.0",
"hash": -4412271357255637500,
"line_mean": 30.5333333333,
"line_max": 82,
"alpha_frac": 0.6461748634,
"autogenerated": false,
"ratio": 3.1450053705692804,... |
#A dictionary of movie critics and their ratings of a small set of movies.
critics = {
'Lisa Rose': {
'Lady in the water': 2.5,
'Snakes on a plane': 3.5,
'Just my luck': 3.0,
'Superman returns': 3.5,
'You, me and dupree': 2.5,
'The night listener': 3.0
},
'Gene Seymour': {
'Lady in the water': 3.0,
'Snakes on a plane'... | {
"repo_name": "andrea-f/Python-Collective-Intelligence-Examples",
"path": "ch2/recommendations.py",
"copies": "1",
"size": "12124",
"license": "bsd-3-clause",
"hash": 5957068341949410000,
"line_mean": 31.5067024129,
"line_max": 136,
"alpha_frac": 0.6567964368,
"autogenerated": false,
"ratio": 3.5... |
"""A dictionary that flattens a nested key-value-mapping-and-list
structure into a store that does not support nesting.
"""
import collections
import logging
from . import python_copy
from .flatpath import FlatPath
from . import flatpath
from .data import JSON_VALUE_TYPES
from . import treeutils
LOGGER = logging.get... | {
"repo_name": "talwrii/jsdb",
"path": "jsdb/flatdict.py",
"copies": "1",
"size": "13294",
"license": "bsd-2-clause",
"hash": -3928607149466715000,
"line_mean": 33.7101827676,
"line_max": 104,
"alpha_frac": 0.5657439446,
"autogenerated": false,
"ratio": 3.971915147893636,
"config_test": false,
... |
"""A dict like object.
Implementation from http://benlast.livejournal.com/12301.html with unnecessary
zope security flag removed.
"""
class Structobject:
"""A 'bag' with keyword initialization, dict-semantics emulation and key
iteration.
"""
def __init__(self, **kw):
"""Initialize, and set a... | {
"repo_name": "tyrylu/pyfmodex",
"path": "pyfmodex/structobject.py",
"copies": "1",
"size": "1806",
"license": "mit",
"hash": -2678806814291471000,
"line_mean": 25.5588235294,
"line_max": 78,
"alpha_frac": 0.5542635659,
"autogenerated": false,
"ratio": 4.330935251798561,
"config_test": false,
... |
# A dict of Rosetta score types generated from ScoreType.hh
# The tuples are of the form (English description, comments from ScoreType.hh - not necessarily meaningful, and the corresponding weights file)
score_types = {
"fa_atr" : ("Lennard-Jones attractive between atoms in... | {
"repo_name": "Kortemme-Lab/klab",
"path": "klab/scoretype.py",
"copies": "1",
"size": "25969",
"license": "mit",
"hash": -3352821850553479700,
"line_mean": 75.1583577713,
"line_max": 200,
"alpha_frac": 0.3828795872,
"autogenerated": false,
"ratio": 3.7789580908032594,
"config_test": false,
"... |
"""A dict subclass that can lookup several layers deep.
>>> my_dict = recursive_dict(**{
... 'alpha': {
... 'first': 1,
... 'second': 2,
... },
... 'many': [
... {'foo': {'test': True}},
... {'foo': {'test': False}},
... ]
... })
>>> my_dict['alpha', 'second']
2
>>> [ite... | {
"repo_name": "ryananguiano/recursive_dict",
"path": "recursive_dict.py",
"copies": "1",
"size": "2871",
"license": "isc",
"hash": 5954959218519440000,
"line_mean": 27.71,
"line_max": 85,
"alpha_frac": 0.5468477882,
"autogenerated": false,
"ratio": 3.9491059147180194,
"config_test": false,
"h... |
"""A dict to translate from IANA location name to Windows timezone name. Translations taken from
http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
"""
import re
import requests
from .util import to_xml
CLDR_WINZONE_URL = 'https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplem... | {
"repo_name": "ecederstrand/exchangelib",
"path": "exchangelib/winzone.py",
"copies": "1",
"size": "29139",
"license": "bsd-2-clause",
"hash": -8291358970427594000,
"line_mean": 54.397338403,
"line_max": 115,
"alpha_frac": 0.6255533821,
"autogenerated": false,
"ratio": 3.0400625978090767,
"conf... |
# Adidas Account Creator v2
# Dev: Simmy (bopped) Twitter: @Backdoorcook
import requests, time, os, json, sys
from classes.AdidasGen import AccountGEN
from colorama import *
init()
s = requests.Session()
def log(msg):
currenttime = time.strftime("%H:%M:%S")
sys.stdout.write("[%s] %s\n" % (currenttime, str(ms... | {
"repo_name": "bopped/Adidas-Account-Creator",
"path": "A.A.C.py",
"copies": "1",
"size": "2292",
"license": "mit",
"hash": 5614609385439579000,
"line_mean": 28.3846153846,
"line_max": 140,
"alpha_frac": 0.612565445,
"autogenerated": false,
"ratio": 3.105691056910569,
"config_test": true,
"ha... |
# A DID.
import binascii
from ..utils import encode_data
from ..utils import decode_data
from ..utils import create_encode_decode_formats
class Did(object):
"""A DID with identifier and other information.
"""
def __init__(self,
identifier,
name,
lengt... | {
"repo_name": "eerimoq/cantools",
"path": "cantools/database/diagnostics/did.py",
"copies": "1",
"size": "3191",
"license": "mit",
"hash": 6972725602514066000,
"line_mean": 22.4632352941,
"line_max": 67,
"alpha_frac": 0.4957693513,
"autogenerated": false,
"ratio": 4.341496598639456,
"config_tes... |
"""A DirectCheckButton is a type of button that toggles between two states
when clicked. It also has a separate indicator that can be modified
separately."""
__all__ = ['DirectCheckButton']
from panda3d.core import *
from .DirectButton import *
from .DirectLabel import *
class DirectCheckButton(DirectButton):
"... | {
"repo_name": "chandler14362/panda3d",
"path": "direct/src/gui/DirectCheckButton.py",
"copies": "9",
"size": "8631",
"license": "bsd-3-clause",
"hash": 5151856511611014000,
"line_mean": 45.4032258065,
"line_max": 95,
"alpha_frac": 0.5218398795,
"autogenerated": false,
"ratio": 4.332831325301205,
... |
# a direct copy of Lib/test/mapping_tests.py from Python 2.7
# tests common to dict and UserDict
import unittest
import UserDict
import _test_support as test_support
class BasicTestMappingProtocol(unittest.TestCase):
# This base class can be used to check that an object conforms to the
# mapping protocol
... | {
"repo_name": "shoyer/cyordereddict",
"path": "python2/cyordereddict/test/_mapping_tests.py",
"copies": "1",
"size": "10849",
"license": "mit",
"hash": -3349153126957979000,
"line_mean": 33.9967741935,
"line_max": 88,
"alpha_frac": 0.5581159554,
"autogenerated": false,
"ratio": 3.96672760511883,
... |
'''A directed graph class.'''
class Digraph:
'''A directed graph class.'''
# Fundamental methods
def __init__(self, vertices=None, edges=None):
'''Initialize the graph with a container of vertices and/or a container
of edges, where edges are tuples containing a start node and end node.
... | {
"repo_name": "bdusell/pycfg",
"path": "src/util/digraph.py",
"copies": "1",
"size": "5530",
"license": "mit",
"hash": -9150266484362252000,
"line_mean": 34,
"line_max": 85,
"alpha_frac": 0.587522604,
"autogenerated": false,
"ratio": 4.26040061633282,
"config_test": false,
"has_no_keywords": ... |
"""a directed graph example."""
from sqlalchemy import Column, Integer, ForeignKey, \
create_engine
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Node(Base):
__tablename__ = 'node'
node_id = Column(Integer, ... | {
"repo_name": "bdupharm/sqlalchemy",
"path": "examples/graphs/directed_graph.py",
"copies": "4",
"size": "1793",
"license": "mit",
"hash": -7305804733257350000,
"line_mean": 20.6024096386,
"line_max": 57,
"alpha_frac": 0.6006692694,
"autogenerated": false,
"ratio": 3.064957264957265,
"config_te... |
"""a directed graph example."""
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker
Base = declarativ... | {
"repo_name": "sqlalchemy/sqlalchemy",
"path": "examples/graphs/directed_graph.py",
"copies": "7",
"size": "1808",
"license": "mit",
"hash": -6846146348185082000,
"line_mean": 21.8860759494,
"line_max": 77,
"alpha_frac": 0.6415929204,
"autogenerated": false,
"ratio": 3.0592216582064298,
"config... |
"""a directed graph example."""
from sqlalchemy import MetaData, Table, Column, Integer, ForeignKey, \
create_engine
from sqlalchemy.orm import mapper, relationship, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Node(Base):
__tablename__ = 'node'
no... | {
"repo_name": "EvaSDK/sqlalchemy",
"path": "examples/graphs/directed_graph.py",
"copies": "30",
"size": "2297",
"license": "mit",
"hash": 1464621714463279600,
"line_mean": 25.4022988506,
"line_max": 70,
"alpha_frac": 0.5690030475,
"autogenerated": false,
"ratio": 3.3145743145743145,
"config_tes... |
"""a directed graph example."""
from sqlalchemy import MetaData, Table, Column, Integer, ForeignKey
from sqlalchemy.orm import mapper, relationship, create_session
import logging
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
meta = MetaData('sqlite://')
nodes = Table('nodes', m... | {
"repo_name": "simplegeo/sqlalchemy",
"path": "examples/graphs/directed_graph.py",
"copies": "1",
"size": "2192",
"license": "mit",
"hash": -6971476018967888000,
"line_mean": 24.488372093,
"line_max": 78,
"alpha_frac": 0.6423357664,
"autogenerated": false,
"ratio": 2.990450204638472,
"config_te... |
"""A directed graph."""
import collections
import copy
import numpy as np
import pygraphviz as pgz
class Graph(object):
"""A labeled, unweighted directed graph."""
def __init__(self):
self.nodes = []
self.edges = [] # triples (i, j, label)
self.label2index = collections.defaultdict(set)
self.out_e... | {
"repo_name": "robinjia/nectar",
"path": "nectar/base/graph.py",
"copies": "1",
"size": "8851",
"license": "mit",
"hash": -519163522042470850,
"line_mean": 33.9841897233,
"line_max": 87,
"alpha_frac": 0.6247881595,
"autogenerated": false,
"ratio": 3.285449146250928,
"config_test": false,
"has... |
"""A DirectFrame is a basic DirectGUI component that acts as the base
class for various other components, and can also serve as a basic
container to hold other DirectGUI components.
A DirectFrame can have:
* A background texture (pass in path to image, or Texture Card)
* A midground geometry item (pass in geometry)
*... | {
"repo_name": "chandler14362/panda3d",
"path": "direct/src/gui/DirectFrame.py",
"copies": "6",
"size": "7506",
"license": "bsd-3-clause",
"hash": 1846417425762753800,
"line_mean": 34.4056603774,
"line_max": 82,
"alpha_frac": 0.5070610179,
"autogenerated": false,
"ratio": 4.7626903553299496,
"co... |
"""A direct light on a fast controller."""
import logging
from mpf.core.utility_functions import Util
from mpf.platforms.interfaces.light_platform_interface import LightPlatformSoftwareFade
class FASTMatrixLight(LightPlatformSoftwareFade):
"""A direct light on a fast controller."""
__slots__ = ["log", "num... | {
"repo_name": "missionpinball/mpf",
"path": "mpf/platforms/fast/fast_light.py",
"copies": "1",
"size": "1856",
"license": "mit",
"hash": 3086329327736481000,
"line_mean": 35.3921568627,
"line_max": 96,
"alpha_frac": 0.6325431034,
"autogenerated": false,
"ratio": 3.9743040685224837,
"config_test... |
"""A directory browser using Ttk Treeview.
Based on an example found at:
http://bitwalk.blogspot.com/2008/01/ttktreeview.html
"""
import os
import glob
import ttk
try:
import Tkinter
except ImportError:
import tkinter as Tkinter
def populate_tree(tree, node):
if tree.set(node, "type") != 'directory':
... | {
"repo_name": "karimbahgat/PythonGis",
"path": "pythongis/app/tk2/_othermisc/dirtree.py",
"copies": "2",
"size": "2874",
"license": "mit",
"hash": 618542027305913200,
"line_mean": 27.1764705882,
"line_max": 77,
"alpha_frac": 0.6169102296,
"autogenerated": false,
"ratio": 3.2292134831460673,
"co... |
"""A directory browser using Ttk Treeview.
Based on the demo found in Tk 8.5 library/demos/browse
"""
import os
import glob
import Tkinter
import ttk
def populate_tree(tree, node):
if tree.set(node, "type") != 'directory':
return
path = tree.set(node, "fullpath")
tree.delete(*tree.get_children(no... | {
"repo_name": "nzavagli/UnrealPy",
"path": "UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/Python-2.7.10/Demo/tkinter/ttk/dirbrowser.py",
"copies": "10",
"size": "2717",
"license": "mit",
"hash": 6238562078933070000,
"line_mean": 28.2150537634,
"line_max": 77,
... |
"""A DirectRadioButton is a type of button that, similar to a
DirectCheckButton, has a separate indicator and can be toggled between
two states. However, only one DirectRadioButton in a group can be enabled
at a particular time."""
__all__ = ['DirectRadioButton']
from panda3d.core import *
from . import DirectGuiGlo... | {
"repo_name": "chandler14362/panda3d",
"path": "direct/src/gui/DirectRadioButton.py",
"copies": "9",
"size": "10371",
"license": "bsd-3-clause",
"hash": 4435948626262002700,
"line_mean": 45.2991071429,
"line_max": 95,
"alpha_frac": 0.5175007232,
"autogenerated": false,
"ratio": 4.370417193426043,... |
#A dirty "sync" example.
#TODO: 1. Re-Write with twisted for async
#2. Improve on the code.
import urllib2
import simplejson
import random
import time
from threading import Thread
import threadpool
import os
PUBLISHER_URL = 'http://localhost:8080/publish/?channel=232'
SUBSCRIBER_URL = 'http://localhost:8080/activity/?... | {
"repo_name": "jedisct1/nginx_http_push_module",
"path": "tests/test.py",
"copies": "2",
"size": "1342",
"license": "mit",
"hash": -6370660774068876000,
"line_mean": 28.1739130435,
"line_max": 70,
"alpha_frac": 0.5953800298,
"autogenerated": false,
"ratio": 3.696969696969697,
"config_test": fal... |
# A disassembler for Luz.
# Converts binary words into mnemonic assembly instructions
#
# Luz micro-controller assembler
# Eli Bendersky (C) 2008-2010
#
import pprint, os, sys
from collections import defaultdict
from ..commonlib.utils import (
extract_bitfield, signed2int)
from ..commonlib.luz_opcodes import *
f... | {
"repo_name": "eliben/luz-cpu",
"path": "luz_asm_sim/lib/asmlib/disassembler.py",
"copies": "1",
"size": "5115",
"license": "unlicense",
"hash": -6198448017414548000,
"line_mean": 30.7701863354,
"line_max": 77,
"alpha_frac": 0.5792766373,
"autogenerated": false,
"ratio": 2.779891304347826,
"con... |
# A disassembler for Luz.
# Converts binary words into mnemonic assembly instructions
#
# Luz micro-controller assembler
# Eli Bendersky (C) 2008-2010
#
import pprint, os, sys
from collections import defaultdict
from ..commonlib.utils import (
extract_bitfield, signed2int)
from ..commonlib.luz_opcode... | {
"repo_name": "8l/luz-cpu",
"path": "luz_asm_sim/lib/asmlib/disassembler.py",
"copies": "1",
"size": "5276",
"license": "unlicense",
"hash": -8289446628384067000,
"line_mean": 30.7701863354,
"line_max": 77,
"alpha_frac": 0.5615996967,
"autogenerated": false,
"ratio": 2.847274689692391,
"config_... |
"""A discrete event simulation framework."""
import debug, config
class Event(object):
"""An occurrence initiated from within the simulation."""
def __init__(self, label, sender, bubble_time = 0):
assert bubble_time >= time
self.label = label
self.sender = sender
self.time =... | {
"repo_name": "mauzeh/formation-flight",
"path": "lib/sim.py",
"copies": "1",
"size": "2430",
"license": "mit",
"hash": -5596093529395623000,
"line_mean": 28.2891566265,
"line_max": 77,
"alpha_frac": 0.6115226337,
"autogenerated": false,
"ratio": 4.0365448504983386,
"config_test": false,
"has... |
"""A dispatcher for directory watcher events
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import fnmatch
import os
from . import dirwatch_base
class DirWatcherDispatcher:
"""Dispatches directory watcher ... | {
"repo_name": "ceache/treadmill",
"path": "lib/python/treadmill/dirwatch/dirwatch_dispatcher.py",
"copies": "2",
"size": "2273",
"license": "apache-2.0",
"hash": -4237509873575289300,
"line_mean": 27.7721518987,
"line_max": 75,
"alpha_frac": 0.5974483062,
"autogenerated": false,
"ratio": 4.346080... |
## Aditya Gilra, NCBS, Bangalore, 2012
"""
Inside the .../moose-examples/CA1PyramidalCell/ directory supplied with MOOSE, run
python CA1.py <filename>
(if no filename is specified, the single compartment CA1 cell is used.)
(supporting channels and different morph xml files are already present in this same directory).
... | {
"repo_name": "h-mayorquin/camp_india_2016",
"path": "tutorials/chemical switches/moose/neuroml/CA1PyramidalCell/CA1.py",
"copies": "1",
"size": "1710",
"license": "mit",
"hash": -5365642802375636000,
"line_mean": 32.5294117647,
"line_max": 100,
"alpha_frac": 0.6783625731,
"autogenerated": false,
... |
## Aditya Gilra, NCBS, Bangalore, 2012
"""
Inside the .../moose-examples/GranuleCell/ directory supplied with MOOSE, run
python testNeuroML_Gran98.py
(other channels and morph xml files are already present in this same directory).
The soma name below is hard coded for gran98, else any other file can be used by modifyi... | {
"repo_name": "h-mayorquin/camp_india_2016",
"path": "tutorials/chemical switches/moose/neuroml/allChannelsCell/allChannelsCell.py",
"copies": "1",
"size": "2130",
"license": "mit",
"hash": -2201605458879197700,
"line_mean": 30.3235294118,
"line_max": 103,
"alpha_frac": 0.6530516432,
"autogenerated... |
## Aditya Gilra, NCBS, Bangalore, 201
"""
Inside the .../moose-examples/CA1PyramidalCell/ directory supplied with MOOSE, run
python testNeuroML_CA1.py
(other channels and morph xml files are already present in this same directory).
The soma name below is hard coded for CA1, else any other file can be used by modifying... | {
"repo_name": "h-mayorquin/camp_india_2016",
"path": "tutorials/chemical switches/moose/neuroml/CA1PyramidalCell/CA1_hsolve.py",
"copies": "1",
"size": "1987",
"license": "mit",
"hash": 4347910332733903400,
"line_mean": 33.8596491228,
"line_max": 100,
"alpha_frac": 0.6597886261,
"autogenerated": fa... |
adj_1 = input("Please type an adjective: ")
obj_1 = input("Please type an object: ")
pronoun_1 = input("Please type a pronoun: ")
body_part_1 = input("Please type a body part: ")
print("The trail of life persistently is " + adj_1 + " without a " + obj_1 + " to light my darkened way; instead " + pronoun_1 + " marc... | {
"repo_name": "glors131/Code-Projects",
"path": "Madlib1.py",
"copies": "1",
"size": "1544",
"license": "mit",
"hash": 7736748082466308000,
"line_mean": 47.8064516129,
"line_max": 221,
"alpha_frac": 0.6230569948,
"autogenerated": false,
"ratio": 2.7971014492753623,
"config_test": false,
"has_... |
def ad2_qubo(qubo_out,adj_in):
import csv
max_states=1000
qubo_Records=[0] * max_states
states_records=[0] * max_states
states_adj=[0] * max_states
states_couplers=[0] * max_states
states=[0]*max_states
states_num=[0]*max_states
qubo = open (qubo_out,"w")
adj = open (adj_in,"... | {
"repo_name": "tepl/qbsolv",
"path": "examples/mapColoringUSStates/adj2qubo.py",
"copies": "1",
"size": "4432",
"license": "apache-2.0",
"hash": 7245484955423801000,
"line_mean": 37.2068965517,
"line_max": 130,
"alpha_frac": 0.5435469314,
"autogenerated": false,
"ratio": 2.7786833855799373,
"co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.