text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'abdul'
import os
from mongoctl.processes import create_subprocess
from mongoctl.mongoctl_logging import *
from mongoctl import repository
from mongoctl.utils import execute_command
###############################################################################
# CONSTS
#################################... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/commands/server/tail_log.py",
"copies": "1",
"size": "1962",
"license": "mit",
"hash": -6119972931859933000,
"line_mean": 35.3333333333,
"line_max": 79,
"alpha_frac": 0.4831804281,
"autogenerated": false,
"ratio": 4.52073732718894,
"config_te... |
__author__ = 'abdul'
import os
import mongoctl.repository as repository
from base import DocumentWrapper
from mongoctl.utils import resolve_path, document_pretty_string, is_host_local
from pymongo.errors import AutoReconnect
from mongoctl.mongoctl_logging import (
log_verbose, log_error, log_warning, log_excepti... | {
"repo_name": "richardxx/mongoctl-service",
"path": "build/lib.linux-x86_64-2.7/mongoctl/objects/server.py",
"copies": "1",
"size": "29298",
"license": "mit",
"hash": 7119833183326902000,
"line_mean": 37.0988296489,
"line_max": 85,
"alpha_frac": 0.4465833845,
"autogenerated": false,
"ratio": 5.09... |
__author__ = 'abdul'
import os
import mongoctl.repository as repository
from base import DocumentWrapper
from mongoctl.utils import resolve_path, document_pretty_string, is_host_local, timedelta_total_seconds, is_pid_alive
import pymongo
from pymongo.errors import AutoReconnect, OperationFailure, ConnectionFailure
... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/objects/server.py",
"copies": "1",
"size": "41911",
"license": "mit",
"hash": 1707077582523177700,
"line_mean": 37.4504587156,
"line_max": 118,
"alpha_frac": 0.4588055642,
"autogenerated": false,
"ratio": 4.971059186336141,
"config_test": fal... |
__author__ = 'abdul'
import platform
import urllib
import shutil
from subprocess import CalledProcessError
import mongoctl.config as config
from mongoctl.prompt import prompt_execute_task
from mongoctl.mongodb_version import MongoDBEdition
from mongoctl.mongoctl_logging import *
from mongoctl.errors import Mongoct... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/commands/misc/install.py",
"copies": "1",
"size": "13808",
"license": "mit",
"hash": 7503289784046250000,
"line_mean": 35.3368421053,
"line_max": 108,
"alpha_frac": 0.5523609502,
"autogenerated": false,
"ratio": 4.297541238717709,
"config_tes... |
__author__ = 'abdul'
import pymongo
import pymongo.uri_parser
import pymongo.errors
import mongoctl_logging
from pymo import mongo_client as _mongo_client
###############################################################################
# db connection timeout, 10 seconds
CONN_TIMEOUT_MS = 10000
#####################... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/mongo_utils.py",
"copies": "1",
"size": "1051",
"license": "mit",
"hash": 3581037885767684000,
"line_mean": 24.6341463415,
"line_max": 79,
"alpha_frac": 0.5613701237,
"autogenerated": false,
"ratio": 4.530172413793103,
"config_test": false,
... |
__author__ = 'abdul'
import repository
from mongoctl_logging import log_info, log_verbose, log_warning, log_exception, log_error
from pymongo.errors import OperationFailure, AutoReconnect
from errors import MongoctlException, is_auth_error
from prompt import read_password
###########################################... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/users.py",
"copies": "1",
"size": "12981",
"license": "mit",
"hash": -4402335543446741500,
"line_mean": 35.776203966,
"line_max": 116,
"alpha_frac": 0.5311609275,
"autogenerated": false,
"ratio": 4.318363273453094,
"config_test": false,
"ha... |
__author__ = 'abdul'
import repository
from mongoctl_logging import log_info, log_verbose, log_warning, log_exception
from pymongo.errors import OperationFailure, AutoReconnect
from errors import MongoctlException
from prompt import read_password
import pymongo.auth
import mongo_version
#############################... | {
"repo_name": "richardxx/mongoctl-service",
"path": "build/lib.linux-x86_64-2.7/mongoctl/users.py",
"copies": "2",
"size": "11344",
"license": "mit",
"hash": 680903846841352800,
"line_mean": 35.5935483871,
"line_max": 89,
"alpha_frac": 0.5269746121,
"autogenerated": false,
"ratio": 4.280754716981... |
__author__ = 'abdul'
import sys
import getpass
from errors import MongoctlException
###############################################################################
# Global flags and their functions
###############################################################################
__interactive_mode__ = True
def set_in... | {
"repo_name": "richardxx/mongoctl-service",
"path": "mongoctl/prompt.py",
"copies": "3",
"size": "4256",
"license": "mit",
"hash": -6148542557409588000,
"line_mean": 34.173553719,
"line_max": 79,
"alpha_frac": 0.4494830827,
"autogenerated": false,
"ratio": 5.097005988023952,
"config_test": fals... |
__author__ = 'abdul'
import sys
import os
import traceback
import logging
import utils
import mongoctl_globals
from logging.handlers import TimedRotatingFileHandler
###############################################################################
LOG_DIR = "logs"
logger = None
# logger settings
_log_to_stdout = Tr... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/mongoctl_logging.py",
"copies": "1",
"size": "3054",
"license": "mit",
"hash": 3163634021946838000,
"line_mean": 28.3653846154,
"line_max": 79,
"alpha_frac": 0.4711853307,
"autogenerated": false,
"ratio": 4.684049079754601,
"config_test": fal... |
__author__ = 'abdul'
import sys
import types
import inspect
from time import sleep, time as now
################################################################################
# Dealing with explosions - the Context Manager way
################################################################################
class ... | {
"repo_name": "gregbanks/robustify",
"path": "robustify/__init__.py",
"copies": "1",
"size": "21700",
"license": "mit",
"hash": -703810962950583400,
"line_mean": 33.1732283465,
"line_max": 101,
"alpha_frac": 0.5387557604,
"autogenerated": false,
"ratio": 3.890980814057737,
"config_test": false,... |
__author__ = 'abdul'
import mongoctl.repository as repository
from mongoctl.mongo_uri_tools import is_mongo_uri, parse_mongo_uri
from mongoctl.utils import resolve_path, ensure_dir
from mongoctl.mongoctl_logging import log_info , log_warning
from mongoctl.commands.command_utils import (
is_db_address, is_dbpat... | {
"repo_name": "mongolab/mongoctl",
"path": "mongoctl/commands/common/dump.py",
"copies": "1",
"size": "12412",
"license": "mit",
"hash": -7310268598031091000,
"line_mean": 36.9571865443,
"line_max": 79,
"alpha_frac": 0.4948436996,
"autogenerated": false,
"ratio": 4.863636363636363,
"config_test... |
__author__ = 'abdul'
import mongoctl.repository as repository
from mongoctl.mongo_uri_tools import is_mongo_uri, parse_mongo_uri
from mongoctl.utils import resolve_path
from mongoctl.mongoctl_logging import log_info , log_warning
from mongoctl.commands.command_utils import (
is_db_address, is_dbpath, extract_m... | {
"repo_name": "richardxx/mongoctl-service",
"path": "build/lib.linux-x86_64-2.7/mongoctl/commands/common/dump.py",
"copies": "2",
"size": "11929",
"license": "mit",
"hash": -2472302452569809400,
"line_mean": 36.9904458599,
"line_max": 82,
"alpha_frac": 0.4893955906,
"autogenerated": false,
"ratio... |
__author__ = 'abel'
import montemodes.functions.calculate as calc
method_function = {
1: calc.get_energy_from_tinker,
2: calc.get_energy_from_gaussian
}
class gaussian:
def __init__(self,
methodology='pm3',
internal=False,
memory=None,
... | {
"repo_name": "abelcarreras/MonteModes",
"path": "montemodes/functions/methods.py",
"copies": "1",
"size": "1986",
"license": "mit",
"hash": 8463471518446853000,
"line_mean": 27.3714285714,
"line_max": 85,
"alpha_frac": 0.5025176234,
"autogenerated": false,
"ratio": 4.915841584158416,
"config_t... |
__author__ = 'abel'
import tempfile
import os
import numpy as np
def int_to_xyz(molecule, no_dummy=True):
internal = molecule.get_full_z_matrix()
coordinates = [[0.0, 0.0, 0.0]]
for line in internal[1:]:
bi = int(line[0]) #bond index
B = line[1] #bond value
ai = int(line[... | {
"repo_name": "abelcarreras/MonteModes",
"path": "montemodes/classes/structure.py",
"copies": "1",
"size": "13864",
"license": "mit",
"hash": 1503145445730430500,
"line_mean": 32.5714285714,
"line_max": 148,
"alpha_frac": 0.5285631852,
"autogenerated": false,
"ratio": 2.9649272882805815,
"confi... |
__author__ = 'Abe'
import json
from unicodedata import normalize
import re
# Run the command below with the correct IP address to retrieve the updated log file
## scp root@<IP ADDRESS>:~/master/logs/main.log ~/Documents/Coursity/Coursity/testing/log_processor/"
f = open("main.log",'r')
output = open("Readable Error T... | {
"repo_name": "sarmadhashmi/Coursity",
"path": "tests/log_processor/log_processor.py",
"copies": "1",
"size": "1674",
"license": "mit",
"hash": 8943245487424378000,
"line_mean": 37.9534883721,
"line_max": 101,
"alpha_frac": 0.5884109916,
"autogenerated": false,
"ratio": 3.679120879120879,
"conf... |
"""Given a function which expects a file object as one of the input
arguments, the decorator in this module will modify the function input
entry point so that it additionally accepts file names without modifying
the implementation of the original function.
"""
__all__ = ('FunctionFilenameWrapper', 'fnfnwrap')
import ... | {
"repo_name": "abhabongse/python-filewraps",
"path": "pyfnfn/decorators.py",
"copies": "2",
"size": "8549",
"license": "mit",
"hash": 6924445655987865000,
"line_mean": 40.2995169082,
"line_max": 80,
"alpha_frac": 0.6225289508,
"autogenerated": false,
"ratio": 4.643671917436176,
"config_test": f... |
__author__ = 'abhay'
# Sample data downloaded for testing
sample_food_trucks_data = [
{
"location":{
"needs_recoding":False,
"longitude":"-122.398658184594",
"latitude":"37.7901490874965"
},
"status":"REQUESTED",
"expirationdate":"2013-03-15T00:00:00",
"permit":"13MFF-0068",
... | {
"repo_name": "abhayv/foodtrucks-backend",
"path": "test_data.py",
"copies": "1",
"size": "5239",
"license": "mit",
"hash": -7003187338951262000,
"line_mean": 38.6893939394,
"line_max": 177,
"alpha_frac": 0.5936247375,
"autogenerated": false,
"ratio": 2.751575630252101,
"config_test": false,
... |
import math
def res(x, y):
if 0 not in (x, y):
# We use the relation x^y = y*log10(x), where 10 is the base.
return y * math.log10(x)
else:
if x == 0: # 0 raised to any number is 0
return 0
elif y == 0:
return 1 # any number raised to 0 is 1
if __na... | {
"repo_name": "TheAlgorithms/Python",
"path": "maths/largest_of_very_large_numbers.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": -8758023757187157000,
"line_mean": 28.4,
"line_max": 79,
"alpha_frac": 0.5665694849,
"autogenerated": false,
"ratio": 3.2563291139240507,
"config_test... |
class Gpa(object):
# data attributes
"helps to calculate the Gpa and Cgpa"
arg1 = None
arg2 = None
subData = None
Scale = None
credits = None
initCourse = 0
initgetCredit = 0
totalCredits = 0
temp = 0
def getCourse(self):
"get the value of the no of course you r... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577800_Python_Gpa_and_Cgpa_Calculator/recipe-577800.py",
"copies": "1",
"size": "5641",
"license": "mit",
"hash": 827416176130042500,
"line_mean": 34.25625,
"line_max": 270,
"alpha_frac": 0.5942208828,
"autogenerated": false,
"ratio": 3.86... |
__author__ = '@abhinavbom a.k.a darkl0rd'
import sys
import os
import urllib2
from xml.dom import minidom
from urllib import quote
from lib.parse import *
# Base API URL
base_url = 'http://api.urlvoid.com/'
# API Key . Key can be obtained from api.urlvoid.com
api_key = '<Add API key Here>'+'/'
if api_key == '<Add A... | {
"repo_name": "abhinavbom/Threat-Intelligence-Hunter",
"path": "api/urlvoid.py",
"copies": "1",
"size": "1415",
"license": "mit",
"hash": -2004291452544340200,
"line_mean": 26.7450980392,
"line_max": 115,
"alpha_frac": 0.6310954064,
"autogenerated": false,
"ratio": 3.5199004975124377,
"config_t... |
__author__ = '@abhinavbom a.k.a darkl0rd'
import urllib2
import urlparse
import re
import os
import time
from lib.feeds import *
from lib.parse import *
def gather():
if not os.path.exists('intel'):
os.mkdir('intel')
os.chdir('.\\intel')
#print os.getcwd()
print "Starting feed update process"
... | {
"repo_name": "abhinavbom/Threat-Intelligence-Hunter",
"path": "lib/updatefeed.py",
"copies": "1",
"size": "1127",
"license": "mit",
"hash": -264536217843432740,
"line_mean": 28.6578947368,
"line_max": 85,
"alpha_frac": 0.5359361136,
"autogenerated": false,
"ratio": 3.6237942122186495,
"config_... |
__author__ = '@abhinavbom a.k.a Darkl0rd'
###List of known IPs from various sources###
#Emerging Threats Community
emerging_threat_compromisedIP = "http://rules.emergingthreats.net/blockrules/compromised-ips.txt"
emerging_threat_blockedIP = "http://rules.emergingthreats.net/fwrules/emerging-Block-IPs.txt"
emerging_t... | {
"repo_name": "abhinavbom/Threat-Intelligence-Hunter",
"path": "lib/feeds.py",
"copies": "1",
"size": "3472",
"license": "mit",
"hash": 5653165215396957000,
"line_mean": 34.0707070707,
"line_max": 125,
"alpha_frac": 0.7373271889,
"autogenerated": false,
"ratio": 2.5968586387434556,
"config_test... |
__author__ = '@abhinavbom a.k.a Darkl0rd'
#local import
from lib.feeds import *
#stdlib import
import sys
import requests
# for traffic inspection from eclipse only
DEBUG=False
# Proxy Support. Added local proxy for debugging purpose.
if DEBUG:
HTTP_PROXY = '127.0.0.1:80'
HTTPS_PROXY = '127.0.0.1:443'
# Add... | {
"repo_name": "abhinavbom/Threat-Intelligence-Hunter",
"path": "lib/parse.py",
"copies": "1",
"size": "3632",
"license": "mit",
"hash": 347241824934938500,
"line_mean": 32.9439252336,
"line_max": 206,
"alpha_frac": 0.5123898678,
"autogenerated": false,
"ratio": 3.1310344827586207,
"config_test"... |
__author__ = '@abhinavbom a.k.a Darkl0rd'
#local imports
from lib.parse import *
from api.vt import *
from api.urlvoid import *
from lib.updatefeed import gather
#stdlib imports
import argparse
banner = ''' Threat Intelligence Hunter framework Begins now '''
print banner
def main():
print "Intel test"
pars... | {
"repo_name": "abhinavbom/Threat-Intelligence-Hunter",
"path": "tih.py",
"copies": "1",
"size": "2680",
"license": "mit",
"hash": 1227851610080421600,
"line_mean": 42.2258064516,
"line_max": 123,
"alpha_frac": 0.5630597015,
"autogenerated": false,
"ratio": 4.3156199677938805,
"config_test": fal... |
import schedule
from django.core.mail import send_mail, send_mass_mail
from haikunator import haikunator
from twilio.rest import TwilioRestClient
from datetime import datetime, timedelta
import time
import _thread
import os
from log.Log import log
from users.models import MemberUser
sys_email = 'hex.omega@yandex.com'... | {
"repo_name": "defstryker/Hex-Omega",
"path": "users/utils.py",
"copies": "1",
"size": "5129",
"license": "mit",
"hash": 3445194616962332000,
"line_mean": 34.1301369863,
"line_max": 118,
"alpha_frac": 0.5810099435,
"autogenerated": false,
"ratio": 3.687275341480949,
"config_test": false,
"has... |
import os
import sqlite3
import datetime
def get_conn(db_file_name, printing=True):
#makes a new file if it does not exist
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) #gets direcotry path in which file is stored.
db_path = os.path.join(BASE_DIR, db_file_name)
with sqlite3.connect(db_path, ... | {
"repo_name": "ARDivekar/SearchDistribute",
"path": "SearchDistribute/sqliteDefaults.py",
"copies": "1",
"size": "9906",
"license": "mit",
"hash": 339821817094511170,
"line_mean": 29.2492113565,
"line_max": 140,
"alpha_frac": 0.6476882697,
"autogenerated": false,
"ratio": 2.9765625,
"config_tes... |
import os
import sqlite3
import datetime
def get_conn(db_file_name):
#makes a new file if it does not exist
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) #gets direcotry path in which file is stored.
db_path = os.path.join(BASE_DIR, db_file_name)
with sqlite3.connect(db_path, detect_types=sq... | {
"repo_name": "ARDivekar/SearchDistribute",
"path": "other/Legacy/sqliteDefaults.py",
"copies": "1",
"size": "9396",
"license": "mit",
"hash": 8178793539901393000,
"line_mean": 28.6058631922,
"line_max": 140,
"alpha_frac": 0.6454874415,
"autogenerated": false,
"ratio": 3,
"config_test": false,
... |
import hashlib
import hmac
import json
import sys
import time
import urllib
import urllib2
import bitcoin
from bitcoin.secrets import api
def warning(msg):
"""
Method for printing a warning to stderr.
"""
sys.stderr.write("WARNING: " + msg + "\n")
def credentials():
"""
This method returns... | {
"repo_name": "abid-mujtaba/BitcoinTracker-python",
"path": "bitcoin/client.py",
"copies": "1",
"size": "4576",
"license": "apache-2.0",
"hash": -4751010431611899000,
"line_mean": 20.3831775701,
"line_max": 129,
"alpha_frac": 0.6280594406,
"autogenerated": false,
"ratio": 3.7355102040816326,
"c... |
import re
import redis
# Define the handle for the redis database
rds = redis.StrictRedis(host='localhost', port=6379, db=0)
def dump():
"""
Method for printing a dump of redis keys and corresponding values
"""
keys = rds.keys()
keys.sort()
for k in keys:
print("{}: {}".format(k,... | {
"repo_name": "abid-mujtaba/BitcoinTracker-python",
"path": "bitcoin/redis_client.py",
"copies": "1",
"size": "5898",
"license": "apache-2.0",
"hash": -3180553644987290600,
"line_mean": 32.5113636364,
"line_max": 147,
"alpha_frac": 0.6993896236,
"autogenerated": false,
"ratio": 2.963819095477387,... |
__author__ = 'abr'
import csv
import os
import subprocess
import tempfile
import sys
from scapetesting.govdocs1 import groundTruth
from scapetesting.toolevaluation.reportParser import ToolPrecisionTest
__author__ = 'abr'
print("running")
_groundTruth = groundTruth.groundTruths
identificationsKeyToMime = {}
#th... | {
"repo_name": "openpreserve/Scape-Tool-Tester",
"path": "app/scapetesting/fidoEval/fidoParser.py",
"copies": "1",
"size": "1496",
"license": "apache-2.0",
"hash": -5566902154563313000,
"line_mean": 22.746031746,
"line_max": 154,
"alpha_frac": 0.6537433155,
"autogenerated": false,
"ratio": 3.89583... |
__author__ = 'abuddenberg'
from gcis_clients import Nca3Client, GcisClient, gcis_stage_auth, gcis_dev_auth
import pickle
import json
import requests
import bs4
from bs4 import BeautifulSoup
nca3_url = 'https://nca3.cicsnc.org'
nca3 = Nca3Client(nca3_url, 'andrew.buddenberg', 'Nz9O^00I', http_basic_user='nca3', http_ba... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "bin/sync_captions.py",
"copies": "1",
"size": "3365",
"license": "bsd-3-clause",
"hash": 6246765158048531,
"line_mean": 31.6796116505,
"line_max": 172,
"alpha_frac": 0.5946508172,
"autogenerated": false,
"ratio": 3.115740740740741,
"config_test": ... |
__author__ = 'abuddenberg'
FIG_TRANSLATIONS = {
'what_is_the_figure_id': 'identifier',
'what_is_the_name_of_the_figure_as_listed_in_the_report': 'title',
'when_was_this_figure_created': 'create_dt',
'what_is_the_chapter_and_figure_number': 'figure_num'
}
IMG_TRANSLATIONS = {
'list_any_keywords_for... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "gcis_clients/webform_transforms.py",
"copies": "1",
"size": "19139",
"license": "bsd-3-clause",
"hash": -2598949407985435600,
"line_mean": 66.8687943262,
"line_max": 190,
"alpha_frac": 0.7126809133,
"autogenerated": false,
"ratio": 2.819119163352482... |
__author__ = 'abuddenberg'
from copy import deepcopy
import json
import re
import inspect
import traceback
from dateutil.parser import parse
class Gcisbase(object):
def __init__(self, data, fields=(), trans=()):
#Setup class variables
self.gcis_fields = fields
self.translations = trans
... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "gcis_clients/domain.py",
"copies": "1",
"size": "18981",
"license": "bsd-3-clause",
"hash": 4920206442520414000,
"line_mean": 35.7848837209,
"line_max": 159,
"alpha_frac": 0.589273484,
"autogenerated": false,
"ratio": 3.8038076152304607,
"config_t... |
__author__ = 'abuddenberg'
from gcis_clients.domain import Person
DATASET_TRANSLATIONS = {
'dataset_name': 'name',
'dataset_id': 'native_id',
'dataset_citation': 'cite_metadata',
'dataset_description': 'description',
'dataset_year_published': 'publication_year',
# 'dataset_period_record': 'tem... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "gcis_clients/survey_transforms.py",
"copies": "1",
"size": "12022",
"license": "bsd-3-clause",
"hash": -3008898724694510000,
"line_mean": 55.7075471698,
"line_max": 276,
"alpha_frac": 0.6953086009,
"autogenerated": false,
"ratio": 2.9329104659673093... |
__author__ = 'abuddenberg'
from gcis_clients import GcisClient, SurveyClient, survey_token, gcis_dev_auth, gcis_stage_auth
from gcis_clients.domain import Report, Chapter
# from sync_utils import realize_parents, realize_contributors
from collections import OrderedDict
import pickle
import sys
# gcis = GcisClient('... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "bin/sync_surveys.py",
"copies": "1",
"size": "17672",
"license": "bsd-3-clause",
"hash": 8643370061094882000,
"line_mean": 57.3234323432,
"line_max": 182,
"alpha_frac": 0.6251697601,
"autogenerated": false,
"ratio": 3.361613087312155,
"config_test... |
__author__ = 'abuddenberg'
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from gcis_clients import GcisClient, SurveyClient, survey_token, gcis_dev_auth, gcis_stage_auth
from domain import Report, Chapter
from... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "bin/sync_states.py",
"copies": "1",
"size": "5005",
"license": "bsd-3-clause",
"hash": -7323429383795670000,
"line_mean": 36.3507462687,
"line_max": 155,
"alpha_frac": 0.600999001,
"autogenerated": false,
"ratio": 3.5471296952515945,
"config_test"... |
__author__ = 'abuddenberg'
import requests
import pickle
import json
from bs4 import BeautifulSoup
def http_resp(fn):
def wrapped(*args, **kwargs):
resp = fn(*args, **kwargs)
if resp.status_code == 200:
return resp
else:
raise Exception('Status: {code} \n{txt}'.form... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "gcis_clients/nca3_client.py",
"copies": "1",
"size": "2500",
"license": "bsd-3-clause",
"hash": -6439263841825736000,
"line_mean": 33.2465753425,
"line_max": 167,
"alpha_frac": 0.5848,
"autogenerated": false,
"ratio": 3.3557046979865772,
"config_t... |
__author__ = 'abuddenberg'
test_figure_json = """
{
"files": [
{
"file_type": null,
"uri": "/file/4cdc6d08-9153-49b2-a924-71f1061dd617",
"url": "/img/ce/22/be3c961e83c6f567744be8a28add/ch02_html_m7f662db3.png",
"href": "http://data.gcis-dev-front.joss.ucar.ed... | {
"repo_name": "USGCRP/gcis-py-client",
"path": "gcis_clients/test/test_data.py",
"copies": "1",
"size": "15159",
"license": "bsd-3-clause",
"hash": 6797001724531661000,
"line_mean": 40.3079019074,
"line_max": 432,
"alpha_frac": 0.5511577281,
"autogenerated": false,
"ratio": 3.057482855990319,
"... |
__author__ = 'Acheron'
import re
import argparse
class CCard:
def __init__(self, card_number):
self.number = str(card_number)
self.length = len(self.number)
self.BANK_CODES = {
'AMEX': {'lead_numbers': (34, 37), 'length': (15, )},
'MasterCard': {'lead_numbers': (51... | {
"repo_name": "Charnelx/CS50",
"path": "pset6/credit.py",
"copies": "1",
"size": "2276",
"license": "mit",
"hash": -4579639257712389000,
"line_mean": 26.743902439,
"line_max": 83,
"alpha_frac": 0.5039577836,
"autogenerated": false,
"ratio": 3.7278688524590162,
"config_test": false,
"has_no_ke... |
import exceptions
import types
from pygsl import errno
class gsl_Error(exceptions.Exception):
"""
base of all gsl exceptions defined here
"""
IsA = 'gsl_Error'
errno = None
pass
class gsl_Warning(exceptions.Warning):
"""
base of all gsl warnings defined here
"""
errno = None
... | {
"repo_name": "juhnowski/FishingRod",
"path": "production/pygsl-0.9.5/pygsl/errors.py",
"copies": "1",
"size": "6452",
"license": "mit",
"hash": -8397720153080963000,
"line_mean": 18.8523076923,
"line_max": 77,
"alpha_frac": 0.6328270304,
"autogenerated": false,
"ratio": 3.5685840707964602,
"co... |
import sys
if sys.version_info[0] < 3:
import exceptions
Exception = exceptions.Exception
Warning = exceptions.Warning
import types
from pygsl import errno
class gsl_Error(Exception):
"""
base of all gsl exceptions defined here
"""
IsA = 'gsl_Error'
errno = None
pass
class g... | {
"repo_name": "poojavade/Genomics_Docker",
"path": "Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pygsl/errors.py",
"copies": "1",
"size": "6512",
"license": "apache-2.0",
"hash": -6762786928466154000,
"line_mean": 18.380952381,
"line_max": 77,
"alpha_frac": 0.6371314496,
"au... |
__author__ = 'acidghost'
class Processor:
@staticmethod
def lowerize(sentences):
for sent in sentences:
for index in range(0, len(sent)):
sent[index] = sent[index].lower()
return sentences
@staticmethod
def remove_digits(sentences):
for sent in sent... | {
"repo_name": "acidghost/sentipolc",
"path": "processor.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": -5878928375656850000,
"line_mean": 25.5,
"line_max": 55,
"alpha_frac": 0.5251798561,
"autogenerated": false,
"ratio": 4.813852813852814,
"config_test": false,
"has_no_keywords... |
__author__ = 'acidghost'
import csv
from tweet import Tweet
with open('data/SENTIPOLC-Evalita-2014.csv', 'r') as csvfile:
csvReader = csv.reader(csvfile)
lines = [row for row in csvReader]
# Remove header line
lines = lines[1:]
# Compose tweets array
tweets = []
for line in lines:
# Skip if tweet is n... | {
"repo_name": "acidghost/sentipolc",
"path": "extract-corpus.py",
"copies": "1",
"size": "1115",
"license": "mit",
"hash": -311938115914435100,
"line_mean": 25.5714285714,
"line_max": 77,
"alpha_frac": 0.6609865471,
"autogenerated": false,
"ratio": 2.911227154046997,
"config_test": false,
"ha... |
__author__ = 'aclapes'
from os.path import isfile, exists, join
from os import makedirs
import cPickle
import random
import time
from math import isnan
import sys
import numpy as np
from sklearn.metrics import pairwise
from sklearn.decomposition import PCA
from spectral_division import spectral_embedding_nystrom, sp... | {
"repo_name": "aclapes/darwintree",
"path": "tracklet_clustering.py",
"copies": "1",
"size": "10849",
"license": "bsd-3-clause",
"hash": 8003376283325307000,
"line_mean": 39.4850746269,
"line_max": 148,
"alpha_frac": 0.5494515624,
"autogenerated": false,
"ratio": 3.2697408077154915,
"config_tes... |
__author__ = 'aclapes'
from os.path import isfile, isdir, exists, join, splitext, basename, dirname
from os import makedirs
import cPickle
import time
import numpy as np
from videodarwin import darwin
INTERNAL_PARAMETERS = dict(
)
def darwin(fullfeatnames, st, num_videos, darwins_path):
if not exists(darwins_p... | {
"repo_name": "aclapes/darwintree",
"path": "darwintree.py",
"copies": "1",
"size": "1616",
"license": "bsd-3-clause",
"hash": -6155086715518369000,
"line_mean": 28.4,
"line_max": 80,
"alpha_frac": 0.5241336634,
"autogenerated": false,
"ratio": 3.9223300970873787,
"config_test": false,
"has_n... |
__author__ = 'aclapes'
from os.path import isfile, isdir, join, splitext
from os import listdir, system, remove
import shutil
# TODO: change MANUALLY these parameters
# ----------------------------------------------------
INTERNAL_PARAMETERS = dict(
home_path = '/Volumes/MacintoshHD/Users/aclapes/',
datasets_... | {
"repo_name": "aclapes/darwintree",
"path": "fix_ucf_sports_dataset.py",
"copies": "1",
"size": "4747",
"license": "bsd-3-clause",
"hash": 2709360509529324000,
"line_mean": 47.4489795918,
"line_max": 136,
"alpha_frac": 0.4653465347,
"autogenerated": false,
"ratio": 4.7,
"config_test": false,
... |
__author__ = 'aclapes'
import numpy as np
from sklearn.svm import LinearSVR
def rootSIFT(X):
'''
:param X: rootSIFT operation applied to elements of X (element-wise).
Check Fisher Vectors literature.
:return:
'''
return np.multiply(np.sign(X), np.sqrt(np.abs(X)))
def normalizeL1(X):
"""
... | {
"repo_name": "aclapes/darwintree",
"path": "videodarwin.py",
"copies": "1",
"size": "1964",
"license": "bsd-3-clause",
"hash": 1723413492944510500,
"line_mean": 28.328358209,
"line_max": 110,
"alpha_frac": 0.6227087576,
"autogenerated": false,
"ratio": 2.858806404657933,
"config_test": false,
... |
__author__ = 'aclapes'
import numpy as np
import cPickle
from os.path import join
from os.path import isfile, exists
from os import makedirs
from sklearn import svm
from sklearn.metrics import average_precision_score
from sklearn.cross_validation import StratifiedKFold
import sys
import itertools
from joblib import de... | {
"repo_name": "aclapes/darwintree",
"path": "kernels.py",
"copies": "1",
"size": "35342",
"license": "bsd-3-clause",
"hash": 3865142625312993000,
"line_mean": 42.6320987654,
"line_max": 184,
"alpha_frac": 0.4926433139,
"autogenerated": false,
"ratio": 3.5967840423366577,
"config_test": true,
... |
__author__ = 'aclapes'
import numpy as np
import cv2
import cv
import argparse
from os import listdir, rename
from os.path import splitext, join, isfile
import time
import random
import subprocess
from joblib import delayed, Parallel
from os.path import isfile, exists
from os import makedirs
import cPickle
PARAMETERS... | {
"repo_name": "aclapes/clip-extractor",
"path": "videocapture_test.py",
"copies": "1",
"size": "18376",
"license": "mit",
"hash": -1684113174936290000,
"line_mean": 35.9738430584,
"line_max": 154,
"alpha_frac": 0.5866891598,
"autogenerated": false,
"ratio": 3.3050359712230217,
"config_test": fa... |
__author__ = 'aclapes'
import numpy as np
import subprocess
from sklearn.neighbors import KDTree
import time
import cPickle
from os.path import isfile, exists, join
from os import makedirs
import fileinput
from spectral_division import build_geom_neighbor_graph
import pyflann
from joblib import delayed, Parallel
impor... | {
"repo_name": "aclapes/darwintree",
"path": "tracklet_extraction.py",
"copies": "1",
"size": "8094",
"license": "bsd-3-clause",
"hash": -1983553602909210000,
"line_mean": 38.8719211823,
"line_max": 134,
"alpha_frac": 0.5678280208,
"autogenerated": false,
"ratio": 3.6005338078291813,
"config_tes... |
___author__ = 'acmASCIS'
'''
by ahani at {9/22/2016}
'''
class DataReader(object):
'''
@:parameter a string that is the file path to the input file
@:parameter a string that is the file path to the output file
It only supports the following file extensions:
for input: .in .txt .csv
for ou... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/dev/server/datasets_processing/reader.py",
"copies": "1",
"size": "6317",
"license": "mit",
"hash": -3472676337261391000,
"line_mean": 41.12,
"line_max": 129,
"alpha_frac": 0.5394965965,
"autogenerated": false,
"ratio": 4.1477347... |
___author__ = 'acmASCIS'
'''
by ahani at {9/22/2016}
'''
import unittest
from dataset_generator._mat2 import Mat2
class Mat2Test(unittest.TestCase):
def setUp(self):
self.__min = 1
self.__max = 10
self.__mat_a_size = (3, 3)
self.__mat_b_size = (3, 3)
self.__mat_2 = Ma... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/testing/dev_test/server_test/datasets_generator_test/_mat2_test.py",
"copies": "1",
"size": "1347",
"license": "mit",
"hash": -1957273684330746000,
"line_mean": 29.6363636364,
"line_max": 77,
"alpha_frac": 0.5590200445,
"autogenera... |
___author__ = 'acmASCIS'
'''
by ahani at {9/22/2016}
'''
import unittest
from dataset_generator._mat2 import Mat2
class MatmulTest(unittest.TestCase):
def setUp(self):
self.__min = 1
self.__max = 10
self.__mat_a_size = (3, 3)
self.__mat_b_size = (3, 3)
self.__mat_2 = ... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/testing/dev_test/server_test/datasets_generator_test/_matmul_test.py",
"copies": "1",
"size": "1511",
"license": "mit",
"hash": 261586976643963700,
"line_mean": 29.8571428571,
"line_max": 77,
"alpha_frac": 0.5625413633,
"autogenera... |
___author__ = 'acmASCIS'
'''
by ahani at {9/22/2016}
'''
class DataReader(object):
def __init__(self, input_file_path, output_file_path):
"""
@:parameter a string that is the file path to the input file
@:parameter a string that is the file path to the output file
It only sup... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/release/datasets_processing/reader.py",
"copies": "1",
"size": "6353",
"license": "mit",
"hash": -88091092449932850,
"line_mean": 39.4649681529,
"line_max": 129,
"alpha_frac": 0.5364394774,
"autogenerated": false,
"ratio": 4.1659... |
___author__ = 'acmASCIS'
'''
by ahani at {9/22/2016}
'''
class DataWriter(object):
def __init__(self, file_path):
self.__file_path = file_path
self.__file_extension = '.txt' if self.__file_path.endswith('.out') else '.csv'
def write_file(self, case, output, n_cases):
if case is "... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/release/datasets_processing/writer.py",
"copies": "1",
"size": "1586",
"license": "mit",
"hash": -8214035324896304000,
"line_mean": 35.9069767442,
"line_max": 87,
"alpha_frac": 0.419924338,
"autogenerated": false,
"ratio": 4.1409... |
___author__ = 'acmASCIS'
'''
by ahani at {9/22/2016}
'''
class Validator(object):
@staticmethod
def validate_custom_sorting_dataset(arrays):
"""
Check if the arrays are valid for sorting
:param arrays: (array of arrays) each array contains an array
:return: Throw an except... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/dev/server/datasets_processing/validator.py",
"copies": "1",
"size": "1814",
"license": "mit",
"hash": 8940457357034902000,
"line_mean": 29.7457627119,
"line_max": 147,
"alpha_frac": 0.5738699008,
"autogenerated": false,
"ratio":... |
___author__ = 'acmASCIS'
'''
by ahani at {9/24/2016}
'''
import sys
from datasets_processing.reader import DataReader
from datasets_processing.writer import DataWriter
from practical._sort import Sort
from practical._freq import Freq
from practical._matmul import Matmul
from submit import Submit
def main():
... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/release/session_1.py",
"copies": "1",
"size": "3148",
"license": "mit",
"hash": -8701875299523500000,
"line_mean": 32.5,
"line_max": 128,
"alpha_frac": 0.581321474,
"autogenerated": false,
"ratio": 3.5251959686450167,
"config_t... |
___author__ = 'acmASCIS'
'''
by ahani at {9/24/2016}
'''
import time
class Matmul(object):
def __init__(self, matrix_a, matrix_b):
self.__matrix_a = matrix_a
self.__matrix_b = matrix_b
self.__matrix_a_size = (len(matrix_a), len(matrix_a[0]))
self.__matrix_b_size = (len(matrix_b... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/release/practical/_matmul.py",
"copies": "1",
"size": "1686",
"license": "mit",
"hash": 4311011149814967300,
"line_mean": 27.1,
"line_max": 108,
"alpha_frac": 0.606168446,
"autogenerated": false,
"ratio": 3.7887640449438202,
"c... |
___author__ = 'acmASCIS'
'''
by ahani at {9/24/2016}
'''
import time
class Freq(object):
def __init__(self, array):
self.__array = array
self.__frequency_dict = {}
self.__array_length = len(array)
self.__running_time = round(time.time() * 1000)
def get_original_array(sel... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/release/practical/_freq.py",
"copies": "1",
"size": "1076",
"license": "mit",
"hash": 3912211037073518600,
"line_mean": 24.023255814,
"line_max": 135,
"alpha_frac": 0.6059479554,
"autogenerated": false,
"ratio": 4.122605363984674... |
___author__ = 'acmASCIS'
'''
by ahani at {9/26/2016}
'''
import sys
from judge import Judge
def main():
if len(sys.argv) <= 1:
raise Exception("Check your arguments please!")
project_dir = sys.argv[1]
user_dataset = []
def get_user_dataset():
sort_input_path = sys.argv[2]
... | {
"repo_name": "AhmedHani/acmASCIS-ML-Hack-2017",
"path": "Session_1/dev/server/server.py",
"copies": "1",
"size": "2013",
"license": "mit",
"hash": 8169862351076439000,
"line_mean": 31.4838709677,
"line_max": 99,
"alpha_frac": 0.6318926975,
"autogenerated": false,
"ratio": 3.452830188679245,
"c... |
# Utility file - adds some colormaps to matplotlib's built-in collection. Currently, they include:
# - Australian
# - dc_au_ClearObservations
# - dc_au_WaterObservations
# - dc_au_Confidence
# - dc_au_WaterSummary
import matplotlib
import matplotlib.colors
def htmlColorMap(html,step=False,name='customColorMap')... | {
"repo_name": "ceos-seo/data_cube_notebooks",
"path": "notebooks/dc_au_colormaps.py",
"copies": "1",
"size": "4594",
"license": "apache-2.0",
"hash": 8813904192497508000,
"line_mean": 23.9673913043,
"line_max": 99,
"alpha_frac": 0.5709621245,
"autogenerated": false,
"ratio": 2.672484002326934,
... |
import sys
import time
import random
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from tkinter import *
from tkinter import ttk
import search
from utils import argmax
LARGE_FONT = ('Verdana', 12)
EXTRA_LARGE_FONT = ('Consolas', 36, 'bold')
canvas_width = 800
canvas_height = 600
bl... | {
"repo_name": "jo-tez/aima-python",
"path": "gui/genetic_algorithm_example.py",
"copies": "1",
"size": "6944",
"license": "mit",
"hash": 4739425559933267000,
"line_mean": 39.3779069767,
"line_max": 184,
"alpha_frac": 0.7363191244,
"autogenerated": false,
"ratio": 3.1780320366132724,
"config_tes... |
from tkinter import *
from functools import partial
import time
import random
import numpy as np
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from search import astar_search, EightPuzzle
import utils
root = Tk()
state = [1, 2, 3, 4, 5, 6, 7, 8, 0]
puzzle = EightPuzzle(tu... | {
"repo_name": "jo-tez/aima-python",
"path": "gui/eight_puzzle.py",
"copies": "1",
"size": "4618",
"license": "mit",
"hash": -5303499428820125000,
"line_mean": 32.4637681159,
"line_max": 138,
"alpha_frac": 0.6632741447,
"autogenerated": false,
"ratio": 2.6724537037037037,
"config_test": false,
... |
__author__ = 'Adam'
import numpy as np
def parameter_learning_train_1(parent,child):
parent_uniq=np.unique(parent)
child_uniq=np.unique(child)
parent_size=parent_uniq.size
child_size=child_uniq.size
# buat cpd polos / make plain cpd table
cpd=np.zeros((parent_size*child_size,3))
tmp=0
... | {
"repo_name": "wiraindrak/AmazingAI",
"path": "PGM/parameter_learning.py",
"copies": "1",
"size": "1438",
"license": "mit",
"hash": 934317870716432300,
"line_mean": 25.1454545455,
"line_max": 72,
"alpha_frac": 0.5890125174,
"autogenerated": false,
"ratio": 2.7030075187969924,
"config_test": fal... |
__author__ = 'Adam'
import sys
import os
def copy_some(obj_from, obj_to, names):
for n in names:
if hasattr(obj_from, n):
v = getattr(obj_from, n)
setattr(obj_to, n, v)
# Strip the advice and unchanged lines from a ndiff list
def make_comp_diff(delta_list):
comp_delta = dict(... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/useful.py",
"copies": "1",
"size": "1261",
"license": "mit",
"hash": -2876332495475552000,
"line_mean": 27.6590909091,
"line_max": 65,
"alpha_frac": 0.5701823949,
"autogenerated": false,
"ratio": 3.71976401179941,
"config_test": f... |
__author__ = 'adam'
"""
Credentials for mysql database access
"""
from sqlalchemy import create_engine
import xml.etree.ElementTree as ET
class Credentials(object):
"""
This is the parent class for the various credential classes which hold the login credentials for the mysql databases
Attributes:
... | {
"repo_name": "PainNarrativesLab/TwitterMining",
"path": "DatabaseAccessObjects/SqlCredentials.py",
"copies": "1",
"size": "2995",
"license": "mit",
"hash": -4834472421508077000,
"line_mean": 28.362745098,
"line_max": 129,
"alpha_frac": 0.5859766277,
"autogenerated": false,
"ratio": 4.25426136363... |
__author__ = 'adam'
from datetime import datetime
from lxml import etree
import xmltodict
from pytrademonster.constants import TradeMonsterConstants
from pytrademonster.objects import AccountTransaction, Account
class AccountRequests(object):
def createAccountHistoryPayload(self, userId, numTransactions, acco... | {
"repo_name": "femtotrader/pytrademonster",
"path": "pytrademonster/services/accountService.py",
"copies": "2",
"size": "10630",
"license": "mit",
"hash": 8440252944786226000,
"line_mean": 48.212962963,
"line_max": 166,
"alpha_frac": 0.6895578551,
"autogenerated": false,
"ratio": 4.28111155859847... |
__author__ = 'adam'
from datetime import datetime
import pandas as pd
from ggplot import *
import os.path, sys
# used to set path to be root
parent = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent)
#from pyTradeMonster import log, PyTradeMonster
from pytrademonster.services ... | {
"repo_name": "NunoEdgarGub1/pytrademonster",
"path": "pytrademonster/visualizer.py",
"copies": "3",
"size": "2699",
"license": "mit",
"hash": 5088652055461910000,
"line_mean": 38.1304347826,
"line_max": 161,
"alpha_frac": 0.7232308262,
"autogenerated": false,
"ratio": 3.8447293447293447,
"conf... |
__author__ = 'adam'
from datetime import datetime
import xmltodict
from pytrademonster.constants import TradeMonsterConstants
from pytrademonster.objects import AccountTransaction, Account
class AccountRequests(object):
def createAccountHistoryPayload(self, userId, numTransactions, accountId, transactionType,... | {
"repo_name": "adamsherman/pytrademonster",
"path": "pytrademonster/services/accountService.py",
"copies": "1",
"size": "10732",
"license": "mit",
"hash": 3699817696934770700,
"line_mean": 47.5610859729,
"line_max": 166,
"alpha_frac": 0.6869176295,
"autogenerated": false,
"ratio": 4.2842315369261... |
__author__ = 'Adam'
from twisted.internet import protocol
from twisted.internet import reactor
from twisted.python import log
from twisted.protocols import basic
import json
from fsprocedures import FileSystemProcedures
import os
class SlaveClient(basic.LineReceiver):
json_command_handler = None
def __init_... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/slave.py",
"copies": "1",
"size": "2217",
"license": "mit",
"hash": 7330565596078343000,
"line_mean": 30.2253521127,
"line_max": 79,
"alpha_frac": 0.6414073072,
"autogenerated": false,
"ratio": 4.009041591320073,
"config_test": fa... |
__author__ = 'Adam'
from twisted.internet import reactor
from twisted.python import log
import win32serviceutil
import win32service
import os
import sys
class AppServerSvc(win32serviceutil.ServiceFramework):
_svc_name_ = "FileService"
_svc_display_name_ = "File Service"
remote_debug = False
local_d... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/service/winservice.py",
"copies": "1",
"size": "1776",
"license": "mit",
"hash": -6139824421357308000,
"line_mean": 26.75,
"line_max": 77,
"alpha_frac": 0.6255630631,
"autogenerated": false,
"ratio": 3.6319018404907975,
"config_te... |
__author__ = 'Adam'
from twisted.protocols import basic
from twisted.internet import protocol
from twisted.python import log
from twisted.internet import reactor
import userprocess
import subject
import json
import os
import useful
#That should be enough
basic.LineReceiver.MAX_LENGTH = 100000
class SlaveConnectionHa... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/slaveservice.py",
"copies": "1",
"size": "3665",
"license": "mit",
"hash": -6847050988904950000,
"line_mean": 30.8695652174,
"line_max": 79,
"alpha_frac": 0.5822646658,
"autogenerated": false,
"ratio": 4.183789954337899,
"config_t... |
__author__ = 'adam'
import json
import requests
from pytrademonster.constants import TradeMonsterConstants
def lookupOption(strike, underlier, expiryDate = None, rowsPerPage = 10000, optionType = None, ):
'''
:param strike: None for all expiries, otherwise a specific strike, i.e. 200
:param underlier:... | {
"repo_name": "femtotrader/pytrademonster",
"path": "pytrademonster/services/lookupService.py",
"copies": "3",
"size": "1820",
"license": "mit",
"hash": 4432692690475954000,
"line_mean": 42.3333333333,
"line_max": 158,
"alpha_frac": 0.5758241758,
"autogenerated": false,
"ratio": 4.008810572687224... |
__author__ = 'adam'
import logging
log = logging.getLogger('whether.parsing')
# defining some constants for tuple indices
# stations
STATION_ID = 0 # 'station_id'
WBAN_ID = 1 # 'wban_id'
STATION_NAME = 2 # 'station_name'
COUNTRY = 3 # 'country'
STATE = 4 # 'state'
LATITUDE = 5 # 'latitude'
LONGITUDE = 6 # 'lon... | {
"repo_name": "dikaiosune/whether",
"path": "py_whether/parsing.py",
"copies": "1",
"size": "9160",
"license": "mit",
"hash": -4105282344639931400,
"line_mean": 35.64,
"line_max": 118,
"alpha_frac": 0.5515283843,
"autogenerated": false,
"ratio": 3.586530931871574,
"config_test": false,
"has_n... |
__author__ = 'Adam'
import pygame as pg
import Colors
from Blocks import BlockShape
class Game():
screen = None
blocks = []
currentBlock = None
lanes = (75,100,125,150,175,200,225,250,275,300)
done = False
def __init__(self,screen):
self.screen = screen
self.makeNewCurrent()
... | {
"repo_name": "artog/intro-prog",
"path": "Tetris/Game.py",
"copies": "1",
"size": "2430",
"license": "mit",
"hash": 5847560025204340000,
"line_mean": 27.6,
"line_max": 121,
"alpha_frac": 0.5534979424,
"autogenerated": false,
"ratio": 3.610698365527489,
"config_test": false,
"has_no_keywords"... |
__author__ = 'Adam'
import sys
import subprocess
"""
Description:
Create a process as another user.
Basically popen with a prefixed authentication parameter.
On windows this requires the calling process/user to have impersonate,
create objects, and change process token privileges (AKA Local Service
... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/userprocess.py",
"copies": "1",
"size": "2751",
"license": "mit",
"hash": 4016351410452346000,
"line_mean": 30.2613636364,
"line_max": 76,
"alpha_frac": 0.6277717194,
"autogenerated": false,
"ratio": 4.180851063829787,
"config_tes... |
__author__ = 'Adam'
import sys
'''
Description:
Use available methods to authenticate supplied system credentials.
On windows the native LogonUser is used.
On Linux, PAM is required and used by default.
If specified, the passwd and shadow files are used - note this
require... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/authentication.py",
"copies": "1",
"size": "5611",
"license": "mit",
"hash": 6648019423967747000,
"line_mean": 29.3297297297,
"line_max": 78,
"alpha_frac": 0.5065050793,
"autogenerated": false,
"ratio": 4.703269069572507,
"config_... |
__author__ = 'Adam'
import weakref
from functools import partial
class WeakMethodInvalid(Exception):
def __str__(self):
return "A weak method was invoked on a dead object"
class WeakCallable:
def __init__(self, obj, func):
self._obj = obj
self._method = func
def __call__(self, *... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/subject.py",
"copies": "1",
"size": "3421",
"license": "mit",
"hash": -7275027185959374000,
"line_mean": 26.8130081301,
"line_max": 79,
"alpha_frac": 0.5399006139,
"autogenerated": false,
"ratio": 4.126658624849216,
"config_test":... |
__author__ = 'adam'
import xml.etree.ElementTree as ET
from rdflib import RDF, Graph, BNode, URIRef, Literal
class Builder(object):
URI_XML_SCHEMA_ROOT = 'http://xml-convert.com/schema#'
CONTAINMENT = URIRef(URI_XML_SCHEMA_ROOT + 'contains')
TEXT = URIRef(URI_XML_SCHEMA_ROOT + 'text')
FILE = URIRef(U... | {
"repo_name": "adamnagel/xml2rdf",
"path": "xml2rdf/builder.py",
"copies": "1",
"size": "2173",
"license": "mit",
"hash": 8383171920062575000,
"line_mean": 31.9242424242,
"line_max": 86,
"alpha_frac": 0.535204786,
"autogenerated": false,
"ratio": 3.568144499178982,
"config_test": false,
"has_... |
__author__ = 'adam'
import xmltodict
from pytrademonster.constants import TradeMonsterConstants
from pytrademonster.objects import PositionItem
class PositionRequests(object):
'''
Class for creating the request strings for the position service
'''
def createPositionsBasicPayload(self, symbol, underl... | {
"repo_name": "NunoEdgarGub1/pytrademonster",
"path": "pytrademonster/services/positionService.py",
"copies": "2",
"size": "7532",
"license": "mit",
"hash": 6123800398609525000,
"line_mean": 47.6,
"line_max": 128,
"alpha_frac": 0.6899893787,
"autogenerated": false,
"ratio": 4.4700296735905045,
... |
__author__ = 'adam'
class ProcessingError(Exception):
"""
Base exception class for text and tweet processing
TODO: Add logging library
"""
def __init__(self, identifier):
self.identifier = identifier
def __repr__(self):
return "%s went bad on %s : %s" % (self.kind, self.identi... | {
"repo_name": "PainNarrativesLab/TwitterDataAnalysis",
"path": "deprecated/TextAnalysis/AnalysisErrors.py",
"copies": "2",
"size": "1144",
"license": "mit",
"hash": -1878404729878744000,
"line_mean": 28.358974359,
"line_max": 92,
"alpha_frac": 0.6354895105,
"autogenerated": false,
"ratio": 4.2214... |
__author__ = 'adam'
"""
Container objects for an account
"""
class Account(object):
'''
Container class for a an Account
'''
def __init__(self):
self.accountNumber = None
self.accountStatus = None
self.accountType = None
self.accountDisplayName = None
self.accou... | {
"repo_name": "femtotrader/pytrademonster",
"path": "pytrademonster/objects/accountObjects.py",
"copies": "3",
"size": "1494",
"license": "mit",
"hash": -4922021614496775000,
"line_mean": 28.88,
"line_max": 200,
"alpha_frac": 0.6211512718,
"autogenerated": false,
"ratio": 4.115702479338843,
"co... |
__author__ = 'adam'
"""
Objects to represent an options' quote chain
"""
class QuoteChain(object):
def __init__(self):
self.rootTicker = None
self.daysToExpire = None
self.deliveryType = None
self.exerciseStyle = None
self.expirationType = None
self.expiryDelivera... | {
"repo_name": "adamsherman/pytrademonster",
"path": "pytrademonster/objects/quoteObjects.py",
"copies": "1",
"size": "1872",
"license": "mit",
"hash": 6406100858678355000,
"line_mean": 25.0138888889,
"line_max": 82,
"alpha_frac": 0.5892094017,
"autogenerated": false,
"ratio": 4.043196544276458,
... |
__author__ = 'Adam'
"""
Show how to fire bullets.
Sample Python/Pygame Programs
Simpson College Computer Science
http://programarcadegames.com/
http://simpson.edu/computer-science/
Explanation video: http://youtu.be/PpdJjaiLX6A
"""
import pygame
import random
import math
BLACK = ( 0, 0, 0)
WHITE =... | {
"repo_name": "artog/intro-prog",
"path": "Shorevival/Main.py",
"copies": "1",
"size": "10009",
"license": "mit",
"hash": -3930783542119679000,
"line_mean": 26.5730027548,
"line_max": 115,
"alpha_frac": 0.5713857528,
"autogenerated": false,
"ratio": 3.6542533771449435,
"config_test": false,
"... |
__author__ = 'adam'
station_create_table_statement = """
CREATE TABLE stations (
station_id INTEGER NOT NULL,
wban_id INTEGER NOT NULL,
station_name VARCHAR,
country_id VARCHAR,
us_state VARCHAR,
latitude NUMERIC(6,3),
longitude ... | {
"repo_name": "dikaiosune/whether",
"path": "py_whether/db.py",
"copies": "1",
"size": "2275",
"license": "mit",
"hash": 7095951479292631000,
"line_mean": 24.8522727273,
"line_max": 107,
"alpha_frac": 0.5938461538,
"autogenerated": false,
"ratio": 3.441754916792738,
"config_test": false,
"has... |
__author__ = 'Adam'
# TODO: import watchdog for monitoring file system events
import os
import stat
import sys
import getpass
from enum import Enum
import shutil
types = Enum('FSEntityType', 'file directory other')
FileSystemFile = None
FileSystemDirectory = None
class EntityException(Exception):
def __init__(... | {
"repo_name": "Adam01/Cylinder-server",
"path": "Cylinder-server/fsentity/fsentity.py",
"copies": "1",
"size": "6033",
"license": "mit",
"hash": -8508717326225519000,
"line_mean": 27.7285714286,
"line_max": 75,
"alpha_frac": 0.58776728,
"autogenerated": false,
"ratio": 3.9099157485418017,
"conf... |
__author__ = 'adam'
"""
Various classes related to an order to TradeMonster.
Order: the actual order sent to market
OrderLeg: component of an order that is sent to market
OrderResponse: class for storing all results returned from a placed order
NewOrderLeg: class for storing result of a leg that is returned from a pl... | {
"repo_name": "adamsherman/pytrademonster",
"path": "pytrademonster/objects/orderObjects.py",
"copies": "3",
"size": "5440",
"license": "mit",
"hash": 4319318238560636400,
"line_mean": 32.3803680982,
"line_max": 104,
"alpha_frac": 0.6391544118,
"autogenerated": false,
"ratio": 3.919308357348703,
... |
__author__ = 'adam'
import sys
import os
import errno
import json
import datetime
import contextlib
class NoStepsException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
repr(self.value)
class TestBenchExecutor:
_path_manifest = ''
... | {
"repo_name": "pombredanne/metamorphosys-desktop",
"path": "metamorphosys/META/src/TestBenchExecutor/__init__.py",
"copies": "1",
"size": "7731",
"license": "mit",
"hash": -7881416007493275000,
"line_mean": 30.8978723404,
"line_max": 121,
"alpha_frac": 0.5115767689,
"autogenerated": false,
"ratio... |
__author__ = 'adamsherman'
import logging
import os
import getpass
from requests import Session,adapters
import xmltodict
from simplecrypt import encrypt,decrypt
from services import LoginService
from constants import TradeMonsterConstants
log = logging.getLogger(__name__)
ECP = '#ecp'
class PyTradeMonster(object... | {
"repo_name": "adamsherman/pytrademonster",
"path": "pytrademonster/pyTradeMonster.py",
"copies": "3",
"size": "2969",
"license": "mit",
"hash": -5206871709071357000,
"line_mean": 34.3452380952,
"line_max": 139,
"alpha_frac": 0.6369147861,
"autogenerated": false,
"ratio": 4.1178918169209435,
"c... |
__author__ = 'adamsherman'
import sys
import logging
import requests
from pytrademonster.constants import TradeMonsterConstants
log = logging.getLogger(__name__)
class LoginService(object):
'''
Class to handle logging in/out of trademonster and storing individual session information
'''
PAYLOAD_USE... | {
"repo_name": "femtotrader/pytrademonster",
"path": "pytrademonster/services/loginService.py",
"copies": "3",
"size": "1635",
"license": "mit",
"hash": 1718809619505781000,
"line_mean": 30.4423076923,
"line_max": 99,
"alpha_frac": 0.6336391437,
"autogenerated": false,
"ratio": 4.128787878787879,
... |
__author__ = 'adamsherman'
def enum(**enums):
return type('Enum', (), enums)
class TradeMonsterConstants(object):
'''
Misc constants for interacting with TradeMonsters' service
URLS are specific endpoints to make requests to
Request classes (AccountRequests etc) contain the default xml payload ... | {
"repo_name": "NunoEdgarGub1/pytrademonster",
"path": "pytrademonster/constants.py",
"copies": "3",
"size": "24930",
"license": "mit",
"hash": 4996901412927599000,
"line_mean": 57.2476635514,
"line_max": 138,
"alpha_frac": 0.389410349,
"autogenerated": false,
"ratio": 5.796326435712625,
"config... |
# USAGE
# python text_demo.py -i ../demo_images/bridge.jpg
# python text_demo.py -i ../demo_images/bridge.jpg -c 0
# import the necessary packages
import argparse
import cv2
import imutils.text
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", req... | {
"repo_name": "jrosebr1/imutils",
"path": "demos/text_demo.py",
"copies": "1",
"size": "1676",
"license": "mit",
"hash": -3521648861329901600,
"line_mean": 35.4347826087,
"line_max": 75,
"alpha_frac": 0.5513126492,
"autogenerated": false,
"ratio": 3.8352402745995424,
"config_test": false,
"ha... |
import tweepy
import time
from credentials import settings
from twitter_stream import twstream
def reply(api, tweet):
"""
replies to all captured tweets
:param api: tweepy api method
:param tweet: [[username, msg, id]]
:return: None
"""
for t in tweet:
# to create a reply you simply ... | {
"repo_name": "castaway2000/marketing_twitterbot",
"path": "tweetbot.py",
"copies": "1",
"size": "1610",
"license": "mit",
"hash": 2847415317086935000,
"line_mean": 28.8148148148,
"line_max": 119,
"alpha_frac": 0.6366459627,
"autogenerated": false,
"ratio": 3.5698447893569845,
"config_test": fa... |
import tweepy
import json
class TwitterStreamListener(tweepy.StreamListener):
""" Tweepy stream listener class"""
def on_status(self, status):
"""
:param status: twitter reply
:return: False if 420 error hits to prevent blacklisting
"""
print status.text
if s... | {
"repo_name": "castaway2000/marketing_twitterbot",
"path": "twitter_stream/twstream.py",
"copies": "1",
"size": "1275",
"license": "mit",
"hash": 6397049088228365000,
"line_mean": 26.7391304348,
"line_max": 111,
"alpha_frac": 0.6070588235,
"autogenerated": false,
"ratio": 4.292929292929293,
"co... |
__author__ = 'addtheice'
import os
import sys
import FileSystem
import PerlQuest
def write_report(quest_source_directory, report_file_path):
quests = FileSystem.get_quests(quest_source_directory)
if quests is []:
print("Quest source directory invalid.")
sys.exit(0)
report_file_path = Fil... | {
"repo_name": "addtheice/EQQuestPerlToLua",
"path": "Report.py",
"copies": "1",
"size": "1473",
"license": "mit",
"hash": 8448638817938587000,
"line_mean": 33.2790697674,
"line_max": 104,
"alpha_frac": 0.5960624576,
"autogenerated": false,
"ratio": 3.507142857142857,
"config_test": false,
"ha... |
__author__ = 'addtheice'
import os
def get_quests(quest_source_directory):
"""
Searches a quest source directory and finds all quest files
:param quest_source_directory:
directory root of where the quest files are located
:return:
List of
[
sub directory,
quest file name,
"... | {
"repo_name": "addtheice/EQQuestPerlToLua",
"path": "FileSystem.py",
"copies": "1",
"size": "3601",
"license": "mit",
"hash": 4505249220283366400,
"line_mean": 24.3591549296,
"line_max": 94,
"alpha_frac": 0.6417661761,
"autogenerated": false,
"ratio": 4.110730593607306,
"config_test": false,
... |
__author__ = 'addtheice'
class PerlQuest:
def __init__(self):
self.file_text_lines = []
self.file_read = False
self.parse_success = False
self.file_path = ""
self.tokens = []
def read_perl_file(self, perl_quest_path):
self.file_path = perl_quest_path
... | {
"repo_name": "addtheice/EQQuestPerlToLua",
"path": "PerlQuest.py",
"copies": "1",
"size": "1092",
"license": "mit",
"hash": -6738381740455142000,
"line_mean": 25.0238095238,
"line_max": 84,
"alpha_frac": 0.5265567766,
"autogenerated": false,
"ratio": 3.9565217391304346,
"config_test": false,
... |
__author__ = 'addtheice'
help_instruction = ["help"]
def command_line_help_message():
"""
Prints out the command line help message.
"""
print("EQQuestPerlToLua - Bulk Everquest Perl quest to Lua quest conversion.")
print("")
print("Usage:")
print("\tEQQuestPerlToLua convert <quest source... | {
"repo_name": "addtheice/EQQuestPerlToLua",
"path": "CommandLine.py",
"copies": "1",
"size": "2786",
"license": "mit",
"hash": -3190263501440945700,
"line_mean": 34.2658227848,
"line_max": 114,
"alpha_frac": 0.6564967696,
"autogenerated": false,
"ratio": 4.02020202020202,
"config_test": false,
... |
__author__ = 'adeb'
from collections import OrderedDict
import numpy as np
import theano
from spynet.utils.utilities import share
class LearningUpdate():
"""
Abstract class defining the update in a Trainer object.
"""
def __init__(self):
pass
def compute_updates(self, params, grads):
... | {
"repo_name": "adbrebs/spynet",
"path": "training/learning_update.py",
"copies": "1",
"size": "2228",
"license": "bsd-2-clause",
"hash": -2345838618416378000,
"line_mean": 30.3943661972,
"line_max": 97,
"alpha_frac": 0.6220825853,
"autogenerated": false,
"ratio": 4.2117202268431,
"config_test":... |
__author__ = 'adeb'
from itertools import cycle
import numpy as np
from bisect import bisect
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from matplotlib2tikz import save as tikz_save
import theano
import theano.tensor as T
from spynet.utils.utilities import error_rate, MSE, compute_dic... | {
"repo_name": "adbrebs/spynet",
"path": "training/monitor.py",
"copies": "1",
"size": "11092",
"license": "bsd-2-clause",
"hash": -6005195572273261000,
"line_mean": 35.7317880795,
"line_max": 118,
"alpha_frac": 0.6242336819,
"autogenerated": false,
"ratio": 3.7096989966555185,
"config_test": fa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.