text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Hugh'
import os
import datetime
import pickle
import string
import sys
from subprocess import PIPE, Popen
from threading import Thread
from contextlib import redirect_stdout
import io
stdout = io.StringIO()
from .IOparse import search as findfirstraw
import bpy
from queue import Queue, Empty
from .IOwrit... | {
"repo_name": "Chasvortex/caffe-gui-tool",
"path": "CGTGraph.py",
"copies": "1",
"size": "8668",
"license": "unlicense",
"hash": -9168827880493448000,
"line_mean": 39.3162790698,
"line_max": 114,
"alpha_frac": 0.5556068297,
"autogenerated": false,
"ratio": 4.102224325603408,
"config_test": true... |
import csv
import sys
import os
inName = str(sys.argv[1])
outName = inName.split('.')[0]+'_numerics.csv'
if (os.path.isabs(inName)):
print 'Only relative paths are supported. E.g. "myfile.csv"'
exit(0)
with open(inName, 'r') as infile, open(outName, 'wb') as outfile, open('./'+inName.split('.')[1]+'_num_labels.csv... | {
"repo_name": "hug-0/feed-forward-neural-network",
"path": "setLabels.py",
"copies": "1",
"size": "1180",
"license": "mit",
"hash": -1347016699528122000,
"line_mean": 34.7575757576,
"line_max": 145,
"alpha_frac": 0.6822033898,
"autogenerated": false,
"ratio": 2.8992628992628995,
"config_test": ... |
__author__ = 'hujin'
from twisted.python import log
class Dispatcher(object):
def __init__(self, app):
"""
:type app: dockerman.application.Application
:return:
"""
self.app = app
def dispatch(self, event):
"""
:type event: Event
:return:
... | {
"repo_name": "bixuehujin/dockerman",
"path": "dockerman/event.py",
"copies": "1",
"size": "1559",
"license": "mit",
"hash": -6054475755008857000,
"line_mean": 21.5942028986,
"line_max": 81,
"alpha_frac": 0.5946119307,
"autogenerated": false,
"ratio": 4.007712082262211,
"config_test": false,
... |
__author__ = 'hujin'
from zope.interface import implements
from twisted.internet import reactor, protocol
from twisted.internet.defer import Deferred, succeed
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
from twisted.web.iweb import IBodyProducer
class BeginningPrinter(... | {
"repo_name": "bixuehujin/dockerman",
"path": "dockerman/http.py",
"copies": "1",
"size": "2409",
"license": "mit",
"hash": 6570662113981527000,
"line_mean": 20.1315789474,
"line_max": 66,
"alpha_frac": 0.6255707763,
"autogenerated": false,
"ratio": 4.204188481675392,
"config_test": false,
"h... |
__author__ = 'hujin'
import copy
from twisted.python import log
from twisted.internet.defer import succeed, fail
from dockerman.storage import Service
from dockerman.event import Event
class Manager(object):
def __init__(self, client, store, dispatcher):
"""
:type client: dockerman.docker.Clien... | {
"repo_name": "bixuehujin/dockerman",
"path": "dockerman/manager.py",
"copies": "1",
"size": "3942",
"license": "mit",
"hash": 2455092361757351400,
"line_mean": 25.28,
"line_max": 77,
"alpha_frac": 0.5705225774,
"autogenerated": false,
"ratio": 4.494868871151653,
"config_test": false,
"has_no... |
__author__ = 'hujin'
import json
from datetime import datetime
from uuid import uuid1
class ServiceStore(object):
def __init__(self, filename):
self._services = []
self._file = filename
self._load_from_file()
def _load_from_file(self):
fd = open(self._file, 'r')
tr... | {
"repo_name": "bixuehujin/dockerman",
"path": "dockerman/storage.py",
"copies": "1",
"size": "2637",
"license": "mit",
"hash": 6446743843226488000,
"line_mean": 25.37,
"line_max": 127,
"alpha_frac": 0.5676905575,
"autogenerated": false,
"ratio": 4.050691244239632,
"config_test": false,
"has_n... |
__author__ = 'hujin'
import json
from dockerman import http
from twisted.internet.defer import succeed, fail
def dict2query(d):
query = ''
for key in d.keys():
if d[key] is not None:
query += str(key) + '=' + str(d[key]) + "&"
return query
class Client(object):
def __init__(s... | {
"repo_name": "bixuehujin/dockerman",
"path": "dockerman/docker.py",
"copies": "1",
"size": "4781",
"license": "mit",
"hash": 6206621139144272000,
"line_mean": 31.5238095238,
"line_max": 102,
"alpha_frac": 0.5101443213,
"autogenerated": false,
"ratio": 4.017647058823529,
"config_test": false,
... |
__author__ = 'hujin'
import json
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from twisted.python.failure import Failure
"""
API
GET /services Get a list of services
GET /services/:id Get information of a service
PUT /services/:id ... | {
"repo_name": "bixuehujin/dockerman",
"path": "dockerman/api.py",
"copies": "1",
"size": "3773",
"license": "mit",
"hash": 2306661804135024000,
"line_mean": 24.8424657534,
"line_max": 87,
"alpha_frac": 0.6262920753,
"autogenerated": false,
"ratio": 4.048283261802575,
"config_test": false,
"ha... |
__author__ = 'hujin'
import time
from dockerman.docker import Client
from twisted.internet import reactor
client = Client('127.0.0.1', 4243)
d = client.create_container('bixuehujin/blink-db-server:1.0.0', name='test')
def inspect_container(response):
print(response)
print("container created\n")
dd =... | {
"repo_name": "bixuehujin/dockerman",
"path": "tests/client.py",
"copies": "1",
"size": "1132",
"license": "mit",
"hash": -4610656115525222000,
"line_mean": 18.5172413793,
"line_max": 76,
"alpha_frac": 0.695229682,
"autogenerated": false,
"ratio": 3.4723926380368098,
"config_test": false,
"ha... |
__author__ = 'Humberto'
#!/usr/bin/env
# -*- coding: utf-8 -*-
import os, re
print
#Tupla de IP's
ipall = [("FNT-ESCCA-AR-A01", "173.194.42.1"), ("FNT-ESCCA-AR-A02", "173.194.42.2"), ("FNT-ESCCA-AR-A03", "173.194.42.3"),
("FNT-ESCCA-AR-A04", "173.194.42.4"), ("FNT-ESCCA-AR-A05", "173.194.42.5"), ("FNT-ESCCA-... | {
"repo_name": "fadelbh/AlertPing",
"path": "alert.py",
"copies": "1",
"size": "3580",
"license": "mit",
"hash": 7757113238539945000,
"line_mean": 39.6931818182,
"line_max": 123,
"alpha_frac": 0.5187150838,
"autogenerated": false,
"ratio": 2.716236722306525,
"config_test": false,
"has_no_keywo... |
__author__ = 'Humphrey'
from decimal import Decimal, InvalidOperation
import pandas as pd
from sys import exc_info
one_pence = Decimal('0.01')
def p(value):
"""Convert `value` to Decimal pence implementing AIS rounding (up) or cents"""
# TODO think about Decimal(-0.00) == Decmial(0.00) which is true. Shoul... | {
"repo_name": "drummonds/remittance",
"path": "remittance/utils.py",
"copies": "1",
"size": "1450",
"license": "mit",
"hash": 5932377901713480000,
"line_mean": 37.1578947368,
"line_max": 105,
"alpha_frac": 0.5793103448,
"autogenerated": false,
"ratio": 3.598014888337469,
"config_test": false,
... |
__author__ = 'humsie'
from Adafruit.Adafruit_PWM import Adafruit_PWM
class Humsie_RGB:
minValue = 0 # Min pulse length out of 4096
maxValue = 4095 # Max pulse length out of 4096
frequency = 1200 # Set frequency between 40 and 1600 Hz
@staticmethod
def getIdentifier():
return "rgb"
... | {
"repo_name": "Humsie/pi-domotica-server",
"path": "server/plugins/Humsie_RGB.py",
"copies": "1",
"size": "1340",
"license": "apache-2.0",
"hash": -1840431781467945700,
"line_mean": 25.82,
"line_max": 97,
"alpha_frac": 0.5791044776,
"autogenerated": false,
"ratio": 3.409669211195929,
"config_te... |
__author__ = 'hunt3r'
from pymongo import GEO2D
import json
from bson.objectid import ObjectId
from bson.timestamp import Timestamp
import json.encoder
import datetime, time
import jsonschema
from json import JSONEncoder
import logging
from tornado.gen import Return, coroutine
import copy
"""
Base document module is ... | {
"repo_name": "urbn/Caesium",
"path": "caesium/document.py",
"copies": "1",
"size": "28404",
"license": "apache-2.0",
"hash": -1283140967770039600,
"line_mean": 32.338028169,
"line_max": 231,
"alpha_frac": 0.5987536967,
"autogenerated": false,
"ratio": 4.484370066308809,
"config_test": false,
... |
__author__ = 'hunt3r'
"""
A base handlers module
"""
import json
import logging
import uuid
from bson.objectid import ObjectId
from bson import json_util
from jsonschema import ValidationError
from pymongo.errors import InvalidId
import tornado.web
from tornado.gen import coroutine, Return
from caesium.document imp... | {
"repo_name": "urbn/Caesium",
"path": "caesium/handler.py",
"copies": "1",
"size": "24419",
"license": "apache-2.0",
"hash": 5390855064403362000,
"line_mean": 32.3137789905,
"line_max": 129,
"alpha_frac": 0.5555100536,
"autogenerated": false,
"ratio": 4.487961771733137,
"config_test": false,
... |
__author__ = 'Hunter Cameron'
# TODO Add a method to print results instead of displaying.
# TODO Add the option to plot more than one subject at once. Perhaps using subplots 2x2?
# TODO The subplots should have the ability to be switched out. Perhaps a subplot list in one pannel?
# TODO The alignment that is s... | {
"repo_name": "hunter-cameron/Bioinformatics",
"path": "python/lucidBLAST/lucidArtist.py",
"copies": "1",
"size": "9000",
"license": "mit",
"hash": -1299272766359874000,
"line_mean": 39.3587443946,
"line_max": 224,
"alpha_frac": 0.561,
"autogenerated": false,
"ratio": 4,
"config_test": false,
... |
__author__ = 'Hunter Cameron'
# TODO Consider some sort of filtering mechanism to select only best subjects when BLASTing to a (large) database
# TODO Add option to filter redundant query hits. (So redundant hits don't stack up if the user mostly wants to see how well they have the subject genome covered)
# TODO Add ... | {
"repo_name": "hunter-cameron/Bioinformatics",
"path": "python/lucidBLAST/lucidSubject.py",
"copies": "1",
"size": "2475",
"license": "mit",
"hash": 3007156274468216000,
"line_mean": 40.9491525424,
"line_max": 259,
"alpha_frac": 0.658989899,
"autogenerated": false,
"ratio": 4.319371727748691,
"... |
__author__ = 'hunter'
import asyncio
from aiohttp import web
import os
import fnmatch
settings = {
"port" : 8000
}
def get_features():
features = {}
lst = os.listdir("aiotest/features")
dir = []
for d in lst:
s = os.path.abspath("aiotest/features") + os.sep + d
if os.path.isdir(s)... | {
"repo_name": "hunt3r/aiotest",
"path": "aiotest/app.py",
"copies": "1",
"size": "1232",
"license": "mit",
"hash": -4118367068991497000,
"line_mean": 26.3777777778,
"line_max": 87,
"alpha_frac": 0.5909090909,
"autogenerated": false,
"ratio": 3.50997150997151,
"config_test": false,
"has_no_key... |
__author__ = 'hunter'
import motor
import tornado
import tornado.testing
import tornado.gen
import time
from bson import ObjectId
from tornado.testing import gen_test
from nose.tools import raises, ok_
import datetime
from .base_tests import BaseAsyncTest
from caesium.document import AsyncRevisionStackManager, AsyncS... | {
"repo_name": "urbn/Caesium",
"path": "test/document_tests.py",
"copies": "1",
"size": "14993",
"license": "apache-2.0",
"hash": -9097400080915189000,
"line_mean": 38.7692307692,
"line_max": 141,
"alpha_frac": 0.6493030081,
"autogenerated": false,
"ratio": 3.737970580902518,
"config_test": true... |
__author__ = 'huqinghua'
# coding=gbk
import string, os, commands, time
import threading
import shutil
from distutils import dir_util
from shutil import make_archive
from ftplib import FTP
import zipfile
import ctypes
from CommonUtil import CommonUtils
import xml.etree.cElementTree as ET
codeTemplate ... | {
"repo_name": "the7day/py-ui4win",
"path": "bin/GenerateCode.py",
"copies": "2",
"size": "3030",
"license": "bsd-2-clause",
"hash": -5991638163918142000,
"line_mean": 33.6705882353,
"line_max": 159,
"alpha_frac": 0.5475247525,
"autogenerated": false,
"ratio": 3.874680306905371,
"config_test": f... |
import csv
csv_file = open('demo.csv', "rb")
reader = csv.reader(csv_file)
master_dic = {}
final_list= []
rownum = 0
for row in reader:
if rownum == 0:
header = row
else:
for i in range(2,len(header)):
"""
# Here it will create a dictionary which till have a structu... | {
"repo_name": "nagri/Binarysemantics-Exercise",
"path": "Hussain_Nagri-2.2.py",
"copies": "1",
"size": "2041",
"license": "apache-2.0",
"hash": -7676399519192654000,
"line_mean": 36.7962962963,
"line_max": 152,
"alpha_frac": 0.5316021558,
"autogenerated": false,
"ratio": 3.5434027777777777,
"co... |
# import numpy and pandas for array manipulationa and csv files
import numpy as np
import pandas as pd
# import keras necessary classes
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dropout, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.o... | {
"repo_name": "dhruvparamhans/mnist_keras",
"path": "mnist-keras.py",
"copies": "1",
"size": "3159",
"license": "mit",
"hash": -5267788805842747000,
"line_mean": 28.523364486,
"line_max": 116,
"alpha_frac": 0.7581513137,
"autogenerated": false,
"ratio": 3.266804550155119,
"config_test": true,
... |
__author__ = 'husser'
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD 3 clause
from sklearn.datasets import fetch_20newsgroups
from sklearn.decomposition import TruncatedSVD
from sklearn.feature_extraction.text import TfidfVectorizer
from sklea... | {
"repo_name": "fredhusser/som",
"path": "examples/text_classification.py",
"copies": "1",
"size": "4321",
"license": "bsd-3-clause",
"hash": 3935610582083955700,
"line_mean": 30.0863309353,
"line_max": 96,
"alpha_frac": 0.6401295996,
"autogenerated": false,
"ratio": 3.470682730923695,
"config_t... |
__author__ = 'hvishwanath'
class CAMPModel(object):
def __init__(self):
pass
class Artifact(CAMPModel):
def __init__(self, atype, content, requirements):
self.type = atype
self.content = content
self.requirements = requirements
@classmethod
def create_from_dict(cls, d... | {
"repo_name": "hvishwanath/libpaas",
"path": "libpaas/camp/models.py",
"copies": "1",
"size": "3947",
"license": "mit",
"hash": -4632569828481454000,
"line_mean": 22.081871345,
"line_max": 89,
"alpha_frac": 0.5323030149,
"autogenerated": false,
"ratio": 3.923459244532803,
"config_test": false,
... |
__author__ = 'hvishwanath'
from heroku import Heroku
from openshift import Openshift
class DriverManager(object):
__singleton = None
def __new__(cls, *args, **kwargs):
# Check to see if a __singleton exists already for this class
# Compare class types instead of just looking for None so
... | {
"repo_name": "hvishwanath/libpaas",
"path": "libpaas/drivers/manager.py",
"copies": "1",
"size": "1347",
"license": "mit",
"hash": -751814037518559700,
"line_mean": 27.6808510638,
"line_max": 85,
"alpha_frac": 0.6020786934,
"autogenerated": false,
"ratio": 4.157407407407407,
"config_test": fal... |
__author__ = 'hvishwanath'
import os
from libpaas import settings
class Config(object):
__singleton = None # the one, true Singleton
def __new__(cls, *args, **kwargs):
# Check to see if a __singleton exists already for this class
# Compare class types instead of just looking for None so
... | {
"repo_name": "hvishwanath/libpaas",
"path": "libpaas/paascli/config.py",
"copies": "1",
"size": "1555",
"license": "mit",
"hash": -2231416142466595300,
"line_mean": 29.5098039216,
"line_max": 78,
"alpha_frac": 0.5884244373,
"autogenerated": false,
"ratio": 3.9367088607594938,
"config_test": fa... |
__author__ = 'hvishwanath'
import os
import sys
import tempfile
import zipfile
import tarfile
from planparser import PlanParser
class PDPParser(object):
def __init__(self, pdpfile):
# PDP File can actually be a pdp archive
# alternately it can be a folder that contains required contents of a PDP
... | {
"repo_name": "hvishwanath/libpaas",
"path": "libpaas/camp/pdpparser.py",
"copies": "1",
"size": "1707",
"license": "mit",
"hash": 5953738924251425000,
"line_mean": 31.2075471698,
"line_max": 93,
"alpha_frac": 0.6162858817,
"autogenerated": false,
"ratio": 4.093525179856115,
"config_test": fals... |
__author__ = 'hvishwanath'
import requests
import base64
import os
import sh
from .base import BasePaaSProvider, ArtifactHandler
class HerokuPythonArtifactHandler(ArtifactHandler):
supported_types = ["org.python:src"]
def __init__(self, pdpobj, artifact):
ArtifactHandler.__init__(self, pdpobj, arti... | {
"repo_name": "hvishwanath/libpaas",
"path": "libpaas/drivers/heroku.py",
"copies": "1",
"size": "8348",
"license": "mit",
"hash": 6793305890437734000,
"line_mean": 29.0287769784,
"line_max": 108,
"alpha_frac": 0.5196454241,
"autogenerated": false,
"ratio": 4.078163165608207,
"config_test": fal... |
__author__ = 'hvishwanath'
import requests
import base64
import os
import sh
from .base import BasePaaSProvider, ArtifactHandler
class OpenshiftPythonArtifactHandler(ArtifactHandler):
supported_types = ["org.python:src"]
cartridge = "python-2.7"
def __init__(self, pdpobj, artifact):
ArtifactHan... | {
"repo_name": "hvishwanath/libpaas",
"path": "libpaas/drivers/openshift.py",
"copies": "1",
"size": "10983",
"license": "mit",
"hash": 4168756202360190500,
"line_mean": 30.2017045455,
"line_max": 108,
"alpha_frac": 0.5268141673,
"autogenerated": false,
"ratio": 4.12739571589628,
"config_test": ... |
__author__ = 'hwang'
import pandas as pd
import numpy as np
import random as rd
from pyspark import SparkContext, SparkConf
import time
def tick_list(file):
symbols = pd.read_csv(file,sep='\t', header=None)
ls_symbols = symbols[0]
ls_symbols = ls_symbols.tolist()
return ls_symbols
def baseRoutine1(ti... | {
"repo_name": "Sapphirine/Real-time-Risk-Management-System",
"path": "GetVar_least_spark.py",
"copies": "1",
"size": "5128",
"license": "apache-2.0",
"hash": -6220573290863907000,
"line_mean": 35.8920863309,
"line_max": 143,
"alpha_frac": 0.6257800312,
"autogenerated": false,
"ratio": 3.052380952... |
__author__ = 'hydezhang'
from oslo.config import cfg
from glanceclient import exc
from tests.flow.test_base import TestBase
from flow.imagetask import ImageMigrationTask
from utils.db_handlers import images
# testing inputs
owner_target_id = '2ddc4b6528f24b039cf4ec093ae8a214'
image_name = "public_image_on_source_cl... | {
"repo_name": "Phoenix1708/OpenAcademy_OpenStack_Flyway",
"path": "flyway/tests/flow/test_imagetask.py",
"copies": "1",
"size": "9130",
"license": "apache-2.0",
"hash": 750230488025646200,
"line_mean": 40.5,
"line_max": 82,
"alpha_frac": 0.5934282585,
"autogenerated": false,
"ratio": 3.8686440677... |
__author__ = 'hydezhang'
from utils.db_base import *
from collections import OrderedDict
def initialise_tenants_mapping():
"""function to create the tenant table
which is used to record tenant that has
been migrated
"""
table_name = "tenants"
if not check_table_exist(table_name):
co... | {
"repo_name": "Phoenix1708/OpenAcademy_OpenStack_Flyway",
"path": "flyway/utils/db_handlers/tenants.py",
"copies": "1",
"size": "4144",
"license": "apache-2.0",
"hash": 6782579753447358000,
"line_mean": 33.2561983471,
"line_max": 82,
"alpha_frac": 0.5644305019,
"autogenerated": false,
"ratio": 4.... |
'''
Script was re-written by Hydra
for any further information please read the README.md file.
'''
# some important modules
import sys
import os
from lib.core.data import logger
# tries to import modules
try:
import subprocess
except KeyboardInterrupt:
errMsg = 'User aborted operation..'
logger.error(err... | {
"repo_name": "Hydr43301/sqliaps",
"path": "sqliaps.py",
"copies": "1",
"size": "1130",
"license": "mit",
"hash": 7685283350856165000,
"line_mean": 25.9047619048,
"line_max": 79,
"alpha_frac": 0.6840707965,
"autogenerated": false,
"ratio": 3.1741573033707864,
"config_test": false,
"has_no_key... |
__author__ = 'HY'
from tkinter import *
from tkinter import colorchooser
import math
from math import *
from operator import *
color=colorchooser.askcolor()
def Color():
Color = str(color[1])
return Color
from random import randrange
def frame(root, side):
w = Frame(root,relief=FLAT,bg="black")
... | {
"repo_name": "saintdragon2/python-3-lecture-2015",
"path": "civil-final/2nd_presentation/8조/8group Calculator.py",
"copies": "1",
"size": "3651",
"license": "mit",
"hash": 841041131255839400,
"line_mean": 11.5034246575,
"line_max": 145,
"alpha_frac": 0.5069843878,
"autogenerated": false,
"ratio"... |
__author__ = 'hyphen'
import sys
import six
def safe_decode(text, incoming=None, errors='strict'):
"""Decodes incoming text/bytes string using `incoming` if they're not
already unicode.
:param incoming: Text's current encoding
:param errors: Errors handling policy. See here for valid
value... | {
"repo_name": "yanheven/ucloud-python-sdk",
"path": "ucloudclient/utils/encodeutils.py",
"copies": "1",
"size": "2351",
"license": "apache-2.0",
"hash": 6321667445913245000,
"line_mean": 34.0895522388,
"line_max": 73,
"alpha_frac": 0.6524883028,
"autogenerated": false,
"ratio": 4.337638376383764,... |
__author__ = 'HyunYoung'
import pickle
import os
class config:
param = {'mainDir': '.'}
def __init__(self):
if not os.path.isfile(".configure"):
self.makeConfigureFile()
try:
with open('.configure', 'rb') as file:
self.param = pickle.load(file)
... | {
"repo_name": "gusdud25/Duplicated-File-Finder",
"path": "configure.py",
"copies": "1",
"size": "1366",
"license": "mit",
"hash": -3786813307307725000,
"line_mean": 26.32,
"line_max": 61,
"alpha_frac": 0.532942899,
"autogenerated": false,
"ratio": 3.947976878612717,
"config_test": true,
"has_... |
__author__ = 'HyunYoung'
import sqlite3
class SqliteAdaptor:
def __init__(self, filename):
self.connection = sqlite3.connect(filename)
self.cursor = self.connection.cursor()
def __del__(self):
self.connection.commit()
self.connection.close()
def query(self, sql):
... | {
"repo_name": "gusdud25/Duplicated-File-Finder",
"path": "sqlite3_adaptor.py",
"copies": "1",
"size": "1025",
"license": "mit",
"hash": -5770002962803398000,
"line_mean": 26,
"line_max": 121,
"alpha_frac": 0.5658536585,
"autogenerated": false,
"ratio": 3.727272727272727,
"config_test": false,
... |
__author__ = 'iadam'
import Colors
import pygame as pg
class BlockShape():
def __init__(self,lanes,lane=0,y=0,shape=[[1,1]]):
self.shapeBlocks = []
self.shape = shape
self.position = [lanes[lane],y]
self.rect = pg.Rect(
self.position[0],
self.position[1],
... | {
"repo_name": "artog/intro-prog",
"path": "Tetris/Blocks.py",
"copies": "1",
"size": "3370",
"license": "mit",
"hash": 6450958784268146000,
"line_mean": 23.0714285714,
"line_max": 56,
"alpha_frac": 0.4908011869,
"autogenerated": false,
"ratio": 3.7486095661846495,
"config_test": false,
"has_n... |
# Problem Sheet: https://emerging-technologies.github.io/problems/python-fundamentals.html
import random # import random package to use random function
# random function generates a random number between 1 and 100 and store in num.
num = random.randint(0, 101)
print ("Guess a number between 1 and 100")
guessCount ... | {
"repo_name": "ianburkeixiv/Python-Fundamentals-Problem-Sheet",
"path": "05-GuessingGame.py",
"copies": "1",
"size": "1026",
"license": "apache-2.0",
"hash": 2681668706556051500,
"line_mean": 29.1764705882,
"line_max": 90,
"alpha_frac": 0.6900584795,
"autogenerated": false,
"ratio": 3.81412639405... |
__author__ = 'ian.collins (modified)'
"""An FTP client class and some helper functions.
Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds
Example:
>>> from ftplib import FTP
>>> ftp = FTP('ftp.python.org') # connect to host, default port
>>> ftp.login() # default, i.e.: user anony... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "localftp.py",
"copies": "1",
"size": "38068",
"license": "apache-2.0",
"hash": 6591168532164038000,
"line_mean": 33.8118532455,
"line_max": 98,
"alpha_frac": 0.5175475465,
"autogenerated": false,
"ratio": 4.171835616438356,
"config_test": false,
"... |
__author__ = 'ian.collins'
from jnius import PythonJavaClass, java_method, autoclass, cast
PythonActivity = autoclass('org.renpy.android.PythonActivity')
activity = PythonActivity.mActivity
Context = autoclass('android.content.Context')
Sensor = autoclass('android.hardware.Sensor')
SensorManager = autoclass('android.... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "lightSensor.py",
"copies": "1",
"size": "2069",
"license": "apache-2.0",
"hash": 3136997435523032600,
"line_mean": 28.5571428571,
"line_max": 76,
"alpha_frac": 0.6384726921,
"autogenerated": false,
"ratio": 4.129740518962076,
"config_test": false,
... |
__author__ = 'ian.collins'
import threading
import os
from kivy.network.urlrequest import UrlRequest
class CrvURL:
def __init__(self, indata):
self.data = indata
self.sourceurl = ''
self.destfile = ''
self.destdata = []
self.estimatedsize = 0
self.working = 0 # 0... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "crvURL.py",
"copies": "1",
"size": "4189",
"license": "apache-2.0",
"hash": 2313462946969118700,
"line_mean": 33.0569105691,
"line_max": 107,
"alpha_frac": 0.570303175,
"autogenerated": false,
"ratio": 3.6018916595012898,
"config_test": false,
"ha... |
__author__ = 'ian.collins'
import threading
import smtplib
import os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.utils import parseaddr
from email import Encoders
class CrvEmail:
def __init__(self, inlogger):
self.Log... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "crvemail.py",
"copies": "1",
"size": "4874",
"license": "apache-2.0",
"hash": -2106094794543963100,
"line_mean": 28.9018404908,
"line_max": 115,
"alpha_frac": 0.5424702503,
"autogenerated": false,
"ratio": 4.1516183986371376,
"config_test": false,
... |
__author__ = 'ian.collins'
from kivy.utils import platform
from kivy.properties import StringProperty
from kivy.clock import Clock, mainthread
from math import radians, cos, sin, asin, sqrt
import re
class CrvGPS:
#gps_location = StringProperty()
#gps_status = StringProperty()
def __init__(... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "crvgps.py",
"copies": "1",
"size": "6016",
"license": "apache-2.0",
"hash": -1078800927131407500,
"line_mean": 34.0359281437,
"line_max": 121,
"alpha_frac": 0.5390625,
"autogenerated": false,
"ratio": 3.637243047158404,
"config_test": false,
"has_... |
__author__ = 'ian.collins'
import kivy
kivy.require('1.9.0')
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.progressbar import ProgressBar
#from kivy.uix.label import Label
from kivy.uix.popup import Popup
#from kivy.uix.bubble import Bubble
#from kivy.logger import... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "crvdata.py",
"copies": "1",
"size": "190112",
"license": "apache-2.0",
"hash": 1522979226574406100,
"line_mean": 48.2808780746,
"line_max": 166,
"alpha_frac": 0.5156539303,
"autogenerated": false,
"ratio": 3.62463298379409,
"config_test": false,
"... |
__author__ = 'ian.collins'
import kivy
kivy.require('1.9.0')
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.uix.modalview import ModalView
import sys
class ... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "crvMessage.py",
"copies": "1",
"size": "2327",
"license": "apache-2.0",
"hash": 2803589910475084300,
"line_mean": 36.7833333333,
"line_max": 125,
"alpha_frac": 0.6029222174,
"autogenerated": false,
"ratio": 3.5472560975609757,
"config_test": false,
... |
__author__ = 'ian.collins'
import threading
import localftp
class CrvFtp:
def __init__(self, indata, inhost, inuser, inpass):
self.data = indata
self.linzhost = inhost
self.linzuser = inuser
self.linzpass = inpass
# self.ftp = ftplib.FTP()
self.ftp = l... | {
"repo_name": "bagpussnz/cgboatlog",
"path": "crvftp.py",
"copies": "1",
"size": "4348",
"license": "apache-2.0",
"hash": -1270405423639203000,
"line_mean": 27.9862068966,
"line_max": 93,
"alpha_frac": 0.510349586,
"autogenerated": false,
"ratio": 4.086466165413534,
"config_test": false,
"has... |
__author__ = "Ian Goodfellow"
"""
A script for sequentially stepping through FoveatedNORB, viewing each image
and its label.
"""
import numpy as np
from pylearn2.datasets.norb_small import FoveatedNORB
from pylearn2.gui.patch_viewer import PatchViewer
from pylearn2.utils import get_choice
print 'Use test set?'
choic... | {
"repo_name": "ml-lab/pylearn2",
"path": "pylearn2/scripts/datasets/step_through_norb_foveated.py",
"copies": "5",
"size": "1077",
"license": "bsd-3-clause",
"hash": -1336635614958900200,
"line_mean": 19.320754717,
"line_max": 75,
"alpha_frac": 0.6109563603,
"autogenerated": false,
"ratio": 2.942... |
__author__ = "Ian Goodfellow"
class Algorithm(object):
"""
Bare-bones algorithm for driving a bandit learning problem.
"""
def setup(self, agent, environment):
self.decide_func = agent.get_decide_func()
self.action_func = environment.get_action_func()
self.learn_func = agent.ge... | {
"repo_name": "caidongyun/pylearn2",
"path": "pylearn2/sandbox/lisa_rl/bandit/algorithm.py",
"copies": "49",
"size": "1619",
"license": "bsd-3-clause",
"hash": 5388857198165238000,
"line_mean": 33.4468085106,
"line_max": 75,
"alpha_frac": 0.6151945645,
"autogenerated": false,
"ratio": 3.646396396... |
__author__ = "Ian Goodfellow"
from pylearn2.sandbox.lisa_rl.bandit.environment import Environment
class ClassifierBandit(Environment):
"""
An n-armed contextual bandit based on a classification problem.
Each of the n-arms corresponds to a different class. If the agent
selects the correct class for th... | {
"repo_name": "ashhher3/pylearn2",
"path": "pylearn2/sandbox/lisa_rl/bandit/classifier_bandit.py",
"copies": "49",
"size": "1598",
"license": "bsd-3-clause",
"hash": -7923004686917408000,
"line_mean": 28.0545454545,
"line_max": 86,
"alpha_frac": 0.6245306633,
"autogenerated": false,
"ratio": 4.46... |
__author__ = "Ian Goodfellow"
import gc
from matplotlib import pyplot
import numpy as np
import os
import sys
from pylearn2.utils import serial
_, d1, d2 = sys.argv
pyplot.hold(True)
for i, d in enumerate([d1, d2]):
fs = os.listdir(d)
best = np.inf
x = []
y = []
assert len(fs) > 0
for f... | {
"repo_name": "goodfeli/momentum",
"path": "time_and_test_error.py",
"copies": "1",
"size": "1384",
"license": "bsd-3-clause",
"hash": 3251810912876907500,
"line_mean": 22.8620689655,
"line_max": 80,
"alpha_frac": 0.561416185,
"autogenerated": false,
"ratio": 3.226107226107226,
"config_test": f... |
__author__ = "Ian Goodfellow"
import gc
from matplotlib import pyplot
import numpy as np
import os
import sys
from pylearn2.utils import serial
_, d1, d2 = sys.argv
pyplot.hold(True)
fs = os.listdir(d1)
improve_t = 0
improve_tm = 0
improve_both = 0
total = 0
for f in sorted(fs):
if f in ['9', '19', '21']:
... | {
"repo_name": "goodfeli/momentum",
"path": "perc_improv.py",
"copies": "1",
"size": "1294",
"license": "bsd-3-clause",
"hash": 4883265482809808000,
"line_mean": 23.4150943396,
"line_max": 73,
"alpha_frac": 0.6043276662,
"autogenerated": false,
"ratio": 3.0023201856148494,
"config_test": false,
... |
__author__ = "Ian Goodfellow"
import logging
import numpy as np
from pylearn2.utils import serial
from pylearn2.utils import contains_nan, contains_inf
logger = logging.getLogger(__name__)
class Simulator(object):
"""
.. todo::
WRITEME : parameter list
"""
def __init__(self, agent, enviro... | {
"repo_name": "ashhher3/pylearn2",
"path": "pylearn2/sandbox/lisa_rl/bandit/simulator.py",
"copies": "45",
"size": "1157",
"license": "bsd-3-clause",
"hash": -3922137657159033000,
"line_mean": 29.4473684211,
"line_max": 76,
"alpha_frac": 0.580812446,
"autogenerated": false,
"ratio": 3.94880546075... |
__author__ = "Ian Goodfellow"
import logging
import numpy as np
from pylearn2.utils import serial
logger = logging.getLogger(__name__)
class Simulator(object):
"""
.. todo::
WRITEME : parameter list
"""
def __init__(self, agent, environment, algorithm, save_path):
self.__dict__.up... | {
"repo_name": "KennethPierce/pylearnk",
"path": "pylearn2/sandbox/lisa_rl/bandit/simulator.py",
"copies": "4",
"size": "1119",
"license": "bsd-3-clause",
"hash": -1540774721559620600,
"line_mean": 29.2432432432,
"line_max": 79,
"alpha_frac": 0.563896336,
"autogenerated": false,
"ratio": 3.7932203... |
__author__ = "Ian Goodfellow"
import logging
import time
from theano import function
import theano.tensor as T
from pylearn2.sandbox.lisa_rl.bandit.agent import Agent
from pylearn2.utils import sharedX
from pylearn2.utils.rng import make_theano_rng
logger = logging.getLogger(__name__)
class ClassifierAgent(Agent... | {
"repo_name": "aalmah/pylearn2",
"path": "pylearn2/sandbox/lisa_rl/bandit/classifier_agent.py",
"copies": "49",
"size": "5199",
"license": "bsd-3-clause",
"hash": 812846659375510800,
"line_mean": 31.9050632911,
"line_max": 107,
"alpha_frac": 0.6170417388,
"autogenerated": false,
"ratio": 3.759219... |
__author__ = "Ian Goodfellow"
import numpy as np
from theano.compat.python2x import OrderedDict
from theano import function
from theano import tensor as T
from pylearn2.sandbox.lisa_rl.bandit.agent import Agent
from pylearn2.utils import sharedX
class AverageAgent(Agent):
"""
A simple n-armed bandit playin... | {
"repo_name": "KennethPierce/pylearnk",
"path": "pylearn2/sandbox/lisa_rl/bandit/average_agent.py",
"copies": "5",
"size": "2258",
"license": "bsd-3-clause",
"hash": 6389092602087905000,
"line_mean": 31.2571428571,
"line_max": 95,
"alpha_frac": 0.6461470328,
"autogenerated": false,
"ratio": 3.961... |
__author__ = "Ian Goodfellow"
import numpy as np
from theano import config
from theano import function
from theano import tensor as T
from pylearn2.sandbox.lisa_rl.bandit.environment import Environment
from pylearn2.utils import sharedX
from pylearn2.utils.rng import make_np_rng, make_theano_rng
class GaussianBand... | {
"repo_name": "ddboline/pylearn2",
"path": "pylearn2/sandbox/lisa_rl/bandit/gaussian_bandit.py",
"copies": "49",
"size": "1542",
"license": "bsd-3-clause",
"hash": -4094578281784440300,
"line_mean": 33.2666666667,
"line_max": 97,
"alpha_frac": 0.6647211414,
"autogenerated": false,
"ratio": 3.6801... |
__author__ = "Ian Goodfellow"
import numpy as np
from theano import function
from theano import tensor as T
from pylearn2.compat import OrderedDict
from pylearn2.sandbox.lisa_rl.bandit.agent import Agent
from pylearn2.utils import sharedX
class AverageAgent(Agent):
"""
A simple n-armed bandit playing agent... | {
"repo_name": "fishcorn/pylearn2",
"path": "pylearn2/sandbox/lisa_rl/bandit/average_agent.py",
"copies": "44",
"size": "2251",
"license": "bsd-3-clause",
"hash": 7968123829442826000,
"line_mean": 31.1571428571,
"line_max": 95,
"alpha_frac": 0.6454908929,
"autogenerated": false,
"ratio": 3.9700176... |
__author__ = 'iankuoli'
import clean_text
setLabel = set()
# Convet "<s>" and "</s>" to "."
setLabel.add(".")
# Other words are set "%%%"
setLabel.add("%%%")
dictWord = dict()
with open('training_2.txt', 'r', encoding='UTF-8') as file:
for line in file:
a = clean_text.clean_text(line)
a = a.sp... | {
"repo_name": "iankuoli/final_rnn",
"path": "extract_label.py",
"copies": "1",
"size": "1346",
"license": "bsd-3-clause",
"hash": -4921193471773653000,
"line_mean": 20.380952381,
"line_max": 80,
"alpha_frac": 0.5274888559,
"autogenerated": false,
"ratio": 3.152224824355972,
"config_test": false... |
__author__ = 'iankuoli'
import numpy
from rnn import MetaRNN
import clean_text
import pickle
import theano
class RNNmodel:
def __init__(self, word2vec_path, label_path, model_path, n_in, n_hidden):
self.n_in = n_in
self.n_hidden = n_hidden
#
# Initialize the label vectorID
... | {
"repo_name": "iankuoli/final_rnn",
"path": "rnn_model.py",
"copies": "1",
"size": "2910",
"license": "bsd-3-clause",
"hash": -6401022078577058000,
"line_mean": 27.8217821782,
"line_max": 83,
"alpha_frac": 0.4838487973,
"autogenerated": false,
"ratio": 3.583743842364532,
"config_test": false,
... |
__author__ = 'iankuoli'
import numpy
from rnn import MetaRNN
import matplotlib.pyplot as plt
import logging
import clean_text
import pickle
import theano
model_path = "save_param2_hidden100_best"
plt.ion()
logging.basicConfig(level=logging.INFO)
# model feature dim has 200
model = {}
fin = open('vectors.6B.200d.txt... | {
"repo_name": "iankuoli/final_rnn",
"path": "test_rnn.py",
"copies": "1",
"size": "2460",
"license": "bsd-3-clause",
"hash": -6109498143491671000,
"line_mean": 21.3636363636,
"line_max": 80,
"alpha_frac": 0.5959349593,
"autogenerated": false,
"ratio": 2.8275862068965516,
"config_test": false,
... |
__author__ = 'iankuoli'
import os
from rnn_model import RNNmodel
model_path = "save_param2_hidden100_best"
word2vec_path = "vectors.6B.200d.txt"
label_path = "label2word_small.txt"
n_in = 200
n_hidden = 80
rnn = RNNmodel(word2vec_path, label_path, model_path, n_in, n_hidden)
'''
#
# HW3
#
with open("testing_data.t... | {
"repo_name": "iankuoli/final_rnn",
"path": "test.py",
"copies": "1",
"size": "2087",
"license": "bsd-3-clause",
"hash": 5386747410770493000,
"line_mean": 25.417721519,
"line_max": 85,
"alpha_frac": 0.5831336847,
"autogenerated": false,
"ratio": 2.731675392670157,
"config_test": false,
"has_n... |
__author__ = 'iankuoli'
import os
id_list = set()
with open("layer8_hw2_best.csv", "r") as f_id:
for line in f_id:
lines = line.strip("\n").split(",")
id_list.add(lines[0])
print(len(id_list))
answer = dict()
ann = dict()
word2id = dict()
id2word = dict()
with open("timit.chmap", "r") as f_ma... | {
"repo_name": "iankuoli/final_rnn",
"path": "output.py",
"copies": "1",
"size": "1671",
"license": "bsd-3-clause",
"hash": -1130477680806559500,
"line_mean": 26.8666666667,
"line_max": 74,
"alpha_frac": 0.5308198683,
"autogenerated": false,
"ratio": 3.2893700787401574,
"config_test": false,
"... |
__author__ = 'ian'
from subprocess import Popen, call
import mimetypes
import os, re
import json
from flask import Flask, make_response, request, send_file, Response, render_template, session, send_from_directory
# configuration
DEBUG = True
SECRET_KEY = '9ddtd2mz%rr3@z+-nqwh@0jcu7#)0x$8fvblt1515tzl7k5=u!*!'
VIDEO_PAT... | {
"repo_name": "ianflitman/CtoriaServer",
"path": "server/server.py",
"copies": "1",
"size": "2224",
"license": "mit",
"hash": -3422856024251526700,
"line_mean": 25.1764705882,
"line_max": 115,
"alpha_frac": 0.601618705,
"autogenerated": false,
"ratio": 3.0465753424657533,
"config_test": false,
... |
__author__ = 'ian'
import cv2
import os
import numpy as np
import pandas as pd
import argparse
############
def on_mouse(event, x, y, flags, params):
if event == cv2.EVENT_LBUTTONDOWN:
print 'Start Mouse Position: ' + str(x) + ', ' + str(y)
sbox = [x, y]
boxes.append(sbox)
elif event ==... | {
"repo_name": "RobertIan/LearningFearandMatechoice",
"path": "processData.py",
"copies": "1",
"size": "17452",
"license": "mit",
"hash": 4907671464131607000,
"line_mean": 51.7250755287,
"line_max": 129,
"alpha_frac": 0.4330735732,
"autogenerated": false,
"ratio": 4.442973523421589,
"config_test... |
__author__ = 'ian'
import random
def predict_survival(age,gender, ticket_class):
if age <= 32.1447:
if age <= 6.5000:
if age <= 2.5000:
if random.randint(1, 45) <= 35:
print("Dead")
return False
else:
p... | {
"repo_name": "YurkaninRyan/datascience",
"path": "public/decision.py",
"copies": "1",
"size": "2244",
"license": "mit",
"hash": -606260168194155500,
"line_mean": 28.9333333333,
"line_max": 49,
"alpha_frac": 0.3204099822,
"autogenerated": false,
"ratio": 5.317535545023697,
"config_test": false,... |
__author__ = 'Ian'
class LanguageCPP(object):
def __init__(self):
self.single_comment = '//'
self.multi_comment = ['/*', '*/']
self.file_exts = ['*.cpp', '*.cxx', '*.c', '*.hpp', '*.hxx', '*.h']
self.ignore_dir = []
class LanguageC(object):
def __init__(self):
self.si... | {
"repo_name": "GrappigPanda/pygemony",
"path": "pyg/languages.py",
"copies": "1",
"size": "1339",
"license": "mit",
"hash": -1786217035287342600,
"line_mean": 25.78,
"line_max": 75,
"alpha_frac": 0.4869305452,
"autogenerated": false,
"ratio": 3.4510309278350517,
"config_test": false,
"has_no_... |
__author__ = 'Ian S. Evans'
__version__ = '0.0.4'
from json import dumps, JSONEncoder, loads
from collections import UserList
MIMETYPE = "application/vnd.collection+json"
class Comparable(object):
"""
An object that needs to be comparable.
Stolen shamelessly from Ricardo Kirkner's bindings
See https... | {
"repo_name": "ievans3024/CollectionPlusJSON",
"path": "collection_plus_json.py",
"copies": "1",
"size": "17455",
"license": "mit",
"hash": -7236085228426963000,
"line_mean": 31.6261682243,
"line_max": 119,
"alpha_frac": 0.5680320825,
"autogenerated": false,
"ratio": 4.220261121856867,
"config_... |
__author__ = 'ibakepunk'
__email__ = 'ibakepunk@gmail.com'
LIST_TYPES = (list, tuple)
def get_diff(expected, actual, key: str = '') -> str:
"""
Recursively gets xpath of elements that differ.
:param expected: Expected dict
:param actual: Actual dict
:type expected: dict
:type actual: dict
... | {
"repo_name": "ibakepunk/hairy-happiness",
"path": "dict_differ.py",
"copies": "1",
"size": "1697",
"license": "mit",
"hash": 135539994150051630,
"line_mean": 34.3541666667,
"line_max": 78,
"alpha_frac": 0.538597525,
"autogenerated": false,
"ratio": 3.520746887966805,
"config_test": false,
"h... |
from pymongo import MongoClient
from NutritionScraper.NutritionApiTools import build_keywords_from_name
import json
import bson
# from NutritionScraper.NutritionApi import FoodItem
class MSUCafeDB(object):
"""
Used to model our MongoDB connection instance.
"""
db_connection = None
def __init__(se... | {
"repo_name": "atbe/MSU-Cafe-Scraper",
"path": "NutritionScraper/db.py",
"copies": "1",
"size": "2608",
"license": "mit",
"hash": -7188131013707707000,
"line_mean": 31.6,
"line_max": 100,
"alpha_frac": 0.6146472393,
"autogenerated": false,
"ratio": 4.087774294670846,
"config_test": false,
"ha... |
__author__ = 'ibrahim (at) sikilabs (dot) com'
__licence__ = 'MIT'
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
import hashlib
import zlib
import urllib
import cPickle as pickle
# import unique url object
modlist = settings.UNIQUE_URL_OBJECT.split(".")
_mod... | {
"repo_name": "diopib/django-unique",
"path": "models.py",
"copies": "1",
"size": "1955",
"license": "mit",
"hash": -4804131080133365000,
"line_mean": 30.5322580645,
"line_max": 76,
"alpha_frac": 0.6204603581,
"autogenerated": false,
"ratio": 3.607011070110701,
"config_test": false,
"has_no_k... |
__author__ = 'ibrahim (at) sikilabs (dot) com'
__licence__ = 'MIT'
from django.shortcuts import RequestContext
from django.template import loader
from django.http import HttpResponse
from django.conf import settings
import datetime
import os
from main.unique.models import UniqueUrl
# import unique url object
modlist... | {
"repo_name": "diopib/django-unique",
"path": "views.py",
"copies": "1",
"size": "2291",
"license": "mit",
"hash": -588027897367098400,
"line_mean": 35.3650793651,
"line_max": 99,
"alpha_frac": 0.6438236578,
"autogenerated": false,
"ratio": 3.677367576243981,
"config_test": false,
"has_no_key... |
__author__ = 'ibrahim (at) zinaria (dot) com'
__licence__ = 'MIT'
import zipfile
import os
from bs4 import BeautifulSoup as bs
# very cool little snippet to run 2 for loop at the same time
# thanks to
# http://matteolandi.blogspot.ca/2009/09/python-double-for-loop-statement_06.html
def cross(a, b):
for i in a:
... | {
"repo_name": "diopib/pyebook",
"path": "pyebook/pyebook.py",
"copies": "1",
"size": "2213",
"license": "mit",
"hash": -5429968398788541000,
"line_mean": 32.5454545455,
"line_max": 107,
"alpha_frac": 0.5661997289,
"autogenerated": false,
"ratio": 3.5126984126984127,
"config_test": false,
"has... |
__author__ = 'IceBrick'
import json
from .Circles import Circles
class TestConfig(object):
"""Class that represents test configuration of crossed/not crossed circles and their state.
Can be converted to JSON and restored from JSON.
"""
def __init__(self, target=None, circles=None):
if target... | {
"repo_name": "1ceBrick/PyLandolt",
"path": "PyLandolt/TestModel/TestConfig.py",
"copies": "1",
"size": "1235",
"license": "apache-2.0",
"hash": -3421758662044997000,
"line_mean": 27.7441860465,
"line_max": 95,
"alpha_frac": 0.6105263158,
"autogenerated": false,
"ratio": 3.7652439024390243,
"co... |
__author__ = "Ice Shi"
from random import randint
# create battle board
board = []
size = int(raw_input("Please input the battle size: "))
for n in range(size):
""" caution. because we need a grid, so we use ["O"] to stand for a place.
if you use the "O", will make "OOOOO" instead of [[["O"],["O"],["O"],["O"]... | {
"repo_name": "SpAiNiOr/mystudy",
"path": "learning/test/battleship_v2.py",
"copies": "1",
"size": "3047",
"license": "apache-2.0",
"hash": 4081140604871021000,
"line_mean": 32.8555555556,
"line_max": 89,
"alpha_frac": 0.6058418116,
"autogenerated": false,
"ratio": 3.352035203520352,
"config_te... |
__author__ = 'ichistov'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
driver = self.app.driver
self.app.open_home_page()
driver.find_element_by_name("user").click()
driver.find_element_by_name("user").clear()
... | {
"repo_name": "ivanSchistov/Python_tranings_new",
"path": "fixture/session.py",
"copies": "1",
"size": "1531",
"license": "apache-2.0",
"hash": -8975917606132254000,
"line_mean": 31.5957446809,
"line_max": 84,
"alpha_frac": 0.5917700849,
"autogenerated": false,
"ratio": 3.6108490566037736,
"con... |
__author__ = 'ichistov'
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_group_page(self):
driver = self.app.driver
if not (driver.current_url.endswitch("/group.php") and len(driver.find_elements_by_name("new")) > 0):
driver... | {
"repo_name": "ivanSchistov/Python_tranings_new",
"path": "fixture/group.py",
"copies": "1",
"size": "3228",
"license": "apache-2.0",
"hash": 1292369417881581000,
"line_mean": 33.7096774194,
"line_max": 109,
"alpha_frac": 0.6081164808,
"autogenerated": false,
"ratio": 3.6026785714285716,
"confi... |
import arcpy, os, datetime
from arcpy import env
def main(argv=None):
# Get Input Parameters
env.workspace = r"D:\Tests\StatOil\StatOil.gdb"
env.overwriteOutput = True
lineFC = r"IHS_Europe_Calibrated_Small" #PolylineM featureclass defining the input geometries fo... | {
"repo_name": "Cintruenigo/ArcGIS-Server-Stuff",
"path": "UpdateHatches.py",
"copies": "1",
"size": "5504",
"license": "apache-2.0",
"hash": -1689342476378066000,
"line_mean": 54.595959596,
"line_max": 244,
"alpha_frac": 0.6068313953,
"autogenerated": false,
"ratio": 4.361331220285262,
"config_... |
import os, sys, time
import urllib, urllib2, urlparse, httplib, json
import mimetools, mimetypes
from cStringIO import StringIO
import threading, Queue
thread_count = 2
printLock = threading.Lock()
serviceDefinitionQueue = Queue.Queue()
publishedQueue = Queue.Queue();
failedQueue = Queue.Queue()
def getToken(baseurl... | {
"repo_name": "Cintruenigo/ArcGIS-Server-Stuff",
"path": "PublishAllSDsinFolder.py",
"copies": "2",
"size": "9313",
"license": "apache-2.0",
"hash": 8238650183481791000,
"line_mean": 40.3911111111,
"line_max": 137,
"alpha_frac": 0.6542467519,
"autogenerated": false,
"ratio": 3.812116250511666,
... |
__author__ = 'idan'
from google.appengine.ext.webapp import template
from google.appengine.api import mail
import webapp2
from models.user import User
import hashlib
import json
import random
class UpdatePassHandler(webapp2.RequestHandler):
def get(self):
template_params = {}
html = template.rend... | {
"repo_name": "yaakov300/ForexApp",
"path": "web/pages/UpdatePass.py",
"copies": "1",
"size": "1385",
"license": "mit",
"hash": -6453993110998353000,
"line_mean": 29.1304347826,
"line_max": 84,
"alpha_frac": 0.6346570397,
"autogenerated": false,
"ratio": 3.9798850574712645,
"config_test": false... |
__author__ = 'idan'
from google.appengine.ext.webapp import template
from google.appengine.api import mail
import webapp2
from models.user import User
class ForgetPassHandler(webapp2.RequestHandler):
def get(self):
template_params = {}
html = template.render("web/templates/forgetPass.html", templ... | {
"repo_name": "yaakov300/ForexApp",
"path": "web/pages/forgetPass.py",
"copies": "1",
"size": "1442",
"license": "mit",
"hash": 5339641914767881000,
"line_mean": 31.0666666667,
"line_max": 147,
"alpha_frac": 0.6366158114,
"autogenerated": false,
"ratio": 3.9291553133514987,
"config_test": false... |
__author__ = 'idan'
from google.appengine.ext.webapp import template
import webapp2
import json
from models.user import User
class LoginHandler(webapp2.RequestHandler):
def get(self):
template_params = {}
html = template.render("web/templates/login.html", template_params)
self.response.wri... | {
"repo_name": "yaakov300/ForexApp",
"path": "web/pages/login.py",
"copies": "1",
"size": "1038",
"license": "mit",
"hash": -9194500204018689000,
"line_mean": 27.8333333333,
"line_max": 79,
"alpha_frac": 0.6281310212,
"autogenerated": false,
"ratio": 3.9770114942528734,
"config_test": false,
"... |
__author__ = 'idclark'
import requests as r
def about_subreddit(sr):
"""get an overview for a given subreddit
> running = about_subreddit('running')
"""
url = r'http://www.reddit.com/r/{sr}/about.json'.format(sr=sr)
response = r.get(url)
return response.json()['data']
def my_subreddits(c... | {
"repo_name": "idclark/wrap-it-up",
"path": "reddit_py/subreddits.py",
"copies": "1",
"size": "2511",
"license": "mit",
"hash": 8918946160749243000,
"line_mean": 30,
"line_max": 83,
"alpha_frac": 0.6507367583,
"autogenerated": false,
"ratio": 3.4730290456431536,
"config_test": false,
"has_no_... |
__author__ = 'idclark'
import requests as r
def get_user_activity(activity, user, limit=25, sort='top', time=all):
"""Retrieve a user's activity, choice of:
Overview, submissions, Comments, liked, disliked, hidden, saved, gilded
User: a valid reddit username
limit: a limit on the number of i... | {
"repo_name": "idclark/wrap-it-up",
"path": "reddit_py/users.py",
"copies": "1",
"size": "1345",
"license": "mit",
"hash": -6687092304706615000,
"line_mean": 37.4571428571,
"line_max": 107,
"alpha_frac": 0.6364312268,
"autogenerated": false,
"ratio": 3.448717948717949,
"config_test": false,
"... |
__author__ = 'idclark'
import requests
def user_login(user_name, password, bot_desc):
""" user_name: a valid reddit username
password: the password to the user name
bot_desc: the name of the bot to be used in the header dict
returns a Requests.session() client that can passed into other functions that... | {
"repo_name": "idclark/wrap-it-up",
"path": "reddit_py/accounts.py",
"copies": "1",
"size": "3247",
"license": "mit",
"hash": -5310488991246810000,
"line_mean": 34.2934782609,
"line_max": 103,
"alpha_frac": 0.6341238066,
"autogenerated": false,
"ratio": 3.9840490797546013,
"config_test": false,... |
__author__ = 'ido'
import sys
sys.path.append('../')
import unittest
from sqlite3 import OperationalError
from teaparty import model
from mock import Mock
from conf import config
class _ELBs():
def __init__(self, data):
self.instances = data[:]
class _EC():
def __init__(self, _id):
self.id... | {
"repo_name": "idooo/teaparty",
"path": "tests/test_model.py",
"copies": "1",
"size": "14127",
"license": "mit",
"hash": -4624091274386104000,
"line_mean": 34.3175,
"line_max": 115,
"alpha_frac": 0.4891342819,
"autogenerated": false,
"ratio": 3.598318899643403,
"config_test": true,
"has_no_ke... |
__author__ = 'Ido'
import urllib2
'''
Make sure you are connected to the internet before using this class
'''
class Connector:
STATEValid="URL_Valid"
STATE404="URL_404"
STATEError="URL_Unknown_Error"
ERROR404="HTTPError_404_was_caught(Page_was_not_found)"
ERRORGeneral="Unkown_Error_was_caught"
... | {
"repo_name": "ido4848/haiku-hebrew",
"path": "python_scripts/connector.py",
"copies": "1",
"size": "1263",
"license": "mit",
"hash": 4328620811789549000,
"line_mean": 20.7931034483,
"line_max": 67,
"alpha_frac": 0.5843230404,
"autogenerated": false,
"ratio": 4.074193548387097,
"config_test": f... |
__author__ = 'IEUser'
from model.contact import Contact
from fixture.stringUtils import StringsHelper
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of contacts", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
... | {
"repo_name": "yulia-baturina/python_training",
"path": "generator/contact.py",
"copies": "1",
"size": "1039",
"license": "apache-2.0",
"hash": -530430426668499200,
"line_mean": 28.6857142857,
"line_max": 115,
"alpha_frac": 0.6717998075,
"autogenerated": false,
"ratio": 3.3089171974522293,
"con... |
__author__ = 'IEUser'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id=PrimaryKey(int, column='gro... | {
"repo_name": "yulia-baturina/python_training",
"path": "fixture/orm.py",
"copies": "1",
"size": "2432",
"license": "apache-2.0",
"hash": 4857817055806542000,
"line_mean": 40.9482758621,
"line_max": 141,
"alpha_frac": 0.6792763158,
"autogenerated": false,
"ratio": 3.6461769115442277,
"config_te... |
__author__ = 'IEUser'
import mysql.connector
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = mysql.... | {
"repo_name": "yulia-baturina/python_training",
"path": "fixture/db.py",
"copies": "1",
"size": "1948",
"license": "apache-2.0",
"hash": -2925716366681222700,
"line_mean": 40.4468085106,
"line_max": 210,
"alpha_frac": 0.5929158111,
"autogenerated": false,
"ratio": 4.13588110403397,
"config_test... |
__author__ = 'IEUser'
from model.contact import Contact
from selenium.webdriver.support.ui import Select
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def fill_in_fields(self, contact):
wd = self.app.wd
self.fill_in_field("firstname", contact.firstname)
... | {
"repo_name": "yulia-baturina/python_training",
"path": "fixture/contact.py",
"copies": "1",
"size": "7754",
"license": "apache-2.0",
"hash": 4811427904735081000,
"line_mean": 41.3770491803,
"line_max": 120,
"alpha_frac": 0.5954346144,
"autogenerated": false,
"ratio": 3.5699815837937385,
"confi... |
__author__ = 'IEUser'
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def is_groups_page_opened(self):
wd = self.app.wd
return wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0
def return_to_groups_page(se... | {
"repo_name": "yulia-baturina/python_training",
"path": "fixture/group.py",
"copies": "1",
"size": "4587",
"license": "apache-2.0",
"hash": 8509506878258116000,
"line_mean": 32.7279411765,
"line_max": 97,
"alpha_frac": 0.58382385,
"autogenerated": false,
"ratio": 3.4592760180995477,
"config_tes... |
__author__ = 'IEUser'
from model.project import Project
import re
class ProjectHelper:
def __init__(self, app):
self.app = app
def fill_in_fields(self, project):
wd = self.app.wd
self.fill_in_field("name", project.name)
self.fill_in_field("description", project.description)
... | {
"repo_name": "yulia-baturina/python_training_mantis",
"path": "fixture/project.py",
"copies": "1",
"size": "2996",
"license": "apache-2.0",
"hash": 8177945756163466000,
"line_mean": 36.4625,
"line_max": 106,
"alpha_frac": 0.6148197597,
"autogenerated": false,
"ratio": 3.596638655462185,
"confi... |
__author__ = 'IEUser'
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
from fixture.navigation import NavigationHelper
class Application:
def __init__(self, browser, baseUrl):
if browser=="firefox":
... | {
"repo_name": "yulia-baturina/python_training",
"path": "fixture/application.py",
"copies": "1",
"size": "1135",
"license": "apache-2.0",
"hash": 3796228558686053000,
"line_mean": 26.0476190476,
"line_max": 66,
"alpha_frac": 0.5947136564,
"autogenerated": false,
"ratio": 4.52191235059761,
"conf... |
__author__ = 'IEUser'
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.navigation import NavigationHelper
from fixture.project import ProjectHelper
from fixture.james import JamesHelper
from fixture.signup import SignupHelper
from fixture.mail import MailHelper
from fixture.soap im... | {
"repo_name": "yulia-baturina/python_training_mantis",
"path": "fixture/application.py",
"copies": "1",
"size": "1407",
"license": "apache-2.0",
"hash": -671155521174358700,
"line_mean": 27.7346938776,
"line_max": 66,
"alpha_frac": 0.6154939588,
"autogenerated": false,
"ratio": 4.356037151702786,... |
__author__ = 'IEUser'
from sys import maxsize
from fixture.stringUtils import StringsHelper
class Contact:
def __init__(self, firstname="", middlename="", lastname="", nickname="", company="", title="",
address="", homePhone="", mobilePhone="", workPhone="", secondaryPhone="",
f... | {
"repo_name": "yulia-baturina/python_training",
"path": "model/contact.py",
"copies": "1",
"size": "3291",
"license": "apache-2.0",
"hash": 6640267212098087000,
"line_mean": 39.6419753086,
"line_max": 137,
"alpha_frac": 0.582193862,
"autogenerated": false,
"ratio": 3.867215041128085,
"config_te... |
__author__ = 'IEUser'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.navigation.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.fin... | {
"repo_name": "yulia-baturina/python_training",
"path": "fixture/session.py",
"copies": "1",
"size": "1438",
"license": "apache-2.0",
"hash": -6001586621975757000,
"line_mean": 28.9791666667,
"line_max": 73,
"alpha_frac": 0.5674547983,
"autogenerated": false,
"ratio": 3.3835294117647057,
"confi... |
__author__ = 'IEUser'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.navigation.open_login_page()
wd.find_element_by_name("username").click()
wd.find_element_by_name("username").clear()
... | {
"repo_name": "yulia-baturina/python_training_mantis",
"path": "fixture/session.py",
"copies": "1",
"size": "1468",
"license": "apache-2.0",
"hash": -8335036646115294000,
"line_mean": 29.6041666667,
"line_max": 78,
"alpha_frac": 0.5803814714,
"autogenerated": false,
"ratio": 3.486935866983373,
... |
__author__ = 'ignacioelola'
import csv
import numpy as np
'''
Cleaning:
- Check that musician = musician from show
- One musician in multiple genres think about structure (musician -> genre or genre -> musician)
Analysis:
- structure genre - musician - year - show - songs
- # different songs per musician - rank them
... | {
"repo_name": "ignacioelola/music-setlists",
"path": "musicians_analysis.py",
"copies": "1",
"size": "4564",
"license": "mit",
"hash": 3925284807672626000,
"line_mean": 35.2222222222,
"line_max": 123,
"alpha_frac": 0.6058282209,
"autogenerated": false,
"ratio": 3.156293222683264,
"config_test":... |
import utils.distribution_utils as dist
import utils.db_utils as db
import utils.queries as queries
__author__ = 'igobrilhante'
import random
import math
import numpy as np
import datetime
import time
trajectories_per_user_distribution_f = ""
trajectory_size_distribution_f = ""
trajectory_extent_distribution_f = "... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "full_randtraj/full_trajectory_generator.py",
"copies": "1",
"size": "4676",
"license": "mit",
"hash": -1266565055479650000,
"line_mean": 23.4816753927,
"line_max": 93,
"alpha_frac": 0.6071428571,
"autogenerated": false,
"ratio": 3... |
import utils.distribution_utils as dist
import utils.db_utils as db
import utils.queries as queries
import utils.utils as utils
__author__ = 'igobrilhante'
import random
import numpy as np
import datetime
import time
trajectories_per_user_distribution_f = ""
trajectory_size_distribution_f = ""
trajectory_extent_d... | {
"repo_name": "igobrilhante/random-trajectory-generator",
"path": "dist_randtraj/dist_trajectory_generator.py",
"copies": "1",
"size": "6862",
"license": "mit",
"hash": 7092612811429588000,
"line_mean": 27.1229508197,
"line_max": 126,
"alpha_frac": 0.6213931798,
"autogenerated": false,
"ratio": 3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.