text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'aje'
__version__ = '0.1.0'
#
# Copyright (c) 2008 - 2013 10gen, Inc. <http://10gen.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LIC... | {
"repo_name": "thedemz/M101P",
"path": "chapter3/blogPostDAO.py",
"copies": "1",
"size": "4260",
"license": "apache-2.0",
"hash": 1699624974823343900,
"line_mean": 32.8095238095,
"line_max": 110,
"alpha_frac": 0.576056338,
"autogenerated": false,
"ratio": 4.111969111969112,
"config_test": false... |
__author__ = 'ajitkumar'
import requests
from bs4 import BeautifulSoup
import unicodedata
def search_page(search_string):
try:
payload = search_string
response = requests.get('http://www.coupondunia.in/'+payload)
soup = BeautifulSoup(response.content)
offers = soup.find_all('div',... | {
"repo_name": "Akcps/coupondunia_api",
"path": "coupondunia.py",
"copies": "1",
"size": "1752",
"license": "mit",
"hash": -658436608865840300,
"line_mean": 34.7551020408,
"line_max": 103,
"alpha_frac": 0.6050228311,
"autogenerated": false,
"ratio": 3.859030837004405,
"config_test": false,
"ha... |
__author__ = 'ajitkumar'
import requests
from bs4 import BeautifulSoup
class Torrent:
def __init__(self):
self.name = ''
self.link = ''
self.verified_by = ''
self.uploaded_date = ''
self.size = ''
self.seeds = ''
self.peers = ''
self.trackers = []
... | {
"repo_name": "Akcps/torrents",
"path": "torrentz.py",
"copies": "1",
"size": "3233",
"license": "mit",
"hash": -6092345530614668000,
"line_mean": 30.3883495146,
"line_max": 73,
"alpha_frac": 0.5589236004,
"autogenerated": false,
"ratio": 3.9235436893203883,
"config_test": false,
"has_no_keyw... |
__author__ = 'ajrenold'
__author__ = 'ajrenold'
# Lib Imports
from flask import (
redirect, url_for, abort,
render_template, request,
Blueprint
)
from flask.ext.stormpath import (
login_required,
... | {
"repo_name": "futurepress/futurepress",
"path": "futurepress/author_routes.py",
"copies": "1",
"size": "5175",
"license": "bsd-2-clause",
"hash": -3833986396660922400,
"line_mean": 33.0460526316,
"line_max": 116,
"alpha_frac": 0.5806763285,
"autogenerated": false,
"ratio": 3.788433382137628,
"... |
__author__ = 'ajrenold'
from copy import deepcopy
from test.data import books, authors
from models import Book, Author, AppUser, Genre, stormpathUserHash
def bootstrapTestDB(db):
"""
Takes an created SQLAlchemy db and bootstraps the tables
with dummy data
"""
books_copy, authors_copy = de... | {
"repo_name": "futurepress/futurepress",
"path": "test/db_bootstrap.py",
"copies": "1",
"size": "1382",
"license": "bsd-2-clause",
"hash": 4324591252087356400,
"line_mean": 31.9285714286,
"line_max": 86,
"alpha_frac": 0.6215629522,
"autogenerated": false,
"ratio": 3.6657824933687,
"config_test"... |
__author__ = 'ajrenold'
from core import db
from model_utils import stormpathUserHash
user_books = db.Table('user_books',
db.Column('book_id', db.Integer, db.ForeignKey('books.book_id')),
db.Column('user_id', db.String(128), db.ForeignKey('app_users.user_id'))
)
class AppUser(db.Model):
__tablename__ = ... | {
"repo_name": "futurepress/futurepress",
"path": "models/appuser_model.py",
"copies": "1",
"size": "2002",
"license": "bsd-2-clause",
"hash": 594132150376745900,
"line_mean": 26.8194444444,
"line_max": 90,
"alpha_frac": 0.5804195804,
"autogenerated": false,
"ratio": 3.6268115942028984,
"config_... |
__author__ = 'ajrenold'
# Lib Imports
from flask import ( request, session, g,
redirect, url_for, abort,
render_template, flash, jsonify,
make_response, Blueprint
)
from flask.ext.login import make_secure_token
from flask.ext.stormpath import ... | {
"repo_name": "futurepress/futurepress",
"path": "futurepress/auth_routes.py",
"copies": "1",
"size": "3750",
"license": "bsd-2-clause",
"hash": -1569051312197705200,
"line_mean": 29.7459016393,
"line_max": 78,
"alpha_frac": 0.5725333333,
"autogenerated": false,
"ratio": 4.084967320261438,
"con... |
__author__ = 'ajrenold'
# Libs
from datetime import date
from urllib2 import urlopen, HTTPError, Request
from urlparse import urlparse
import re
from zipfile import ZipFile
import StringIO
from mimetypes import guess_type
import boto
from boto.s3.key import Key
from boto.s3.connection import S3Connection
# Our Impo... | {
"repo_name": "futurepress/futurepress",
"path": "models/book_model.py",
"copies": "1",
"size": "5530",
"license": "bsd-2-clause",
"hash": -2443821840085558300,
"line_mean": 31.9226190476,
"line_max": 94,
"alpha_frac": 0.6028933092,
"autogenerated": false,
"ratio": 3.6309914642153642,
"config_t... |
__author__ = 'ajrenold'
# Libs
from flask import url_for
from flask.ext.sqlalchemy import ( SQLAlchemy )
# Our Imports
from core import db
from model_utils import slugify
class Author(db.Model):
__tablename__ = 'author'
# primary key
author_id = db.Column(db.Integer, primary_key=True)
# relations
... | {
"repo_name": "futurepress/futurepress",
"path": "models/author_model.py",
"copies": "1",
"size": "2105",
"license": "bsd-2-clause",
"hash": -4771559474105328000,
"line_mean": 30.4328358209,
"line_max": 99,
"alpha_frac": 0.5662707838,
"autogenerated": false,
"ratio": 3.8553113553113554,
"config... |
__author__ = "ajshajib", "sibirrer"
"""
Multi-Gaussian expansion fitting, based on Capellari 2002, http://adsabs.harvard.edu/abs/2002MNRAS.333..400C
"""
import numpy as np
from scipy.optimize import nnls
from LightProfiles.gaussian import Gaussian
gaussian_func = Gaussian()
def gaussian(R, sigma, amp):
"""
... | {
"repo_name": "sibirrer/astrofunc",
"path": "astrofunc/multi_gauss_expansion.py",
"copies": "1",
"size": "1881",
"license": "mit",
"hash": 7297643700440295000,
"line_mean": 26.6764705882,
"line_max": 108,
"alpha_frac": 0.6135034556,
"autogenerated": false,
"ratio": 2.911764705882353,
"config_te... |
__author__ = 'ajtag'
from math import pi, sin
# import math
# import os.path
# from TrinRoofPlayer.Renderer import ceiling, new_random
# import pygame
from TrinRoofPlayer.utils import *
from TrinRoofPlayer.Objects import *
from TrinRoofPlayer.Constants import *
from pygame.math import Vector2
import numpy as np
#To ch... | {
"repo_name": "ajtag/ln2015",
"path": "ln_objects.py",
"copies": "1",
"size": "37025",
"license": "mit",
"hash": -7258909217383839000,
"line_mean": 31.8818827709,
"line_max": 168,
"alpha_frac": 0.4981769075,
"autogenerated": false,
"ratio": 3.483066792097836,
"config_test": false,
"has_no_key... |
__author__ = 'ajtag'
from pygame import Rect
import collections
import csv
import os.path
MADRIX_X = 132
MADRIX_Y = 70
MADRIX_SIZE = (MADRIX_X, MADRIX_Y)
white = 255, 255, 255, 0xff
black = 0, 0, 0, 0xff
red = 255, 0, 0, 0xff
green = 0, 255, 0, 0xff
blue = 0, 0, 255, 0xff
dark_grey = 0x30, 0x30, 0x30, 0xff
transpar... | {
"repo_name": "ajtag/TrinRoofPlayer",
"path": "Constants.py",
"copies": "1",
"size": "1703",
"license": "mit",
"hash": 903801524269797900,
"line_mean": 26.9180327869,
"line_max": 144,
"alpha_frac": 0.6124486201,
"autogenerated": false,
"ratio": 2.6,
"config_test": false,
"has_no_keywords": fa... |
__author__ = 'ajtag'
from Renderer import *
class Sprite(pygame.sprite.Sprite):
def __init__(self, x=None, y=None, surface_flags=0):
self.log = logging.getLogger(self.__class__.__name__)
super().__init__()
if x is not None:
self.image = pygame.Surface((abs(x), abs(y)), surface... | {
"repo_name": "ajtag/TrinRoofPlayer",
"path": "Objects.py",
"copies": "1",
"size": "2413",
"license": "mit",
"hash": -1870416546428524800,
"line_mean": 29.1625,
"line_max": 72,
"alpha_frac": 0.5076668048,
"autogenerated": false,
"ratio": 3.512372634643377,
"config_test": false,
"has_no_keywor... |
__author__ = 'ajtag'
import colorsys
import math
def hls_to_rgb(hue, lightness, saturation):
"""
:param hue: 0-360
:param lightness: 0-100
:param saturation: 0-100
:return: list(int)
"""
return [int(i * 255) for i in colorsys.hls_to_rgb(hue / 360.0, lightness / 100.0, saturation / 100.0)... | {
"repo_name": "ajtag/TrinRoofPlayer",
"path": "utils.py",
"copies": "1",
"size": "1305",
"license": "mit",
"hash": 6785830712328659000,
"line_mean": 22.3035714286,
"line_max": 106,
"alpha_frac": 0.5762452107,
"autogenerated": false,
"ratio": 2.7473684210526317,
"config_test": false,
"has_no_k... |
__author__ = 'ajtag'
import random
from collections import namedtuple
import logging
import pygame
from pygame.math import Vector2
from Constants import *
from utils import *
import sys
import platform
import Renderer
import math
from Renderer import get_fps
import random
log = logging.getLogger()
logging.basicConf... | {
"repo_name": "ajtag/TrinRoofPlayer",
"path": "patterns/gameoflife.py",
"copies": "1",
"size": "3161",
"license": "mit",
"hash": 8181613793315273000,
"line_mean": 23.8897637795,
"line_max": 111,
"alpha_frac": 0.5099652009,
"autogenerated": false,
"ratio": 3.4660087719298245,
"config_test": fals... |
__author__ = 'ajtag'
import subprocess as sp
import glob
import pygame
import logging
from Constants import *
import os
import math
import random
import argparse
pygame.font.init()
FONT = pygame.font.Font(None, 24)
_fps = None
def cmd_line_args():
parser = argparse.ArgumentParser()
parser.add_argument("--w... | {
"repo_name": "ajtag/TrinRoofPlayer",
"path": "Renderer.py",
"copies": "1",
"size": "14696",
"license": "mit",
"hash": -8518442549218390000,
"line_mean": 34.0739856802,
"line_max": 167,
"alpha_frac": 0.5194610778,
"autogenerated": false,
"ratio": 3.946294307196563,
"config_test": false,
"has_... |
__author__ = 'ajtag'
import csv
import xml.etree.ElementTree as ET
import os.path
import math
from collections import namedtuple
white = 255,255,255
Lamp = namedtuple("Lamp", ["x", "y", 'name', 'dmx', 'channel'])
def parse_imagemask_svg(x, y, scale, x_offset = 19, y_offset = 0):
tree = ET.parse('../Resourc... | {
"repo_name": "ajtag/ln2015",
"path": "utils/match_pixels.py",
"copies": "1",
"size": "2159",
"license": "mit",
"hash": 1895519296945222400,
"line_mean": 27.7866666667,
"line_max": 152,
"alpha_frac": 0.5794349236,
"autogenerated": false,
"ratio": 2.7822164948453607,
"config_test": false,
"has... |
__author__ = 'akarapetyan'
from numpy import loadtxt
# A simple function for reading the file and checking whether it is compatible with the input rules
def checkMe(function):
#Loading the input file
temp = loadtxt('test.in', dtype='str')
#Checking if the input parameters are right
if temp[0].isdigit(... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw1/Q3_3.py",
"copies": "1",
"size": "1170",
"license": "mit",
"hash": 3525120491220578000,
"line_mean": 32.4571428571,
"line_max": 99,
"alpha_frac": 0.6051282051,
"autogenerated": false,
"ratio": 3.75,
"config_test": false,
"has_no_keywords": false,
"f... |
__author__ = 'akarapetyan'
from random import choice
from numpy import loadtxt
# A simple function for reading the file and checking whether it is compatible with the input rules
def checkMe(function):
#Loading the input file
temp = loadtxt('test.in', dtype='str')
#Checking if the input parameters are rig... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw1/Q3_5.py",
"copies": "1",
"size": "1738",
"license": "mit",
"hash": 3068227730424452000,
"line_mean": 26.6031746032,
"line_max": 99,
"alpha_frac": 0.5575373993,
"autogenerated": false,
"ratio": 3.10912343470483,
"config_test": false,
"has_no_keywords":... |
__author__ = 'akarapetyan'
from random import choice, randrange, shuffle
from numpy import loadtxt
import math
import numpy
#Output Buffer
f = open('test.out', 'r+')
FirstLine = []
OtherLines = []
# A simple function for reading the file and checking whether it is compatible with the input rules
def checkMe(function... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw1/Q4.py",
"copies": "1",
"size": "3461",
"license": "mit",
"hash": 1508885607483522000,
"line_mean": 36.6304347826,
"line_max": 121,
"alpha_frac": 0.4348454204,
"autogenerated": false,
"ratio": 4.584105960264901,
"config_test": false,
"has_no_keywords":... |
__author__ = 'akarapetyan'
#Global Variables
Vertexes = {}
RootVertexes = []
ordNodes = []
VertexesAlive = []
DeadVertexes = []
Memory = 0
n = 0
#Output Buffer
f = open('test.out', 'r+')
class Node:
def __init__(self, ID, Memory, Priority):
self.ID = ID
self.Priority = Priority
self.Memory... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw2/Q3.py",
"copies": "1",
"size": "2862",
"license": "mit",
"hash": -3995878129750631000,
"line_mean": 26.5288461538,
"line_max": 106,
"alpha_frac": 0.5457721873,
"autogenerated": false,
"ratio": 3.134720700985761,
"config_test": false,
"has_no_keywords"... |
__author__ = 'akarapetyan'
import random
from numpy import loadtxt
from numpy import inf
#Output Buffer
f = open('test.out', 'r+')
# A simple function for reading the file and checking whether the data is compatible with the input rules
def checkMe(function):
#Loading the input file
try:
temp = loadtx... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw2/Q1.py",
"copies": "1",
"size": "4874",
"license": "mit",
"hash": -6462788520264640000,
"line_mean": 28.0178571429,
"line_max": 105,
"alpha_frac": 0.5750923266,
"autogenerated": false,
"ratio": 3.5733137829912023,
"config_test": false,
"has_no_keywords... |
__author__ = 'akarapetyan'
import random
from numpy import loadtxt
import math
mycounter = 0
#Output Buffer
f = open('test.out', 'r+')
# A simple function for reading the file and checking whether the data is compatible with the input rules
def checkMe(function):
#Loading the input file
try:
temp = loa... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw2/Q2.py",
"copies": "1",
"size": "4925",
"license": "mit",
"hash": 9152319468933918000,
"line_mean": 28.3214285714,
"line_max": 105,
"alpha_frac": 0.5837563452,
"autogenerated": false,
"ratio": 3.7169811320754715,
"config_test": false,
"has_no_keywords"... |
__author__ = 'akarapetyan'
import matplotlib.pyplot as plt
from wnaffect import WNAffect
from emotion import Emotion
from nltk.corpus import wordnet as wn
from cursor_spinning import SpinCursor
import time
import sys
import numpy as np
import PorterStemmer as ps
from scipy.interpolate import interp1d
#CONSTANTS
#arra... | {
"repo_name": "Arnukk/TDS",
"path": "main_assignment1.py",
"copies": "1",
"size": "8251",
"license": "mit",
"hash": 2686718328171719000,
"line_mean": 39.8465346535,
"line_max": 176,
"alpha_frac": 0.6013816507,
"autogenerated": false,
"ratio": 3.339133953864832,
"config_test": false,
"has_no_k... |
__author__ = 'akarapetyan'
# A simple function for reading the file and checking whether the data is compatible with the input rules
def checkMe(function):
#Loading the input file
try:
f = open("test.in", 'r')
firstLine = f.readline().split()
n = int(firstLine[0])
newweights = ... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw3/Q2_2.py",
"copies": "1",
"size": "2499",
"license": "mit",
"hash": 4894109619976993000,
"line_mean": 30.2375,
"line_max": 105,
"alpha_frac": 0.5602240896,
"autogenerated": false,
"ratio": 3.4564315352697097,
"config_test": false,
"has_no_keywords": fa... |
__author__ = 'akarapetyan'
vertices = []
class Vertex:
def __init__(self, Id, p, childNodes):
self.Id = Id
self.p = p
self.alreadyDone = 0
self.childNodes = childNodes
# A simple function for reading the file and checking whether the data is compatible with the input rules
def ch... | {
"repo_name": "Arnukk/DAA",
"path": "Hmw3/Q2_1.py",
"copies": "1",
"size": "2520",
"license": "mit",
"hash": -7580752819547152000,
"line_mean": 27,
"line_max": 105,
"alpha_frac": 0.5757936508,
"autogenerated": false,
"ratio": 3.8181818181818183,
"config_test": false,
"has_no_keywords": false,... |
__author__ = 'akarpov'
def write_greyscale(filename, pixels):
# each pixel is a value from 0 to 255
height = len(pixels)
width = len(pixels[0])
with open(filename, 'wb') as bmp:
# BMP header
bmp.write(b'BM')
size_bookmark = bmp.tell() # the next four bytes hold the 32-bit... | {
"repo_name": "alexakarpov/interview_problems",
"path": "python/bmp.py",
"copies": "2",
"size": "2083",
"license": "mit",
"hash": -1251989388202386000,
"line_mean": 31.0461538462,
"line_max": 93,
"alpha_frac": 0.5679308689,
"autogenerated": false,
"ratio": 3.0364431486880465,
"config_test": fal... |
__author__ = 'akeenan'
from django.core.management.base import BaseCommand
from xml.dom import minidom as XML_Parser
import xmltodict
import json
from collections import OrderedDict
from backend.models import Project, Dictionary, Gloss, Survey, Variety, Transcription, PartOfSpeech
class Command(BaseCommand):
a... | {
"repo_name": "tu-software-studio/websurv",
"path": "backend/management/commands/import_xml.py",
"copies": "1",
"size": "5628",
"license": "mit",
"hash": -1446255277047457500,
"line_mean": 37.2925170068,
"line_max": 118,
"alpha_frac": 0.5717839375,
"autogenerated": false,
"ratio": 3.8653846153846... |
__author__ = 'Akhil'
import cv2
import storage
import sqlite3
import cvutils
import itertools
import shutil
from numpy.linalg.linalg import inv
from numpy import loadtxt
homographyFilename = "laurier-homography.txt"
homography = inv(loadtxt(homographyFilename))
databaseFilename = "laurier.sqlite"
newFilename = "corre... | {
"repo_name": "Transience/tracker",
"path": "main.py",
"copies": "1",
"size": "16902",
"license": "mit",
"hash": 5986292736164098000,
"line_mean": 47.2914285714,
"line_max": 205,
"alpha_frac": 0.5788072417,
"autogenerated": false,
"ratio": 3.709019091507571,
"config_test": false,
"has_no_keyw... |
__author__ = 'akil.harris'
import geojson
import argparse
import pprint
import psycopg2
from admin.postgres_connector import *
data = None
def read_file(filenames):
global data
for filename in filenames:
with open(filename, encoding='utf8', newline='') as jsonfile:
data = geojson.load(j... | {
"repo_name": "akilism/nyc-campaign-finance",
"path": "admin/zipcode_parser.py",
"copies": "1",
"size": "2193",
"license": "mit",
"hash": -5896953271314026000,
"line_mean": 40.3962264151,
"line_max": 129,
"alpha_frac": 0.5782033744,
"autogenerated": false,
"ratio": 4.03125,
"config_test": false... |
__author__ = 'akilharris'
import httplib
from bs4 import BeautifulSoup
import os
#Load http://www.nyc.gov/html/nypd/html/traffic_reports/traffic_summons_reports.shtml
#grab all pdfs and save to a folder
path = "raw_data/pdf/"
def scrape(url):
conn = httplib.HTTPConnection("www.nyc.gov")
conn.request("GET", ... | {
"repo_name": "akilism/moving_violation_scraper",
"path": "scraper.py",
"copies": "1",
"size": "1500",
"license": "mit",
"hash": 3535982703556535300,
"line_mean": 24.4237288136,
"line_max": 86,
"alpha_frac": 0.5806666667,
"autogenerated": false,
"ratio": 3.2822757111597376,
"config_test": false... |
__author__ = 'akoziol'
import os, errno, re, shutil, subprocess, json, sys, time, gzip
from glob import glob
from argparse import ArgumentParser
from multiprocessing import Pool
from collections import defaultdict
#Parser for arguments
parser = ArgumentParser(description='Prep Illumina fastq metagenome files to be pr... | {
"repo_name": "adamkoziol/metagenomeAutomator",
"path": "metagenomR.py",
"copies": "1",
"size": "18393",
"license": "mit",
"hash": 7853484469652363000,
"line_mean": 46.0409207161,
"line_max": 130,
"alpha_frac": 0.648779427,
"autogenerated": false,
"ratio": 3.860831234256927,
"config_test": fals... |
__author__ = 'akoziol'
# Import the necessary modules
# OS is used for file/folder manipulations
import os
# Subprocess->call is used for making system calls
from subprocess import call
# Errno is used in the file creation command - I think it's similar to the $! variable in Perl
import errno
# Glob finds all the pat... | {
"repo_name": "adamkoziol/SipprModeling",
"path": "modelling.py",
"copies": "1",
"size": "9371",
"license": "mit",
"hash": 8077281785456471000,
"line_mean": 41.0224215247,
"line_max": 129,
"alpha_frac": 0.6235193683,
"autogenerated": false,
"ratio": 3.5362264150943394,
"config_test": false,
"... |
__author__ = 'akoziol'
# Import the necessary modules
# OS is used for file/folder manipulations
import os
# Subprocess->call is used for making system calls
import subprocess
# Errno is used in the file creation command - I think it's similar to the $! variable in Perl
import errno
# Glob finds all the path names ma... | {
"repo_name": "adamkoziol/SipprModeling",
"path": "modellingMultiprocessing.py",
"copies": "1",
"size": "24473",
"license": "mit",
"hash": -9210337676631298000,
"line_mean": 49.0490797546,
"line_max": 137,
"alpha_frac": 0.5448453398,
"autogenerated": false,
"ratio": 4.079513252208701,
"config_t... |
__author__ = 'a.kozlowski'
import pygame
from pygame.locals import *
from random import randint
class Snake(object):
game_speed = 10 #fps limit
screen_w = 800
screen_h = 640
map_margin_y = 40 #space for displaying score during game
map_w = 40 #tiles x
map_h = 30 #tiles y
surface_color = (... | {
"repo_name": "AlbertKozlowski/GeekSnake",
"path": "snake.py",
"copies": "1",
"size": "6035",
"license": "mit",
"hash": 2478090873065433000,
"line_mean": 32.5277777778,
"line_max": 102,
"alpha_frac": 0.5231151616,
"autogenerated": false,
"ratio": 3.341638981173865,
"config_test": false,
"has_... |
__author__ = 'Akshay'
"""
File contains code to Mine reviews and stars from a state reviews.
This is just an additional POC that we had done on YELP for visualising number of 5 star reviews per state on a map.
For each business per state, 5 reviews are taken and the count of the review is kept in the dictionary for e... | {
"repo_name": "akshaykamath/StateReviewTrendAnalysisYelp",
"path": "StateReviewTrendsPOC.py",
"copies": "1",
"size": "4899",
"license": "mit",
"hash": 6676727531916012000,
"line_mean": 27.4825581395,
"line_max": 119,
"alpha_frac": 0.5362318841,
"autogenerated": false,
"ratio": 3.7597851112816576,... |
__author__ = 'Alain Dechorgnat'
import subprocess
import re
def get_ceph_version():
try:
args = ['ceph',
'--version']
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = p.communicate()
if p.returncode != 0:
return... | {
"repo_name": "inkscope/inkscope",
"path": "inkscopeCtrl/ceph_version.py",
"copies": "1",
"size": "1709",
"license": "apache-2.0",
"hash": -841413974532078800,
"line_mean": 26.564516129,
"line_max": 102,
"alpha_frac": 0.521357519,
"autogenerated": false,
"ratio": 3.6517094017094016,
"config_tes... |
__author__ = 'alain.dechorgnat@orange.com'
# Copyright (c) 2014, Alain Dechorgnat
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyr... | {
"repo_name": "abrefort/inkscope-debian",
"path": "inkscopeCtrl/S3/user.py",
"copies": "1",
"size": "13635",
"license": "apache-2.0",
"hash": -382573789481204300,
"line_mean": 41.0833333333,
"line_max": 124,
"alpha_frac": 0.5983865053,
"autogenerated": false,
"ratio": 3.9237410071942445,
"confi... |
__author__ = 'alain.dechorgnat@orange.com'
from flask import Flask, request, Response
from S3.bucket import S3Bucket, S3Error
from S3.user import S3User
from Log import Log
import json
class S3Ctrl:
def __init__(self,conf):
self.admin = conf.get("radosgw_admin", "admin")
self.key = conf.get("rad... | {
"repo_name": "abrefort/inkscope-debian",
"path": "inkscopeCtrl/S3Ctrl.py",
"copies": "1",
"size": "6920",
"license": "apache-2.0",
"hash": 4350361273932041000,
"line_mean": 36.6086956522,
"line_max": 123,
"alpha_frac": 0.6147398844,
"autogenerated": false,
"ratio": 3.673036093418259,
"config_t... |
__author__ = 'alain.dechorgnat@orange.com'
from flask import Flask, request, Response
from S3.bucket import S3Bucket, S3Error
from S3.user import S3User
from Log import Log
import json
import boto
import boto.s3.connection
from boto.exception import S3PermissionsError
#import boto3
from InkscopeError import Inkscope... | {
"repo_name": "inkscope/inkscope",
"path": "inkscopeCtrl/S3Ctrl.py",
"copies": "1",
"size": "13046",
"license": "apache-2.0",
"hash": 9061942243403723000,
"line_mean": 33.4221635884,
"line_max": 144,
"alpha_frac": 0.6426490878,
"autogenerated": false,
"ratio": 3.4385872430152875,
"config_test":... |
__author__ = 'alain.dechorgnat@orange.com'
from flask import request
import subprocess
from StringIO import StringIO
import json
class RbdCtrl:
def __init__(self,conf):
self.cluster_name = conf['cluster']
pass
def list_images(self):
output = subprocess.Popen(['ceph', 'osd', 'lspools'... | {
"repo_name": "inkscope/inkscope",
"path": "inkscopeCtrl/rbdCtrl.py",
"copies": "1",
"size": "11715",
"license": "apache-2.0",
"hash": -2587347901505758000,
"line_mean": 38.9863481229,
"line_max": 176,
"alpha_frac": 0.5609048229,
"autogenerated": false,
"ratio": 4.2109992810927395,
"config_test... |
__author__ = 'alain ivars'
# -*- coding: utf-8 -*-
import sys, os
# check to see if this file is getting loaded on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd is False:
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
... | {
"repo_name": "alainivars/django-contact-form",
"path": "docs/conf.py",
"copies": "1",
"size": "2083",
"license": "bsd-3-clause",
"hash": 4110747569218348000,
"line_mean": 27.9305555556,
"line_max": 80,
"alpha_frac": 0.6706673068,
"autogenerated": false,
"ratio": 3.465890183028286,
"config_test... |
__author__ = 'alandinneen'
from MySQLdb import connect, Error
from collections import OrderedDict
class DBConn(object):
"""
A class to handle all MySQL connection reads/writes.
"""
def __init__(self, host=None, db=None, user=None, password=None):
self._host = host
self._db = db
... | {
"repo_name": "rad08d/mysqlconn",
"path": "dbconn/dbconn.py",
"copies": "1",
"size": "3405",
"license": "mit",
"hash": 6393837889572282000,
"line_mean": 29.9636363636,
"line_max": 115,
"alpha_frac": 0.5380323054,
"autogenerated": false,
"ratio": 4.552139037433155,
"config_test": false,
"has_n... |
__author__ = 'alan'
from . import rssapp_blueprint
from flask import render_template
from os import path
from logging import getLogger
from flask_rss import customlogg
from settings import Configuration
import rss
logger = getLogger(__name__)
config = Configuration()
@rssapp_blueprint.route('/')
def index():
try:... | {
"repo_name": "rad08d/rssreader_flask",
"path": "flask_rss/rssapp/views.py",
"copies": "1",
"size": "1110",
"license": "apache-2.0",
"hash": -8273817866912707000,
"line_mean": 31.6764705882,
"line_max": 93,
"alpha_frac": 0.6135135135,
"autogenerated": false,
"ratio": 4.157303370786517,
"config_... |
__author__ = 'alan'
import heapq
class Solution(object):
def getSkyline(self, buildings):
"""
:type buildings: List[List[int]]
:rtype: List[List[int]]
"""
i, n = 0, len(buildings)
hq, re = [], []
while i < n or len(hq) > 0:
if len(hq) == 0 or (i... | {
"repo_name": "alyiwang/LeetPy",
"path": "Skyline.py",
"copies": "1",
"size": "1027",
"license": "apache-2.0",
"hash": 359047702324409000,
"line_mean": 28.3428571429,
"line_max": 80,
"alpha_frac": 0.4206426485,
"autogenerated": false,
"ratio": 3.102719033232628,
"config_test": false,
"has_no_... |
__author__ = 'alan'
import random
class Solution(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.ls = []
self.m = {}
def insert(self, val):
"""
Inserts a value to the set. Returns true if the set did not already contain ... | {
"repo_name": "alyiwang/LeetPy",
"path": "InsertDeleteGetRandomO1.py",
"copies": "1",
"size": "1476",
"license": "apache-2.0",
"hash": -7501933958888869000,
"line_mean": 22.8064516129,
"line_max": 106,
"alpha_frac": 0.5108401084,
"autogenerated": false,
"ratio": 3.7367088607594936,
"config_test... |
__author__ = 'alan'
import random
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def __init__(self, head):
"""
@param head The linked list's head.
Note that the head is guaran... | {
"repo_name": "alyiwang/LeetPy",
"path": "LinkedListRandomNode.py",
"copies": "1",
"size": "1069",
"license": "apache-2.0",
"hash": -5775895797609902000,
"line_mean": 19.5576923077,
"line_max": 90,
"alpha_frac": 0.5070159027,
"autogenerated": false,
"ratio": 3.5752508361204014,
"config_test": f... |
__author__ = 'alan'
import string
class Solution(object):
def findLadders(self, start, end, dict):
"""
:type start: str
:type end: str
:type dict: Set[str]
:rtype: List[List[int]]
"""
l = len(start)
if start == end:
return [[start]]
... | {
"repo_name": "alyiwang/LeetPy",
"path": "WordLadder2.py",
"copies": "1",
"size": "1485",
"license": "apache-2.0",
"hash": 8070814087898088000,
"line_mean": 24.1694915254,
"line_max": 93,
"alpha_frac": 0.3818181818,
"autogenerated": false,
"ratio": 3.9812332439678286,
"config_test": false,
"h... |
__author__ = 'alan'
import string
class Solution(object):
def ladderLength(self, beginWord, endWord, wordDict):
"""
:type beginWord: str
:type endWord: str
:type wordDict: Set[str]
:rtype: int
"""
dif = self.diff(beginWord, endWord)
if dif <= 1:
... | {
"repo_name": "alyiwang/LeetPy",
"path": "WordLadder.py",
"copies": "1",
"size": "1377",
"license": "apache-2.0",
"hash": 371709880457842800,
"line_mean": 26,
"line_max": 57,
"alpha_frac": 0.41902687,
"autogenerated": false,
"ratio": 3.889830508474576,
"config_test": false,
"has_no_keywords":... |
__author__ = 'alan'
class Solution:
# @param {character[][]} board
# @return {void} Do not return anything, modify board in-place instead.
def solveSudoku(self, board):
self.solve(board, 0, 0)
def solve(self, b, x, y):
if y >= 9:
x, y = x + 1, y - 9
if x >= 9:
... | {
"repo_name": "alyiwang/LeetPy",
"path": "SudokuSolver.py",
"copies": "1",
"size": "1360",
"license": "apache-2.0",
"hash": 5647523553822450000,
"line_mean": 26.2,
"line_max": 116,
"alpha_frac": 0.4088235294,
"autogenerated": false,
"ratio": 3.1627906976744184,
"config_test": false,
"has_no_k... |
__author__ = 'alan'
class Solution(object):
def addOperators(self, num, target):
"""
:type num: str
:type target: int
:rtype: List[str]
"""
if not num:
return []
def check0(snum):
return len(snum) > 1 and snum[0] == '0'
def ... | {
"repo_name": "alyiwang/LeetPy",
"path": "ExpressionAddOperators.py",
"copies": "1",
"size": "1241",
"license": "apache-2.0",
"hash": 2793746665715166000,
"line_mean": 29.2682926829,
"line_max": 68,
"alpha_frac": 0.4689766317,
"autogenerated": false,
"ratio": 3.8184615384615386,
"config_test": ... |
__author__ = 'alan'
class Solution(object):
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
stack = []
# find the previous '(' or beginning of stack
def goback():
t = len(stack) - 1
while t >= 0:
if stack[t] ... | {
"repo_name": "alyiwang/LeetPy",
"path": "BasicCalculator.py",
"copies": "1",
"size": "1496",
"license": "apache-2.0",
"hash": 6714300127272637000,
"line_mean": 24.3559322034,
"line_max": 59,
"alpha_frac": 0.3181818182,
"autogenerated": false,
"ratio": 3.9681697612732094,
"config_test": false,
... |
__author__ = 'alan'
class Solution(object):
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
tokens = self.reverse_polish_notation(s)
return self.evaluate(tokens)
operators = ['+', '-', '*', '/']
def priority(self, operator):
return {
... | {
"repo_name": "alyiwang/LeetPy",
"path": "BasicCalculator2.py",
"copies": "1",
"size": "1934",
"license": "apache-2.0",
"hash": 8981887192509885000,
"line_mean": 26.2394366197,
"line_max": 86,
"alpha_frac": 0.4022750776,
"autogenerated": false,
"ratio": 4.195227765726681,
"config_test": false,
... |
__author__ = 'alan'
class Solution(object):
def canFinish(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: bool
"""
r = [[] for i in range(numCourses)]
deg = [0 for i in range(numCourses)]
for p... | {
"repo_name": "alyiwang/LeetPy",
"path": "CourseSchedule.py",
"copies": "1",
"size": "1060",
"license": "apache-2.0",
"hash": -5572826823676477000,
"line_mean": 26.8947368421,
"line_max": 67,
"alpha_frac": 0.4481132075,
"autogenerated": false,
"ratio": 3.719298245614035,
"config_test": false,
... |
__author__ = 'alan'
class Solution(object):
def colorConnected(self, board):
"""
:type board: List[str]
:rtype: integer
"""
m, n = len(board), len(board[0])
def bfs():
count, q = 1, []
for i in range(m):
for j in range(n):
... | {
"repo_name": "alyiwang/LeetPy",
"path": "ColorConnected.py",
"copies": "1",
"size": "2506",
"license": "apache-2.0",
"hash": -8767288083784792000,
"line_mean": 35.8529411765,
"line_max": 68,
"alpha_frac": 0.2773343974,
"autogenerated": false,
"ratio": 4.247457627118644,
"config_test": false,
... |
__author__ = 'alan'
class Solution(object):
def exist(self, board, word):
"""
:type board: List[List[str]]
:type word: str
:rtype: bool
"""
for i in range(len(board)):
for j in range(len(board[0])):
if board[i][j] == word[0]:
... | {
"repo_name": "alyiwang/LeetPy",
"path": "WordSearch.py",
"copies": "1",
"size": "1284",
"license": "apache-2.0",
"hash": -9041286312901326000,
"line_mean": 24.68,
"line_max": 58,
"alpha_frac": 0.4026479751,
"autogenerated": false,
"ratio": 3.1625615763546797,
"config_test": false,
"has_no_ke... |
__author__ = 'alan'
class Solution(object):
def findWords(self, board, words):
"""
:type board: List[List[str]]
:type words: List[str]
:rtype: List[str]
"""
l1, l2 = len(board), len(board[0])
tr = Trie()
for w in words:
tr.add(w)
... | {
"repo_name": "alyiwang/LeetPy",
"path": "WordSearch2.py",
"copies": "1",
"size": "2085",
"license": "apache-2.0",
"hash": -1574651295570158000,
"line_mean": 23.8214285714,
"line_max": 69,
"alpha_frac": 0.4081534772,
"autogenerated": false,
"ratio": 3.3902439024390243,
"config_test": false,
"... |
__author__ = 'alan'
class Solution(object):
def __init__(self):
self.m = {}
def combinationSum4(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
return self.helper(nums, target)
def helper(self, nums, target):
... | {
"repo_name": "alyiwang/LeetPy",
"path": "CombinationSum4.py",
"copies": "1",
"size": "1089",
"license": "apache-2.0",
"hash": 4075672386866467300,
"line_mean": 21.2244897959,
"line_max": 54,
"alpha_frac": 0.4527089073,
"autogenerated": false,
"ratio": 3.7681660899653977,
"config_test": false,
... |
__author__ = 'alan'
class Solution(object):
def numberToWords(self, num):
"""
:type num: int
:rtype: str
"""
def get_base(x):
return {
1: '',
100: 'Hundred',
1000: 'Thousand',
1000000: 'Million',
... | {
"repo_name": "alyiwang/LeetPy",
"path": "IntegerToWords.py",
"copies": "1",
"size": "2236",
"license": "apache-2.0",
"hash": -939011879711247900,
"line_mean": 25.619047619,
"line_max": 72,
"alpha_frac": 0.3255813953,
"autogenerated": false,
"ratio": 3.802721088435374,
"config_test": false,
"... |
__author__ = 'alan'
class WordDictionary(object):
class Node(object):
def __init__(self):
self.isWord = False
self.ch = {}
def __init__(self):
"""
initialize your data structure here.
"""
self.root = self.Node()
def addWord(self, word):
... | {
"repo_name": "alyiwang/LeetPy",
"path": "WordDict.py",
"copies": "1",
"size": "1706",
"license": "apache-2.0",
"hash": -6249998761865192000,
"line_mean": 23.7246376812,
"line_max": 66,
"alpha_frac": 0.4777256741,
"autogenerated": false,
"ratio": 3.708695652173913,
"config_test": false,
"has_... |
__author__ = 'Alan Richmond'
'''
Mandelbrot.py Copyright (C) 2014 Alan Richmond (Tuxar.uk)
Full mandelbrot set with a couple of optimizations:
1 compute only top half, mirror it.
2 don't compute set inside the big circle and a couple of smaller ones.
See http://en.wikipedia.org/wiki/Mandelbrot_s... | {
"repo_name": "tuxar-uk/Mandelbrot",
"path": "Mandelbrot.py",
"copies": "1",
"size": "1746",
"license": "mit",
"hash": 6832860415995486000,
"line_mean": 29.6315789474,
"line_max": 78,
"alpha_frac": 0.470790378,
"autogenerated": false,
"ratio": 3.556008146639511,
"config_test": false,
"has_no_... |
__author__ = 'alanseciwa'
import sys
import json
import csv
from datetime import datetime, timedelta
from textblob import TextBlob
from elasticsearch import Elasticsearch
from scripts.spam_detection import SpamBotDetection
es = Elasticsearch()
def check_obj(c):
if not c:
c = ''
else:
c = c
... | {
"repo_name": "aseciwa/independent-study",
"path": "scripts/parse_twitter_data_PartThree.py",
"copies": "1",
"size": "2411",
"license": "mit",
"hash": -7815309185996555000,
"line_mean": 29.15,
"line_max": 117,
"alpha_frac": 0.550808793,
"autogenerated": false,
"ratio": 3.737984496124031,
"confi... |
__author__ = 'alanseciwa'
import sys
import json
import csv
from datetime import datetime, timedelta
from textblob import TextBlob
from textblob import sentiments
from elasticsearch import Elasticsearch
es = Elasticsearch()
class SpamBodDetection():
"""Check if twitter user is a spambot.
Check user date c... | {
"repo_name": "aseciwa/independent-study",
"path": "scripts/parse_twitter_data_partTwo.py",
"copies": "1",
"size": "4110",
"license": "mit",
"hash": -3232682500037866500,
"line_mean": 28.3642857143,
"line_max": 107,
"alpha_frac": 0.5313868613,
"autogenerated": false,
"ratio": 3.9825581395348837,
... |
__author__ = 'alanseciwa'
import sys, os
import json
import csv
def parse_json_data(data):
csv_file = open('/Users/alanseciwa/Desktop/clean_data-TWEETONLY-2.csv', 'w')
writer = csv.writer(csv_file, quoting=csv.QUOTE_NONE)
# Open json file while reserving a buffer size of 1028
with open(data, 'r', bu... | {
"repo_name": "aseciwa/independent-study",
"path": "scripts/parse_twitter_data.py",
"copies": "1",
"size": "1630",
"license": "mit",
"hash": 2785875847155723300,
"line_mean": 28.6545454545,
"line_max": 97,
"alpha_frac": 0.5460122699,
"autogenerated": false,
"ratio": 3.55119825708061,
"config_te... |
__author__ = 'alanseciwa'
import sys, os
import nltk
import json
import pandas as pd
def parse_json_data(data):
with open(data, 'r') as read_json:
for i in read_json:
# Load json and store key value pair for text in tweet
jd = json.loads(i)
created_at = jd['created_a... | {
"repo_name": "aseciwa/independent-study",
"path": "scripts/geo_location.py",
"copies": "1",
"size": "1452",
"license": "mit",
"hash": -6694450299291596000,
"line_mean": 29.8936170213,
"line_max": 134,
"alpha_frac": 0.5633608815,
"autogenerated": false,
"ratio": 3.4653937947494033,
"config_test... |
__author__ = 'alanseciwa'
import re
import csv
import os
import sys
def match_values(u_list, v_list, t_list):
re_pattern = re.compile(u'['
u'\U0001F300-\U0001F5FF'
u'\U0001F600-\U0001F64F'
u'\U0001F680-\U0001F6FF'
... | {
"repo_name": "aseciwa/independent-study",
"path": "examples/replace_hex.py",
"copies": "1",
"size": "1327",
"license": "mit",
"hash": -1285317319336530200,
"line_mean": 19.75,
"line_max": 65,
"alpha_frac": 0.5350414469,
"autogenerated": false,
"ratio": 3.3341708542713566,
"config_test": false,... |
__author__ = 'alanseciwa'
import re
import numpy as np
import pandas as pd
from textblob import TextBlob
from candidate_list import clist
def clean(df):
# go through candidate name list
df = df[df.candidate.isin(clist)]
del df['Unnamed: 0']
return df
def datetimeify(df):
# get created time of t... | {
"repo_name": "aseciwa/independent-study",
"path": "scripts/tweet_preprocess.py",
"copies": "1",
"size": "2608",
"license": "mit",
"hash": 8885392936108335000,
"line_mean": 25.3434343434,
"line_max": 84,
"alpha_frac": 0.6468558282,
"autogenerated": false,
"ratio": 3.5290933694181326,
"config_te... |
__author__ = 'alanseciwa'
# Reference: Raj Kesavan @ http://www.rajk.me
import datetime
import json
import pandas as pd
import tweepy
# import sys
from candidate_list import clist
from private_keys import consumer_key, consumer_secret, access_token, access_token_secret
from spam_detection import SpamBotDetection
# s... | {
"repo_name": "aseciwa/independent-study",
"path": "scripts/retrieve.py",
"copies": "1",
"size": "3800",
"license": "mit",
"hash": -1591292753454534700,
"line_mean": 30.9327731092,
"line_max": 89,
"alpha_frac": 0.6663157895,
"autogenerated": false,
"ratio": 3.4111310592459607,
"config_test": fa... |
__author__ = 'Alan Snow'
import netCDF4 as NET
import numpy as np
import os
from json import dumps
def generate_warning_points(ecmwf_prediction_folder, era_interim_file, out_directory):
"""
Create warning points from era interim data and ECMWD prediction data
"""
#Get list of prediciton files
p... | {
"repo_name": "CI-WATER/erfp_data_process_ubuntu_aws",
"path": "generate_warning_points_from_era_interim_data.py",
"copies": "1",
"size": "7511",
"license": "mit",
"hash": 9020849851004345000,
"line_mean": 50.4452054795,
"line_max": 150,
"alpha_frac": 0.5866063107,
"autogenerated": false,
"ratio"... |
__author__ = 'albert cuesta'
import os.path
class database:
def listaraplicaiones(self):
result = []
with open("database/data/aplicaciones.txt", mode='r+', encoding='utf-8') as file:
resultado = file.read()
texto = resultado.split("\n")
for linea in texto:
result.... | {
"repo_name": "albertcuesta/PEACHESTORE",
"path": "database/Database.py",
"copies": "1",
"size": "2281",
"license": "mit",
"hash": 5498083207788691000,
"line_mean": 42,
"line_max": 150,
"alpha_frac": 0.5563843791,
"autogenerated": false,
"ratio": 3.2510699001426535,
"config_test": false,
"has... |
__author__ = 'Albert cuesta'
import PEACHESTORE.database.Database as database
def menu(self=None):
print('\t BENVINGUTS A PEACHESTORE')
print('\t [1]: Mostrar aplicacions')
print('\t [2]: Registrar aplicacions')
print('\t [3]: Modificar aplicacions')
print('\t [4]: sumar desca... | {
"repo_name": "albertcuesta/PEACHESTORE",
"path": "database/menu.py",
"copies": "1",
"size": "4057",
"license": "mit",
"hash": -1122451580719135700,
"line_mean": 47.25,
"line_max": 125,
"alpha_frac": 0.5534172218,
"autogenerated": false,
"ratio": 3.3887959866220734,
"config_test": false,
"has... |
__author__ = 'albertlwohletz'
from API import models
from django.http import HttpResponse
import json
def add_char(request):
# Get Request Information
name = request.GET['name']
image = request.GET['image']
hp = request.GET['hp']
ac = request.GET['ac']
count = int(request.GET['count'])
# C... | {
"repo_name": "albertwohletz/combatmanager",
"path": "API/views.py",
"copies": "1",
"size": "1445",
"license": "mit",
"hash": -3749873529307861500,
"line_mean": 26.7884615385,
"line_max": 88,
"alpha_frac": 0.6359861592,
"autogenerated": false,
"ratio": 3.3840749414519906,
"config_test": false,
... |
__author__ = 'alberto, azu'
from escom.pepo.config import NUMBER_OF_GENERATIONS, EPSILON, logger, CURRENT_RESULT, CONSTANT_RESULT, CONSTANT_NON_ZERO
from escom.pepo.config import PRINTING_INTERVAL
from escom.pepo.genetic_algorithms.components.population import *
from escom.pepo.genetic_algorithms.components.mutation i... | {
"repo_name": "jresendiz27/EvolutionaryComputing",
"path": "practices/second/strassen_algorithm/strassen_evaluation.py",
"copies": "2",
"size": "4796",
"license": "apache-2.0",
"hash": 4368299829279361000,
"line_mean": 37.0634920635,
"line_max": 120,
"alpha_frac": 0.6171809842,
"autogenerated": fal... |
__author__ = 'alberto'
from datetime import datetime
def create_and_add_mapping(connection, index_name, type_name):
try:
connection.indices.create(index_name)
except:
# we skip exception if index already exists
pass
connection.cluster.health(wait_for_status="yellow")
connection... | {
"repo_name": "abarry/elasticsearch-cookbook-scripts",
"path": "chapter_11/utils.py",
"copies": "2",
"size": "3032",
"license": "bsd-2-clause",
"hash": 1829086959101975600,
"line_mean": 49.55,
"line_max": 123,
"alpha_frac": 0.5039577836,
"autogenerated": false,
"ratio": 3.6181384248210025,
"con... |
__author__ = 'alberto'
from escom.pepo.config import CHROMOSOME_LENGTH, OFFSPRING_POPULATION_SIZE, FITNESS_WEIGHT, logger, np
from escom.pepo.genetic_algorithms.components.selectors import *
from escom.pepo.genetic_algorithms.components.crosses import one_point_crosses
from escom.pepo.genetic_algorithms.components.muta... | {
"repo_name": "pepo27/EvolutionaryComputing",
"path": "escom/pepo/genetic_algorithms/components/population.py",
"copies": "2",
"size": "2372",
"license": "apache-2.0",
"hash": -1317048423356229400,
"line_mean": 35.5076923077,
"line_max": 119,
"alpha_frac": 0.6804384486,
"autogenerated": false,
"r... |
__author__ = 'alberto'
from pyes import ES
import random
import os
import codecs
from lorem_ipsum import words
from datetime import datetime, timedelta
import sys
def get_names():
"""
Return a list of names.
"""
return [n.strip().replace("'", "-") for n in codecs.open(os.path.join("data", "names.txt"),... | {
"repo_name": "aparo/elasticsearch-cookbook-second-edition",
"path": "data_scripts/facets_data_generation.py",
"copies": "2",
"size": "3930",
"license": "bsd-2-clause",
"hash": -4771752301036804000,
"line_mean": 39.9375,
"line_max": 135,
"alpha_frac": 0.6061068702,
"autogenerated": false,
"ratio"... |
__author__ = 'alberto'
import os
import sys
from difflib import unified_diff
MIGRATIONS = [
("aliases", "indices.aliases"),
("status", "indices.status"),
("create_index", "indices.create_index"),
("create_index_if_missing", "indices.create_index_if_missing"),
("delete_index", "indices.delete_index"... | {
"repo_name": "HackLinux/pyes",
"path": "migrate_deprecation.py",
"copies": "5",
"size": "2697",
"license": "bsd-3-clause",
"hash": 4830755783668730000,
"line_mean": 38.6764705882,
"line_max": 102,
"alpha_frac": 0.5936225436,
"autogenerated": false,
"ratio": 3.448849104859335,
"config_test": fa... |
__author__ = 'alberto'
import random
CHROMOSOME_LENGTH = 8
POPULATION_SIZE = 4
NUMBER_OF_GENERATIONS = 5000
FITNESS_WEIGHT = 0.1
EPSILON = 0.01
chromosome = [random.randint(0, 1) for i in range(0, CHROMOSOME_LENGTH)]
def init():
return [[random.randint(0, 1) for i in range(0, CHROMOSOME_LENGTH)] for j in range(0... | {
"repo_name": "jresendiz27/EvolutionaryComputing",
"path": "practices/first/GeneticAlgorithm/ga_example.py",
"copies": "2",
"size": "3733",
"license": "apache-2.0",
"hash": -5625134492002996000,
"line_mean": 27.0751879699,
"line_max": 107,
"alpha_frac": 0.6249665149,
"autogenerated": false,
"rati... |
__author__ = 'alberto'
import sys
import numpy as np
from string import Template
print sys.argv
def getDicionary(elements):
dictionary = {}
for index in range(0, len(elements)):
dictionary["x" + str(index)] = elements[index]
return dictionary
def generatetruthtable(nvariables, template):
tr... | {
"repo_name": "jresendiz27/EvolutionaryComputing",
"path": "practices/first/booleanSatisfiabilityProblem/solution.py",
"copies": "2",
"size": "2730",
"license": "apache-2.0",
"hash": 6265369876759264000,
"line_mean": 31.1294117647,
"line_max": 75,
"alpha_frac": 0.5758241758,
"autogenerated": false,... |
__author__ = 'alberto'
def create_and_add_mapping(connection, index_name, type_name):
from pyes.mappings import DocumentObjectField
from pyes.mappings import IntegerField
from pyes.mappings import NestedObject
from pyes.mappings import StringField, DateField
from pyes.helpers import SettingsBuilde... | {
"repo_name": "aparo/elasticsearch-cookbook-second-edition",
"path": "chapter_11/utils_pyes.py",
"copies": "2",
"size": "2585",
"license": "bsd-2-clause",
"hash": 5617987258648719000,
"line_mean": 48.7115384615,
"line_max": 122,
"alpha_frac": 0.6912959381,
"autogenerated": false,
"ratio": 3.49324... |
__author__ = "alberto"
'''
Fitnesses
@author: azu
'''
#
import math
import random
import numpy as np
#
maxGenerations = 1000
sigma = [np.float(0) for i in range(0, maxGenerations + 1)]
sigma[0] = 10
epsilon = 0.00001
mu = 10
lamb = 10
a = [[-32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 1... | {
"repo_name": "pepo27/EvolutionaryComputing",
"path": "practices/first/evolutionaryStrategies/fitness.py",
"copies": "2",
"size": "4158",
"license": "apache-2.0",
"hash": -8477773472258619000,
"line_mean": 25.6538461538,
"line_max": 143,
"alpha_frac": 0.4155844156,
"autogenerated": false,
"ratio"... |
__author__ = 'alberto'
from escom.pepo.config import POPULATION_SIZE
from escom.pepo.config import random
# Returns the index of the most suitable
def roulette_selector(fitness):
fitness_sum = sum(fitness)
fitness_average = fitness_sum / POPULATION_SIZE
expected_values = []
for single_fitness in fitne... | {
"repo_name": "pepo27/EvolutionaryComputing",
"path": "escom/pepo/genetic_algorithms/components/selectors.py",
"copies": "2",
"size": "1180",
"license": "apache-2.0",
"hash": -859248969881603800,
"line_mean": 26.4651162791,
"line_max": 82,
"alpha_frac": 0.6601694915,
"autogenerated": false,
"rati... |
__author__ = 'alberto'
# Para poder mostrar en pantalla el proceso
debug = False
#
from pylab import *
from sympy import solve
from sympy.abc import x
from practices.first.evolutionaryStrategies.PureFunctions import function as function_database
# Constant values
RAW_VALUES = True
IMAGE_PATH = './latex/images/'
X_MIN... | {
"repo_name": "jresendiz27/EvolutionaryComputing",
"path": "practices/first/evolutionaryStrategies/ImageMaker.py",
"copies": "2",
"size": "2938",
"license": "apache-2.0",
"hash": -8597609945121923000,
"line_mean": 38.1866666667,
"line_max": 98,
"alpha_frac": 0.5953029272,
"autogenerated": false,
... |
__author__='alberto.rincon.borreguero@gmail.com'
"""
"""
from flask import Flask, render_template, request, redirect, url_for, session
from svd_recs import SVDRecommender
import utils
import os
app = Flask(__name__)
@app.route('/registration', methods=['POST', 'GET'])
def signup():
if request.method == 'POST':
... | {
"repo_name": "albertorb/movies-for-recommender",
"path": "movies.py",
"copies": "1",
"size": "1664",
"license": "apache-2.0",
"hash": 6075577523566009000,
"line_mean": 32.9591836735,
"line_max": 91,
"alpha_frac": 0.6298076923,
"autogenerated": false,
"ratio": 3.570815450643777,
"config_test": ... |
__author__ = 'albmin'
import json
import os
"""
Initializer that will return a json schema object
"""
#TODO add add functionality separately (from a shell or program) with a persist option in the fn call
class Schema():
dict = None
"""
Constructor takes in an input json file and schema map (also JSON)
... | {
"repo_name": "albmin/json_mapper",
"path": "schema.py",
"copies": "1",
"size": "2224",
"license": "mit",
"hash": -1809691296005813800,
"line_mean": 30.7714285714,
"line_max": 101,
"alpha_frac": 0.5683453237,
"autogenerated": false,
"ratio": 4.080733944954129,
"config_test": false,
"has_no_ke... |
__author__ = 'Alby Chaj and Alex Frank'
import numpy as np
import datetime as dt
import time
def calc_cma(filename, size):
"""
This function calculates the centered moving average (CMA) of the norm values
for the image data set's top and bottom amplifiers
Parameters
filename (str) -- name of ... | {
"repo_name": "acic2015/findr",
"path": "deprecated/calc_cma.py",
"copies": "1",
"size": "6071",
"license": "mit",
"hash": 6950851090556844000,
"line_mean": 35.1428571429,
"line_max": 129,
"alpha_frac": 0.5956185142,
"autogenerated": false,
"ratio": 3.479083094555874,
"config_test": false,
"h... |
__author__ = 'aleaf'
import sys
sys.path.append('/Users/aleaf/Documents/GitHub/flopy3')
import os
import glob
import shutil
import numpy as np
try:
import matplotlib
if os.getenv('TRAVIS'): # are we running https://travis-ci.org/ automated tests ?
matplotlib.use('Agg') # Force matplotlib not to use ... | {
"repo_name": "bdestombe/flopy-1",
"path": "autotest/t009_test.py",
"copies": "1",
"size": "12148",
"license": "bsd-3-clause",
"hash": -535786901955293900,
"line_mean": 38.3139158576,
"line_max": 92,
"alpha_frac": 0.5428877181,
"autogenerated": false,
"ratio": 2.9314671814671813,
"config_test":... |
__author__ = 'aleaf'
import sys
#sys.path.append('/Users/aleaf/Documents/GitHub/flopy3')
import os
import numpy as np
import matplotlib
matplotlib.use('agg')
import flopy
if os.path.split(os.getcwd())[-1] == 'flopy3':
path = os.path.join('examples', 'data', 'mf2005_test')
path2 = os.path.join('examples', 'dat... | {
"repo_name": "mrustl/flopy",
"path": "autotest/t009_test.py",
"copies": "1",
"size": "8374",
"license": "bsd-3-clause",
"hash": 6532958614616524000,
"line_mean": 42.1649484536,
"line_max": 117,
"alpha_frac": 0.5597086219,
"autogenerated": false,
"ratio": 2.8541240627130198,
"config_test": true... |
__author__ = 'aleaf'
import sys
import textwrap
import os
import numpy as np
from numpy.lib import recfunctions
from ..pakbase import Package
from ..utils import MfList
from ..utils.flopy_io import line_parse
class ModflowSfr2(Package):
"""
Streamflow-Routing (SFR2) Package Class
Paramet... | {
"repo_name": "brclark-usgs/flopy",
"path": "flopy/modflow/mfsfr2.py",
"copies": "1",
"size": "108856",
"license": "bsd-3-clause",
"hash": -620210491802452700,
"line_mean": 44.4204690832,
"line_max": 193,
"alpha_frac": 0.5301591093,
"autogenerated": false,
"ratio": 3.9932501834189287,
"config_t... |
__author__ = 'aleaf'
import sys
sys.path.insert(0, '..')
import textwrap
import os
import numpy as np
from numpy.lib import recfunctions
from ..pakbase import Package
from flopy.utils.util_list import MfList
from ..utils.flopy_io import line_parse
class ModflowSfr2(Package):
"""
Streamflow-R... | {
"repo_name": "mrustl/flopy",
"path": "flopy/modflow/mfsfr2.py",
"copies": "1",
"size": "94999",
"license": "bsd-3-clause",
"hash": -7441174444280513000,
"line_mean": 45.547047047,
"line_max": 192,
"alpha_frac": 0.5324266571,
"autogenerated": false,
"ratio": 4.004341595009273,
"config_test": fa... |
__author__ = 'aleivag'
import os
from distutils.core import setup
import os
from distutils.core import setup
from epifpm import __version__
try:
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
long_description = f.read()
f.close()
except:
long_description = ''
reqs = []
try:
wi... | {
"repo_name": "Epi10/epifpm",
"path": "setup.py",
"copies": "1",
"size": "1181",
"license": "mit",
"hash": 3817331868641952000,
"line_mean": 23.6041666667,
"line_max": 80,
"alpha_frac": 0.6265876376,
"autogenerated": false,
"ratio": 3.6450617283950617,
"config_test": false,
"has_no_keywords":... |
__author__ = 'aleivag'
import logging
import serial
from cStringIO import StringIO
HEADER = [0xEF, 0x01]
PACKAGE_HANDSHAKE = 0x17 #: To greet (and posible ping) the fingerprint
PACKAGE_EMPTY = 0x0d
PACKAGE_GETIMAGE = 0x01
PACKAGE_IMAGE2TZ = 0x02
PACKAGE_REGMODEL = 0x05
PACKAGE_RANDOM = 0x14
PACKAGE_STORE = 0x06
PACK... | {
"repo_name": "Epi10/epifpm",
"path": "epifpm/zfm20.py",
"copies": "1",
"size": "8279",
"license": "mit",
"hash": -8618993402727876000,
"line_mean": 28.462633452,
"line_max": 128,
"alpha_frac": 0.5917381326,
"autogenerated": false,
"ratio": 3.4741921947125474,
"config_test": false,
"has_no_ke... |
__author__ = 'aleivag'
import sys
import time
from csv import writer
import argparse
from multiprocessing import Process, Queue
class Generator(Process):
def __init__(self, manager):
Process.__init__(self)
self.manager = manager
self.queue = manager.manager_queue
self.small_pool... | {
"repo_name": "aleivag/stress",
"path": "stresslib/stress.py",
"copies": "1",
"size": "4841",
"license": "mit",
"hash": -686755892057190400,
"line_mean": 25.7458563536,
"line_max": 78,
"alpha_frac": 0.4955587688,
"autogenerated": false,
"ratio": 3.8728,
"config_test": false,
"has_no_keywords"... |
__author__ = 'Alejandro.Esquiva'
class AARConnector:
def __init__(self,**kwargs):
self.url = kwargs.get("url","")
self.domain = kwargs.get("domain","http://automaticapirest.info/demo/")
self.table = kwargs.get("table","")
self.columns = kwargs.get("columns","")
self.orderby ... | {
"repo_name": "alejandroesquiva/AutomaticApiRest-PythonConnector",
"path": "aarpy/AARConnector.py",
"copies": "1",
"size": "2036",
"license": "mit",
"hash": 2172136919043305500,
"line_mean": 28.0857142857,
"line_max": 79,
"alpha_frac": 0.5358546169,
"autogenerated": false,
"ratio": 3.597173144876... |
__author__ = 'Alek Ratzloff <alekratz@gmail.com>'
from socket import socket
class ThinClient:
"""
Python client used for doing stuff... Thinly
"""
def __init__(self, port, host="127.0.0.1", recv_size=1024):
self.port = port
self.host = host
self.recv_size = recv_size
s... | {
"repo_name": "alekratz/pythinclient",
"path": "pythinclient/client.py",
"copies": "1",
"size": "2352",
"license": "bsd-3-clause",
"hash": 167175308280535260,
"line_mean": 30.7837837838,
"line_max": 98,
"alpha_frac": 0.5948129252,
"autogenerated": false,
"ratio": 4.192513368983957,
"config_test... |
__author__ = 'Alek Ratzloff <alekratz@gmail.com>'
import abc
import sys
import os
from socket import socket, timeout
from os.path import exists
from threading import Thread
class ThinServer:
__metaclass__ = abc.ABCMeta
def __init__(self, port, host='127.0.0.1', recv_size=1024, is_daemon=False, lockfile="/tm... | {
"repo_name": "alekratz/pythinclient",
"path": "pythinclient/server.py",
"copies": "1",
"size": "8016",
"license": "bsd-3-clause",
"hash": -7787661052449574000,
"line_mean": 35.9400921659,
"line_max": 120,
"alpha_frac": 0.5782185629,
"autogenerated": false,
"ratio": 4.351791530944626,
"config_t... |
__author__ = 'Aleksandar Savkov'
import re
from os import makedirs
from pandas.io.html import read_html
# output folder
dp = 'data/'
# make sure folder exists
try:
makedirs(dp)
except OSError:
pass # dir exists
# output files
hiphen_affix_path = '%s/medaffix_with_hiphens.txt' % dp
affix_path = '%s/medaffix... | {
"repo_name": "savkov/MedAffix",
"path": "scripts/medaffix.py",
"copies": "1",
"size": "2361",
"license": "mit",
"hash": 8393681290960247000,
"line_mean": 25.5280898876,
"line_max": 80,
"alpha_frac": 0.5997458704,
"autogenerated": false,
"ratio": 3.177658142664872,
"config_test": false,
"has_... |
__author__ = 'Aleksandar Savkov'
import re
import StringIO
def parse_ftvec_templ(self, s, r):
"""Parses a feature vector template string into a FeatureTemplate object.
*Important*: if resources (e.g. embeddings) are used in the feature template
they should be provided during the parsing in the `r` parame... | {
"repo_name": "savkov/crfppftvec",
"path": "crfppftvec.py",
"copies": "1",
"size": "4253",
"license": "mit",
"hash": -5902834145117482000,
"line_mean": 24.7757575758,
"line_max": 80,
"alpha_frac": 0.5367975547,
"autogenerated": false,
"ratio": 3.4718367346938774,
"config_test": false,
"has_no... |
__author__ = 'Aleksandar Savkov'
import re
import warnings
import requests
from bs4 import BeautifulSoup
from os import makedirs
def get_next_cat_page(soup, affix_type):
atags = soup.findAll(name='a',
attrs={'title': 'Category:English %ses' % affix_type})
urls = [x['href'] for x in a... | {
"repo_name": "savkov/MedAffix",
"path": "scripts/wikiaffix.py",
"copies": "1",
"size": "3581",
"license": "mit",
"hash": -8129105397221860000,
"line_mean": 35.1717171717,
"line_max": 80,
"alpha_frac": 0.636693661,
"autogenerated": false,
"ratio": 2.8488464598249803,
"config_test": false,
"ha... |
__author__ = 'aleks'
# -*- coding: utf-8 -*-
import re
from bs4 import Tag
def _feature_video_title(tag):
previous = tag.previous_element
while (previous is not None) and (type(previous) != Tag or previous.name == 'p'):
previous = previous.previous_element
if previous.name != 'h3':
raise... | {
"repo_name": "nevkontakte/drupal2acrylamid",
"path": "drupal/filters/feature_video.py",
"copies": "1",
"size": "1155",
"license": "mit",
"hash": -8097336494852650000,
"line_mean": 24.0652173913,
"line_max": 91,
"alpha_frac": 0.5247181266,
"autogenerated": false,
"ratio": 3.707395498392283,
"co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.