text stringlengths 0 1.05M | meta dict |
|---|---|
#AND HOW WE SPEND OUR DAYS IS, OFCOURSE, HOW WE SPEND OUR LIVES
#display images according to twitchbrain api data
"""
import tkinter as tk
class firstPage(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
... | {
"repo_name": "jonathanpreston/twitchbrain",
"path": "GUI.py",
"copies": "1",
"size": "2619",
"license": "mpl-2.0",
"hash": 1139406246861698800,
"line_mean": 24.427184466,
"line_max": 108,
"alpha_frac": 0.5987017946,
"autogenerated": false,
"ratio": 3.1900121802679657,
"config_test": false,
"... |
"""Andor camera interface
The Andor SDK is generic for all of their cameras. However, this was
written more for using the Andor iXon line, so although it will
probably work with any Andor camera, there may be some unforeseen
bugs.
"""
from __future__ import print_function
import time
import traceback as tb
import ct... | {
"repo_name": "mivade/qCamera",
"path": "qcamera/andor.py",
"copies": "1",
"size": "17045",
"license": "bsd-2-clause",
"hash": -2588544046977759000,
"line_mean": 35.8142548596,
"line_max": 99,
"alpha_frac": 0.557113523,
"autogenerated": false,
"ratio": 4.06413924654268,
"config_test": false,
... |
"""Andor."""
# --- import --------------------------------------------------------------------------------------
import os
import pathlib
import time
import numpy as np
from ._data import Data
from .. import exceptions as wt_exceptions
from ..kit import _timestamp as timestamp
# --- define ---------------------... | {
"repo_name": "wright-group/WrightTools",
"path": "WrightTools/data/_solis.py",
"copies": "1",
"size": "3508",
"license": "mit",
"hash": -6146749965863240000,
"line_mean": 28.2333333333,
"line_max": 99,
"alpha_frac": 0.5324971494,
"autogenerated": false,
"ratio": 3.9460067491563553,
"config_tes... |
"""Andrea and Maria each have an array of integers. Andrea wants to change her array to match Maria's. For each element
of her array, she can increment or decrement one digit in one item in one move. How many moves will it take Andrea to
match Maria's array. No reordering of the digits is allowed.
For example, consider... | {
"repo_name": "pycharmer/py-training",
"path": "algorithms/minimummoves.py",
"copies": "1",
"size": "1666",
"license": "apache-2.0",
"hash": -5249121630485899000,
"line_mean": 29.7037037037,
"line_max": 120,
"alpha_frac": 0.7201447527,
"autogenerated": false,
"ratio": 3.425619834710744,
"config... |
# Andrea Masi 2014 eraclitux@gmail.com
import json
import time
from ipcampy.globals import cam_types
def __parse_args(cam_c):
"""Arrange class init params from conf file.
Returns: a dict with values."""
user = None
pswd = None
name = None
address = "{address}:{port}".format(**cam_c)
if "us... | {
"repo_name": "eraclitux/ipcampy",
"path": "ipcampy/sentry.py",
"copies": "1",
"size": "1164",
"license": "mit",
"hash": -2219697606991500000,
"line_mean": 28.8461538462,
"line_max": 73,
"alpha_frac": 0.5970790378,
"autogenerated": false,
"ratio": 3.1716621253405997,
"config_test": false,
"ha... |
# Andrea Masi 2014 eraclitux@gmail.com
import os
import datetime
def ensure_secret():
"""Check if secret key to encryot sessions exists,
generate it otherwise."""
home_dir = os.environ['HOME']
file_name = home_dir + "/.ipcamweb"
if os.path.exists(file_name):
with open(file_name, "r") as s_... | {
"repo_name": "eraclitux/ipcampy",
"path": "ipcamweb/utils.py",
"copies": "1",
"size": "1768",
"license": "mit",
"hash": -1123826951785026700,
"line_mean": 33.6666666667,
"line_max": 85,
"alpha_frac": 0.604638009,
"autogenerated": false,
"ratio": 3.4,
"config_test": false,
"has_no_keywords": ... |
# Andrei Antonescu
# Initial Date: January 30, 2014
# Last Updated: February 18, 2014
#
# We assume we only use two motors PORT_A & PORT_B
from BrickPi import * #import BrickPi.py file to use BrickPi operations
import math
eps = 1e-8
m1 = PORT_A
m2 = PORT_B
m3 = PORT_C
encToCm = 42 #47 # 53.03 # 42
encToDeg = 6.88... | {
"repo_name": "andrei-alpha/robotics",
"path": "utils.py",
"copies": "1",
"size": "5342",
"license": "mit",
"hash": 3601251321875410000,
"line_mean": 21.5400843882,
"line_max": 104,
"alpha_frac": 0.5909771621,
"autogenerated": false,
"ratio": 2.5944633317144246,
"config_test": false,
"has_no_... |
# Andrei Antonescu
# Initial Date: January 30, 2014
# Last Updated: January 30, 2014
#
# We assume we only use two motors PORT_A & PORT_B
from BrickPi import * #import BrickPi.py file to use BrickPi operations
m1 = PORT_A
m2 = PORT_B
BrickPiSetup() # setup the serial port for communication
BrickPiSetupSensors() ... | {
"repo_name": "andrei-alpha/robotics",
"path": "samples/motor_rotate.py",
"copies": "1",
"size": "3083",
"license": "mit",
"hash": -3700901736813010400,
"line_mean": 22.3560606061,
"line_max": 85,
"alpha_frac": 0.5974699968,
"autogenerated": false,
"ratio": 2.7115215479331574,
"config_test": fa... |
# Andres Felipe Gomez
# Not Finished! :(
# 03/28/2014
import pickle
import math
def posIntersect(termList_X,termList_Y,k):
a = 1;
b = 1;
intersection = [];
while a < len(termList_X) and b < len(termList_Y):
if len(termList_X[a]) < len(termList_Y[b]):
posArray_A = termList_Y[b]
posArray_B = termList_X... | {
"repo_name": "anfego/search_IR",
"path": "queryAnswer.py",
"copies": "1",
"size": "4873",
"license": "mit",
"hash": 4641505936510449000,
"line_mean": 19.3891213389,
"line_max": 60,
"alpha_frac": 0.6150215473,
"autogenerated": false,
"ratio": 2.5274896265560165,
"config_test": false,
"has_no_... |
#Andrew Dhawan
#Sept 8 2016
#count_cycles.py
#This code enables the count of unique cycles of a particular length
#implements a DFS on an adjacency matrix for a weighted graph.
#Element (i,j)=1 of the adjacency matrix indicates a directed edge
#from node j to node i.
import numpy as np
def find_path_to_vertex (graph,... | {
"repo_name": "andrewdhawan/alk-collateral-sensitivity",
"path": "count_cycles.py",
"copies": "1",
"size": "2252",
"license": "mit",
"hash": 856495963935038100,
"line_mean": 21.3069306931,
"line_max": 327,
"alpha_frac": 0.5910301954,
"autogenerated": false,
"ratio": 2.0585009140767823,
"config_... |
import pymongo
# gets the next number in a sequence
def get_next_sequence_number(name):
connection = pymongo.MongoClient("mongodb://localhost")
db = connection.test
counters = db.counters
# let's get ourselves a sequence number
# note there are two other varients of this call as well:
# find... | {
"repo_name": "nesterione/experiments-of-programming",
"path": "MongoDB/Python/Week2/Classroom/using_find_and_modify.py",
"copies": "1",
"size": "1061",
"license": "apache-2.0",
"hash": 4367894597840134000,
"line_mean": 30.2058823529,
"line_max": 92,
"alpha_frac": 0.5928369463,
"autogenerated": fal... |
#Andrew MacInnes
import mediacloud, datetime, logging, unittest
logging.basicConfig(filename="logger.log", filemode = 'w', level=logging.INFO)
def activateNow():
mc = mediacloud.api.MediaCloud('API goes here')
logging.info('Successful implementation.')
#Find the annual number of sentences in US mainstream media ... | {
"repo_name": "amacinn/MAS500",
"path": "homework2.py",
"copies": "1",
"size": "3746",
"license": "mit",
"hash": -676208755728137600,
"line_mean": 75.4489795918,
"line_max": 158,
"alpha_frac": 0.7058195408,
"autogenerated": false,
"ratio": 2.818660647103085,
"config_test": false,
"has_no_keyw... |
#Andrew Michaud
#12/3/11
#CS 5 Green
#Picobot Project Milestone
import random
ROWS = 20
COLUMNS = 20
STATES = 5
TRIALS = 20
STEPS = 800
allowedPatterns = ['xxxx','Nxxx','NExx','NxWx','xxxS','xExS','xxWS','xExx',
'xxWx']
class Program:
def __init__(self):
"""Initializes... | {
"repo_name": "andrewmichaud/picobot-GA",
"path": "milestone.py",
"copies": "1",
"size": "7790",
"license": "mit",
"hash": 7868360413167456000,
"line_mean": 31.5775862069,
"line_max": 82,
"alpha_frac": 0.5643132221,
"autogenerated": false,
"ratio": 3.354866494401378,
"config_test": false,
"ha... |
# Andrew Michaud
# Original:
# 11/23/11-12/8/11
# Updated/cleaned:
# 17 Feb 2015
# CS 5 Green
# Final Project
# Comments on my project:
# I tested my code mostly by just running the GA function (usually with 200
# individuals and 10-20 generations), and obseving what happened. I tried
# changing severa... | {
"repo_name": "andrewmichaud/picobot-GA",
"path": "Final Project.py",
"copies": "1",
"size": "29737",
"license": "mit",
"hash": -1599193711402300400,
"line_mean": 38.7914951989,
"line_max": 83,
"alpha_frac": 0.5833137169,
"autogenerated": false,
"ratio": 3.9958344531040044,
"config_test": false... |
# Andrew Miller <amiller@cs.ucf.edu> 2011
#
# BlockPlayer - 3D model reconstruction using the Lattice-First algorithm
# See:
# "Interactive 3D Model Acquisition and Tracking of Building Block Structures"
# Andrew Miller, Brandyn White, Emiko Charbonneau, Zach Kanzler, and Joseph J. LaViola Jr.
# IEEE VR 2012,... | {
"repo_name": "amiller/blockplayer",
"path": "demos/demo_preprocess.py",
"copies": "1",
"size": "1604",
"license": "mpl-2.0",
"hash": -4151994649448473000,
"line_mean": 27.1403508772,
"line_max": 93,
"alpha_frac": 0.6857855362,
"autogenerated": false,
"ratio": 3.0037453183520597,
"config_test":... |
# Andrew Miller <amiller@cs.ucf.edu> 2011
# Zach Kanzler <they4kman@gmail.com>
#
# BlockPlayer - 3D model reconstruction using the Lattice-First algorithm
# See:
# "Interactive 3D Model Acquisition and Tracking of Building Block Structures"
# Andrew Miller, Brandyn White, Emiko Charbonneau, Zach Kanzler, and Jos... | {
"repo_name": "amiller/blockplayer",
"path": "blockplayer/blockdraw.py",
"copies": "1",
"size": "3259",
"license": "mpl-2.0",
"hash": 3658298909119999500,
"line_mean": 29.7452830189,
"line_max": 93,
"alpha_frac": 0.6011046333,
"autogenerated": false,
"ratio": 2.8866253321523474,
"config_test": ... |
# Andrew Powell
#
# This script is necessary to convert the binary into a format acceptable by Xilinx to load into their BRAM.
import argparse, struct, binascii, array, time
if __name__ == '__main__':
# Create the parser.
parser = argparse.ArgumentParser(description='Convert binary to a coe files.')
... | {
"repo_name": "andrewandrepowell/axiplasma",
"path": "misc/bin2coe.py",
"copies": "1",
"size": "5774",
"license": "mit",
"hash": -6714485008799538000,
"line_mean": 48.775862069,
"line_max": 108,
"alpha_frac": 0.5777623831,
"autogenerated": false,
"ratio": 3.649810366624526,
"config_test": false... |
#Andrew St. Ours
#3/28/17
#Mountain bike game
#welcome
print("Welcome to Whistler Mountain Bike Park. \nToday you are going to"
"have a choice of three trails to ride on. \nA green circle trail, a blue"
" square trail and a black diamond trail.")
print("\nMake sure you pick the trail that appli... | {
"repo_name": "astours17/Mountain-Biking-2.0",
"path": "St. Ours_MountainBikeGame.py",
"copies": "1",
"size": "1807",
"license": "mit",
"hash": 1388407096376418800,
"line_mean": 22.7534246575,
"line_max": 82,
"alpha_frac": 0.6065301605,
"autogenerated": false,
"ratio": 3.170175438596491,
"confi... |
#Andrew Tan, 1/31, Section 010, Math Expressions
#Storing calculated values to variables
conv = 0.621
lightspeed = 299792.458
miles_lightspeed = lightspeed * conv
half_miles_lightspeed = miles_lightspeed * 0.5
quarter_miles_lightspeed = miles_lightspeed * 0.25
revolution = 66600
km_revolution = revolution / c... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign1_problem3.py",
"copies": "1",
"size": "1053",
"license": "mit",
"hash": -8976474035668110000,
"line_mean": 34.3103448276,
"line_max": 60,
"alpha_frac": 0.6847103514,
"autogenerated": false,
"ratio": 2.686224489795918,
"con... |
#Andrew Tan, 2/15, Section 010, NYU Calendar
#Ask user to input month and date
m = int(input("Enter a month (1-12): "))
d = int(input("Enter a day (1-31): "))
#Convert month format
if m == 1:
month = "January"
elif m == 2:
month = "Feburary"
elif m == 3:
month = "March"
elif m == 4:
mont... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign3_problem3.py",
"copies": "1",
"size": "1692",
"license": "mit",
"hash": 7220874910001633000,
"line_mean": 25.737704918,
"line_max": 79,
"alpha_frac": 0.5502364066,
"autogenerated": false,
"ratio": 2.801324503311258,
"confi... |
#Andrew Tan, 2/16, Section 010, Arrows
#Define right()
def right():
#Define variables
trow = tcol + tcol - 1
row = 1
#Top half
while row <= tcol:
rep = 1
while rep < row:
print(" ", end="")
rep += 1
print("*")
row += 1
... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign4_problem3.py",
"copies": "1",
"size": "1481",
"license": "mit",
"hash": -1307996440044984600,
"line_mean": 18.8591549296,
"line_max": 55,
"alpha_frac": 0.4328156651,
"autogenerated": false,
"ratio": 4.013550135501355,
"con... |
#Andrew Tan, 2/16, Section 010, Roll the Dice
from random import randint
result = False
while result == False:
s = int(input("How many sides on your dice? "))
#Check for valid data
if s < 3:
print("Sorry, that's not a valid size value. Please choose a positive number.")
conti... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign4_problem1.py",
"copies": "1",
"size": "1502",
"license": "mit",
"hash": 5997404035860077000,
"line_mean": 29.2916666667,
"line_max": 87,
"alpha_frac": 0.4394141145,
"autogenerated": false,
"ratio": 4.230985915492957,
"conf... |
#Andrew Tan, 2/17, Section 010, Pick Up Sticks
player = 1
#Check for valid number of sticks
while True:
sticks = int(input("How many sticks are on the table? (enter a number between 10 and 100): "))
if sticks < 10 or sticks > 100:
print("Invalid # of sticks, please try again.")
contin... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign4_problem2.py",
"copies": "1",
"size": "1025",
"license": "mit",
"hash": 2418455050262915600,
"line_mean": 29.0606060606,
"line_max": 98,
"alpha_frac": 0.5951219512,
"autogenerated": false,
"ratio": 3.7683823529411766,
"con... |
#Andrew Tan, 2/2, Section 010, Data Size Converter
#Ask user to input file size
size_KB = float(input("Enter a file size, in kilobytes (KB): "))
#Converting and formatting the input
size_B = size_KB * 1024
size_b = size_B * 8
size_MB = size_KB / 1024
size_GB = size_MB / 1024
fsize_B = format(size_B, ">20,... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign2_problem3.py",
"copies": "1",
"size": "1336",
"license": "mit",
"hash": 7866315296839428000,
"line_mean": 35.1111111111,
"line_max": 189,
"alpha_frac": 0.6489520958,
"autogenerated": false,
"ratio": 2.8365180467091293,
"co... |
#Andrew Tan, 2/2, Section 010, Grade Calculator
#Ask user for name and class
name = input("What is your name? ")
course = input("What class are you in? ")
print()
#Ask user for weightage and test scores
weight_test = float(input("How much are tests worth in this class (i.e. 0.40 for 40%): "))
test1 = float... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign2_problem2.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": -3629752821852159500,
"line_mean": 28.5641025641,
"line_max": 103,
"alpha_frac": 0.6543624161,
"autogenerated": false,
"ratio": 2.9651741293532337,
"c... |
#Andrew Tan, 3/30, Section 010, Part 1b
#Ask user for username and validate
while True:
username = str(input("Please enter a username: "))
if len(username) < 8 or len(username) > 15:
print("Username must be between 8 and 15 characters.\n")
continue
if username.isalnum() == False:
... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign7_part1b.py",
"copies": "1",
"size": "2463",
"license": "mit",
"hash": 2436013148459495000,
"line_mean": 30.4078947368,
"line_max": 79,
"alpha_frac": 0.5680064961,
"autogenerated": false,
"ratio": 4.569573283858998,
"config... |
#Andrew Tan, 3/30, Section 010, Part 2b
#Ask user for input
name = str.lower(input("Name: "))
#Clean up user input
index = 0
for i in name:
if ord(i) < 97 or ord(i) > 122:
name = name.replace(name[index], "", 1)
else:
index += 1
print("Your 'cleaned up' name is : %s" %(name))
#C... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign7_part2b.py",
"copies": "1",
"size": "1211",
"license": "mit",
"hash": 5748453541545539000,
"line_mean": 27.5365853659,
"line_max": 95,
"alpha_frac": 0.5227085054,
"autogenerated": false,
"ratio": 3.2379679144385025,
"confi... |
#Andrew Tan, 3/30, Section 010, Part 3b
import random
#Define functions
def add_letters(word, num):
new_word = ""
for char in word:
insert = ""
for i in range(num):
rdm = 91
while rdm in range(91, 97):
rdm = random.randint(65, 122)
... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign7_part3b.py",
"copies": "1",
"size": "1615",
"license": "mit",
"hash": -22560099993465176,
"line_mean": 27.3636363636,
"line_max": 76,
"alpha_frac": 0.5287925697,
"autogenerated": false,
"ratio": 3.738425925925926,
"config_... |
#Andrew Tan, 4/12, Section 010, Part 2
#Product lists
product_names = ["hamburger", "cheeseburger", "small fries"]
product_costs = [0.99, 1.29, 1.49]
product_stock = [10, 5, 20]
#Main program
while True:
#Ask user to select mode and check validity
option = str.lower(input("(s)earch, (l)ist, (a)dd, (... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign8_part2.py",
"copies": "1",
"size": "5111",
"license": "mit",
"hash": 6410638662772044000,
"line_mean": 33.7412587413,
"line_max": 145,
"alpha_frac": 0.4746624927,
"autogenerated": false,
"ratio": 4.432784041630529,
"config... |
#Andrew Tan, 4/12, Section 010, Part 3
import random
#Define possible cards and associated values
cards = ['10 of Hearts', '9 of Hearts', '8 of Hearts', '7 of Hearts', '6 of Hearts', '5 of Hearts', '4 of Hearts', '3 of Hearts', '2 of Hearts', 'Ace of Hearts', 'King of Hearts', 'Queen of Hearts', 'Jack of Hearts... | {
"repo_name": "sojournexx/python",
"path": "Assignments/TanAndrew_assign8_part3.py",
"copies": "1",
"size": "2988",
"license": "mit",
"hash": -497375878390467800,
"line_mean": 43.9692307692,
"line_max": 854,
"alpha_frac": 0.5967202142,
"autogenerated": false,
"ratio": 2.967229394240318,
"config... |
#Andrew Tan, 4/24, Section 010, Assignment 9
#Open file requested by user
try:
file = input("Enter a class file to grade (i.e. class1 for class1.txt): ")
file_obj = open(file+".txt", "r")
print("Successfully opened {}.txt\n".format(file))
alldata = file_obj.read()
student = alldata.split("\... | {
"repo_name": "sojournexx/python",
"path": "Assignments/Assignment9/TanAndrew_assign9.py",
"copies": "1",
"size": "3574",
"license": "mit",
"hash": -170414812804154940,
"line_mean": 33.0392156863,
"line_max": 109,
"alpha_frac": 0.5047565753,
"autogenerated": false,
"ratio": 3.7463312368972748,
... |
#Andrew Tan, 5/3, Section 010, Part 3
import random
#Create dictionary from external file
file_obj = open("python_asg10_Roget_Thesaurus.txt", "r")
alldata = file_obj.read()
splitdata = alldata.split("\n")
thesaurus = {}
for i in range(len(splitdata)):
value = splitdata[i].split(",")
key = value... | {
"repo_name": "sojournexx/python",
"path": "Assignments/Assignment10/TanAndrew_assign10_part3.py",
"copies": "1",
"size": "1201",
"license": "mit",
"hash": 3819503848248699000,
"line_mean": 24.6888888889,
"line_max": 103,
"alpha_frac": 0.6444629475,
"autogenerated": false,
"ratio": 3.040506329113... |
# Andrew Wilson
# Translated from Joe Groff's "An intro to modern OpenGL"
# http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-1:-The-Graphics-Pipeline.html
from OpenGL.GL import *
from OpenGL.GLU import gluBuild2DMipmaps
import pygame, pygame.image, pygame.key
from pygame.locals import *
import numpy
im... | {
"repo_name": "weeble/clockworkcodex_ogl",
"path": "ogl_helpers.py",
"copies": "1",
"size": "3395",
"license": "mit",
"hash": 8318609516410703000,
"line_mean": 30.1467889908,
"line_max": 96,
"alpha_frac": 0.6583210604,
"autogenerated": false,
"ratio": 3.318670576735093,
"config_test": false,
... |
class AnalysisInitDefaultValue(object):
APP_NAME = 'kltn'
A_PERMISSION = 1
A_CFG = 2
A_STRING = 3
A_PACKAGES = 4
A_PACKAGES_IE = 5
A_PACKAGES_II = 6
A_SEARCH_PACKAGES = 7
A_SEARCH_METHODS = 8
A_OBJECT_CREATED = 9
A_DynCode = 10
A_ReflectionCode = ... | {
"repo_name": "congthuc/androguard-2.0-custom",
"path": "resourcefactories/AnalysisInitDefaultValue.py",
"copies": "1",
"size": "4417",
"license": "apache-2.0",
"hash": -4989600342780129000,
"line_mean": 39.1545454545,
"line_max": 60,
"alpha_frac": 0.5800316957,
"autogenerated": false,
"ratio": 4... |
ANDROID_BOOM_ICON = "ANDROID_BOOM_ICON.png"
ANDROID_LOCK_BUTTON = "1412005436007.png"
CLASH_GAME_ICON = "1449765483207.png"
CLASH_RELOAD_BUTTON = "clash_reload_button.png"
CLASH_RELOAD_ANOTHER_DEVICE = "clash_reload_another_device.png"
CLASH_UPGRADE_ICON = "CLASH_UPGRADE_ICON.png"
CLASH_UPGRADE_BUTTON = Pattern("CLASH_... | {
"repo_name": "mackuntu/CoCScript",
"path": "boom.sikuli/boom.py",
"copies": "1",
"size": "1201",
"license": "mit",
"hash": -3765352941671351300,
"line_mean": 34.3529411765,
"line_max": 72,
"alpha_frac": 0.7160699417,
"autogenerated": false,
"ratio": 2.6395604395604395,
"config_test": false,
... |
"""Built-in module for archiving a project"""
from __future__ import absolute_import
from __future__ import print_function
import os
import zipfile
import dtf.properties as prop
import dtf.logging as log
from dtf.module import Module
class archive(Module): # pylint: disable=invalid-name
"""Module class for ar... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/core/cmds/archive.py",
"copies": "2",
"size": "2591",
"license": "apache-2.0",
"hash": -3578807915310148600,
"line_mean": 23.214953271,
"line_max": 74,
"alpha_frac": 0.5901196449,
"autogenerated": false,
"ratio": 3.8385185185185184,
"conf... |
"""Built-in module for client on device """
from __future__ import absolute_import
from __future__ import print_function
import os.path
from argparse import ArgumentParser
import dtf.logging as log
import dtf.properties as prop
import dtf.adb as adb
from dtf.module import Module
from dtf.constants import DTF_CLIENT
... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/core/cmds/client.py",
"copies": "2",
"size": "11429",
"license": "apache-2.0",
"hash": -1896497214437262000,
"line_mean": 28.9188481675,
"line_max": 78,
"alpha_frac": 0.5562166419,
"autogenerated": false,
"ratio": 3.907350427350427,
"conf... |
"""Built-in module for creating dtf project"""
from __future__ import absolute_import
from __future__ import print_function
import os
import os.path
import re
import signal
import time
from dtf.module import Module
from dtf.properties import set_prop
import dtf.adb as adb
import dtf.constants as const
import dtf.core... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/core/cmds/init.py",
"copies": "2",
"size": "12225",
"license": "apache-2.0",
"hash": -1764139113007522300,
"line_mean": 27.7647058824,
"line_max": 79,
"alpha_frac": 0.5658895706,
"autogenerated": false,
"ratio": 3.8262910798122065,
"config_test... |
"""Built-in module for getting the status of a project"""
from __future__ import absolute_import
from __future__ import print_function
from dtf.module import Module
import dtf.adb as DtfAdb
class status(Module): # pylint: disable=invalid-name
"""Module class for getting the status of a device"""
adb = Dt... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/core/cmds/status.py",
"copies": "2",
"size": "1505",
"license": "apache-2.0",
"hash": 5816155541766705000,
"line_mean": 26.8703703704,
"line_max": 74,
"alpha_frac": 0.6584717608,
"autogenerated": false,
"ratio": 4.0675675675675675,
"confi... |
"""Built-in module for reseting a project"""
from __future__ import absolute_import
from __future__ import print_function
import os
import dtf.core.compat as compat
import dtf.core.utils as utils
import dtf.logging as log
from dtf.module import Module
TAG = 'reset'
class reset(Module): # pylint: disable=invalid-... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/core/cmds/reset.py",
"copies": "2",
"size": "1519",
"license": "apache-2.0",
"hash": -1685419935461034800,
"line_mean": 29.38,
"line_max": 75,
"alpha_frac": 0.6787360105,
"autogenerated": false,
"ratio": 3.8651399491094147,
"config_test": false... |
"""dtf Constants"""
from __future__ import absolute_import
import dtf
VERSION = dtf.__version__
DTF_CLIENT = "com.dtf.client"
# API Constants
API_1 = 1
API_2 = 2
API_CUPCAKE = 3
API_DONUT = 4
API_ECLAIR = 5
API_ECLAIR_R1 = 6
API_ECLAIR_R2 = 7
API_FROYO = 8
API_GINGERBREAD = 9
API_GINGERBREAD_R1 = 10
API_HONEYCOMB =... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/constants.py",
"copies": "2",
"size": "1299",
"license": "apache-2.0",
"hash": -7721596747282833000,
"line_mean": 23.5094339623,
"line_max": 74,
"alpha_frac": 0.7305619707,
"autogenerated": false,
"ratio": 2.634888438133874,
"config_test"... |
"""dtf logging framework"""
from __future__ import absolute_import
from sys import stdout
from time import localtime, strftime
from colored import attr
import dtf.core.utils as utils
import dtf.colors as colors
# Can override just like the shell
LOG_LEVEL_FILE = 4 # By default, log E-V
LOG_LEVEL_STDOUT = 4 # B... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/logging.py",
"copies": "2",
"size": "4744",
"license": "apache-2.0",
"hash": 523865761855982340,
"line_mean": 22.3694581281,
"line_max": 74,
"alpha_frac": 0.5807335582,
"autogenerated": false,
"ratio": 3.70625,
"config_test": false,
"has_no_k... |
"""dtf Module Template"""
from __future__ import absolute_import
import os
import dtf.logging as log
import dtf.properties as prop
import dtf.core.packagemanager as pm
from dtf.globals import DTF_PACKAGES_DIR
from dtf.exceptions import DtfException
TAG = "dtf-module"
def sub_cmd(name, usage=""):
"""Decorator ... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/module.py",
"copies": "2",
"size": "3329",
"license": "apache-2.0",
"hash": -3798404996906875400,
"line_mean": 25.0078125,
"line_max": 75,
"alpha_frac": 0.5896665665,
"autogenerated": false,
"ratio": 4.020531400966184,
"config_test": false,
"... |
"""dtf public package querying"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import imp
import inspect
import os
import os.path
import shlex
import sys
import subprocess
import traceback
from contextlib import contextmanager
import dtf.adb as ... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/packages.py",
"copies": "2",
"size": "12037",
"license": "apache-2.0",
"hash": -3890898177285191700,
"line_mean": 25.4549450549,
"line_max": 75,
"alpha_frac": 0.6018110825,
"autogenerated": false,
"ratio": 3.6631162507608033,
"config_test": fal... |
""" dtf's package manager """
from __future__ import absolute_import
from __future__ import print_function
import os
import os.path
import tempfile
import zipfile
from argparse import ArgumentParser
import requests
from dtf.module import Module
import dtf.globals
import dtf.logging as log
import dtf.core.compat as c... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/core/cmds/pm.py",
"copies": "2",
"size": "25450",
"license": "apache-2.0",
"hash": -3494094761748516400,
"line_mean": 31.0933165195,
"line_max": 79,
"alpha_frac": 0.54,
"autogenerated": false,
"ratio": 4.27515538384008,
"config_test": false,
... |
""" dtf Utilities """
from __future__ import absolute_import
from hashlib import md5
import errno
import os
import os.path
import shutil
import stat
import dtf.core.compat as compat
CONFIG_FILE_NAME = '.dtfini'
LOG_FILE_NAME = '.dtflog'
REPORTS_DIRECTORY = 'reports'
DBS_DIRECTORY = '.dbs'
LOCAL_MODULES_DIRECTORY = ... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/core/utils.py",
"copies": "2",
"size": "4466",
"license": "apache-2.0",
"hash": -6970317325029768000,
"line_mean": 20.3684210526,
"line_max": 76,
"alpha_frac": 0.6372592924,
"autogenerated": false,
"ratio": 3.5137686860739574,
"config_tes... |
"""Internal Package Manager"""
from __future__ import absolute_import
from __future__ import print_function
import imp
import os
import os.path
import re
import sqlite3
from shutil import copy, rmtree
import dtf.globals
import dtf.logging as log
import dtf.core.compat as compat
import dtf.core.item
import dtf.core.ma... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/core/packagemanager.py",
"copies": "2",
"size": "36927",
"license": "apache-2.0",
"hash": 691212545166494100,
"line_mean": 23.8332212508,
"line_max": 78,
"alpha_frac": 0.5547160614,
"autogenerated": false,
"ratio": 3.7827289489858638,
"config_t... |
"""Python helper for using `adb`"""
from __future__ import absolute_import
from __future__ import print_function
import os
import os.path
import tempfile
import shutil
from subprocess import Popen, PIPE
from dtf.properties import get_prop
from dtf.constants import DTF_CLIENT
ADB_BINARY = "adb"
STATUS_DEVICE = 'dev... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/adb.py",
"copies": "2",
"size": "7433",
"license": "apache-2.0",
"hash": 8695547176905548000,
"line_mean": 22.6719745223,
"line_max": 74,
"alpha_frac": 0.5563029732,
"autogenerated": false,
"ratio": 3.775012696800406,
"config_test": false... |
"""Python wrapper for Android tools"""
from __future__ import absolute_import
from subprocess import Popen, PIPE
from dtf.globals import get_binding
def aapt(cmd):
"""aapt wrapper"""
aapt_path = get_binding("dtf_aapt")
cmd = ("%s %s" % (aapt_path, cmd)).split(' ')
proc = Popen(cmd, stdout=PIPE, st... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/included.py",
"copies": "2",
"size": "2995",
"license": "apache-2.0",
"hash": 3721216194837697500,
"line_mean": 22.5826771654,
"line_max": 75,
"alpha_frac": 0.6404006678,
"autogenerated": false,
"ratio": 3.331479421579533,
"config_test": ... |
"""API for interacting with dtfClient application"""
from __future__ import absolute_import
from __future__ import print_function
import os
import socket
import struct
from dtf.adb import DtfAdb
import dtf.logging as log
CMD_DOWNLOAD = 'd'
CMD_UPLOAD = 'u'
CMD_EXECUTE = 'e'
RESP_OK = chr(0)
RESP_ERROR = chr(1)
RES... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/client.py",
"copies": "2",
"size": "10785",
"license": "apache-2.0",
"hash": -3451163636892931600,
"line_mean": 25.6296296296,
"line_max": 78,
"alpha_frac": 0.5629114511,
"autogenerated": false,
"ratio": 3.90619340818544,
"config_test": false,
... |
""" dtf Checker script """
from __future__ import absolute_import
import os
import os.path
import shlex
import subprocess
import sys
from argparse import ArgumentParser
import dtf.core.utils as utils
import dtf.core.packagemanager as pm
import dtf.core.item
import dtf.logging as log
from dtf.globals import DTF_DB, DT... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/checker.py",
"copies": "2",
"size": "7348",
"license": "apache-2.0",
"hash": 2940988571323704000,
"line_mean": 25.3369175627,
"line_max": 79,
"alpha_frac": 0.5952640174,
"autogenerated": false,
"ratio": 3.650273224043716,
"config_test": f... |
""" dtf Main Launcher """
from __future__ import absolute_import
from __future__ import print_function
import sys
import subprocess
import os
import os.path
# Coverage is used for tests.
try:
import coverage
except ImportError:
pass
else:
coverage.process_startup()
import dtf.constants as constants
impor... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/launcher.py",
"copies": "2",
"size": "7087",
"license": "apache-2.0",
"hash": 8241999957593001000,
"line_mean": 27.5766129032,
"line_max": 76,
"alpha_frac": 0.6201495696,
"autogenerated": false,
"ratio": 3.728037874802735,
"config_test": true,
... |
"""Integration tests for the general launcher"""
from __future__ import absolute_import
import dtf.testutils as testutils
def test_dtf():
"""Just attempt to run dtf"""
rtn = testutils.dtf("")
assert(rtn.return_code == 255)
def test_version():
"""Attempt to obtain version"""
rtn = testutils.... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/tests/integration/test_dtf.py",
"copies": "2",
"size": "2020",
"license": "apache-2.0",
"hash": -2506270132906108000,
"line_mean": 21.9545454545,
"line_max": 74,
"alpha_frac": 0.6722772277,
"autogenerated": false,
"ratio": 3.435374149659864,
"confi... |
"""Integration tests for the "pm" utility"""
from __future__ import absolute_import
import dtf.testutils as testutils
class PmTests(testutils.BasicIntegrationTest):
"""Wraper for integration tests"""
def test_no_args(self):
"""Running with no args"""
rtn = self.run_cmd("pm")
asser... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/tests/integration/pm/test_pm.py",
"copies": "2",
"size": "1140",
"license": "apache-2.0",
"hash": 3248918203303493600,
"line_mean": 29,
"line_max": 74,
"alpha_frac": 0.7035087719,
"autogenerated": false,
"ratio": 3.8,
"config_test": true,
"has_no... |
"""Integration tests for the "prop" utility"""
from __future__ import absolute_import
import dtf.testutils as testutils
def test_no_args():
"""Running with no args"""
testutils.deploy_config(testutils.get_default_config())
rtn = testutils.dtf("prop")
testutils.undeploy()
assert(rtn.return_co... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/tests/integration/prop/test_prop.py",
"copies": "2",
"size": "1197",
"license": "apache-2.0",
"hash": 7643663376108679000,
"line_mean": 25.6,
"line_max": 74,
"alpha_frac": 0.7218045113,
"autogenerated": false,
"ratio": 3.7058823529411766,
"config_t... |
"""pytest for using dtf property manager"""
from __future__ import absolute_import
import pytest
import dtf.properties as prop
import dtf.testutils as testutils
# prop_set() tests
def test_set_new_property():
"""Attempt to set a new property (existing section)"""
value = '1'
contents = ("[info]\n"
... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/tests/unit/test_prop.py",
"copies": "2",
"size": "5430",
"license": "apache-2.0",
"hash": 7465317381772302000,
"line_mean": 18.1197183099,
"line_max": 74,
"alpha_frac": 0.6121546961,
"autogenerated": false,
"ratio": 3.5653315824031515,
"config_test... |
"""Wrapper API for using colors in dtf modules"""
from __future__ import absolute_import
from colored import fg, attr
import dtf.globals as glbl
COLOR_ERR = fg(1)
COLOR_WARN = fg(3)
COLOR_INFO = fg(2)
COLOR_VERB = fg(6)
COLOR_DEB = fg(5)
def __use_colors():
"""Check if colors should be used"""
return boo... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/colors.py",
"copies": "2",
"size": "2125",
"license": "apache-2.0",
"hash": 506867387172876400,
"line_mean": 21.6063829787,
"line_max": 74,
"alpha_frac": 0.6423529412,
"autogenerated": false,
"ratio": 3.589527027027027,
"config_test": false,
... |
"""Compatibility helpers"""
# pylint: disable=invalid-name,input-builtin,raw_input-builtin
# pylint: disable=wrong-import-position
from __future__ import absolute_import
try:
raw_input = raw_input # pylint: disable=redefined-builtin
except NameError:
raw_input = input
try:
from io import StringIO
excep... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/core/compat.py",
"copies": "2",
"size": "1187",
"license": "apache-2.0",
"hash": -5687848118975606000,
"line_mean": 27.9512195122,
"line_max": 74,
"alpha_frac": 0.7548441449,
"autogenerated": false,
"ratio": 3.9304635761589406,
"config_test": f... |
"""dtf Libraries Template"""
from __future__ import absolute_import
import os.path
import sqlite3
import dtf.core.utils as utils
import dtf.properties as prop
TAG = "dtf-library"
class DtfDbException(Exception): # pylint: disable=too-few-public-methods
"""Base class for DB Exceptions"""
def __init__(se... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/library.py",
"copies": "2",
"size": "3032",
"license": "apache-2.0",
"hash": -760827638996407700,
"line_mean": 25.1379310345,
"line_max": 75,
"alpha_frac": 0.6184036939,
"autogenerated": false,
"ratio": 4.03728362183755,
"config_test": fa... |
"""Helpers for interacting with manifest.xml + packages"""
from __future__ import absolute_import
import os
import tempfile
import zipfile
from shutil import copy, rmtree
from lxml import etree
import dtf.globals
import dtf.logging as log
import dtf.core.item
import dtf.core.utils as utils
TAG = "dtf-manifestparser... | {
"repo_name": "jakev/dtf",
"path": "python-dtf/dtf/core/manifestparser.py",
"copies": "2",
"size": "13559",
"license": "apache-2.0",
"hash": -6254035857757036000,
"line_mean": 28.2219827586,
"line_max": 77,
"alpha_frac": 0.5726823512,
"autogenerated": false,
"ratio": 3.817286036036036,
"config_... |
"""Integration tests for the "pm repo" utility"""
from __future__ import absolute_import
import dtf.testutils as testutils
class PmRepoTests(testutils.BasicIntegrationTest):
"""Wraper for integration tests"""
def test_no_args(self):
"""Running repo with no args"""
rtn = self.run_cmd("pm re... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/tests/integration/pm/test_pm_repo.py",
"copies": "2",
"size": "3105",
"license": "apache-2.0",
"hash": 7594503449437171000,
"line_mean": 27.2272727273,
"line_max": 78,
"alpha_frac": 0.6305958132,
"autogenerated": false,
"ratio": 3.5404789053591... |
"""Item class"""
# Eventually this will be changed
# pylint: disable=too-many-instance-attributes
from __future__ import absolute_import
import semantic_version
TYPE_MODULE = 'module'
TYPE_LIBRARY = 'library'
TYPE_BINARY = 'binary'
TYPE_PACKAGE = 'package'
VALID_TYPES = [TYPE_BINARY, TYPE_LIBRARY,
TY... | {
"repo_name": "android-dtf/dtf",
"path": "python-dtf/dtf/core/item.py",
"copies": "2",
"size": "2273",
"license": "apache-2.0",
"hash": 1642358140430819000,
"line_mean": 25.1264367816,
"line_max": 74,
"alpha_frac": 0.6454025517,
"autogenerated": false,
"ratio": 3.801003344481605,
"config_test":... |
# androidhelper_r6.py - for SL4A R6, created on 13-Jul-2012
#
# To simplify development of SL4A Python scripts in IDEs by enabling hints &
# autocompletion through a helper class defining API functions containing
# help text in DocStrings
#
# To use, copy androidhelper_r6.py to your script's folder and import it ... | {
"repo_name": "brousch/sl4a_pydroid_mock_api",
"path": "src/android/utils/androidhelper_r6.py",
"copies": "1",
"size": "83027",
"license": "bsd-3-clause",
"hash": 4184474359236994000,
"line_mean": 29.0497382199,
"line_max": 187,
"alpha_frac": 0.6031411469,
"autogenerated": false,
"ratio": 4.81930... |
ANDROID = ("Mozilla/5.0 (Linux; Android 7.1.1; SM-J510FN Build/NMF26X) "
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36")
CHROME = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36")
CHROME_OS = ... | {
"repo_name": "back-to/streamlink",
"path": "src/streamlink/plugin/api/useragents.py",
"copies": "1",
"size": "2288",
"license": "bsd-2-clause",
"hash": -3584771509552638000,
"line_mean": 77.8965517241,
"line_max": 104,
"alpha_frac": 0.6512237762,
"autogenerated": false,
"ratio": 2.32284263959390... |
""" Android phone worker, OS version >5
"""
import logging
import re
import pkg_resources
import time
import threading
import subprocess
import pandas as pd
from netort.data_processing import Drain, get_nowait_from_queue
from netort.resource import manager as resource
from volta.common.interfaces import Phone
from v... | {
"repo_name": "yandex-load/volta",
"path": "volta/providers/phones/android.py",
"copies": "1",
"size": "12104",
"license": "mpl-2.0",
"hash": 327829086066743740,
"line_mean": 37.7948717949,
"line_max": 120,
"alpha_frac": 0.5583278255,
"autogenerated": false,
"ratio": 3.9349804941482445,
"config... |
""" Android phone worker, OS version below 5
"""
import logging
import re
import queue as q
import time
import pkg_resources
from volta.common.interfaces import Phone
from volta.common.util import LogReader
from netort.data_processing import Drain
from netort.process import execute, popen
from netort.resource import... | {
"repo_name": "yandex-load/volta",
"path": "volta/providers/phones/android_old.py",
"copies": "1",
"size": "7907",
"license": "mpl-2.0",
"hash": -3099440624369598000,
"line_mean": 36.6523809524,
"line_max": 124,
"alpha_frac": 0.6070570381,
"autogenerated": false,
"ratio": 3.8439474963539135,
"c... |
"""Android SDK support"""
import os
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
import zipfile
import subprocess
import hashlib
from mod import log, util
from mod.tools import java, javac
tools_urls = {
'win': 'https://dl.googl... | {
"repo_name": "floooh/fips",
"path": "mod/android.py",
"copies": "1",
"size": "5417",
"license": "mit",
"hash": -6341821918640888000,
"line_mean": 40.3511450382,
"line_max": 100,
"alpha_frac": 0.5499353886,
"autogenerated": false,
"ratio": 3.7565880721220526,
"config_test": false,
"has_no_key... |
"""Android SDK support"""
import os
import urllib
import zipfile
import subprocess
from mod import log, util
from mod.tools import java
sdk_urls = {
'win' : 'http://dl.google.com/android/android-sdk_r22.6.2-windows.zip',
'osx' : 'http://dl.google.com/android/android-sdk_r22.6.2-macosx.zip',
'lin... | {
"repo_name": "mgerhardy/fips",
"path": "mod/android.py",
"copies": "1",
"size": "5896",
"license": "mit",
"hash": 6202272012334493000,
"line_mean": 40.8156028369,
"line_max": 156,
"alpha_frac": 0.5318860244,
"autogenerated": false,
"ratio": 3.3729977116704806,
"config_test": false,
"has_no_k... |
""" ands_doi.py """
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.importlib import import_module
from urllib2 import HTTPError
from tardis.tardis_portal.models import ExperimentParameter, \
ExperimentParameterSet, ParameterName, Schema
import re
import url... | {
"repo_name": "steveandroulakis/mytardis",
"path": "tardis/tardis_portal/ands_doi.py",
"copies": "2",
"size": "5160",
"license": "bsd-3-clause",
"hash": -1109024231310581800,
"line_mean": 30.6564417178,
"line_max": 93,
"alpha_frac": 0.5831395349,
"autogenerated": false,
"ratio": 3.894339622641509... |
""" ands_doi.py """
import re
import urllib2
from urllib2 import HTTPError
import logging
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.importlib import import_module
from tardis.tardis_portal.models import ExperimentParameter, \
ExperimentParameterSet, Pa... | {
"repo_name": "pansapiens/mytardis",
"path": "tardis/tardis_portal/ands_doi.py",
"copies": "3",
"size": "5163",
"license": "bsd-3-clause",
"hash": -8043420527047528000,
"line_mean": 30.1024096386,
"line_max": 78,
"alpha_frac": 0.5858996707,
"autogenerated": false,
"ratio": 3.870314842578711,
"c... |
# Andy Kotz final project: graphing calculator with regressions
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, TextAsset
from ggame import CircleAsset, ImageAsset
from math import sin, cos, radians
SCREEN_WIDTH = 1900
SCREEN_HEIGHT = 1000
def correlation(xlistpts,ylistpts):
N = len(xlistpts)
... | {
"repo_name": "Aqkotz/Final-Project",
"path": "Graphingcalc.py",
"copies": "1",
"size": "7239",
"license": "mit",
"hash": 4221696171644461600,
"line_mean": 35.3768844221,
"line_max": 183,
"alpha_frac": 0.5471750242,
"autogenerated": false,
"ratio": 2.9826946847960447,
"config_test": false,
"h... |
# an early attempt to abstract access to "coverage data". Also,
# because the Coverage.py API doesn't give access to their internal
# Analysis instances anyway :/ and using a 5-tuple is annoying
class CoverageAnalysis(object):
"""
Coverage's 'Analysis' instances aren't part of the public API, but
dealing ... | {
"repo_name": "meejah/cuvner",
"path": "cuv/analysis.py",
"copies": "1",
"size": "1132",
"license": "mit",
"hash": -1919143646005927400,
"line_mean": 31.3428571429,
"line_max": 75,
"alpha_frac": 0.6828621908,
"autogenerated": false,
"ratio": 4.161764705882353,
"config_test": false,
"has_no_ke... |
"""An easy interface for adding keyboard shortcuts using decorators."""
import ctypes
import functools
import operator
import sys
import uuid
import objc_util
_app = objc_util.UIApplication.sharedApplication()
_controller = _app.keyWindow().rootViewController()
# Modifiers for special keys
_modifiers = {
"shi... | {
"repo_name": "controversial/ui2",
"path": "ui2/kb_shortcuts.py",
"copies": "1",
"size": "4965",
"license": "mit",
"hash": 7207142454583288000,
"line_mean": 26.131147541,
"line_max": 79,
"alpha_frac": 0.5985901309,
"autogenerated": false,
"ratio": 3.924901185770751,
"config_test": false,
"has... |
# An easy Sudoku Solver.
# A pretty print
def pprint(puzzle):
for i in puzzle:
print i
# Inital board
puzzle = [[5,3,0,0,7,0,0,0,0],
[6,0,0,1,9,5,0,0,0],
[0,9,8,0,0,0,0,6,0],
[8,0,0,0,6,0,0,0,3],
[4,0,0,8,0,3,0,0,1],
[7,0,0,0,2,0,0,0,6],
[0,6,0,0,0,0,2,8,... | {
"repo_name": "FA810/My_Codes",
"path": "[Python]_Easy_Sudoku_Solver/sudoku_solver.py",
"copies": "1",
"size": "2781",
"license": "apache-2.0",
"hash": -3355908168740858000,
"line_mean": 33.3333333333,
"line_max": 152,
"alpha_frac": 0.6116504854,
"autogenerated": false,
"ratio": 2.570240295748613... |
"""An easy way to get ROX-Filer to do things."""
# Note: do a double-fork in case it's an old version of the filer
# and doesn't automatically background itself.
def _spawn(argv):
from os import fork, _exit, execvp, waitpid
child = fork()
if child == 0:
# We are the child
child = fork()
if child == 0:
# Gr... | {
"repo_name": "leuschel/logen",
"path": "old_logen/pylogen/rox/filer.py",
"copies": "1",
"size": "1508",
"license": "apache-2.0",
"hash": -9218998541311222000,
"line_mean": 27.4528301887,
"line_max": 87,
"alpha_frac": 0.6432360743,
"autogenerated": false,
"ratio": 2.839924670433145,
"config_tes... |
# an eazy app for login
from flask import request, session, url_for, escape, redirect
def register(app):
@app.route('/')
def index():
if 'username' in session:
return '''
<p>Logged in as %s</p>
<a href="http://localhost:5000/logout">logout</a>
... | {
"repo_name": "imxana/Flask_init",
"path": "apps/eazy_login.py",
"copies": "1",
"size": "1085",
"license": "mit",
"hash": -5172118883596827000,
"line_mean": 24.2325581395,
"line_max": 65,
"alpha_frac": 0.5105990783,
"autogenerated": false,
"ratio": 4.1891891891891895,
"config_test": false,
"h... |
""" An editor whose content is provided by a traits UI. """
# Standard library imports.
import logging
# Enthought library imports.
from enthought.traits.api import Instance, Str
from enthought.traits.ui.api import UI
# Local imports.
from editor import Editor
# Logging.
logger = logging.getLogger(__name__)
cla... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/traits_ui_editor.py",
"copies": "1",
"size": "2641",
"license": "bsd-3-clause",
"hash": 7895458114552525000,
"line_mean": 27.7065217391,
"line_max": 79,
"alpha_frac": 0.4982961,
"autogenerated": false,
"ratio": 5.04007633587... |
""" An editor whose content is provided by a traits UI. """
# Standard library imports.
import logging
# Enthought library imports.
from traits.api import Instance, Str
from traitsui.api import UI
# Local imports.
from editor import Editor
# Logging.
logger = logging.getLogger(__name__)
class TraitsUIEditor(Edi... | {
"repo_name": "brett-patterson/pyface",
"path": "pyface/workbench/traits_ui_editor.py",
"copies": "2",
"size": "2620",
"license": "bsd-3-clause",
"hash": -4416264199868605000,
"line_mean": 27.4782608696,
"line_max": 79,
"alpha_frac": 0.4954198473,
"autogenerated": false,
"ratio": 5.08737864077669... |
# An eduPersonTargetedID comprises
# the entity name of the identity provider, the entity name of the service
# provider, and a opaque string value.
# These strings are separated by "!" symbols. This form is advocated by
# Internet2 and may overtake the other form in due course.
import hashlib
import shelve
import lo... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/pysaml2-4.9.0/src/saml2/eptid.py",
"copies": "2",
"size": "2103",
"license": "apache-2.0",
"hash": -970160093800439300,
"line_mean": 28.2083333333,
"line_max": 74,
"alpha_frac": 0.5706134094,
"autogenerated": false,
"ratio": 3.62586206896... |
# An eduPersonTargetedID comprises
# the entity name of the identity provider, the entity name of the service
# provider, and a opaque string value.
# These strings are separated by "!" symbols. This form is advocated by
# Internet2 and may overtake the other form in due course.
import hashlib
import shelve
import ... | {
"repo_name": "rohe/pysaml2-3",
"path": "src/saml2/eptid.py",
"copies": "1",
"size": "1658",
"license": "bsd-2-clause",
"hash": 2063017421756846600,
"line_mean": 27.1016949153,
"line_max": 75,
"alpha_frac": 0.5693606755,
"autogenerated": false,
"ratio": 3.794050343249428,
"config_test": false,
... |
# A Needle in the Haystack
# https://www.codewars.com/kata/56676e8fabd2d1ff3000000c
def find_needle(haystack: list) -> str:
return 'found the needle at position %d' % haystack.index('needle')
def find_needle_5(haystack: list) -> str:
return (lambda idx: {
idx: 'found the needle at position %s' % idx... | {
"repo_name": "davidlukac/codekata-python",
"path": "codewars/needle_in_haystack.py",
"copies": "1",
"size": "1342",
"license": "mit",
"hash": 7423942598545808000,
"line_mean": 31.7317073171,
"line_max": 112,
"alpha_frac": 0.6557377049,
"autogenerated": false,
"ratio": 3.0430839002267573,
"conf... |
"""An Effect to be used with ScrollView to prevent scrolling beyond
the bounds, but politely.
A ScrollView constructed with StiffScrollEffect,
eg. ScrollView(effect_cls=StiffScrollEffect), will get harder to
scroll as you get nearer to its edges. You can scroll all the way to
the edge if you want to, but it will take ... | {
"repo_name": "kivy-garden/garden.stiffscroll",
"path": "__init__.py",
"copies": "1",
"size": "6125",
"license": "mit",
"hash": 4754640940292052000,
"line_mean": 37.28125,
"line_max": 78,
"alpha_frac": 0.6275918367,
"autogenerated": false,
"ratio": 3.9414414414414414,
"config_test": false,
"h... |
"""An efficient computation of the intersection of rays and blocks"""
import numpy as np
import dask.array as da
from dask import delayed
from dask.threaded import get
class Ray(object):
def __init__(self,r0,n):
self.r0 = np.array(r0)
self.n = np.array(n)
self.n /= np.linalg.norm(self.n... | {
"repo_name": "Joshuaalbert/IonoTomo",
"path": "src/ionotomo/geometry/slab_method.py",
"copies": "1",
"size": "5771",
"license": "apache-2.0",
"hash": -3337192477802009600,
"line_mean": 30.3641304348,
"line_max": 138,
"alpha_frac": 0.5643735921,
"autogenerated": false,
"ratio": 2.3326596604688765... |
"""An elegant and powerfull implementation of a value object.
This module provides base classes to easilly create new value
objects. Although value objects should in general be immutable
it is possible to create a mutable instance of a value object
when this is required.
"""
class _ValueBase:
def _is_same_type(s... | {
"repo_name": "snah/ezvalue",
"path": "ezvalue/__init__.py",
"copies": "1",
"size": "10865",
"license": "mit",
"hash": -8910079865606561000,
"line_mean": 38.7985347985,
"line_max": 77,
"alpha_frac": 0.6534744593,
"autogenerated": false,
"ratio": 5.018475750577367,
"config_test": false,
"has_n... |
"""An ellipse widget."""
from typing import Optional
from kivy.graphics.vertex_instructions import Ellipse as KivyEllipse
from kivy.graphics.context_instructions import Color, Rotate, Scale
from kivy.properties import NumericProperty
from mpfmc.uix.widget import Widget
MYPY = False
if MYPY: # pragma: no cover
f... | {
"repo_name": "missionpinball/mpf_mc",
"path": "mpfmc/widgets/ellipse.py",
"copies": "1",
"size": "2477",
"license": "mit",
"hash": -7602672219098168000,
"line_mean": 29.5802469136,
"line_max": 95,
"alpha_frac": 0.5938635446,
"autogenerated": false,
"ratio": 3.925515055467512,
"config_test": fa... |
"""An embedding store to make fast prediction of all preceding theorems.
This module contains the class TheoremEmbeddingStore that is used for
storing theorem embeddings and can compute goal parameter scoring for a large
number of theorems.
"""
from __future__ import absolute_import
from __future__ import division
# ... | {
"repo_name": "tensorflow/deepmath",
"path": "deepmath/deephol/embedding_store.py",
"copies": "1",
"size": "5490",
"license": "apache-2.0",
"hash": 8998751481031010000,
"line_mean": 39.3676470588,
"line_max": 80,
"alpha_frac": 0.7018214936,
"autogenerated": false,
"ratio": 3.8661971830985915,
"... |
"""An emcee example which gets probabilties from a set of external
processes, rather than from a Python function. We use a Pool-like
object which provides map to pass to emcee.
This example starts the remote() method of itself in different
processes to compute the lnprob. The remote process returns the
probability for... | {
"repo_name": "jellis18/emcee3",
"path": "examples/subprocessing.py",
"copies": "13",
"size": "6888",
"license": "mit",
"hash": -2942462712121313300,
"line_mean": 30.1674208145,
"line_max": 77,
"alpha_frac": 0.5846399535,
"autogenerated": false,
"ratio": 4.1493975903614455,
"config_test": false... |
"""
Classes for interaction with the Dark Sky API
"""
##########################################################################
# Imports
##########################################################################
import sys
import os
sys.path.insert(0, os.getcwd())
from pprint import pprint
import requests
from a... | {
"repo_name": "looselycoupled/anemoi",
"path": "anemoi/apis/dark_sky.py",
"copies": "1",
"size": "5610",
"license": "mit",
"hash": -401668100610595800,
"line_mean": 29.4891304348,
"line_max": 93,
"alpha_frac": 0.5392156863,
"autogenerated": false,
"ratio": 4.675,
"config_test": false,
"has_no... |
"""
SlackBot mixin for DarkSky functionality
"""
##########################################################################
# Imports
##########################################################################
from anemoi.config import settings
from anemoi.apis.dark_sky import DarkSky
##############################... | {
"repo_name": "looselycoupled/anemoi",
"path": "anemoi/bots/slack/mixins.py",
"copies": "1",
"size": "2363",
"license": "mit",
"hash": 1986651069248988200,
"line_mean": 32.7571428571,
"line_max": 85,
"alpha_frac": 0.5438002539,
"autogenerated": false,
"ratio": 4.131118881118881,
"config_test": ... |
"""
module description
"""
##########################################################################
# Imports
##########################################################################
from collections import namedtuple, Iterable
from anemoi.utils.decorators import memoized
######################################... | {
"repo_name": "looselycoupled/anemoi",
"path": "anemoi/bots/slack/messages.py",
"copies": "1",
"size": "4172",
"license": "mit",
"hash": -9199661938950195000,
"line_mean": 27.1891891892,
"line_max": 114,
"alpha_frac": 0.5457813998,
"autogenerated": false,
"ratio": 4.5249457700650755,
"config_te... |
"""
module description
"""
##########################################################################
# Imports
##########################################################################
import time
import signal
from collections import namedtuple
from slackclient import SlackClient
from concurrent.futures import T... | {
"repo_name": "looselycoupled/anemoi",
"path": "anemoi/bots/slack/bots.py",
"copies": "1",
"size": "4349",
"license": "mit",
"hash": -1316129038126605000,
"line_mean": 31.6992481203,
"line_max": 89,
"alpha_frac": 0.5477121177,
"autogenerated": false,
"ratio": 4.701621621621622,
"config_test": f... |
"""
primary configuration module for Anemoi project
"""
##########################################################################
## Imports
##########################################################################
from confire import Configuration
from confire import environ_setting
import os
###################... | {
"repo_name": "looselycoupled/anemoi",
"path": "anemoi/config.py",
"copies": "1",
"size": "3295",
"license": "mit",
"hash": -4746100763269381000,
"line_mean": 27.9035087719,
"line_max": 99,
"alpha_frac": 0.4861911988,
"autogenerated": false,
"ratio": 4.782293178519594,
"config_test": true,
"h... |
'''Anemoi
'''
import os
from distutils.core import setup
from setuptools import find_packages
import numpy as np
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'T... | {
"repo_name": "uwoseis/anemoi",
"path": "setup.py",
"copies": "1",
"size": "1321",
"license": "mit",
"hash": 6162739952733339000,
"line_mean": 27.1063829787,
"line_max": 68,
"alpha_frac": 0.6351249054,
"autogenerated": false,
"ratio": 3.503978779840849,
"config_test": false,
"has_no_keywords"... |
"""
Provides zipcode and geographic data
"""
##########################################################################
# Imports
##########################################################################
import os
import unicodecsv as csv
##########################################################################
... | {
"repo_name": "looselycoupled/anemoi",
"path": "anemoi/utils/geo.py",
"copies": "1",
"size": "1553",
"license": "mit",
"hash": -3429706087893476400,
"line_mean": 26.7321428571,
"line_max": 78,
"alpha_frac": 0.4288473921,
"autogenerated": false,
"ratio": 4.4498567335243555,
"config_test": false,... |
""" An Enable component to render SVG documents.
"""
import sys
import time
from enable.api import Component
from traits.api import Any, Array, Bool, Float
from kiva.fonttools import Font
if sys.platform == 'win32':
now = time.clock
else:
now = time.time
class SVGComponent(Component):
""" An Enable co... | {
"repo_name": "tommy-u/enable",
"path": "enable/savage/compliance/svg_component.py",
"copies": "1",
"size": "2992",
"license": "bsd-3-clause",
"hash": -6959667964877335000,
"line_mean": 28.0485436893,
"line_max": 96,
"alpha_frac": 0.5748663102,
"autogenerated": false,
"ratio": 4.0269179004037685,... |
"""An encapsulated thread-local variable that indicates whether future DB
writes should be "stuck" to the master."""
from functools import wraps
import threading
__all__ = ['this_thread_is_pinned', 'pin_this_thread', 'unpin_this_thread',
'use_master', 'db_write']
_locals = threading.local()
def this_t... | {
"repo_name": "sonico999/django-multidb-router",
"path": "multidb/pinning.py",
"copies": "1",
"size": "1594",
"license": "bsd-3-clause",
"hash": -5512141625307634000,
"line_mean": 22.7910447761,
"line_max": 75,
"alpha_frac": 0.6141781681,
"autogenerated": false,
"ratio": 3.7156177156177157,
"co... |
"""An engine accessing network activations.
"""
# standard imports
from typing import Union, List, Tuple, Iterable
from pathlib import Path
import os
import json
import logging
# import math
# import functools
# import operator
# third party imports
import numpy as np
# toolbox imports
from network import Network, C... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/tool/activation.py",
"copies": "1",
"size": "49892",
"license": "mit",
"hash": 7270598977069679000,
"line_mean": 38.2232704403,
"line_max": 82,
"alpha_frac": 0.5706325663,
"autogenerated": false,
"ratio": 4.410927415789939,
"config_test": false,
... |
"""An English grammar for chartparse.
This grammar was originally written by Steve Isard at the
University of Sussex. The vocabulary is designed to amuse
undergraduate Experimental Psychology students, hence the
references to pigeons and cages.
The grammar is almost entirely Steve's original. The only changes
are a f... | {
"repo_name": "cbrew/chartparse",
"path": "python/chart/english.py",
"copies": "1",
"size": "6589",
"license": "apache-2.0",
"hash": -3468573060670117400,
"line_mean": 20.3928571429,
"line_max": 116,
"alpha_frac": 0.6075276977,
"autogenerated": false,
"ratio": 2.808610400682012,
"config_test": ... |
# An English text needs to be encrypted using the following encryption scheme.
# First, the spaces are removed from the text. Let L be the length of this
# text. Then, characters are written into a grid, whose rows and columns have
# the following constraints:
#
# floor(sqrt(L)) <= rows <= columns <= ceil(sqrt(L))
#... | {
"repo_name": "chinhtle/python_fun",
"path": "hacker_rank/algorithms/implementation/encryption.py",
"copies": "1",
"size": "1547",
"license": "mit",
"hash": -3836117496010005500,
"line_mean": 29.3333333333,
"line_max": 79,
"alpha_frac": 0.7188106012,
"autogenerated": false,
"ratio": 3.41501103752... |
""" An entity about whom data is collected.
:Authors: Sana dev team
:Version: 2.0
"""
import datetime
import os
from PIL import Image
from django.db import models
from mds.api.utils import make_uuid
__all__ = ["AbstractSubject","Subject"]
class AbstractSubject(models.Model):
""" The entity about whom data is col... | {
"repo_name": "SanaMobile/sana.mds",
"path": "src/mds/core/models/subject.py",
"copies": "1",
"size": "2957",
"license": "bsd-3-clause",
"hash": 1479905410492381400,
"line_mean": 30.1263157895,
"line_max": 90,
"alpha_frac": 0.5989178221,
"autogenerated": false,
"ratio": 3.6282208588957054,
"con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.