text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Frederik Diehl'
import uuid
from apsis.utilities.logging_utils import get_logger
import time
class Candidate(object):
"""
A Candidate is a dictionary of parameter values, which should - or have
been - evaluated.
A Candidate object can be seen as a single iteration of the experiment.
... | {
"repo_name": "FrederikDiehl/apsis",
"path": "code/apsis/models/candidate.py",
"copies": "2",
"size": "7764",
"license": "mit",
"hash": 3996365836099465000,
"line_mean": 32.0382978723,
"line_max": 79,
"alpha_frac": 0.5855229263,
"autogenerated": false,
"ratio": 4.5859421145894865,
"config_test"... |
"""Support to pretty-print lists, tuples, & dictionaries recursively.
## Modified by Chaim-Leib Halbert <chaim.leib.halbert@gmail.com> 03/06/14:
## Added support for objects defining simple __reduce__() methods.
## For this to function, __reduce__ must returns a tuple of a
## constructor and arguments for the constru... | {
"repo_name": "chaimleib/intervaltree",
"path": "test/pprint.py",
"copies": "1",
"size": "16790",
"license": "apache-2.0",
"hash": -3483171566728311000,
"line_mean": 34.1991614256,
"line_max": 105,
"alpha_frac": 0.5431209053,
"autogenerated": false,
"ratio": 4.320638188368502,
"config_test": fa... |
"""Support to pretty-print lists, tuples, & dictionaries recursively.
Very simple, but useful, especially in debugging data structures.
Classes
-------
PrettyPrinter()
Handle pretty-printing operations onto a stream using a configured
set of formatting parameters.
Functions
---------
pformat()
Format ... | {
"repo_name": "int19h/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/pprint.py",
"copies": "5",
"size": "20884",
"license": "apache-2.0",
"hash": -8499602455168980000,
"line_mean": 33.9815745394,
"line_max": 86,
"alpha_frac": 0.5386899061,
"autogenerated": false,
"ratio": 4.196945337... |
"""Support to pretty-print lists, tuples, & dictionaries recursively.
Very simple, but useful, especially in debugging data structures.
Classes
-------
PrettyPrinter()
Handle pretty-printing operations onto a stream using a configured
set of formatting parameters.
Functions
---------
pformat()
... | {
"repo_name": "1900/pyspider",
"path": "libs/pprint.py",
"copies": "4",
"size": "13152",
"license": "apache-2.0",
"hash": 6170034384097377000,
"line_mean": 34.2600536193,
"line_max": 85,
"alpha_frac": 0.5078315085,
"autogenerated": false,
"ratio": 4.360742705570292,
"config_test": false,
"has... |
"""Support to pretty-print lists, tuples, & dictionaries recursively.
Very simple, but useful, especially in debugging data structures.
Classes
-------
PrettyPrinter()
Handle pretty-printing operations onto a stream using a configured
set of formatting parameters.
Functions
---------
pformat()
Format ... | {
"repo_name": "jamesblunt/pyspider",
"path": "pyspider/libs/pprint.py",
"copies": "3",
"size": "12863",
"license": "apache-2.0",
"hash": -5184505974217339000,
"line_mean": 32.85,
"line_max": 86,
"alpha_frac": 0.5183083262,
"autogenerated": false,
"ratio": 4.3005683717820125,
"config_test": fals... |
"""Support to pretty-print lists, tuples, & dictionaries recursively.
Very simple, but useful, especially in debugging data structures.
Classes
-------
PrettyPrinter()
Handle pretty-printing operations onto a stream using a configured
set of formatting parameters.
Functions
---------
pforma... | {
"repo_name": "jittat/cafe-grader-web",
"path": "lib/assets/Lib/pprint.py",
"copies": "9",
"size": "13127",
"license": "mit",
"hash": 1391571734956533200,
"line_mean": 33.4783783784,
"line_max": 81,
"alpha_frac": 0.5090271959,
"autogenerated": false,
"ratio": 4.410954301075269,
"config_test": f... |
__author__ = 'Fred Lorry'
from misc import *
from devil import *
from hud import *
from level import *
if not pygame.font: print('Warning, fonts disabled!')
if not pygame.mixer: print('Warning, sound disabled!')
class SimpleGameMain:
def __init__(self, width=640, height=480, fps=30):
pygame.init()
... | {
"repo_name": "cs-hse-projects/fredlorry-1yr-project",
"path": "SimpleGame.py",
"copies": "1",
"size": "8455",
"license": "mit",
"hash": -3162447482271331000,
"line_mean": 42.137755102,
"line_max": 159,
"alpha_frac": 0.5291543465,
"autogenerated": false,
"ratio": 3.576565143824027,
"config_test... |
__author__ = 'Fred Lorry'
from misc import *
from platform import *
from devil import Mob
class Level():
'''Level class. Contains platforms & mobs.'''
def __init__(self, number=0, width=640, height=480):
with open("level"+str(number)+".json", "r") as f:
level_data = json.loads(f.read())
... | {
"repo_name": "cs-hse-projects/fredlorry-1yr-project",
"path": "level.py",
"copies": "1",
"size": "1456",
"license": "mit",
"hash": -1159881635343150600,
"line_mean": 31.3555555556,
"line_max": 133,
"alpha_frac": 0.5769230769,
"autogenerated": false,
"ratio": 3.5773955773955772,
"config_test": ... |
__author__ = 'Fred Lorry'
from misc import *
class Object(pygame.sprite.Sprite):
def __init__(self, name, x=0, y=0, boundaries=None):
#Parent Constructor
super().__init__()
#Creating constants
with open("constants.json", "r") as f:
constants = json.loads(f.read())[name]... | {
"repo_name": "cs-hse-projects/fredlorry-1yr-project",
"path": "devil.py",
"copies": "1",
"size": "6842",
"license": "mit",
"hash": 2167794459973003500,
"line_mean": 32.0579710145,
"line_max": 99,
"alpha_frac": 0.5349313066,
"autogenerated": false,
"ratio": 3.65491452991453,
"config_test": fals... |
__author__ = 'Fred Lorry'
from misc import *
with open("constants.json", "r") as f:
tile_paths = json.loads(f.read())["tiles_path"]
class Block(pygame.sprite.Sprite):
'''A block from which platform is formed'''
def __init__(self, x, y, appearance="TOP"):
#Parent constructor
super().__init... | {
"repo_name": "cs-hse-projects/fredlorry-1yr-project",
"path": "platform.py",
"copies": "1",
"size": "2027",
"license": "mit",
"hash": 5605943938568885000,
"line_mean": 25.3246753247,
"line_max": 79,
"alpha_frac": 0.5614208189,
"autogenerated": false,
"ratio": 3.626118067978533,
"config_test": ... |
__author__ = 'Fred Lorry'
import os, sys
import pygame
import json
from pygame.locals import *
with open("constants.json", "r") as f:
colors = json.loads(f.read())["colors"]
#Block constants
BLOCK_HEIGHT = 64
BLOCK_WIDTH = 64
def showMessage():
self.background.fill(colors["BLACK"])
messag... | {
"repo_name": "cs-hse-projects/fredlorry-1yr-project",
"path": "misc.py",
"copies": "1",
"size": "1554",
"license": "mit",
"hash": 2289220203003262500,
"line_mean": 26.75,
"line_max": 109,
"alpha_frac": 0.6241956242,
"autogenerated": false,
"ratio": 3.4456762749445677,
"config_test": false,
"... |
__author__ = 'fritz'
import os
import xml.etree.ElementTree as ET
import time,datetime
from location.models import Location
from person.models import Person
from .models import RegesteUniMainz, Regeste, Department, Issue, Volume
from .tasks import data_mining_regeste
from django.db import IntegrityError
def parse_fol... | {
"repo_name": "danielbaak/imperii-viz",
"path": "regeste/utils.py",
"copies": "1",
"size": "4060",
"license": "mit",
"hash": 3019390386882626600,
"line_mean": 36.9439252336,
"line_max": 135,
"alpha_frac": 0.5522167488,
"autogenerated": false,
"ratio": 4.0681362725450905,
"config_test": false,
... |
__author__ = 'frodriguez'
from tota.utils import closest, distance, sort_by_distance, possible_moves
from tota.settings import STUN_DISTANCE, ENEMY_TEAMS, FIREBALL_RADIUS, FIREBALL_DISTANCE, HERO_ATTACK_DISTANCE
from tota.things import Ancient, Hero, Tower, Creep
AUTHOR = 'francusa'
def create():
def pulenta_he... | {
"repo_name": "fisadev/tota",
"path": "pycamp2015competition/heroes/pulenta.py",
"copies": "1",
"size": "4545",
"license": "mit",
"hash": -201028687756976450,
"line_mean": 50.0674157303,
"line_max": 110,
"alpha_frac": 0.4853685369,
"autogenerated": false,
"ratio": 4.391304347826087,
"config_tes... |
__author__ = 'fsoler'
from enum import Enum
import time
import calendar
from PyQt4 import QtCore
import copy
'''
esta clase alarma es para reordenar los autos o sacarlos, el mensaje pone la alarma en deliver
'''
# this is the margin time to deliver the car, in seconds
Margin_time = 900
Input_id = 1
Conveyor_input_id =... | {
"repo_name": "Nebla/cylindricalParkingPrototype",
"path": "parking_app/Common.py",
"copies": "1",
"size": "8344",
"license": "mit",
"hash": 1584772425893584000,
"line_mean": 27.9756944444,
"line_max": 115,
"alpha_frac": 0.5977948226,
"autogenerated": false,
"ratio": 3.693669765382913,
"config_... |
__author__ = 'fsoler'
import sys
import parking_app.concurrent.SharedHandler as ShHan
from PyQt4 import QtCore
class RoboticDeliverer(QtCore.QThread):
# level, column, vehicle id, vehicle weight
update = QtCore.pyqtSignal(int, str, int)
def __init__(self):
super(RoboticDeliverer, self).__init__(... | {
"repo_name": "Nebla/cylindricalParkingPrototype",
"path": "parking_app/Robotic_Deliverer/RoboticDeliverer.py",
"copies": "1",
"size": "1806",
"license": "mit",
"hash": 7388190036096493000,
"line_mean": 30.1551724138,
"line_max": 108,
"alpha_frac": 0.6002214839,
"autogenerated": false,
"ratio": 3... |
__author__ = 'fsoler'
import sys
import time
import parking_app.Common as Common
import parking_app.concurrent.SharedBuffer as ShBuff
import parking_app.concurrent.SharedCylinder as ShCyl
import parking_app.concurrent.SharedConveyorBelt as ShCon
import parking_app.concurrent.SharedHandler as ShHan
from PyQt4 import Qt... | {
"repo_name": "Nebla/cylindricalParkingPrototype",
"path": "parking_app/Robotic_Dispatcher/Robotic_Dispatcher.py",
"copies": "1",
"size": "4245",
"license": "mit",
"hash": -8822675030672861000,
"line_mean": 39.0566037736,
"line_max": 122,
"alpha_frac": 0.639811543,
"autogenerated": false,
"ratio"... |
__author__ = 'fsoler'
from multiprocessing import Process, Condition, Lock
from multiprocessing.managers import BaseManager
import time, os
class numeri(object):
def __init__(self):
self.nl = []
def getLen(self):
return len(self.nl)
def stampa(self):
print(self.nl)
def app... | {
"repo_name": "Nebla/cylindricalParkingPrototype",
"path": "parking_app/concurrent/test.py",
"copies": "1",
"size": "1454",
"license": "mit",
"hash": 2232896661971628000,
"line_mean": 21.734375,
"line_max": 90,
"alpha_frac": 0.6258596974,
"autogenerated": false,
"ratio": 3.167755991285403,
"con... |
__author__ = 'fsoler'
import time
import parking_app.Common as Common
import parking_app.concurrent.SharedHandler as ShHan
from PyQt4 import QtCore
class PlatformController(QtCore.QThread):
# cylinder, level, column, vehicle id, vehicle weight, alarm
update = QtCore.pyqtSignal(int, int, int, str, int, int)
... | {
"repo_name": "Nebla/cylindricalParkingPrototype",
"path": "parking_app/Platform_Controller/Platform_Controller.py",
"copies": "1",
"size": "6139",
"license": "mit",
"hash": 259448860519196600,
"line_mean": 41.0547945205,
"line_max": 138,
"alpha_frac": 0.5285877179,
"autogenerated": false,
"ratio... |
__author__ = 'fsoler'
import time
import string as string
import parking_app.Common as Common
import parking_app.concurrent.SharedHandler as ShHan
from PyQt4 import QtCore
class RoboticHand(QtCore.QThread):
# cylinder, level, column, vehicle id, vehicle weight, alarm
update = QtCore.pyqtSignal(int, int, i... | {
"repo_name": "Nebla/cylindricalParkingPrototype",
"path": "parking_app/Robotic_Hand/Robotic_Hand.py",
"copies": "1",
"size": "5849",
"license": "mit",
"hash": -5300298198004022000,
"line_mean": 34.0299401198,
"line_max": 114,
"alpha_frac": 0.593776714,
"autogenerated": false,
"ratio": 3.38288027... |
__author__ = 'Fábio Henrique e Walison Filipe'
# Funções Para Achar A área
def quadrado():
lado1 = float(input("Digite O Tamanho Do Primeiro Lado: "))
lado2 = float(input("Digite O Tamanho Do Outro Lado: "))
areaQuadrado = lado1 * lado2
print("A área Do Quadrado é %3.2f Unidades De Área" % (areaQuadr... | {
"repo_name": "fabinhow12/Algoritmos-em-python",
"path": "aula/Geometrica.py",
"copies": "1",
"size": "4636",
"license": "mit",
"hash": 3403943792463979500,
"line_mean": 27.3416149068,
"line_max": 111,
"alpha_frac": 0.5748411133,
"autogenerated": false,
"ratio": 2.7080118694362016,
"config_test... |
__author__ = 'Fábio Henrique'
def verifica_celsius():
tempCelsius = float(input("Digite A Temperatura em Celsius: "))
celsiusParaFare = (9 * tempCelsius + 160) / 5
print("A Temperatura em Farenheit é %4.2f" % (celsiusParaFare))
celsiusParaKelvin = tempCelsius + 273
print("A Temperatura em Kelvin é... | {
"repo_name": "fabinhow12/Algoritmos-em-python",
"path": "aula/Temperatura.py",
"copies": "1",
"size": "1605",
"license": "mit",
"hash": -2739038641870291000,
"line_mean": 27.9636363636,
"line_max": 70,
"alpha_frac": 0.618957941,
"autogenerated": false,
"ratio": 2.4813084112149535,
"config_test... |
__author__ = 'fujun'
# -*- coding: utf-8 -*-
import io
import json
from nltk import sent_tokenize
from nltk import word_tokenize
"""
these codes are mainly for cleaning the test. Doing sentence segmentation and clean raw text.
"""
if __name__ == "__main__":
review_file = io.open("review.json", 'r', encoding='ut... | {
"repo_name": "fujunswufe/YelpDataChallenge",
"path": "src/preprocess/clean.py",
"copies": "1",
"size": "1078",
"license": "apache-2.0",
"hash": -5438988590945024000,
"line_mean": 29.8285714286,
"line_max": 93,
"alpha_frac": 0.5927643785,
"autogenerated": false,
"ratio": 3.6542372881355933,
"co... |
__author__ = 'fujun'
from nltk import sent_tokenize
import json
import io
if __name__ == "__main__":
review_file = io.open("/Users/fujun/GitHub/YelpDataChallenge/data/tip_review.json", 'r', encoding='utf8')
index = 1
for line in review_file:
json_decode = json.loads(line.strip("\n"))
re... | {
"repo_name": "fujunswufe/YelpDataChallenge",
"path": "src/summarize/baseline.py",
"copies": "1",
"size": "1052",
"license": "apache-2.0",
"hash": -4834899776981350000,
"line_mean": 25.9743589744,
"line_max": 109,
"alpha_frac": 0.5950570342,
"autogenerated": false,
"ratio": 3.495016611295681,
"... |
__author__ = 'fujun'
import config
import json
import io
from nltk import sent_tokenize
from cStringIO import StringIO
def top(biz_path, review_path, tip_path, k=5000):
biz_set = set() # hash set for more than 10,000 business id
biz_input = io.open(biz_path, 'r', encoding='utf8')
for line in biz_input... | {
"repo_name": "fujunswufe/YelpDataChallenge",
"path": "src/summarize/businessID.py",
"copies": "1",
"size": "3019",
"license": "apache-2.0",
"hash": 2463278243831739000,
"line_mean": 34.1162790698,
"line_max": 145,
"alpha_frac": 0.588936734,
"autogenerated": false,
"ratio": 2.9773175542406314,
... |
__author__ = 'fujun'
import json
import re
from string import maketrans
from string import punctuation
from nltk import word_tokenize
from string import translate
regex = re.compile('[%s]' % re.escape(punctuation))
def comp_len(yelp_tip):
# ss = regex.sub('', yelp_tip).strip()
# sl = word_tokenize(ss)
#... | {
"repo_name": "fujunswufe/YelpDataChallenge",
"path": "src/preprocess/TipLength.py",
"copies": "1",
"size": "2715",
"license": "apache-2.0",
"hash": -9061172435174696000,
"line_mean": 28.8461538462,
"line_max": 82,
"alpha_frac": 0.5373848987,
"autogenerated": false,
"ratio": 3.3559950556242275,
... |
__author__ = 'fujun'
import json
if __name__ == "__main__":
input_file = open('yelp_academic_dataset_tip.json', 'r')
my_dict = {}
for line in input_file:
json_decode = json.loads(line.strip("\n"))
tup = (json_decode.get("user_id"), json_decode.get("business_id"))
if tup not in my_... | {
"repo_name": "fujunswufe/YelpDataChallenge",
"path": "src/preprocess/process.py",
"copies": "1",
"size": "1548",
"license": "apache-2.0",
"hash": 4692158871073802000,
"line_mean": 29.96,
"line_max": 91,
"alpha_frac": 0.5129198966,
"autogenerated": false,
"ratio": 3.191752577319588,
"config_tes... |
__author__ = 'fujun'
import nltk
import itertools
import networkx
import io
import string
import json
import re
from nltk import sent_tokenize
from nltk import word_tokenize
from operator import itemgetter
from math import log
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from scipy.spars... | {
"repo_name": "fujunswufe/YelpDataChallenge",
"path": "src/summarize/textrank_fujun.py",
"copies": "1",
"size": "12261",
"license": "apache-2.0",
"hash": 7120844948097421000,
"line_mean": 30.1218274112,
"line_max": 104,
"alpha_frac": 0.5422885572,
"autogenerated": false,
"ratio": 3.63935886019590... |
from __future__ import print_function, division
import sys
import pdb
from os import listdir
from os.path import isfile, join
# from table import *
class o(object):
def __init__(i, **filed):
i.__dict__.update(filed)
return i
class Row(object):
def __init__(i,data):
i.x = data[:-1]
i.y = data[-1]
... | {
"repo_name": "ST-Data-Mining/crater",
"path": "wei/data.py",
"copies": "1",
"size": "2913",
"license": "mit",
"hash": 3795110739008806000,
"line_mean": 20.7462686567,
"line_max": 80,
"alpha_frac": 0.4898729832,
"autogenerated": false,
"ratio": 3.028066528066528,
"config_test": false,
"has_no... |
__author__ = 'fyrestone@outlook.com'
import sys
import ast
import difflib
import operator
import argparse
import itertools
import collections
class FuncNodeCollector(ast.NodeTransformer):
"""
Clean node attributes, delete the attributes that are not helpful for recognition repetition.
Then collect all fu... | {
"repo_name": "fyrestone/pycode_similar",
"path": "pycode_similar/tests/original_version.py",
"copies": "1",
"size": "12778",
"license": "mit",
"hash": 4155309665616812500,
"line_mean": 34.0082191781,
"line_max": 122,
"alpha_frac": 0.5442166223,
"autogenerated": false,
"ratio": 3.907645259938838,... |
__author__ = 'g10k'
"""Потом убрать в миграции"""
# ('Регистраторы','Регистраторы'),
# ('Менеджеры','Менеджеры'),
# ('Проф департамент','Проф департамент'),
# ('Аналитика','Аналитика'),
# ('Контроль качества','Контроль качества'),
import kb.models
departaments = {
'Регистра... | {
"repo_name": "telminov/knowledge-base",
"path": "kb/data.py",
"copies": "1",
"size": "1498",
"license": "mit",
"hash": -403355902467668400,
"line_mean": 27.152173913,
"line_max": 96,
"alpha_frac": 0.5335907336,
"autogenerated": false,
"ratio": 2.4760994263862335,
"config_test": false,
"has_n... |
__author__ = 'gabe'
# Standard Library Imports
from collections import namedtuple
# Core Django Imports
from django.db import models
from django.contrib.auth.models import User
# Third Party Imports
# App Imports
# DRY -> we'll use this for any resource we create with a url.
class AddressableMixin(object):
uri... | {
"repo_name": "nehalm/NY-PY",
"path": "ny-py/apps/profiles/models.py",
"copies": "1",
"size": "4505",
"license": "mit",
"hash": -7437817297885603000,
"line_mean": 22.4635416667,
"line_max": 112,
"alpha_frac": 0.5791342952,
"autogenerated": false,
"ratio": 3.860325621251071,
"config_test": false... |
__author__ = 'gabriele'
import urllib2
import base64
import time
import datetime
import json
def print_time(step):
ts = time.time();
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S');
print st + " - " + step;
def call_api(rabbitmqhost, api):
request = urllib2.Request("http://" ... | {
"repo_name": "Gsantomaggio/rabbitmqexample",
"path": "httptest/httpTest.py",
"copies": "1",
"size": "1344",
"license": "apache-2.0",
"hash": 3978791854882978000,
"line_mean": 28.2173913043,
"line_max": 78,
"alpha_frac": 0.5587797619,
"autogenerated": false,
"ratio": 3.40253164556962,
"config_t... |
__author__ = 'gabriel'
from django.db import connection
from database import models
import numpy as np
from django.contrib.gis import geos
def create_table():
cursor = connection.cursor()
cursor.execute(
"""CREATE TABLE crimes (
pk integer);
SELECT AddGeometryColumn('crimes', 'loc... | {
"repo_name": "gaberosser/geo-network",
"path": "runner.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": 1875633680367432700,
"line_mean": 29.5897435897,
"line_max": 111,
"alpha_frac": 0.6216442953,
"autogenerated": false,
"ratio": 3.495601173020528,
"config_test": false,
"has_no... |
__author__ = 'gabriel'
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.collections as mcoll
import matplotlib.path as mpath
from matplotlib import patches
from matplotlib import cm
import bisect
from descartes import PolygonPatch
from shapely import geometry, ops
from plotting.spatial import plot_s... | {
"repo_name": "gaberosser/geo-network",
"path": "plots.py",
"copies": "1",
"size": "10064",
"license": "mit",
"hash": -7427457573558504000,
"line_mean": 32.8888888889,
"line_max": 132,
"alpha_frac": 0.5542527822,
"autogenerated": false,
"ratio": 3.7054491899852726,
"config_test": false,
"has_... |
# Enthought library imports.
from traits.api import Instance
from tvtk.api import tvtk
# Local imports
from mayavi.filters.filter_base import FilterBase
from mayavi.core.pipeline_info import PipelineInfo
######################################################################
# `DecimatePro` class.
##################... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/filters/decimatepro.py",
"copies": "5",
"size": "1171",
"license": "bsd-3-clause",
"hash": 7683696182557041000,
"line_mean": 32.4571428571,
"line_max": 79,
"alpha_frac": 0.5516652434,
"autogenerated": false,
"ratio": 4.369402985074627,
"config_tes... |
# Enthought library imports.
from traits.api import Instance
from tvtk.api import tvtk
# Local imports
from mayavi.filters.poly_data_filter_base import \
PolyDataFilterBase
from mayavi.core.pipeline_info import PipelineInfo
######################################################################
# `QuadricDec... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/filters/quadric_decimation.py",
"copies": "5",
"size": "1172",
"license": "bsd-3-clause",
"hash": 7818731158322880000,
"line_mean": 32.4857142857,
"line_max": 85,
"alpha_frac": 0.5563139932,
"autogenerated": false,
"ratio": 4.389513108614232... |
# Standard scientific Python imports
import matplotlib.pyplot as plt
# Import datasets, classifiers and performance metrics
from sklearn import datasets, svm, metrics
# The digits dataset
digits = datasets.load_digits()
# The data that we are interested in is made of 8x8 images of digits, let's
# have a look at the... | {
"repo_name": "dkandalov/katas",
"path": "python/ml/scikit/simple_plot.py",
"copies": "1",
"size": "2083",
"license": "unlicense",
"hash": 7235382930405486000,
"line_mean": 39.0769230769,
"line_max": 78,
"alpha_frac": 0.7287566011,
"autogenerated": false,
"ratio": 3.465890183028286,
"config_tes... |
# Enthought library imports.
from traits.api import Instance
from tvtk.api import tvtk
# Local imports
from mayavi.filters.filter_base import FilterBase
from mayavi.core.pipeline_info import PipelineInfo
######################################################################
# `ExtractEdges` class.
#################... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/filters/extract_edges.py",
"copies": "5",
"size": "1094",
"license": "bsd-3-clause",
"hash": -842512466896601100,
"line_mean": 30.2571428571,
"line_max": 80,
"alpha_frac": 0.542047532,
"autogenerated": false,
"ratio": 4.5966386554621845,
"config_t... |
from mayavi import mlab
import numpy as np
def gen_random_quaternions(n):
q = np.random.rand(n,4)
norm = np.linalg.norm(q, axis=1)
q_unit = q / norm[:,None]
return q_unit
def plot_quaternions(q):
angles = 2 * np.arccos(q[:,0])
angles = angles + 0.000001
axis = q[:,1:4] / np.sin(0.5 * angles)[:,None]
... | {
"repo_name": "SebastianRiedel/python_scratchbook",
"path": "pose_vis.py",
"copies": "1",
"size": "1625",
"license": "mit",
"hash": -7525480988703781000,
"line_mean": 28.0357142857,
"line_max": 171,
"alpha_frac": 0.616,
"autogenerated": false,
"ratio": 2.4583963691376702,
"config_test": false,
... |
from mayavi import mlab
# To access any VTK object, we use 'tvtk', which is a Python wrapping of
# VTK replacing C++ setters and getters by Python properties and
# converting numpy arrays to VTK arrays when setting data.
from tvtk.api import tvtk
import numpy as np
from transformations import transformations as tf
d... | {
"repo_name": "SebastianRiedel/python_scratchbook",
"path": "vtk_example.py",
"copies": "1",
"size": "6635",
"license": "mit",
"hash": -1765419689714803700,
"line_mean": 26.9957805907,
"line_max": 108,
"alpha_frac": 0.6836473248,
"autogenerated": false,
"ratio": 3.0090702947845807,
"config_test... |
import numpy as np
from scipy import special
from mayavi import mlab
##############################################################################
# Function to caculate the Magnetic field generated by a current loop
def base_vectors(n):
""" Returns 3 orthognal base vectors, the first one colinear to n.
... | {
"repo_name": "arakcheev/python-data-plotter",
"path": "magnetic_example.py",
"copies": "1",
"size": "7716",
"license": "mit",
"hash": 103096635681406750,
"line_mean": 29.7410358566,
"line_max": 85,
"alpha_frac": 0.5523587351,
"autogenerated": false,
"ratio": 2.8684014869888474,
"config_test": ... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (assert_allclose,
assert_array_almost_equal, assert_raises)
from scipy import sparse
from scipy.sparse import csgraph
def _explicit_laplacian(x, normed=False):
if sparse.issparse(x):
x =... | {
"repo_name": "apbard/scipy",
"path": "scipy/sparse/csgraph/tests/test_graph_laplacian.py",
"copies": "1",
"size": "4382",
"license": "bsd-3-clause",
"hash": -8826750155016127000,
"line_mean": 31.2205882353,
"line_max": 79,
"alpha_frac": 0.5506617983,
"autogenerated": false,
"ratio": 2.9829816201... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (run_module_suite, assert_allclose,
assert_array_almost_equal, assert_raises)
from scipy import sparse
from scipy.sparse import csgraph
def _explicit_laplacian(x, normed=False):
... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scipy-master/scipy/sparse/csgraph/tests/test_graph_laplacian.py",
"copies": "1",
"size": "4580",
"license": "mit",
"hash": -8091119293237587000,
"line_mean": 32.1884057971,
"line_max": 89,
"alpha_frac": 0.5351528384,
"autogenerated": fal... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (run_module_suite, assert_allclose,
assert_array_almost_equal, assert_raises)
from scipy import sparse
from scipy.sparse import csgraph
def _explicit_laplacian(x, normed=False):
if sparse.isspar... | {
"repo_name": "anielsen001/scipy",
"path": "scipy/sparse/csgraph/tests/test_graph_laplacian.py",
"copies": "38",
"size": "4451",
"license": "bsd-3-clause",
"hash": -815908206080130000,
"line_mean": 31.0215827338,
"line_max": 79,
"alpha_frac": 0.5506627724,
"autogenerated": false,
"ratio": 2.98324... |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy import sparse
from scipy.sparse import csgraph
def _explicit_laplacian(x, normed=False):
if sparse.issparse(x):
x = x.todense()
x = np.asarray(x)
y = -1.0 * x
for j in range(y.shape[0]):
y[j... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "data/Python/x86/Lib/site-packages/scipy/sparse/csgraph/tests/test_graph_laplacian.py",
"copies": "4",
"size": "2078",
"license": "mit",
"hash": 5225715632104617000,
"line_mean": 30.0149253731,
"line_max": 79,
"alpha_frac": 0.5490856593,
"a... |
import numpy as np
from scipy import sparse
from scipy.sparse import csgraph
def _explicit_laplacian(x, normed=False):
if sparse.issparse(x):
x = x.todense()
x = np.asarray(x)
y = -1.0 * x
for j in range(y.shape[0]):
y[j,j] = x[j,j+1:].sum() + x[j,:j].sum()
if normed:
d = ... | {
"repo_name": "teoliphant/scipy",
"path": "scipy/sparse/csgraph/tests/test_graph_laplacian.py",
"copies": "2",
"size": "2013",
"license": "bsd-3-clause",
"hash": 701386387841758100,
"line_mean": 29.5,
"line_max": 79,
"alpha_frac": 0.5414803775,
"autogenerated": false,
"ratio": 3.059270516717325,
... |
import numpy as np
from scipy import sparse
from sklearn.utils.graph import graph_laplacian
from sklearn.utils.testing import ignore_warnings
@ignore_warnings(category=DeprecationWarning)
def test_graph_laplacian():
for mat in (np.arange(10) * np.arange(10)[:, np.newaxis],
np.ones((7, 7)),
... | {
"repo_name": "mbayon/TFG-MachineLearning",
"path": "vbig/lib/python2.7/site-packages/sklearn/utils/tests/test_graph.py",
"copies": "41",
"size": "1042",
"license": "mit",
"hash": 5200565337257331000,
"line_mean": 39.0769230769,
"line_max": 76,
"alpha_frac": 0.6007677543,
"autogenerated": false,
... |
import numpy as np
import scipy.sparse as sp
import pytest
import sklearn
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_no_warnings
from sklearn.utils._testing import assert_warns_message
from sklearn.utils._testing import ignore_warnings
from sklearn.base import Bas... | {
"repo_name": "kevin-intel/scikit-learn",
"path": "sklearn/tests/test_base.py",
"copies": "2",
"size": "18499",
"license": "bsd-3-clause",
"hash": -6132087802350428000,
"line_mean": 29.4761120264,
"line_max": 79,
"alpha_frac": 0.6565219742,
"autogenerated": false,
"ratio": 3.879823825503356,
"c... |
import numpy as np
import scipy.sparse as sp
import pytest
import sklearn
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_raises
from sklearn.utils._testing import assert_no_warnings
from sklearn.utils._testing import assert_warns_message
from sklearn.utils._testing imp... | {
"repo_name": "xuewei4d/scikit-learn",
"path": "sklearn/tests/test_base.py",
"copies": "4",
"size": "17718",
"license": "bsd-3-clause",
"hash": 9140842814511750000,
"line_mean": 29.9214659686,
"line_max": 79,
"alpha_frac": 0.6541370358,
"autogenerated": false,
"ratio": 3.929474384564205,
"confi... |
import numpy as np
import scipy.sparse as sp
import sklearn
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_not_equal
from sklearn.u... | {
"repo_name": "zorroblue/scikit-learn",
"path": "sklearn/tests/test_base.py",
"copies": "1",
"size": "14463",
"license": "bsd-3-clause",
"hash": 8852531906963177000,
"line_mean": 31.5743243243,
"line_max": 79,
"alpha_frac": 0.6531839867,
"autogenerated": false,
"ratio": 3.9015376315079577,
"con... |
import sys
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_not_equal
from sklearn.util... | {
"repo_name": "imaculate/scikit-learn",
"path": "sklearn/tests/test_base.py",
"copies": "5",
"size": "7693",
"license": "bsd-3-clause",
"hash": 5953296212717978000,
"line_mean": 29.2874015748,
"line_max": 80,
"alpha_frac": 0.6396724295,
"autogenerated": false,
"ratio": 3.6843869731800765,
"conf... |
import sys
import numpy as np
import scipy.sparse as sp
import sklearn
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_not_equal
fr... | {
"repo_name": "jblackburne/scikit-learn",
"path": "sklearn/tests/test_base.py",
"copies": "2",
"size": "11255",
"license": "bsd-3-clause",
"hash": 6550040909023618000,
"line_mean": 30.1772853186,
"line_max": 79,
"alpha_frac": 0.6451354953,
"autogenerated": false,
"ratio": 3.8269296157769466,
"c... |
__author__ = 'galkremer'
import os
import argparse
import sys
import getopt
import oauth2client
from datetime import datetime
from apiclient.discovery import build
from httplib2 import Http
from oauth2client import client
from oauth2client import tools
SCOPES = 'https://www.googleapis.com/auth/gmail.readonly'
CLIENT_... | {
"repo_name": "galkremer1/gmail-finder",
"path": "find_name.py",
"copies": "1",
"size": "2579",
"license": "mit",
"hash": 6591577235871394000,
"line_mean": 30.0722891566,
"line_max": 88,
"alpha_frac": 0.6545172547,
"autogenerated": false,
"ratio": 3.91350531107739,
"config_test": false,
"has_... |
__author__ = 'galyna'
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
wd.find_element_by_link_text("add new").click()
self.fill_contact_form(contact)
# submit contact ... | {
"repo_name": "galaktika81/python_training",
"path": "fixture/contact.py",
"copies": "1",
"size": "6124",
"license": "apache-2.0",
"hash": 65495632807222710,
"line_mean": 40.3783783784,
"line_max": 120,
"alpha_frac": 0.6025473547,
"autogenerated": false,
"ratio": 3.5439814814814814,
"config_tes... |
__author__ = 'galyna'
from model.group import Group
import re
class GroupHelper:
def __init__(self, app):
self.app = app
def delete_group_by_index(self, index):
wd = self.app.wd
self.open_groups_page()
self.select_group_by_index(index)
# submit deletion
wd.fi... | {
"repo_name": "galaktika81/python_training",
"path": "fixture/group.py",
"copies": "1",
"size": "3509",
"license": "apache-2.0",
"hash": 6158211019949226000,
"line_mean": 32.1037735849,
"line_max": 131,
"alpha_frac": 0.5862068966,
"autogenerated": false,
"ratio": 3.4001937984496124,
"config_tes... |
__author__ = 'galyna'
from sys import maxsize
class Contact:
def __init__(self, firstname=None, middlename=None, lastname=None,
id = None, address = None,
email = None, email2 = None, email3 = None, all_emails = None,
homephone = None, workphone = None, mobilepho... | {
"repo_name": "galaktika81/python_training",
"path": "model/contact.py",
"copies": "1",
"size": "1380",
"license": "apache-2.0",
"hash": 7836026413533382000,
"line_mean": 31.0930232558,
"line_max": 115,
"alpha_frac": 0.5855072464,
"autogenerated": false,
"ratio": 3.8333333333333335,
"config_tes... |
__author__ = 'galyna'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_b... | {
"repo_name": "galaktika81/python_training",
"path": "fixture/session.py",
"copies": "1",
"size": "1435",
"license": "apache-2.0",
"hash": -3217175438390497000,
"line_mean": 26.0754716981,
"line_max": 73,
"alpha_frac": 0.5616724739,
"autogenerated": false,
"ratio": 3.368544600938967,
"config_te... |
__author__ = 'galyna'
from test.test_phone import merge_phones_like_on_home_page
from model.contact import Contact
def test_contacts_on_home_page(app, db):
contacts_from_home_page = app.contact.get_contact_list()
contacts_from_db = db.get_contact_list()
assert(len(contacts_from_home_page) == len(contacts... | {
"repo_name": "galaktika81/python_training",
"path": "test/test_contact_equality.py",
"copies": "1",
"size": "1851",
"license": "apache-2.0",
"hash": 2615154380266619000,
"line_mean": 53.4411764706,
"line_max": 120,
"alpha_frac": 0.6931388439,
"autogenerated": false,
"ratio": 3.126689189189189,
... |
__author__ = 'galyna'
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edi... | {
"repo_name": "galaktika81/python_training",
"path": "test/test_phone.py",
"copies": "1",
"size": "1201",
"license": "apache-2.0",
"hash": 2291903160516554200,
"line_mean": 40.4482758621,
"line_max": 133,
"alpha_frac": 0.6835970025,
"autogenerated": false,
"ratio": 3.245945945945946,
"config_te... |
__author__ = 'gambit'
import boto
from boto.iam.connection import IAMConnection
from boto.s3.key import Key
import datetime
import time
import smtplib
import os
class IdentityAccessManagement():
admin_access_key = "XXXXXXXXXXXXXXXXXXXXXXX"
admin_secret_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
def create_u... | {
"repo_name": "thinksabin/lazy-devops",
"path": "S3 bucket Maker/IdentityAccessManagement.py",
"copies": "1",
"size": "2418",
"license": "apache-2.0",
"hash": 1952461174675023600,
"line_mean": 31.6756756757,
"line_max": 120,
"alpha_frac": 0.535566584,
"autogenerated": false,
"ratio": 3.8564593301... |
__author__ = 'ganeshchand'
def main():
# tuples in Python are immutable. You cannot add or remove
mytuple = (1, 2, 3, 4, 4)
print(type(mytuple), mytuple)
print("4 occurs : {}".format(mytuple.count(4)) + " times")
print("There are total of {}".format(mytuple.__len__()) + " values")
#iterating... | {
"repo_name": "ganeshchand/python3",
"path": "basic/collections.py",
"copies": "1",
"size": "1722",
"license": "apache-2.0",
"hash": 3923359423133902000,
"line_mean": 25.5076923077,
"line_max": 80,
"alpha_frac": 0.5981416957,
"autogenerated": false,
"ratio": 3.4578313253012047,
"config_test": f... |
__author__ = 'ganeshchand'
import os
def main():
search_directory = '/Users/ganeshchand/Downloads/lesson1/test'
for root, dirs, files in os.walk(search_directory):
# print(root) # node in a tree - a node is a directory that has sub-directory or a file
# print(dirs) # list of directories wit... | {
"repo_name": "ganeshchand/python3",
"path": "advanced/filesystem/walkingdirectory.py",
"copies": "1",
"size": "1233",
"license": "apache-2.0",
"hash": -5883777546181747000,
"line_mean": 32.3513513514,
"line_max": 96,
"alpha_frac": 0.5417680454,
"autogenerated": false,
"ratio": 3.7477203647416415... |
__author__ = 'ganeshchand'
import re
def regex_search(pattern_string, string_source):
if re.search(pattern_string,string_source):
print("%s matched %s" % (pattern_string, string_source))
else:
print("%s did not match %s" % (pattern_string, string_source))
# matching a pattern in one string
... | {
"repo_name": "ganeshchand/python3",
"path": "advanced/regular_expression/regular_expresion_anchors.py",
"copies": "1",
"size": "1306",
"license": "apache-2.0",
"hash": 685067273605533200,
"line_mean": 30.0952380952,
"line_max": 127,
"alpha_frac": 0.6531393568,
"autogenerated": false,
"ratio": 3.... |
#Built in modules
import os
import sys
import time
import subprocess
import datetime
import platform
from win10toast import ToastNotifier
#Used defined module
import exception
class Notify(object):
def __init__(self):
self.title = 'Alert From Alertify'
self.platform = platform.system()
se... | {
"repo_name": "GaneshmKumar/Alertify",
"path": "alertify/alertify.py",
"copies": "1",
"size": "3659",
"license": "mit",
"hash": 1378618345801917000,
"line_mean": 30.2735042735,
"line_max": 124,
"alpha_frac": 0.5192675594,
"autogenerated": false,
"ratio": 3.8760593220338984,
"config_test": false... |
__author__ = 'ganesh'
import sys
from PyQt4 import QtCore, QtGui, uic
import os
import exifread
form_class = uic.loadUiType("sheet_gen_ui.ui")[0] # Load the UI
class MyWindowClass(QtGui.QMainWindow, form_class):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
... | {
"repo_name": "xgt001/uav_msr_ip14",
"path": "experimental/sheet_gen.py",
"copies": "1",
"size": "7313",
"license": "mit",
"hash": -7904011842906333000,
"line_mean": 30.2521367521,
"line_max": 197,
"alpha_frac": 0.5532613155,
"autogenerated": false,
"ratio": 3.6131422924901186,
"config_test": f... |
__author__ = 'ganesh'
import cv2
import numpy as np
# TODO: loop through folder files
filename = "alpha_N.JPG"
image = cv2.imread(filename)
newx,newy = image.shape[1]/6,image.shape[0]/6 #new size (w,h)
img = cv2.resize(image,(newx,newy))
img_sav = img
# CODE: Resize Image Toggle
# cv2.imshow("resize image",img)
#... | {
"repo_name": "xgt001/uav_msr_ip14",
"path": "opencv_rnd/contour_new.py",
"copies": "1",
"size": "2333",
"license": "mit",
"hash": -8151318939086484000,
"line_mean": 22.33,
"line_max": 105,
"alpha_frac": 0.6459494213,
"autogenerated": false,
"ratio": 2.4713983050847457,
"config_test": false,
... |
__author__ = 'gaoce'
from typevar import *
from reporter import *
from graphtype import GraphType
class DataGodBuilder(object):
"""Data God Factory"""
def __init__(self):
self.type = -1
self.lowRange = 0
self.highRange = 10
self.step = 1
self.swing = 0.1
def draw(self):
self.typeVar.draw()
def getIn... | {
"repo_name": "gaocegege/Data-God",
"path": "datagod/datagod.py",
"copies": "1",
"size": "1687",
"license": "mit",
"hash": -5435764633953745000,
"line_mean": 22.7746478873,
"line_max": 155,
"alpha_frac": 0.7059869591,
"autogenerated": false,
"ratio": 2.980565371024735,
"config_test": false,
"... |
__author__ = 'GaoJie'
import getpass
from .ext._compat import string_types, ascii_lowercase, input
def prompt(name, default=None):
"""
Grab user input from command line.
:param name: prompt text
:param default: default value if no input provided.
"""
prompt = name + (default and ' [%s]' % def... | {
"repo_name": "ueffort/Flask-Script",
"path": "flask_script/cli.py",
"copies": "1",
"size": "2748",
"license": "mit",
"hash": -143989798412554820,
"line_mean": 29.2087912088,
"line_max": 72,
"alpha_frac": 0.5705967977,
"autogenerated": false,
"ratio": 3.9089615931721196,
"config_test": false,
... |
__author__ = 'Gareth Coles'
from internal.api import ApiManager
from internal.routes import hybrid_route
class Routes(object):
def __init__(self, app, manager):
self.apis = ApiManager()
self.app = app
self.manager = manager
self.db = self.manager.mongo
self.apis.add_rout... | {
"repo_name": "Statik-Metrics/Statik-API",
"path": "routes/api.py",
"copies": "1",
"size": "1223",
"license": "artistic-2.0",
"hash": -3531945714116549000,
"line_mean": 23.9591836735,
"line_max": 74,
"alpha_frac": 0.5347506132,
"autogenerated": false,
"ratio": 4.090301003344481,
"config_test": ... |
__author__ = 'Gareth Coles'
from network import do_authentication, do_refresh, do_invalidate, do_signout, \
do_validate
class Account(object):
__client_token = ""
__access_token = ""
__username = ""
__uuid = ""
__logged_in = False
__profiles = None
@property
def logged_in(self):... | {
"repo_name": "gdude2002/MojangAuth",
"path": "mojang/auth/account.py",
"copies": "1",
"size": "1749",
"license": "artistic-2.0",
"hash": 1446320602859200800,
"line_mean": 22.6351351351,
"line_max": 79,
"alpha_frac": 0.5894797027,
"autogenerated": false,
"ratio": 4.214457831325301,
"config_test... |
__author__ = 'Gareth Coles'
import json
import requests
from constants import *
from exceptions import MethodNotAllowedException, NotFoundException, \
ForbiddenOperationException, IllegalArgumentException, \
UnsupportedMediaTypeException, UnknownException
def raise_exception(payload):
"""
:param pa... | {
"repo_name": "gdude2002/MojangAuth",
"path": "mojang/auth/network.py",
"copies": "1",
"size": "2915",
"license": "artistic-2.0",
"hash": 4212228317480665600,
"line_mean": 22.1349206349,
"line_max": 70,
"alpha_frac": 0.6689536878,
"autogenerated": false,
"ratio": 4.2492711370262395,
"config_tes... |
__author__ = 'Gareth Coles'
import json
from bottle import route, request, response
from dicttoxml import dicttoxml
from internal.api import ApiManager
from internal.util import logger
api = ApiManager()
def xml_route(route_, methods=None):
"""Decorator for registering an XML-only API route. It handles
th... | {
"repo_name": "Statik-Metrics/Statik-API",
"path": "internal/routes.py",
"copies": "1",
"size": "4304",
"license": "artistic-2.0",
"hash": 4003554131058106000,
"line_mean": 29.7428571429,
"line_max": 78,
"alpha_frac": 0.5666821561,
"autogenerated": false,
"ratio": 4.232055063913471,
"config_tes... |
__author__ = 'Gareth Coles'
import os
import markdown2
from internal.highlight import Highlight
from internal.singleton import Singleton
MARKDOWN_EXTRAS = [
"code-friendly", # Don't use `_` and `__` for `em` and `strong`
"fenced-code-blocks", # GitHub fenced code blocks with syntax highlighting
"markdo... | {
"repo_name": "Statik-Metrics/Statik-API",
"path": "internal/api.py",
"copies": "1",
"size": "2623",
"license": "artistic-2.0",
"hash": 119387304564719360,
"line_mean": 26.3229166667,
"line_max": 79,
"alpha_frac": 0.5486084636,
"autogenerated": false,
"ratio": 3.9266467065868262,
"config_test":... |
__author__ = 'Gareth Coles'
import os
import rsa
import multiprocessing
def create_keys(cores=None):
"""
Generate a new public key and private key, large enough to store the
Votifier data.
:returns: a tuple (:py:class:`rsa.PublicKey`, :py:class:`rsa.PrivateKey`)
:rtype: tuple
"""
if cor... | {
"repo_name": "gdude2002/twistifier",
"path": "twistifier/common/keys.py",
"copies": "1",
"size": "3155",
"license": "artistic-2.0",
"hash": 6507370558410647000,
"line_mean": 23.4573643411,
"line_max": 77,
"alpha_frac": 0.6427892235,
"autogenerated": false,
"ratio": 3.814993954050786,
"config_t... |
__author__ = 'Gareth Coles'
import os
import rsa
from twistifier.common.vote import Vote
from twisted.internet.protocol import Protocol, connectionDone
class VotifierClient(Protocol):
factory = None
privkey = None
buffer = ""
verbose = False
version = 1.9 # Votifier version
def __init__(s... | {
"repo_name": "gdude2002/twistifier",
"path": "twistifier/server/protocol.py",
"copies": "1",
"size": "1829",
"license": "artistic-2.0",
"hash": -4746157118100222000,
"line_mean": 24.4027777778,
"line_max": 75,
"alpha_frac": 0.5795516676,
"autogenerated": false,
"ratio": 4.175799086757991,
"con... |
__author__ = 'Gareth Coles'
import re
from github.GithubException import UnknownObjectException
from util.log import getLogger
class Repos(object):
manager = None
repo_objects = {}
@property
def repos(self):
return self.manager.repos
def __init__(self, manager):
"""
:ty... | {
"repo_name": "gdude2002/IssueManager",
"path": "system/repos.py",
"copies": "1",
"size": "1957",
"license": "artistic-2.0",
"hash": -248857749976619170,
"line_mean": 26.1805555556,
"line_max": 72,
"alpha_frac": 0.4885028104,
"autogenerated": false,
"ratio": 4.378076062639821,
"config_test": fa... |
__author__="gary paulson"
__date__ ="$Jan 4, 2009 12:55:44 PM$"
from django import template
from satchmo_utils.templatetags import get_filter_args
from satchmo_utils.numbers import round_decimal, RoundedDecimalError
try:
from django.utils.safestring import mark_safe
except ImportError:
mark_safe = lambda s:s
... | {
"repo_name": "dokterbob/satchmo",
"path": "satchmo/apps/satchmo_utils/templatetags/normalize_decimal.py",
"copies": "13",
"size": "2511",
"license": "bsd-3-clause",
"hash": 3625332454724862000,
"line_mean": 34.8714285714,
"line_max": 112,
"alpha_frac": 0.6949422541,
"autogenerated": false,
"rati... |
__author__ = 'Gary Wu'
from decimal import Decimal
import pytest
import exparse
@pytest.fixture
def html():
return """
<html>
<tag1 class="plain" attr="abc" >
tag1 text
<tag2 attr="cbs" id="id2">
tag2 text
<br>
... | {
"repo_name": "garywu/exparse",
"path": "tests/test_basic.py",
"copies": "1",
"size": "6735",
"license": "mit",
"hash": 3606054619167797000,
"line_mean": 26.9460580913,
"line_max": 136,
"alpha_frac": 0.4106904232,
"autogenerated": false,
"ratio": 3.432721712538226,
"config_test": true,
"has_n... |
__author__ = 'Gary Wu'
import logging
mylogger = logging.getLogger(__name__)
from itertools import chain
from functools import partial
from lxml import etree
from lxml import html
def currency(elm):
if elm is not None and elm.text:
text = elm.text.strip()
if text.startswith('$'):
tex... | {
"repo_name": "garywu/exparse",
"path": "exparse/helper.py",
"copies": "1",
"size": "2450",
"license": "mit",
"hash": -3763255534705272300,
"line_mean": 27.8352941176,
"line_max": 112,
"alpha_frac": 0.5542857143,
"autogenerated": false,
"ratio": 3.2885906040268456,
"config_test": false,
"has_... |
__author__ = 'Gary Wu'
import logging
mylogger = logging.getLogger(__name__)
import io
import inspect
from decimal import Decimal
from urlparse import urljoin
from itertools import chain
import dateutil.parser
from lxml import etree
from lxml import html as html_parser
from helper import debug_lines
class XMLSynt... | {
"repo_name": "garywu/exparse",
"path": "exparse/parser.py",
"copies": "1",
"size": "8899",
"license": "mit",
"hash": 4052411324982065700,
"line_mean": 34.596,
"line_max": 131,
"alpha_frac": 0.5692774469,
"autogenerated": false,
"ratio": 3.8291738382099827,
"config_test": false,
"has_no_keywo... |
__author__ = "Gavin Huttley, Anuj Pahwa"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Gavin Huttley", "Anuj Pahwa"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Gavin Huttley"
__email__ = "Gavin.Huttley@anu.edu.au"
__status__ = "Development"
def MinimalFastqParser(data, stri... | {
"repo_name": "sauloal/cnidaria",
"path": "scripts/venv/lib/python2.7/site-packages/cogent/parse/fastq.py",
"copies": "1",
"size": "1400",
"license": "mit",
"hash": 8824315038784234000,
"line_mean": 30.1111111111,
"line_max": 77,
"alpha_frac": 0.5385714286,
"autogenerated": false,
"ratio": 3.4567... |
__author__ = 'gc355804'
import curses
import datetime
class RenderState(object):
HOME = 1
TIMERS = 1
THREADS = 2
TABLES = 3
class Renderer(object):
MAX_HIST_ENTRIES = 50
def __init__(self, base=None, history=[]):
self.finished = False
self.advance = base.advance if base else... | {
"repo_name": "cubic1271/pybrof",
"path": "top/render.py",
"copies": "1",
"size": "6013",
"license": "mit",
"hash": -5097732129318510000,
"line_mean": 40.4689655172,
"line_max": 161,
"alpha_frac": 0.5356727091,
"autogenerated": false,
"ratio": 3.3933408577878104,
"config_test": false,
"has_no... |
__author__ = 'gca'
from interfaces.ServiceAdapter import ServiceAdapter as ABCServiceAdapter
import httplib
import json
import socket, time, datetime
class ZabbixAdapter(ABCServiceAdapter):
def __init__(self):
"""
Initializes a new ServiceAdapter.
:return:
"""
self.headers... | {
"repo_name": "MobileCloudNetworking/maas",
"path": "bundle/adapters/zabbix.py",
"copies": "1",
"size": "2415",
"license": "apache-2.0",
"hash": 6181011641902831000,
"line_mean": 23.8969072165,
"line_max": 163,
"alpha_frac": 0.5602484472,
"autogenerated": false,
"ratio": 4.052013422818792,
"con... |
__author__ = 'gchevalier'
import tensorflow as tf
from sklearn import metrics
from sklearn.utils import shuffle
import numpy as np
def one_hot(y):
"""convert label from dense to one hot
argument:
label: ndarray dense label ,shape: [sample_num,1]
return:
one_hot_label: ndarray one hot... | {
"repo_name": "guillaume-chevalier/HAR-stacked-residual-bidir-LSTMs",
"path": "lstm_architecture.py",
"copies": "1",
"size": "16618",
"license": "apache-2.0",
"hash": -5036565465338187000,
"line_mean": 41.5012787724,
"line_max": 152,
"alpha_frac": 0.585148634,
"autogenerated": false,
"ratio": 3.7... |
__author__ = "geduldig"
__date__ = "February 7, 2013"
__license__ = "MIT"
import os
class TwitterOAuth:
"""Optional class for retrieving Twitter credentials stored in a text file.
:param consumer_key: Twitter application consumer key
:param consumer_secret: Twitter application consumer secret
:par... | {
"repo_name": "mpvoss/RickAndMortyWeatherTweets",
"path": "env/lib/python3.5/site-packages/TwitterAPI/TwitterOAuth.py",
"copies": "1",
"size": "1874",
"license": "mit",
"hash": 308200030622514000,
"line_mean": 30.7627118644,
"line_max": 89,
"alpha_frac": 0.5752401281,
"autogenerated": false,
"rat... |
__author__ = "geduldig"
__date__ = "June 7, 2013"
__license__ = "MIT"
from .BearerAuth import BearerAuth as OAuth2
from .constants import *
from datetime import datetime
from requests.exceptions import ConnectionError, ReadTimeout, SSLError
from requests.packages.urllib3.exceptions import ReadTimeoutError, ProtocolEr... | {
"repo_name": "mpvoss/RickAndMortyWeatherTweets",
"path": "env/lib/python3.5/site-packages/TwitterAPI/TwitterAPI.py",
"copies": "1",
"size": "11447",
"license": "mit",
"hash": 8467898582290753000,
"line_mean": 35.807073955,
"line_max": 95,
"alpha_frac": 0.544858915,
"autogenerated": false,
"ratio... |
__author__ = "geduldig"
__date__ = "June 8, 2013"
__license__ = "MIT"
from requests.exceptions import ConnectionError, ReadTimeout, SSLError
from requests.packages.urllib3.exceptions import ReadTimeoutError, ProtocolError
from .TwitterError import *
import requests
import time
class TwitterRestPager(object):
"... | {
"repo_name": "mpvoss/RickAndMortyWeatherTweets",
"path": "env/lib/python3.5/site-packages/TwitterAPI/TwitterRestPager.py",
"copies": "1",
"size": "3599",
"license": "mit",
"hash": -8846181156954763000,
"line_mean": 35.7244897959,
"line_max": 88,
"alpha_frac": 0.5220894693,
"autogenerated": false,
... |
__author__ = 'geebzter'
# Defines message types for standard framework message
# Provides free (global) functions that help create standard messages
# such as get_round_end_message etc.
class Message(object):
"""
Message types:
Defines standard types of messages that are broadcast within the game.
... | {
"repo_name": "mccler89/RPS_Player",
"path": "Message.py",
"copies": "3",
"size": "3928",
"license": "apache-2.0",
"hash": -6507989882842113000,
"line_mean": 30.9349593496,
"line_max": 130,
"alpha_frac": 0.6321283096,
"autogenerated": false,
"ratio": 4.388826815642458,
"config_test": false,
"... |
__author__ = 'geebzter'
# Defines message types for standard framework message
# Provides free (global) functions that help create standard messages
# such as get_round_end_message etc.
class Message(object):
"""
Message types:
Defines standard types of messages that are broadcast within the game.
... | {
"repo_name": "PaulieC/sprint1_Council_a",
"path": "Message.py",
"copies": "3",
"size": "4488",
"license": "apache-2.0",
"hash": -4346082883992163000,
"line_mean": 32,
"line_max": 130,
"alpha_frac": 0.633912656,
"autogenerated": false,
"ratio": 4.387096774193548,
"config_test": false,
"has_no... |
__author__ = 'geebzter'
# Example of how to implement an RPS player within the framework
import Player
import Message
class RPSPlayerExample(Player.Player):
def __init__(self):
# Call super class constructor
Player.Player.__init__(self)
self.reset()
def play(self):
return Rp... | {
"repo_name": "mccler89/RPS_Player",
"path": "RPSPlayerExample.py",
"copies": "3",
"size": "3278",
"license": "apache-2.0",
"hash": -5811625973155462000,
"line_mean": 27.7543859649,
"line_max": 123,
"alpha_frac": 0.5954850519,
"autogenerated": false,
"ratio": 4.002442002442002,
"config_test": f... |
__author__ = 'geebzter'
# Example of how to implement an RPS player within the framework
import Player
import Message
class RPSPlayerExample(Player.Player):
def __init__(self):
# Call super class constructor
Player.Player.__init__(self)
self.reset()
def play(self):
return R... | {
"repo_name": "geebzter/game-framework",
"path": "RPSPlayerExample.py",
"copies": "3",
"size": "3269",
"license": "apache-2.0",
"hash": -7026183594463307000,
"line_mean": 32.3673469388,
"line_max": 108,
"alpha_frac": 0.5971245029,
"autogenerated": false,
"ratio": 3.9865853658536587,
"config_tes... |
__author__ = 'Geir Istad'
from ctypes import c_int16
import time
class CanParser:
"""
Class to handle the parsing of received CAN messages and the data structure
relating CAN arbitration IDs and data frames to the data sent by an ECU
over CANBUS
"""
__ecu_storage = {}
__ecu_frame_reference... | {
"repo_name": "TAURacing/BeagleDash",
"path": "CANparser.py",
"copies": "1",
"size": "10955",
"license": "mit",
"hash": 723659788586577000,
"line_mean": 42.4722222222,
"line_max": 80,
"alpha_frac": 0.5482428115,
"autogenerated": false,
"ratio": 3.9463256484149856,
"config_test": false,
"has_n... |
__author__ = 'Geir Istad'
from tinydb import TinyDB, where
class CanStorage:
__data_base = TinyDB
__current_sequence_table = TinyDB.table
__current_sequence = None
__max_sequence = None
__ready_to_store = False
def __init__(self, a_file_path):
"""
Opens (or creates) a data ba... | {
"repo_name": "TAURacing/BeagleDash",
"path": "CANstorage.py",
"copies": "1",
"size": "5746",
"license": "mit",
"hash": -4679961458582194000,
"line_mean": 36.5555555556,
"line_max": 80,
"alpha_frac": 0.5922380787,
"autogenerated": false,
"ratio": 4.25,
"config_test": false,
"has_no_keywords":... |
__author__ = 'Geir Istad'
"""
MPU6050 Python I2C Class - MPU6050 example usage
Copyright (c) 2015 Geir Istad
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without ... | {
"repo_name": "thisisG/MPU6050-I2C-Python-Class",
"path": "MPU6050_example.py",
"copies": "2",
"size": "2957",
"license": "mit",
"hash": -3242752337646955500,
"line_mean": 35.9625,
"line_max": 79,
"alpha_frac": 0.7020629016,
"autogenerated": false,
"ratio": 3.253025302530253,
"config_test": fal... |
__author__ = 'Geir Istad'
"""
MPU6050 Python I2C Class
Copyright (c) 2015 Geir Istad
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to... | {
"repo_name": "thisisG/MPU6050-I2C-Python-Class",
"path": "Quaternion.py",
"copies": "2",
"size": "4666",
"license": "mit",
"hash": -4656024039396256000,
"line_mean": 33.562962963,
"line_max": 78,
"alpha_frac": 0.6333047578,
"autogenerated": false,
"ratio": 3.453737971872687,
"config_test": fal... |
__author__ = 'Geir Istad'
"""
The MIT License (MIT)
SimplePID - PID in Python made easy!
Copyright (c) 2015 Geir Istad
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | {
"repo_name": "thisisG/SimplePID",
"path": "SimplePID.py",
"copies": "1",
"size": "5207",
"license": "mit",
"hash": 4431404611038118400,
"line_mean": 31.748427673,
"line_max": 78,
"alpha_frac": 0.5786441329,
"autogenerated": false,
"ratio": 3.4189100459619173,
"config_test": false,
"has_no_ke... |
__author__ = 'Geir'
from MPU6050 import MPU6050
from time import clock
mpu = mpu = MPU6050(1, 0x68, -5489, -1441, 1305, -2, -72, -5, True)
mpu.dmp_initialize()
mpu.set_DMP_enabled(True)
mpu_int_status = mpu.get_int_status()
print(hex(mpu_int_status))
while False:
print(mpu.get_acceleration())
print(mpu.get_r... | {
"repo_name": "thisisG/MPU6050-I2C-Python-Class",
"path": "testMPU.py",
"copies": "2",
"size": "1989",
"license": "mit",
"hash": -4568154861897625600,
"line_mean": 27.8260869565,
"line_max": 78,
"alpha_frac": 0.6138763198,
"autogenerated": false,
"ratio": 2.6205533596837944,
"config_test": fals... |
__author__ = 'Geir'
import can
import csv
import time
from CANparser import CanParser
from CANstorage import CanStorage
class ParseAndStore(can.Listener):
# TODO: Create an instance of a DataToUDP here
__parser = CanParser()
__0x600_file_name = './logs/can0x600.csv'
__0x601_file_name = './logs/can0x6... | {
"repo_name": "TAURacing/BeagleDash",
"path": "ParseAndStore.py",
"copies": "1",
"size": "1895",
"license": "mit",
"hash": -1337307770312724000,
"line_mean": 28.609375,
"line_max": 78,
"alpha_frac": 0.5577836412,
"autogenerated": false,
"ratio": 3.483455882352941,
"config_test": false,
"has_n... |
__author__ = 'Gene'
import operator
from PIL import Image
def generate(file, weights, iteration, mutation_rate):
width = file.size[0]
height = file.size[1]
image = file.load()
for t in range(iteration):
for h in range(height):
for w in range(width):
pixe... | {
"repo_name": "gene-levitzky/Cartographer",
"path": "src/MapGenerator.py",
"copies": "1",
"size": "1376",
"license": "mit",
"hash": 6328984342552360000,
"line_mean": 39.7575757576,
"line_max": 89,
"alpha_frac": 0.4731104651,
"autogenerated": false,
"ratio": 3.528205128205128,
"config_test": fal... |
__author__ = 'Gennady Kovalev <gik@bigur.ru>'
__copyright__ = '(c) 2016-2019 Development management business group'
__licence__ = 'For license information see LICENSE'
from logging import getLogger
from esl.table import Table
logger = getLogger(__name__)
_DEFAULT = object()
class Namespace(object):
def __init... | {
"repo_name": "belolap/esl",
"path": "esl/namespace.py",
"copies": "1",
"size": "2378",
"license": "bsd-3-clause",
"hash": 834738100298469400,
"line_mean": 26.9764705882,
"line_max": 74,
"alpha_frac": 0.5832632464,
"autogenerated": false,
"ratio": 3.738993710691824,
"config_test": false,
"has... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.