text stringlengths 0 1.05M | meta dict |
|---|---|
# Basic OLS regression using base python (and numpy)
import numpy as np
import matplotlib.pyplot as plt
# Load data
dataset = np.genfromtxt('../data/regression_heart.csv', delimiter=",")
x = dataset[:,1:]
y = dataset[:,0]
y = np.reshape(y, (y.shape[0],1)) # Reshape to a column vector
# Scale (standardize) data for... | {
"repo_name": "sho-87/python-machine-learning",
"path": "Linear Regression/multiple_regression.py",
"copies": "1",
"size": "1719",
"license": "mit",
"hash": -3015745501839647000,
"line_mean": 32.0576923077,
"line_max": 78,
"alpha_frac": 0.6689936009,
"autogenerated": false,
"ratio": 2.984375,
"... |
# basic omegalib script: just display a textured spinning cube.
from omega import *
from cyclops import *
from player import *
from common import *
from itemManager import *
import random
from scoreboard import *
global dirAmount
global scoreBoard
global bananas
dirAmount = 0.01
nmbPlayers = 3
objSpeed = 0.5 # per... | {
"repo_name": "mvictoras/caveNinja",
"path": "game.py",
"copies": "1",
"size": "7207",
"license": "bsd-3-clause",
"hash": -1261883740436820000,
"line_mean": 26.6130268199,
"line_max": 135,
"alpha_frac": 0.6941862079,
"autogenerated": false,
"ratio": 2.9979201331114806,
"config_test": false,
"... |
"""Basic operations that are needed repeatedly throughout Skyfield."""
from numpy import arcsin, arctan2, array, cos, load, sin, sqrt
from pkgutil import get_data
from skyfield.constants import tau
def dots(v, u):
"""Given one or more vectors in `v` and `u`, return their dot products.
This works whether `v` ... | {
"repo_name": "ozialien/python-skyfield",
"path": "skyfield/functions.py",
"copies": "1",
"size": "2304",
"license": "mit",
"hash": -1978085959232278800,
"line_mean": 27.8,
"line_max": 75,
"alpha_frac": 0.6028645833,
"autogenerated": false,
"ratio": 3.1955617198335644,
"config_test": false,
"... |
"""Basic operations that are needed repeatedly throughout Skyfield."""
from numpy import (
arcsin, arctan2, array, cos, einsum, finfo, float64,
full_like, load, rollaxis, sin, sqrt,
)
from pkgutil import get_data
from skyfield.constants import tau
_AVOID_DIVIDE_BY_ZERO = finfo(float64).tiny
class A(object):
... | {
"repo_name": "skyfielders/python-skyfield",
"path": "skyfield/functions.py",
"copies": "1",
"size": "5918",
"license": "mit",
"hash": -847225661202337400,
"line_mean": 29.6632124352,
"line_max": 79,
"alpha_frac": 0.6093274755,
"autogenerated": false,
"ratio": 3.1834319526627217,
"config_test":... |
"""Basic optimizer."""
from grortir.externals.pyswarm.pso import pso
from grortir.main.model.core.optimization_status import OptimizationStatus
from grortir.main.optimizers.base_optimizer import BaseOptimizer
class Optimizer(BaseOptimizer):
"""Optimizer is object which optimize process."""
def optimize_proc... | {
"repo_name": "qbahn/grortir",
"path": "grortir/main/optimizers/optimizer.py",
"copies": "1",
"size": "1289",
"license": "mit",
"hash": -350086062054620100,
"line_mean": 35.8285714286,
"line_max": 74,
"alpha_frac": 0.6353762607,
"autogenerated": false,
"ratio": 4.35472972972973,
"config_test": ... |
"""Basic Package
"""
import numpy as np
from .base import MFPackageDIS
from .reader import MFFileReader
__all__ = ['BAS6']
class BAS6(MFPackageDIS):
"""Basic Package"""
valid_options = ['XSECTION', 'CHTOCH', 'FREE', 'PRINTTIME',
'SHOWPROGRESS', 'STOPERROR']
_Options = []
@pr... | {
"repo_name": "mwtoews/moflow",
"path": "moflow/mf/basic.py",
"copies": "1",
"size": "4941",
"license": "bsd-2-clause",
"hash": -8016228653199625000,
"line_mean": 32.8424657534,
"line_max": 76,
"alpha_frac": 0.507791945,
"autogenerated": false,
"ratio": 3.6955871353777114,
"config_test": false,... |
"""basicpar.py -- General base class for parameter objects. Broken out
from PyRAF's IrafPar class.
$Id$
"""
import re
import sys
from . import irafutils, minmatch
from .irafglobals import INDEF, Verbose, yes, no
int_types = (int, )
# container class used for __deepcopy__ method
class _EmptyClass:... | {
"repo_name": "spacetelescope/stsci.tools",
"path": "lib/stsci/tools/basicpar.py",
"copies": "1",
"size": "60106",
"license": "bsd-3-clause",
"hash": 2961488429406394000,
"line_mean": 35.8974831185,
"line_max": 96,
"alpha_frac": 0.5031777194,
"autogenerated": false,
"ratio": 4.4172852208422135,
... |
'''Basic parser for lisp expressions'''
import re
class Parser:
"Parse a Lisp expression from a string"
def __init__(self, STRINGS=None): # noqa
self.regex = re.compile('"(?:[^"])*"')
self.STRINGS = STRINGS
if STRINGS is None:
self.STRINGS = {}
def parse(self, s):
... | {
"repo_name": "aroberge/lispy-experiments",
"path": "src/parser.py",
"copies": "1",
"size": "2160",
"license": "cc0-1.0",
"hash": -6652874320292340000,
"line_mean": 33.8387096774,
"line_max": 84,
"alpha_frac": 0.5351851852,
"autogenerated": false,
"ratio": 4.243614931237721,
"config_test": fals... |
'''Basic parsers
Created on 7 august 2012
@author: fredo
'''
from collections import defaultdict
from popparser.llparser import ParseResult, ParseError
#==============================================================================
# ABSTRACT BASE CLASS FOR PARSERS
#===============================================... | {
"repo_name": "fredokun/popparser",
"path": "src/popparser/parsers.py",
"copies": "1",
"size": "13465",
"license": "mit",
"hash": 7626975882890449000,
"line_mean": 31.4457831325,
"line_max": 117,
"alpha_frac": 0.4807278128,
"autogenerated": false,
"ratio": 4.786704585851404,
"config_test": fals... |
# Basic 'parse this value' class.
class ParseDatatype(object):
"""Handles converting strings to other data types, with NA rules.
Strings and numbers can have different NA rules: it's possible to
decide '' or 'NA' as a number should be None, but '' or 'NA' as a
string should remain '' or 'NA'.
"""
... | {
"repo_name": "rareitmeyer/CSVToGeo",
"path": "parse_datatypes.py",
"copies": "1",
"size": "1566",
"license": "apache-2.0",
"hash": -1786387927677336800,
"line_mean": 25.5423728814,
"line_max": 81,
"alpha_frac": 0.5657726692,
"autogenerated": false,
"ratio": 3.9545454545454546,
"config_test": f... |
"""Basic parts for plotting bigwig (coverage etc.), genes, ideograms.
"""
import os
import re
try:
from itertools import izip
except:
izip = zip
from itertools import chain
import numpy as N
import pandas as PD
import matplotlib.pyplot as PP
from matplotlib.collections import BrokenBarHCollection
import matplotlib... | {
"repo_name": "kensugino/jGEM",
"path": "jgem/plottracks.py",
"copies": "1",
"size": "12515",
"license": "mit",
"hash": -2920222147062944300,
"line_mean": 26.4451754386,
"line_max": 93,
"alpha_frac": 0.6219736316,
"autogenerated": false,
"ratio": 2.384717987804878,
"config_test": false,
"has_... |
"""Basic plotting functions
"""
import math
import numpy as np
from scipy.interpolate import interp1d, splrep, splev
from energy_demand.technologies import diffusion_technologies
#matplotlib.use('Agg') # Used to make it work in linux
def export_legend(legend, filename="legend.png"):
"""Export legend as seperate ... | {
"repo_name": "nismod/energy_demand",
"path": "energy_demand/plotting/basic_plot_functions.py",
"copies": "1",
"size": "3472",
"license": "mit",
"hash": 5026940573837309000,
"line_mean": 24.1594202899,
"line_max": 114,
"alpha_frac": 0.58640553,
"autogenerated": false,
"ratio": 3.377431906614786,
... |
# basic post processing hooks
import re
import pandas
from snakemakelib.odo import cutadapt
from snakemakelib_oliver.odo import fastqc, bowtie2, htseq
__all__ = ['qc_fastqc_summary_hook',
'qc_cutadapt_post_processing_hook',
'qc_bowtie2_post_processing_hook',
'qc_htseq_post_processing_... | {
"repo_name": "Oliver-Lab/snakemakelib-oliver",
"path": "snakemakelib_oliver/workflows/qc/app/hooks.py",
"copies": "1",
"size": "1635",
"license": "mit",
"hash": -1122942896667817700,
"line_mean": 34.5434782609,
"line_max": 121,
"alpha_frac": 0.6532110092,
"autogenerated": false,
"ratio": 3.12022... |
"""Basic Preprocessor."""
from tqdm import tqdm
from . import units
from matchzoo import DataPack
from matchzoo.engine.base_preprocessor import BasePreprocessor
from .build_vocab_unit import build_vocab_unit
from .build_unit_from_data_pack import build_unit_from_data_pack
from .chain_transform import chain_transform
... | {
"repo_name": "faneshion/MatchZoo",
"path": "matchzoo/preprocessors/basic_preprocessor.py",
"copies": "1",
"size": "6154",
"license": "apache-2.0",
"hash": 8116341292901481000,
"line_mean": 40.3020134228,
"line_max": 79,
"alpha_frac": 0.5563860903,
"autogenerated": false,
"ratio": 4.1191432396251... |
"""Basic Priority Queue"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import heapq
import itertools
class PriorityQueue:
REMOVED = '<removed-e>'
def __init__(self):
self.priority_queue = []
self.map = {}
self.counter = itertools.count()
def add(self, e... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/utils/priority_queue.py",
"copies": "1",
"size": "1280",
"license": "mit",
"hash": -9086422052292937000,
"line_mean": 22.7037037037,
"line_max": 71,
"alpha_frac": 0.571875,
"autogenerated": false,
"ratio": 3.6363636363636362,
"config_te... |
"""Basic PyAMG demo showing AMG standalone convergence versus preconditioned CG
with AMG"""
__docformat__ = "restructuredtext en"
__all__ = ['demo']
import scipy as sp
import numpy as np
from pyamg.gallery import poisson
from pyamg.aggregation import smoothed_aggregation_solver
def demo():
A = poisson((100, 100... | {
"repo_name": "huahbo/pyamg",
"path": "pyamg/gallery/demo.py",
"copies": "2",
"size": "2113",
"license": "mit",
"hash": -7779972640299032000,
"line_mean": 36.0701754386,
"line_max": 79,
"alpha_frac": 0.6464742073,
"autogenerated": false,
"ratio": 3.7200704225352115,
"config_test": false,
"has... |
"""Basic PyAMG demo showing AMG standalone convergence versus preconditioned CG with AMG."""
from __future__ import print_function
import scipy as sp
import numpy as np
from pyamg.gallery import poisson
from pyamg.aggregation import smoothed_aggregation_solver
__all__ = ['demo']
def demo():
"""Outline basic dem... | {
"repo_name": "pyamg/pyamg",
"path": "pyamg/gallery/demo.py",
"copies": "1",
"size": "2159",
"license": "mit",
"hash": -4557956963394284000,
"line_mean": 36.224137931,
"line_max": 92,
"alpha_frac": 0.6456692913,
"autogenerated": false,
"ratio": 3.7032590051457976,
"config_test": false,
"has_n... |
from cgi import escape
import os
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import sys
import timeit
def u(stringlit):
if sys.version_info >= (3,):
return stringlit
else:
return stringlit.decode('latin1')
__all__ = ['choco', 'choco_inheritance', 'ji... | {
"repo_name": "whiteclover/Choco",
"path": "examples/bench/basic.py",
"copies": "1",
"size": "6920",
"license": "mit",
"hash": 2796939964082748400,
"line_mean": 35.2303664921,
"line_max": 108,
"alpha_frac": 0.6345375723,
"autogenerated": false,
"ratio": 4.097098875074009,
"config_test": false,
... |
"""basic.py: defines base Property and basic Property types"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import datetime
import math
import random
import re
import uuid
import warnings
from si... | {
"repo_name": "aranzgeo/properties",
"path": "properties/basic.py",
"copies": "1",
"size": "56346",
"license": "mit",
"hash": 7260134612690716000,
"line_mean": 34.9578813019,
"line_max": 126,
"alpha_frac": 0.5920207291,
"autogenerated": false,
"ratio": 4.267020068156001,
"config_test": false,
... |
''' basic.py
Basic module
Copyright 2008 Corey Tabaka
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required ... | {
"repo_name": "eieio/pyy",
"path": "modules/basic.py",
"copies": "1",
"size": "2503",
"license": "apache-2.0",
"hash": 8050884715794524000,
"line_mean": 30.0897435897,
"line_max": 109,
"alpha_frac": 0.6715940871,
"autogenerated": false,
"ratio": 3.377867746288799,
"config_test": false,
"has_n... |
# Basic Python3 script to communicate with MD-01 via Ethernet module
# Only using standard Python3 libraries
#
# Format from http://ryeng.name/blog/3
#The SPID protocol supports 3 commands: stop, status and set. The stop
#command stops the rotator in its current position. The status command
#returns the current positio... | {
"repo_name": "varenius/salsa",
"path": "Developer_notes/BIGRAS_HR_MD0X/MD01-python3-test.py",
"copies": "1",
"size": "4918",
"license": "mit",
"hash": 3252365066679787000,
"line_mean": 29.3580246914,
"line_max": 85,
"alpha_frac": 0.5961773078,
"autogenerated": false,
"ratio": 2.8726635514018692,... |
#Basic Python Server in Flask for showing reports
#Essentially put together from this page: http://flask.pocoo.org/docs/0.10/quickstart/
#Just run this like:
#> python server.py
#and then visit http://localhost:5000
from json import dump, dumps
from datetime import datetime
from pdb import set_trace
from collections i... | {
"repo_name": "matthewruttley/zenko",
"path": "server.py",
"copies": "2",
"size": "7255",
"license": "mit",
"hash": -7138982986616971000,
"line_mean": 32.587962963,
"line_max": 131,
"alpha_frac": 0.683115093,
"autogenerated": false,
"ratio": 3.2287494437027147,
"config_test": false,
"has_no_k... |
# Basic Python Server in Flask for showing reports
# Essentially put together from this page:
# http://flask.pocoo.org/docs/0.10/quickstart/
# Just run this like:
# > python server.py
# and then visit http://localhost:5000
from datetime import datetime
from flask import Flask, render_template, request, make_response
... | {
"repo_name": "mozilla/zenko",
"path": "zenko/server.py",
"copies": "1",
"size": "21695",
"license": "mit",
"hash": -8864937880207088000,
"line_mean": 32.3769230769,
"line_max": 79,
"alpha_frac": 0.5324268265,
"autogenerated": false,
"ratio": 4.023553412462908,
"config_test": false,
"has_no_k... |
"""Basic ramming together of turtlepower and pymunk.
Bouncing ball demo with a turtle?
Requires pymunk"""
from turtlepower.world import TurtleWorld, PowerTurtle, clamp
try:
import pymunk as pm
except ImportError:
print("You need to have pymunk installed to run bouncing turtle. See http://www.pymunk.org")
ex... | {
"repo_name": "AllTheWayDown/turtlepower",
"path": "turtlepower/bouncing_turtle.py",
"copies": "1",
"size": "4007",
"license": "mit",
"hash": -3822119390904744000,
"line_mean": 28.2481751825,
"line_max": 96,
"alpha_frac": 0.5729972548,
"autogenerated": false,
"ratio": 3.3587594300083823,
"confi... |
# Basic RBC model with full depreciation (Alternate 1)
#
# Jesus Fernandez-Villaverde
# Haverford, July 3, 2013
#
# Modified to use a Cython implementation of the inner loop
import numpy as np
import math
import time
# Import the Cython version of the inner loop
from innerloop_ext import innerloop
def main_func():
... | {
"repo_name": "tomooinoue/Comparison-Programming-Languages-Economics",
"path": "RBC_Python_Cython.py",
"copies": "7",
"size": "3629",
"license": "mit",
"hash": -942216992390796000,
"line_mean": 34.2330097087,
"line_max": 215,
"alpha_frac": 0.6552769358,
"autogenerated": false,
"ratio": 3.36641929... |
# Basic RBC model with full depreciation (Alternate 1)
#
# Jesus Fernandez-Villaverde
# Haverford, July 3, 2013
import numpy as np
import math
import time
from numba import autojit
# - Start Inner Loop - #
# - bbeta float
# - nGridCapital: int64
# - gridCapitalNextPeriod: int... | {
"repo_name": "mseri/Comparison-Programming-Languages-Economics",
"path": "RBC_Python_Numba.py",
"copies": "7",
"size": "5046",
"license": "mit",
"hash": 228336278940042700,
"line_mean": 35.3925925926,
"line_max": 215,
"alpha_frac": 0.6373365042,
"autogenerated": false,
"ratio": 3.460905349794239... |
# Basic RBC model with full depreciation
#
# Jesus Fernandez-Villaverde
# Haverford, July 3, 2013
# 0. Initialization
import numpy as np
import math
import time
t1=time.time()
def main_func():
# 1. Calibration
aalpha = 1.0/3.0 # Elasticity of output w.r.t. capital
bbeta = 0.95 ... | {
"repo_name": "mseri/Comparison-Programming-Languages-Economics",
"path": "RBC_Python.py",
"copies": "7",
"size": "4269",
"license": "mit",
"hash": 7662719694139972000,
"line_mean": 33.8907563025,
"line_max": 128,
"alpha_frac": 0.6284844226,
"autogenerated": false,
"ratio": 3.5164744645799013,
... |
""" Basic reflector tests
"""
import unittest
import unittest.mock
import os
import sys
import io
sys.path.insert(0, os.path.abspath('..'))
from reflector import utils
class TestReflectorUtils(unittest.TestCase):
def setUp(self):
self.ip_addr = '192.168.101.99'
@unittest.mock.patch.object(... | {
"repo_name": "swysocki/reflector",
"path": "tests/test_basic.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": -8055490408711524000,
"line_mean": 28.4358974359,
"line_max": 59,
"alpha_frac": 0.6341463415,
"autogenerated": false,
"ratio": 3.406528189910979,
"config_test": true,
"h... |
"""Basic regular expression demostration facility (Perl style syntax)."""
from Tkinter import *
import re
class ReDemo:
def __init__(self, master):
self.master = master
self.promptdisplay = Label(self.master, anchor=W,
text="Enter a Perl-style regular expression:")
self.p... | {
"repo_name": "valkjsaaa/sl4a",
"path": "python/src/Tools/scripts/redemo.py",
"copies": "63",
"size": "5769",
"license": "apache-2.0",
"hash": -7843167485693510000,
"line_mean": 32.7368421053,
"line_max": 73,
"alpha_frac": 0.5104870862,
"autogenerated": false,
"ratio": 4.17438494934877,
"config... |
"""Basic rendering code"""
from flask import current_app, make_response, render_template
def render(template, category, base, flavour, template_variables):
"""The main YAWT render routine"""
if flavour is None:
flavour = current_app.config['YAWT_DEFAULT_FLAVOUR']
content_type = None
if flavou... | {
"repo_name": "drivet/yawt",
"path": "yawt/view.py",
"copies": "1",
"size": "1491",
"license": "mit",
"hash": -930070738871663700,
"line_mean": 31.4130434783,
"line_max": 87,
"alpha_frac": 0.6673373575,
"autogenerated": false,
"ratio": 3.997319034852547,
"config_test": false,
"has_no_keywords... |
# basic rendering tools
from django.shortcuts import render
from django.http import HttpResponse
from moviepicker.models import Movie
def home(request):
return render(request, 'moviepicker/home.html')
def get_results(request):
context = {}
choices = Movie.objects.filter(shown=False).order_by('-vote_cou... | {
"repo_name": "all-out/all-out-website",
"path": "moviepicker/views.py",
"copies": "1",
"size": "1103",
"license": "apache-2.0",
"hash": 5042491331411513000,
"line_mean": 23.5111111111,
"line_max": 80,
"alpha_frac": 0.6817769719,
"autogenerated": false,
"ratio": 3.751700680272109,
"config_test"... |
# basic rendering tools
from django.shortcuts import render, redirect
from django.http import HttpResponse
# user authentication
from django.contrib.auth.decorators import (
login_required,
user_passes_test,
)
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
fr... | {
"repo_name": "mosbasik/message_board",
"path": "main/views.py",
"copies": "1",
"size": "6141",
"license": "apache-2.0",
"hash": 7463538262945028000,
"line_mean": 29.8592964824,
"line_max": 79,
"alpha_frac": 0.6384953591,
"autogenerated": false,
"ratio": 4.180394826412526,
"config_test": false,... |
# Basic REST api
from flask import Flask, request, jsonify
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
# Database configuration
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqlconnector://pk:protokoll@127.0.0.1/pk?unix_socket=/run/mysqld/mysqld.sock'
# Enable debugging to log errors to
# /var... | {
"repo_name": "noahwilliamsson/protokollen",
"path": "web/api/routes.py",
"copies": "1",
"size": "5586",
"license": "bsd-2-clause",
"hash": 8273694622817161000,
"line_mean": 26.1165048544,
"line_max": 126,
"alpha_frac": 0.6555674902,
"autogenerated": false,
"ratio": 2.668896321070234,
"config_t... |
"""Basic REST API"""
from cassandra.cluster import Cluster
from cassandra import ConsistencyLevel
from flask import Flask, json, jsonify, request
app = Flask(__name__)
# Connect to the local Cassandra instance and use the 'accounts' keyspace
CLUSTER = Cluster(['127.0.0.1'])
SESSION = CLUSTER.connect()
SESSION.execut... | {
"repo_name": "exponential-io/complete-cassandra-course-examples",
"path": "basic-api/api.py",
"copies": "1",
"size": "2505",
"license": "mit",
"hash": 5717122908231768000,
"line_mean": 22.2037037037,
"line_max": 73,
"alpha_frac": 0.5612774451,
"autogenerated": false,
"ratio": 3.889751552795031,
... |
# basic
# This is a comment!
# Storing a string to the variable s
s = "Hello world, world"
# printing the type. It shows 'str' which means it is a string type
print type(s)
# printing the number of characters in the string.
print len(s)
# Python gave me an error below! I guess we can't change individual parts... | {
"repo_name": "jpgroup/democode",
"path": "pythontips.py",
"copies": "2",
"size": "4487",
"license": "mit",
"hash": 7188501916242437000,
"line_mean": 25.0301204819,
"line_max": 231,
"alpha_frac": 0.6142188545,
"autogenerated": false,
"ratio": 2.9288511749347257,
"config_test": false,
"has_no_... |
"""Basic robot control to test motors and drive"""
# Choose whether to test the bot with a controller
IGNORE_CONTROLLER = False
# Update motor values below
left_motor = ""
right_motor = ""
assert left_motor and right_motor, "Insert the motor IDs from Dawn"
def autonomous_setup():
print("Autonomous mode has start... | {
"repo_name": "pioneers/PieCentral",
"path": "staff-bots/basic.py",
"copies": "1",
"size": "1347",
"license": "apache-2.0",
"hash": 4976729247866653000,
"line_mean": 28.9333333333,
"line_max": 67,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 3.222488038277512,
"config_test": fal... |
# basic room sensors circuit
# temperature, light level and movement
# import libraries
import time
import RPi.GPIO as GPIO
import sys
import Adafruit_DHT as dht
import urllib2
import urllib
import httplib
import datetime
# set the GPIO mode
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# variables for the readings... | {
"repo_name": "jargonautical/roomsense",
"path": "room_sense_ts.py",
"copies": "1",
"size": "2609",
"license": "cc0-1.0",
"hash": 3484817354681803300,
"line_mean": 29.6941176471,
"line_max": 142,
"alpha_frac": 0.662322729,
"autogenerated": false,
"ratio": 3.344871794871795,
"config_test": false... |
# Basic routines to display numpy array as image
from ipython_slideatlas import *
import cv2
import numpy as np
def gamma_correction(img, correction):
img = img/255.0
img = cv2.pow(img, correction)
return np.uint8(img*255)
def analyze_orientations(inp=None, scale=15, delta=0, kernel_size=5, blur=True, b... | {
"repo_name": "SlideAtlas/SlideAtlas-Server",
"path": "slideatlas/plugins/ipython/notebooks/analysis_tools.py",
"copies": "1",
"size": "2342",
"license": "apache-2.0",
"hash": 7730419147286485000,
"line_mean": 30.6486486486,
"line_max": 122,
"alpha_frac": 0.6635354398,
"autogenerated": false,
"ra... |
# basic routinues
import struct
from gevent import socket
from gevent import select
import msg
class ProtocolError(Exception): pass
class FormatError(Exception): pass
def readaddr(sock, addrtype):
if addrtype == msg.IP_V4:
return sock.recv(4)
elif addrtype == msg.IP_V6:
return sock.recv(16)
... | {
"repo_name": "Jonavin/firefly-proxy",
"path": "gsocks/utils.py",
"copies": "6",
"size": "6130",
"license": "bsd-2-clause",
"hash": 5368976546482683000,
"line_mean": 28.7572815534,
"line_max": 111,
"alpha_frac": 0.5977161501,
"autogenerated": false,
"ratio": 3.500856653340948,
"config_test": fa... |
"""basic schema
Revision ID: 176bef6a90a3
Revises: 353dff346d3
Create Date: 2014-12-14 14:49:32.149387
"""
# revision identifiers, used by Alembic.
revision = '176bef6a90a3'
down_revision = '353dff346d3'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('user',
sa.Column('i... | {
"repo_name": "pudo/storyweb",
"path": "storyweb/migrate/versions/176bef6a90a3_basic_schema.py",
"copies": "1",
"size": "4032",
"license": "mit",
"hash": 8155162663061948000,
"line_mean": 41.8936170213,
"line_max": 127,
"alpha_frac": 0.6108630952,
"autogenerated": false,
"ratio": 3.62589928057553... |
# basic script for restarting Rclone mount on failure and notifying via pushbullet,
# hardcoded and not great but whatever, note this mounts read-only, change to suit your needs
# put this in your crontab to run every 5 minuntes
# */5 * * * * python /home/user/Rclonemountdown.py > /dev/null
from pushbullet import Push... | {
"repo_name": "kamos69/scripts",
"path": "acdrclonemountchecker.py",
"copies": "1",
"size": "1602",
"license": "mit",
"hash": 3613994702094795300,
"line_mean": 37.1428571429,
"line_max": 114,
"alpha_frac": 0.7053682896,
"autogenerated": false,
"ratio": 3.3167701863354035,
"config_test": false,
... |
""" Basic script to mimic the behavior of Pyneal during an actual scan.
This is a quick and dirty server set up to mimic the behavior of Pyneal. It
will listen for incoming data over an assigned port using the same methods
that Pyneal would use during a real scan. This tool allows you to test
components of Pyneal Scan... | {
"repo_name": "jeffmacinnes/pyneal",
"path": "pyneal_scanner/simulation/pynealReceiver_sim.py",
"copies": "1",
"size": "4511",
"license": "mit",
"hash": -6969390668394728000,
"line_mean": 31.9270072993,
"line_max": 109,
"alpha_frac": 0.6122810907,
"autogenerated": false,
"ratio": 4.19237918215613... |
'''Basic script to retreive a count of OTUs from all studies in phylesystem'''
import requests
import json
import time
import timeit
import os.path
import sys
import argparse
# Overview:
# Grabs the files via API
# Parses the adding OTUS to lists
# Keeps a unique set
# Counts and returns those values ... | {
"repo_name": "OpenTreeOfLife/germinator",
"path": "statistics/phylesystem_stats.py",
"copies": "1",
"size": "8052",
"license": "bsd-2-clause",
"hash": 7263559315515258000,
"line_mean": 31.8319327731,
"line_max": 79,
"alpha_frac": 0.6029557874,
"autogenerated": false,
"ratio": 3.7243293246993523,... |
''' Basic script to retreive a count of OTUs from all studies in synthesis'''
import requests
import json
import time
import os.path
import argparse
# Overview:
# Grabs the files via API
# Parses the adding OTUS to lists
# Keeps a unique set
# Counts and returns those values in JSON file
# Peter E. Mid... | {
"repo_name": "OpenTreeOfLife/germinator",
"path": "statistics/synthesis_stats.py",
"copies": "1",
"size": "7216",
"license": "bsd-2-clause",
"hash": -1574754999150657000,
"line_mean": 32.1990521327,
"line_max": 79,
"alpha_frac": 0.59672949,
"autogenerated": false,
"ratio": 3.7081192189105856,
... |
"""Basic security tables
Revision ID: 381ff3809f91
Revises: None
Create Date: 2015-03-25 10:58:08.823720
"""
# revision identifiers, used by Alembic.
revision = '381ff3809f91'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adj... | {
"repo_name": "openmaraude/APITaxi_models",
"path": "APITaxi_models2/migrations/versions/20150325_10:58:08_381ff3809f91_initialize.py.py",
"copies": "3",
"size": "1758",
"license": "mit",
"hash": -7945608516758502000,
"line_mean": 29.3103448276,
"line_max": 67,
"alpha_frac": 0.606370876,
"autogener... |
"""Basic server for Monitor Requests.
Run with:
monitor_requests_server
Optional arguments:
-p 9001
--port=9001
"""
import argparse
import json
import tornado.ioloop
import tornado.web
import sqlite3
from tornado import gen
from tornado.escape import json_decode
def init_db():
"""Initialize the temp db."""
c... | {
"repo_name": "danpozmanter/monitor_requests",
"path": "monitor_requests/server.py",
"copies": "1",
"size": "5154",
"license": "bsd-3-clause",
"hash": -8859951472799657000,
"line_mean": 29.8622754491,
"line_max": 79,
"alpha_frac": 0.5306558013,
"autogenerated": false,
"ratio": 4.349367088607595,
... |
"""Basic set of setting validators."""
import os
from django.core.exceptions import ValidationError
class TypeValidator(object):
"""Validator which checks type of the value."""
message = "Value %(value)s is not of type %(type)s."
def __init__(self, value_type, message=None):
self.value_type = v... | {
"repo_name": "Genida/django-appsettings",
"path": "src/appsettings/validators.py",
"copies": "1",
"size": "3322",
"license": "isc",
"hash": 5251715836909855000,
"line_mean": 33.2474226804,
"line_max": 120,
"alpha_frac": 0.6044551475,
"autogenerated": false,
"ratio": 4.258974358974359,
"config_... |
# Basic settings for django. They should enable localhost-only development.
# These settings are extended for actual production use.
# Before go-live review: https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
import os.path
TEMPLATE_DEBUG = DEBUG = True
# If development is set to true, all calls to Sa... | {
"repo_name": "hhauer/myinfo",
"path": "oam_base/settings.py",
"copies": "1",
"size": "7736",
"license": "mit",
"hash": -8841108151478047000,
"line_mean": 29.337254902,
"line_max": 110,
"alpha_frac": 0.653697001,
"autogenerated": false,
"ratio": 3.6473361621876474,
"config_test": false,
"has_... |
# ******************** BASIC SETTINGS ***************
# These are the MUST BE SET parameters!
CENTRAL_WALLET = 'FKAXaGvSQohVTivtLn4V99NkRBZXMoBeC4' # Local coin address where money goes
COINDAEMON_TRUSTED_HOST = 'localhost'
COINDAEMON_TRUSTED_PORT = 1991
COINDAEMON_TRUSTED_USER = 'mainnetwork'
COINDAEM... | {
"repo_name": "flightcoin/flightcoinold",
"path": "config.py",
"copies": "1",
"size": "9094",
"license": "mit",
"hash": 3259023228447659500,
"line_mean": 47.1164021164,
"line_max": 194,
"alpha_frac": 0.6724213767,
"autogenerated": false,
"ratio": 3.671376665320953,
"config_test": false,
"has_... |
"""Basic shapes for scene rendering, extended from base object (Thing) class
"""
from pyglet import gl, graphics
from math import pi, sin, cos, sqrt
from hypyr import scene, linal
def frange(xMin, dx, xMax):
vals = [xMin]
while xMin <= xMax:
xMin += dx
vals.append(min(xMin,xMax))
return vals
class Sphere(sce... | {
"repo_name": "Tythos/hypyr",
"path": "solids.py",
"copies": "1",
"size": "1551",
"license": "mit",
"hash": 2398846076569778000,
"line_mean": 27.2,
"line_max": 198,
"alpha_frac": 0.5673758865,
"autogenerated": false,
"ratio": 2.555189456342669,
"config_test": false,
"has_no_keywords": false,
... |
# basic shopping list with function and clean code
# has 3 command in this apps
# SHOW, HELP, and DONE
# add new command to save the list to my_shopping_list.txt
print("enter a new list for you...")
shopping_list = []
file_name = "my_shopping_list.txt"
# function to show the help
def show_help():
print("typing ... | {
"repo_name": "hrahadiant/mini_py_project",
"path": "shopping_list_with_function.py",
"copies": "1",
"size": "1745",
"license": "apache-2.0",
"hash": -6010658867268595000,
"line_mean": 25.0447761194,
"line_max": 87,
"alpha_frac": 0.5954154728,
"autogenerated": false,
"ratio": 3.469184890656064,
... |
# Basic signature scan module. This is the default (and primary) feature
# of binwalk.
import binwalk.core.magic
from binwalk.core.module import Module, Option, Kwarg
class Signature(Module):
TITLE = "Signature Scan"
ORDER = 10
CLI = [
Option(short='B',
long='signature',
... | {
"repo_name": "sundhaug92/binwalk",
"path": "src/binwalk/modules/signature.py",
"copies": "1",
"size": "7336",
"license": "mit",
"hash": -2167696604287624200,
"line_mean": 37.6105263158,
"line_max": 105,
"alpha_frac": 0.5272628135,
"autogenerated": false,
"ratio": 4.481368356750153,
"config_tes... |
# Basic signature scan module. This is the default (and primary) feature of binwalk.
import binwalk.core.magic
from binwalk.core.module import Module, Option, Kwarg
class Signature(Module):
TITLE = "Signature Scan"
ORDER = 10
CLI = [
Option(short='B',
long='signature',
... | {
"repo_name": "UniqMartin/binwalk",
"path": "src/binwalk/modules/signature.py",
"copies": "23",
"size": "7384",
"license": "mit",
"hash": -2741642583226684000,
"line_mean": 40.251396648,
"line_max": 118,
"alpha_frac": 0.5238353196,
"autogenerated": false,
"ratio": 4.538414259373079,
"config_tes... |
"""Basics
This program performs basic Python instructions.
"""
def main():
# Expressions
print(2 + 2)
print(2 + 3 * 6)
print((2 + 3) * 6)
print(48565878 * 578453)
print(2 ** 8)
print(23 / 7)
print(23 // 7)
print(23 % 7)
print(2 + 2)
print((5 - 1) * ((7 + 1) / ... | {
"repo_name": "JoseALermaIII/python-tutorials",
"path": "pythontutorials/books/AutomateTheBoringStuff/Ch01/P1_basics.py",
"copies": "1",
"size": "1859",
"license": "mit",
"hash": -5066301146719819000,
"line_mean": 20.367816092,
"line_max": 72,
"alpha_frac": 0.5465303927,
"autogenerated": false,
"... |
#### temporal normalization, spectral ####
#### whitening, bandpass filters are standard ##
#### types of filters you could add here ####
#### in this class definition. ####
def scale_data(self,c):
'''Scale the data and the data spectrum by multiplying by c (a scalar float)'''
self.data =... | {
"repo_name": "eileenrmartin/FastDispersionImages",
"path": "traceClass.py",
"copies": "1",
"size": "2176",
"license": "mit",
"hash": -8424648663059271000,
"line_mean": 40.0566037736,
"line_max": 329,
"alpha_frac": 0.6888786765,
"autogenerated": false,
"ratio": 3.327217125382263,
"config_test":... |
# Basics of Elliptic Curve Cryptography implementation on Python
import collections
from utils.inversion import Inverse
from utils.math_utils import MathUtil
class EC(object):
"""System of Elliptic Curve"""
def __init__(self, a, b, q):
"""elliptic curve as: (y**2 = x**3 + a * x + b) mod q
- a, ... | {
"repo_name": "gbanegas/KissECC",
"path": "ecc.py",
"copies": "1",
"size": "3470",
"license": "apache-2.0",
"hash": -3894163553757988000,
"line_mean": 31.4299065421,
"line_max": 88,
"alpha_frac": 0.4351585014,
"autogenerated": false,
"ratio": 2.913518052057095,
"config_test": false,
"has_no_k... |
"""Basic sort function examples"""
def bubble_sort(array):
"""bubble_sort(list) -> list
>>> bubble_sort([3, 2, 13, 4, 6, 5, 7, 8, 1, 20])
[1, 2, 3, 4, 5, 6, 7, 8, 13, 20]
"""
for value in range(len(array) - 1, 0, -1):
for key in range(value):
if array[key] > array[key + 1]:
... | {
"repo_name": "gdahlm/python_examples",
"path": "python_examples/basic_sorting.py",
"copies": "1",
"size": "4125",
"license": "mit",
"hash": -2129929336215026200,
"line_mean": 26.1381578947,
"line_max": 75,
"alpha_frac": 0.4930909091,
"autogenerated": false,
"ratio": 3.165771297006907,
"config_... |
# PyPI imports
import numpy
# Putil imports
import putil.exh
import putil.pcontracts
from .constants import PRECISION
from .functions import _C, _SEL, DataSource
###
# Exception tracing initialization code
###
"""
[[[cog
import os, sys
if sys.hexversion < 0x03000000:
import __builtin__
else:
import builtins ... | {
"repo_name": "pmacosta/putil",
"path": "putil/plot/basic_source.py",
"copies": "1",
"size": "11320",
"license": "mit",
"hash": 1185654135133675000,
"line_mean": 31.5287356322,
"line_max": 79,
"alpha_frac": 0.5984982332,
"autogenerated": false,
"ratio": 3.493827160493827,
"config_test": false,
... |
""" Basic splitter interface """
from pprint import pprint
import mwmatching
from util import lcm
class Cost(object):
def __init__(self, item, actor, amount):
self.item = item
self.actor = actor
self.amount = amount
def __eq__(self, other):
return self.item == other.item and ... | {
"repo_name": "jolynch/splitit",
"path": "splitit/splitter.py",
"copies": "1",
"size": "4320",
"license": "mit",
"hash": 5718362214577786000,
"line_mean": 35.9230769231,
"line_max": 90,
"alpha_frac": 0.5344907407,
"autogenerated": false,
"ratio": 3.9130434782608696,
"config_test": false,
"has... |
"""Basic ssh tunnel utilities, and convenience functions for tunneling
zeromq connections.
Authors
-------
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full... | {
"repo_name": "WillisXChen/django-oscar",
"path": "oscar/lib/python2.7/site-packages/IPython/external/ssh/tunnel.py",
"copies": "5",
"size": "12381",
"license": "bsd-3-clause",
"hash": -4503784017550713000,
"line_mean": 33.6806722689,
"line_max": 119,
"alpha_frac": 0.6031015265,
"autogenerated": fa... |
"""Basic ssh tunnel utilities, and convenience functions for tunneling
zeromq connections.
"""
# Copyright (C) 2010-2011 IPython Development Team
# Copyright (C) 2011- PyZMQ Developers
#
# Redistributed from IPython under the terms of the BSD License.
from __future__ import print_function
import atexit
import os
i... | {
"repo_name": "zanph/zanph",
"path": "flaskroulette/venv/lib/python2.7/site-packages/zmq/ssh/tunnel.py",
"copies": "5",
"size": "12940",
"license": "mit",
"hash": -9122214373043325000,
"line_mean": 33.414893617,
"line_max": 119,
"alpha_frac": 0.6262751159,
"autogenerated": false,
"ratio": 4.15809... |
# Basic Steps of Scientific Investigations
An overarching aim in this course is to give you a deeper
understanding of the scientific method. The problems we study will all
involve cases where we can apply classical mechanics. In our previous
material we already assumed that we had a model for the motion of an
object. ... | {
"repo_name": "CompPhysics/MachineLearning",
"path": "doc/src/LectureNotes/_build/jupyter_execute/testbook/chapter3.py",
"copies": "3",
"size": "33558",
"license": "cc0-1.0",
"hash": 4829858657682704000,
"line_mean": 31.6754385965,
"line_max": 415,
"alpha_frac": 0.734846677,
"autogenerated": false,... |
'''Basic strict go game logic.
'''
import enum
import re
import numpy as np
import itertools as it
@enum.unique
class State(enum.Enum):
empty = 0
black = 1
white = 2
@property
def enemy(self):
'Return the enemy of this player (for empty, return self).'
if self is State.black:
... | {
"repo_name": "DouglasOrr/Snippets",
"path": "sillygo/sillygo/game.py",
"copies": "1",
"size": "9570",
"license": "mit",
"hash": -5664441860867278000,
"line_mean": 32.5789473684,
"line_max": 84,
"alpha_frac": 0.5426332288,
"autogenerated": false,
"ratio": 4.162679425837321,
"config_test": false... |
# Basic string exercises
# Fill in the code for the functions below. main() is already set up
# to call the functions with a few different inputs,
# printing 'OK' when each function is correct.
# The starter code for each function includes a 'return'
# which is just a placeholder for your code.
# It's ok if you do not ... | {
"repo_name": "morfioce/basic-python3",
"path": "1 Strings/solution/string1.py",
"copies": "1",
"size": "3563",
"license": "mit",
"hash": -82818662538123040,
"line_mean": 30.5309734513,
"line_max": 88,
"alpha_frac": 0.6595565535,
"autogenerated": false,
"ratio": 3.0982608695652174,
"config_test... |
"""Basic Structure
Revision ID: 312c1d408043
Revises: 41984a51dbb2
Create Date: 2014-12-10 22:21:47.178397
"""
# revision identifiers, used by Alembic.
revision = '312c1d408043'
down_revision = '41984a51dbb2'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic ... | {
"repo_name": "cuducos/findaconf",
"path": "migrations/versions/312c1d408043_basic_structure.py",
"copies": "2",
"size": "7777",
"license": "mit",
"hash": -870525394324540300,
"line_mean": 43.9537572254,
"line_max": 106,
"alpha_frac": 0.6638806738,
"autogenerated": false,
"ratio": 3.3164179104477... |
"""Basic structure
Revision ID: 8a208be6362
Revises: ee26b6a2a19
Create Date: 2014-12-19 18:29:15.863743
"""
# revision identifiers, used by Alembic.
revision = '8a208be6362'
down_revision = 'ee26b6a2a19'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | {
"repo_name": "cuducos/whiskyton",
"path": "migrations/versions/8a208be6362_basic_structure.py",
"copies": "1",
"size": "2639",
"license": "mit",
"hash": -4276616261458804000,
"line_mean": 40.234375,
"line_max": 97,
"alpha_frac": 0.6627510421,
"autogenerated": false,
"ratio": 3.1833534378769603,
... |
"""basic syntax of the parameter file is::
# simple parameter file
[driver]
nsteps = 100 ; comment
max_time = 0.25
[riemann]
tol = 1.e-10
max_iter = 10
[io]
basename = myfile_
The recommended way to use this is for the code to have a master list
of parameters and their defaults ... | {
"repo_name": "harpolea/pyro2",
"path": "util/runparams.py",
"copies": "2",
"size": "9823",
"license": "bsd-3-clause",
"hash": 2873686670731576000,
"line_mean": 28.7666666667,
"line_max": 96,
"alpha_frac": 0.5432149038,
"autogenerated": false,
"ratio": 4.2213149978513105,
"config_test": false,
... |
"""Basic system of units (copied from Geant4).
The basic units are :
millimeter (millimeter)
nanosecond (nanosecond)
Mega electron Volt (MeV)
positron charge (eplus)
degree Kelvin (kelvin)
the amoun... | {
"repo_name": "jmalbos/pybbsens",
"path": "pybbsens/units.py",
"copies": "1",
"size": "5711",
"license": "mit",
"hash": -5348670992516508000,
"line_mean": 21.30859375,
"line_max": 72,
"alpha_frac": 0.5421117142,
"autogenerated": false,
"ratio": 2.720819437827537,
"config_test": false,
"has_no... |
'''Basic Table, Matrix and Vector functions for Python 2.2
License: Public Domain Author: Raymond Hettinger email: python@rcn.com
Updates and documentation: http://users.rcn.com/python/download/python.htm
Revision In Use: 'File %n, Ver %v, Date %f' '''
Version = 'File MATF... | {
"repo_name": "karimbahgat/PythonGis",
"path": "tests/advmatrix.py",
"copies": "1",
"size": "16557",
"license": "mit",
"hash": -8236372545910725000,
"line_mean": 41.5629820051,
"line_max": 134,
"alpha_frac": 0.5563205895,
"autogenerated": false,
"ratio": 3.0480486008836523,
"config_test": false... |
"""Basic target model."""
import logging
from math import sqrt
import random
import itertools
import argparse
import inspect
from unittest import TestCase
import numpy as np
import cv2
from collections import OrderedDict
from lumos.context import Context
from lumos.input import Projector, run
from matplotlib.pyplot ... | {
"repo_name": "napratin/nap",
"path": "nap/vision/retina.py",
"copies": "1",
"size": "17291",
"license": "mit",
"hash": -7391090809333643000,
"line_mean": 54.7774193548,
"line_max": 253,
"alpha_frac": 0.6940604939,
"autogenerated": false,
"ratio": 3.150118418655493,
"config_test": true,
"has_... |
"""Basic tasks."""
from __future__ import absolute_import
import logging
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import TemplateDoesNotExist
from django.utils import timezone
from messages_extends.models ... | {
"repo_name": "safwanrahman/readthedocs.org",
"path": "readthedocs/core/tasks.py",
"copies": "2",
"size": "1750",
"license": "mit",
"hash": -3781243596405464600,
"line_mean": 25.5151515152,
"line_max": 83,
"alpha_frac": 0.688,
"autogenerated": false,
"ratio": 4.4529262086514,
"config_test": fal... |
"""Basic tasks"""
from __future__ import absolute_import
import logging
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import TemplateDoesNotExist
from readthedocs.worker import app
log = logging.getLogger(__... | {
"repo_name": "pombredanne/readthedocs.org",
"path": "readthedocs/core/tasks.py",
"copies": "1",
"size": "1202",
"license": "mit",
"hash": 6997289647238781000,
"line_mean": 23.04,
"line_max": 79,
"alpha_frac": 0.6772046589,
"autogenerated": false,
"ratio": 4.451851851851852,
"config_test": fals... |
"""Basic tasks"""
import logging
from celery import task
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import TemplateDoesNotExist
log = logging.getLogger(__name__)
EMAIL_TIME_LIMIT = 30
@task(queue='web',... | {
"repo_name": "tddv/readthedocs.org",
"path": "readthedocs/core/tasks.py",
"copies": "1",
"size": "1147",
"license": "mit",
"hash": -6031640936728544000,
"line_mean": 22.8958333333,
"line_max": 79,
"alpha_frac": 0.6721883173,
"autogenerated": false,
"ratio": 4.4980392156862745,
"config_test": f... |
"""Basic TCP Server that will listen to port 6633."""
import logging
from socket import error as SocketError
from socketserver import BaseRequestHandler, TCPServer, ThreadingMixIn
from threading import current_thread
from kytos.core.connection import Connection, ConnectionState
from kytos.core.events import KytosEvent... | {
"repo_name": "macartur/kytos",
"path": "kytos/core/tcp_server.py",
"copies": "1",
"size": "6561",
"license": "mit",
"hash": -3836636464628747300,
"line_mean": 36.4914285714,
"line_max": 79,
"alpha_frac": 0.6093583295,
"autogenerated": false,
"ratio": 4.4693460490463215,
"config_test": false,
... |
"""Basic template tags library
"""
import collections
import copy
from functools import partial
import itertools
from .context import resolve
from .tag import tag_manager, parse_token
from .template import LazyTemplate, Template
def exec_with_context(func, context={}, context_diff={}):
'''Execute function with c... | {
"repo_name": "GrAndSE/lighty",
"path": "lighty/templates/templatetags.py",
"copies": "1",
"size": "10017",
"license": "bsd-3-clause",
"hash": -5660931735675364000,
"line_mean": 25.5,
"line_max": 79,
"alpha_frac": 0.5874014176,
"autogenerated": false,
"ratio": 4.118832236842105,
"config_test": ... |
"""Basic test of tone synthesis with `muser.live.Synth`"""
import muser.live as live
import math
import time
synth = live.Synth(channels=2)
def synth_on(synth, duration, pause=0):
"""Activate synth's tone generation for a time, then pause."""
synth.toggle()
time.sleep(duration)
synth.toggle()
tim... | {
"repo_name": "laporte-m/muser",
"path": "scripts/synth_tone.py",
"copies": "1",
"size": "1027",
"license": "mit",
"hash": 7045272809043878000,
"line_mean": 26.0263157895,
"line_max": 68,
"alpha_frac": 0.688412853,
"autogenerated": false,
"ratio": 2.7026315789473685,
"config_test": false,
"ha... |
"""Basic tests for Byterun."""
from __future__ import print_function
from . import vmtest
import six
PY3, PY2 = six.PY3, not six.PY3
class TestIt(vmtest.VmTestCase):
def test_constant(self):
self.assert_ok("17")
def test_globals(self):
self.assert_ok("""\
global xyz
... | {
"repo_name": "nedbat/byterun",
"path": "tests/test_basic.py",
"copies": "1",
"size": "17174",
"license": "mit",
"hash": -4854966612667652000,
"line_mean": 25.380952381,
"line_max": 78,
"alpha_frac": 0.3744031676,
"autogenerated": false,
"ratio": 4.154329946782777,
"config_test": true,
"has_n... |
"""Basic tests for contrib modules."""
import json
from django.test.utils import override_settings
from django.test.client import Client
from .base import TestImportBase, FixtureDir
from ..contrib.ajax_selects_lookups import (
CountryLookup,
RegionLookup,
CityLookup
)
class TestRestFramework(TestImportB... | {
"repo_name": "yourlabs/django-cities-light",
"path": "src/cities_light/tests/test_contrib.py",
"copies": "1",
"size": "7340",
"license": "mit",
"hash": -4449579968084004000,
"line_mean": 40.2303370787,
"line_max": 79,
"alpha_frac": 0.6291047827,
"autogenerated": false,
"ratio": 3.682388359257400... |
""" Basic tests for emitters. Does not contain an awefull extensive
test suite, as we test emitters quite well in test_both.py.
"""
from flexx.util.testing import run_tests_if_main, skipif, skip, raises
from flexx import event
def test_property():
class MyObject(event.HasEvents):
@event.pr... | {
"repo_name": "JohnLunzer/flexx",
"path": "flexx/event/tests/test_emitters.py",
"copies": "1",
"size": "6048",
"license": "bsd-2-clause",
"hash": 2420745222812270600,
"line_mean": 21.2352941176,
"line_max": 70,
"alpha_frac": 0.5239748677,
"autogenerated": false,
"ratio": 3.6,
"config_test": tru... |
"""Basic tests for os.popen()
Particularly useful for platforms that fake popen.
"""
import unittest
from test import support
import os, sys
# Test that command-lines get down as we expect.
# To do this we execute:
# python -c "import sys;print(sys.argv)" {rest_of_commandline}
# This results in Python being spa... | {
"repo_name": "brython-dev/brython",
"path": "www/src/Lib/test/test_popen.py",
"copies": "2",
"size": "2050",
"license": "bsd-3-clause",
"hash": -6138393152275473000,
"line_mean": 30.0606060606,
"line_max": 70,
"alpha_frac": 0.5751219512,
"autogenerated": false,
"ratio": 3.6283185840707963,
"co... |
"""Basic tests for os.popen()
Particularly useful for platforms that fake popen.
"""
import unittest
from test import test_support
import os, sys
# Test that command-lines get down as we expect.
# To do this we execute:
# python -c "import sys;print sys.argv" {rest_of_commandline}
# This results in ... | {
"repo_name": "Jeff-Tian/mybnb",
"path": "Python27/Lib/test/test_popen.py",
"copies": "3",
"size": "1652",
"license": "apache-2.0",
"hash": -1394303896948106200,
"line_mean": 30.3921568627,
"line_max": 72,
"alpha_frac": 0.5696125908,
"autogenerated": false,
"ratio": 3.58351409978308,
"config_te... |
""" Basic tests for slicer.
An unholy balance of use cases and test coverage.
"""
import pytest
from .slicer import AtomicSlicer
from . import Slicer as S
from . import Alias as A
from . import Obj as O
import pandas as pd
import numpy as np
import torch
from scipy.sparse import csc_matrix
from scipy.sparse import ... | {
"repo_name": "interpretml/slicer",
"path": "slicer/test_slicer.py",
"copies": "1",
"size": "13678",
"license": "mit",
"hash": 6889892331745115000,
"line_mean": 26.5211267606,
"line_max": 87,
"alpha_frac": 0.551396403,
"autogenerated": false,
"ratio": 2.9446716899892356,
"config_test": true,
... |
"""Basic tests for the CherryPy core: request handling."""
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
def setup_server():
from cherrypy.lib import safemime
safemime.init()
class Root:
def flashupload(self, Filedata, Upload, Filename):
... | {
"repo_name": "fmcingvale/cherrypy_gae",
"path": "test/test_safe_multipart.py",
"copies": "2",
"size": "2511",
"license": "bsd-3-clause",
"hash": -4703175357081136000,
"line_mean": 32.48,
"line_max": 76,
"alpha_frac": 0.5149342891,
"autogenerated": false,
"ratio": 3.468232044198895,
"config_tes... |
"""Basic tests for the CherryPy core: request handling."""
from cherrypy.test import test
test.prefer_parent_path()
import os
localDir = os.path.dirname(__file__)
import sys
import types
from httplib import IncompleteRead
import cherrypy
from cherrypy import _cptools, tools
from cherrypy.lib import http, static
fa... | {
"repo_name": "VHAINNOVATIONS/DmD",
"path": "scrubber/MIST_2_0_4/src/CherryPy-3.1.2/cherrypy/test/test_core.py",
"copies": "1",
"size": "48846",
"license": "apache-2.0",
"hash": 1976221777081744400,
"line_mean": 38.2337349398,
"line_max": 114,
"alpha_frac": 0.5513245711,
"autogenerated": false,
"... |
"""Basic tests for the CherryPy core: request handling."""
from cherrypy.test import test
test.prefer_parent_path()
import os
localDir = os.path.dirname(__file__)
import sys
import types
import cherrypy
from cherrypy import _cptools, tools
from cherrypy.lib import http, static
favicon_path = os.path.join(os.getcwd... | {
"repo_name": "fmcingvale/cherrypy_gae",
"path": "test/test_core.py",
"copies": "1",
"size": "43189",
"license": "bsd-3-clause",
"hash": -1543819025861342200,
"line_mean": 37.4585930543,
"line_max": 114,
"alpha_frac": 0.5440737225,
"autogenerated": false,
"ratio": 4.045050107708158,
"config_tes... |
"""Basic tests for the CherryPy core: request handling."""
import logging
import os
from unittest import mock
import pytest
import requests # FIXME: Temporary using it directly, better switch
import cherrypy
from cherrypy._cpcompat import ntou
from cherrypy.test import helper, logtest
localDir = os.path.dirname(__... | {
"repo_name": "Southpaw-TACTIC/TACTIC",
"path": "3rd_party/python3/site-packages/cherrypy/test/test_logging.py",
"copies": "2",
"size": "7013",
"license": "epl-1.0",
"hash": -721355724200554500,
"line_mean": 31.9248826291,
"line_max": 79,
"alpha_frac": 0.5496934265,
"autogenerated": false,
"ratio... |
"""Basic tests for the CherryPy core: request handling."""
import logging
from cheroot.test import webtest
import pytest
import requests # FIXME: Temporary using it directly, better switch
import cherrypy
from cherrypy.test.logtest import LogCase
# Some unicode strings.
tartaros = u'\u03a4\u1f71\u03c1\u03c4\u03b1... | {
"repo_name": "Safihre/cherrypy",
"path": "cherrypy/test/test_logging.py",
"copies": "2",
"size": "8315",
"license": "bsd-3-clause",
"hash": -2611273941947540500,
"line_mean": 27.8715277778,
"line_max": 78,
"alpha_frac": 0.5980757667,
"autogenerated": false,
"ratio": 3.354175070592981,
"config_... |
"""Basic tests for the CherryPy core: request handling."""
import os
localDir = os.path.dirname(__file__)
import sys
import types
import cherrypy
from cherrypy._cpcompat import IncompleteRead, itervalues, ntob
from cherrypy import _cptools, tools
from cherrypy.lib import httputil, static
from cherrypy.test._test_deco... | {
"repo_name": "CodyKochmann/pi-cluster",
"path": "software/src/cherrypy/test/test_core.py",
"copies": "1",
"size": "27329",
"license": "mit",
"hash": 1023281619537798500,
"line_mean": 36.3857729138,
"line_max": 82,
"alpha_frac": 0.5585641626,
"autogenerated": false,
"ratio": 4.055349458376614,
... |
"""Basic tests for the CherryPy core: request handling."""
from cherrypy.test import test
test.prefer_parent_path()
import os
localDir = os.path.dirname(__file__)
import sys
import types
from httplib import IncompleteRead
import cherrypy
from cherrypy import _cptools, tools
from cherrypy.lib import http... | {
"repo_name": "cread/ec2id",
"path": "cherrypy/test/test_core.py",
"copies": "1",
"size": "50091",
"license": "apache-2.0",
"hash": -1843336649022991400,
"line_mean": 38.2337349398,
"line_max": 114,
"alpha_frac": 0.5376215288,
"autogenerated": false,
"ratio": 4.072439024390244,
"config_test": t... |
"""Basic tests"""
import time
import os, os.path
import unittest
from cc.test import CCTestCase, VMAP, TMPDIR
class TestLogging(CCTestCase):
"""Test logging.
log-recv.ini::
[ccserver]
logfile = TMP/%(job_name)s.log
pidfile = TMP/%(job_name)s.pid
cc-role = remote
cc-s... | {
"repo_name": "markokr/cc",
"path": "cc/test/test_basic.py",
"copies": "1",
"size": "1425",
"license": "bsd-2-clause",
"hash": -2782078399245794000,
"line_mean": 23.1525423729,
"line_max": 71,
"alpha_frac": 0.5375438596,
"autogenerated": false,
"ratio": 3.268348623853211,
"config_test": true,
... |
"""Basic tests.
"""
import logging
import random
import requests
from ox_herd.core.utils import test_utils
class SimpleTest(test_utils.SelfContainedTest):
"""Run some simple tests.
"""
_user_info = {}
@classmethod
def setUpClass(cls): # pylint: disable=invalid-name
if not cls._user_i... | {
"repo_name": "aocks/ox_herd",
"path": "tests/flask_tests/test_basics.py",
"copies": "1",
"size": "3191",
"license": "bsd-2-clause",
"hash": -1444293796371793700,
"line_mean": 36.5411764706,
"line_max": 78,
"alpha_frac": 0.5850830461,
"autogenerated": false,
"ratio": 3.7234539089848306,
"config... |
"""basic tests of eager loaded attributes"""
from sqlalchemy.test.testing import eq_, is_, is_not_
import sqlalchemy as sa
from sqlalchemy.test import testing
from sqlalchemy.orm import joinedload, deferred, undefer, joinedload_all, backref
from sqlalchemy import Integer, String, Date, ForeignKey, and_, select, func
f... | {
"repo_name": "simplegeo/sqlalchemy",
"path": "test/orm/test_eager_relations.py",
"copies": "1",
"size": "76030",
"license": "mit",
"hash": -2315906513857306000,
"line_mean": 39.2062400846,
"line_max": 159,
"alpha_frac": 0.5277916612,
"autogenerated": false,
"ratio": 3.8296479121543343,
"config... |
"""basic tests of lazy loaded attributes"""
from sqlalchemy.orm import create_session
from sqlalchemy.orm import immediateload
from sqlalchemy.orm import mapper
from sqlalchemy.orm import relationship
from sqlalchemy.testing import eq_
from test.orm import _fixtures
class ImmediateTest(_fixtures.FixtureTest):
ru... | {
"repo_name": "wujuguang/sqlalchemy",
"path": "test/orm/test_immediate_load.py",
"copies": "4",
"size": "1935",
"license": "mit",
"hash": 5679846324964562000,
"line_mean": 24.8,
"line_max": 78,
"alpha_frac": 0.5100775194,
"autogenerated": false,
"ratio": 4.510489510489511,
"config_test": true,
... |
"""basic tests of lazy loaded attributes"""
from sqlalchemy.testing import assert_raises, assert_raises_message
import datetime
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import attributes, exc as orm_exc
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy import Integer, String, Forei... | {
"repo_name": "Cito/sqlalchemy",
"path": "test/orm/test_lazy_relations.py",
"copies": "1",
"size": "25399",
"license": "mit",
"hash": -796342615406512400,
"line_mean": 35.5979827089,
"line_max": 157,
"alpha_frac": 0.5288790897,
"autogenerated": false,
"ratio": 4.146098596147568,
"config_test": ... |
"""basic tests of lazy loaded attributes"""
from sqlalchemy.test.testing import assert_raises, assert_raises_message
import datetime
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import attributes, exc as orm_exc
import sqlalchemy as sa
from sqlalchemy.test import testing
from sqlalchemy import Integer, Str... | {
"repo_name": "obeattie/sqlalchemy",
"path": "test/orm/test_lazy_relations.py",
"copies": "1",
"size": "16846",
"license": "mit",
"hash": 6565429610220607000,
"line_mean": 34.0958333333,
"line_max": 149,
"alpha_frac": 0.5598955242,
"autogenerated": false,
"ratio": 3.8225550260948493,
"config_te... |
"""basic tests of lazy loaded attributes"""
import datetime
import sqlalchemy as sa
from sqlalchemy import and_
from sqlalchemy import bindparam
from sqlalchemy import Boolean
from sqlalchemy import Date
from sqlalchemy import ForeignKey
from sqlalchemy import ForeignKeyConstraint
from sqlalchemy import func
from sql... | {
"repo_name": "sqlalchemy/sqlalchemy",
"path": "test/orm/test_lazy_relations.py",
"copies": "3",
"size": "49098",
"license": "mit",
"hash": 5487177406871660000,
"line_mean": 27.6954997078,
"line_max": 79,
"alpha_frac": 0.4742963053,
"autogenerated": false,
"ratio": 4.298546664331991,
"config_te... |
# Copyright (c) Jupyter Development Team
# Copyright (c) 2014, Ramalingam Saravanan <sarava@sarava.net>
# Distributed under the terms of the Simplified BSD License.
from __future__ import absolute_import, print_function
import unittest
from terminado import *
import tornado
import tornado.httpserver
from ... | {
"repo_name": "takluyver/terminado",
"path": "terminado/tests/basic_test.py",
"copies": "1",
"size": "9046",
"license": "bsd-2-clause",
"hash": 1852386569799538200,
"line_mean": 34.6234817814,
"line_max": 90,
"alpha_frac": 0.5637850984,
"autogenerated": false,
"ratio": 3.9245119305856835,
"conf... |
# basictimerapp - a really simple timer application.
# This should be run using the command line:
# pythonwin /app demos\basictimerapp.py
import win32ui
import win32api
import win32con
import sys
from pywin.framework import app, cmdline, dlgappcore, cmdline
import timer
import time
import string
class TimerAppDialog(d... | {
"repo_name": "int19h/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py",
"copies": "6",
"size": "6382",
"license": "apache-2.0",
"hash": 1575607677738073900,
"line_mean": 27.8778280543,
"line_max": 125,
"alpha_frac": 0.7118458164,
... |
""" Basic todo list using webpy 0.3 """
import web
import model
import json
### Url mappings
urls = (
'/', 'Index',
'/login', 'Login',
'/logout', 'Logout',
'/del/(\d+)', 'Delete',
'/service/login/(.*)/(.*)', 'ServiceLogin',
'/service/todo/', 'ServiceTodoGet',
'/service/todo/add/(.*)', 'Ser... | {
"repo_name": "Zihuatanejo50/50AH-code",
"path": "hack023-server/todo.py",
"copies": "6",
"size": "3881",
"license": "mit",
"hash": -4521442399124581400,
"line_mean": 25.7655172414,
"line_max": 87,
"alpha_frac": 0.5745941768,
"autogenerated": false,
"ratio": 3.710325047801147,
"config_test": fa... |
""" Basic todo list using webpy 0.3 """
import web
import model
### Url mappings
urls = (
'/', 'Index',
'/del/(\d+)', 'Delete'
)
### Templates
render = web.template.render('templates', base='base')
class Index:
form = web.form.Form(
web.form.Textbox('title', web.form.notnull,
desc... | {
"repo_name": "ptphp/PyLib",
"path": "src/webpy/todo/todo.py",
"copies": "1",
"size": "1036",
"license": "apache-2.0",
"hash": 7056555537330738000,
"line_mean": 18.5660377358,
"line_max": 54,
"alpha_frac": 0.528957529,
"autogenerated": false,
"ratio": 3.535836177474403,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.