text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/env python
from arrow import Arrow
import re
from datetime import datetime, timedelta
def parse_markdown(text):
link_list = []
p = re.compile(r'\[(?P<text>.+)\]\((?P<link>.+)\)')
for match in p.finditer(text):
link_list.append(match.group('link'))
text = text.replace(match.group(), ... | {
"repo_name": "deniederhut/redicorpus",
"path": "redicorpus/tools.py",
"copies": "1",
"size": "1428",
"license": "bsd-2-clause",
"hash": -4829164449399811000,
"line_mean": 30.7333333333,
"line_max": 133,
"alpha_frac": 0.600140056,
"autogenerated": false,
"ratio": 3.375886524822695,
"config_test... |
#!/bin/env python
from .base import *
if os.getenv("DEBUG") == "true":
DEBUG = True
# DebugToolbar Middleware
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
# DebugToobar
INSTALLED_APPS += ["debug_toolbar"]
# Add our Docker host IP to the INTERNAL_IPS
import os
im... | {
"repo_name": "usgo/agagd",
"path": "agagd/agagd/settings/prod.py",
"copies": "1",
"size": "1675",
"license": "mit",
"hash": -6281672833202851000,
"line_mean": 27.8793103448,
"line_max": 107,
"alpha_frac": 0.648358209,
"autogenerated": false,
"ratio": 3.439425051334702,
"config_test": false,
... |
#!/bin/env python
from circularbuffer import * # used for context
class Context_(object) :
"""
A helper class that keeps track of where we are within the parsing:
allows us to return better error messages from parsing the tabs.
"""
def __init__(self, keep_last_n_lines=5) :
"""Create a ... | {
"repo_name": "RichIsMyName/PicklingToolsRepo",
"path": "PythonModule/ptools/parsereader.py",
"copies": "3",
"size": "12249",
"license": "bsd-3-clause",
"hash": -1709268075019841800,
"line_mean": 32.9307479224,
"line_max": 91,
"alpha_frac": 0.5433912972,
"autogenerated": false,
"ratio": 4.0385756... |
#!/bin/env python
from ciscoconfparse import CiscoConfParse
def main():
cisco_cfg = CiscoConfParse("cisco_ipsec.txt")
map_list = cisco_cfg.find_objects(r"^crypto map CRYPTO")
for cryptoMap in map_list:
print cryptoMap.text
mapChildren = cryptoMap.children
for child in mapChildre... | {
"repo_name": "pherrington/pynet",
"path": "ciscoconfparse/parseipsecconf.py",
"copies": "1",
"size": "1033",
"license": "apache-2.0",
"hash": -7289986114346631000,
"line_mean": 27.6944444444,
"line_max": 122,
"alpha_frac": 0.669893514,
"autogenerated": false,
"ratio": 3.466442953020134,
"confi... |
#! /bin/env python
from collections import defaultdict
import numpy as np
from scipy.spatial import KDTree
from six.moves import zip
from .imapper import IGridMapper, IncompatibleGridError
# from .mapper import IncompatibleGridError
def map_cells_to_points(coords, dst_grid, dst_point_ids, bad_val=-1):
src_x, ... | {
"repo_name": "csdms/coupling",
"path": "pymt/mappers/pointtocell.py",
"copies": "2",
"size": "2254",
"license": "mit",
"hash": 6227184445141703000,
"line_mean": 30.7464788732,
"line_max": 81,
"alpha_frac": 0.6144631766,
"autogenerated": false,
"ratio": 3.2478386167146973,
"config_test": false,... |
#! /bin/env python
from collections import OrderedDict
import six
_TASK_STATUS_STRINGS = OrderedDict(
[
("create", ("creating", "created")),
("initialize", ("initializing", "initialized")),
("update", ("updating", "updated")),
("finalize", ("finalizing", "finalized")),
]
)
_TA... | {
"repo_name": "csdms/pymt",
"path": "deprecated/task_status.py",
"copies": "2",
"size": "4034",
"license": "mit",
"hash": -2863864792875079700,
"line_mean": 24.5316455696,
"line_max": 75,
"alpha_frac": 0.571888944,
"autogenerated": false,
"ratio": 3.8565965583173996,
"config_test": false,
"ha... |
#!/bin/env python
from concurrent import futures
import logging
import grpc
from demo import demo_pb2
from demo import demo_pb2_grpc
class DemoService(demo_pb2_grpc.DemoServiceServicer):
def init(self):
pass
def ListenHeartbeat(self, request, context):
logging.info("ListenHeartbeat - receiv... | {
"repo_name": "egustafson/sandbox",
"path": "Python/grpc-basic/server.py",
"copies": "1",
"size": "1172",
"license": "apache-2.0",
"hash": -4906430915164633000,
"line_mean": 29.8421052632,
"line_max": 98,
"alpha_frac": 0.680887372,
"autogenerated": false,
"ratio": 3.6739811912225706,
"config_te... |
#!/bin/env python
from config import DATA_DIR, LATS, LONS, GRIDS, MONTHS_YEAR
from netCDF4 import Dataset
from local_utils import get_month_slice, get_grid_subset, days_year, get_day_of_year_index, is_leap_year
import numpy as np
from mpi4py import MPI
import argparse
import sys
comm = MPI.COMM_WORLD
mpi_rank = com... | {
"repo_name": "abuddenb/agu2015",
"path": "calc_daily_mean_current.py",
"copies": "1",
"size": "4778",
"license": "mit",
"hash": 6299486316361946000,
"line_mean": 35.7538461538,
"line_max": 145,
"alpha_frac": 0.6525742989,
"autogenerated": false,
"ratio": 3.178975382568197,
"config_test": false... |
#!/bin/env python
from ConfigParser import SafeConfigParser
from json import loads
from SocketServer import ThreadingTCPServer, BaseRequestHandler
from importlib import import_module
config = SafeConfigParser()
config.read('conf/scout.conf')
class ScoutServerHandler(BaseRequestHandler):
@property
def job_bac... | {
"repo_name": "toudi/lsb",
"path": "scout/__init__.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": -1690744992456082700,
"line_mean": 25.5111111111,
"line_max": 85,
"alpha_frac": 0.6468120805,
"autogenerated": false,
"ratio": 3.832797427652733,
"config_test": true,
"has_no_keywo... |
#!/bin/env python
#
from dd import def_dict
import csv
import sys
def fix_postcode(pc):
""" convert postcodes to standard form
standard form is upper case with no spaces
>>> pcs = ["LA1 4YF", "LA14YF", " LA1 4YF", "L A 1 4 Y f"]
>>> [fix_postcode(pc) for pc in pcs]
['LA14YF', 'LA14YF', 'LA1... | {
"repo_name": "barryrowlingson/dispensr",
"path": "inst/python/postcodes.py",
"copies": "1",
"size": "1538",
"license": "mit",
"hash": 1090355145061168100,
"line_mean": 25.9824561404,
"line_max": 74,
"alpha_frac": 0.6163849155,
"autogenerated": false,
"ratio": 3.30752688172043,
"config_test": f... |
#!/bin/env python
from distutils.core import setup
# noinspection PyPackageRequirements
import py2exe, sys, os
if sys.platform == 'darwin':
# noinspection PyPackageRequirements
import py2app
elif sys.platform == 'win32':
# noinspection PyPackageRequirements
import py2exe
_PYSIDEDIR = r'C:\Python27... | {
"repo_name": "travcunn/kissync-python",
"path": "setup-build.py",
"copies": "1",
"size": "1722",
"license": "mit",
"hash": 1256276230393165800,
"line_mean": 28.6896551724,
"line_max": 94,
"alpha_frac": 0.5540069686,
"autogenerated": false,
"ratio": 3.471774193548387,
"config_test": false,
"h... |
#! /bin/env python
from .encoders import ASCIIEncoder, Base64Encoder, RawEncoder
class VtkEndian(object):
def __init__(self, endian):
self.name = endian
def __str__(self):
return self.name
VtkLittleEndian = VtkEndian("LittleEndian")
VtkBigEndian = VtkEndian("BigEndian")
sys_to_vtk_endian ... | {
"repo_name": "csdms/coupling",
"path": "deprecated/printers/vtk/vtktypes.py",
"copies": "2",
"size": "1862",
"license": "mit",
"hash": -8256282392276068000,
"line_mean": 20.9058823529,
"line_max": 84,
"alpha_frac": 0.6390977444,
"autogenerated": false,
"ratio": 2.8470948012232418,
"config_test... |
#!/bin/env python
from fuelclient.client import APIClient
import json
import re
from subprocess import Popen, PIPE
def get_inventory_json():
def add_fuel_to_inventory(inventory, fuel_client):
ip_regex = r'^[a-z]+://(?P<server_address>[^:]+)[:/]'
re_match = re.search(ip_regex, fuel_client.root)
... | {
"repo_name": "aepifanov/mos_mu",
"path": "inventory/fuel_inventory.py",
"copies": "1",
"size": "2597",
"license": "apache-2.0",
"hash": -4916398011978267000,
"line_mean": 37.7611940299,
"line_max": 77,
"alpha_frac": 0.5644974971,
"autogenerated": false,
"ratio": 3.7747093023255816,
"config_tes... |
#!/bin/env python
# from __future__ import absolute_import, division, print_function
from __future__ import division, print_function
import numpy as np
from . import paths
from . import image_utils as imgs
from joblib import Memory
_memory = Memory('.', verbose=1)
DATADIR_101 = paths.CALTECH_101
DATADIR_256 = pat... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/datasets/caltech.py",
"copies": "1",
"size": "2804",
"license": "mpl-2.0",
"hash": -7284781259471182000,
"line_mean": 28.2083333333,
"line_max": 81,
"alpha_frac": 0.652639087,
"autogenerated": false,
"ratio": 2.9453781512605044,
"config... |
#!/bin/env python
from __future__ import absolute_import, division, print_function
import numpy as np
import os
import PIL
from PIL import Image
from PIL import ImageOps # can't just do PIL.ImageOps for some reason
from . import files
# ================================ TODO rm duplicate code from imagenet.py
# ... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/datasets/image_utils.py",
"copies": "1",
"size": "6893",
"license": "mpl-2.0",
"hash": 2472612318263721500,
"line_mean": 32.2995169082,
"line_max": 80,
"alpha_frac": 0.5971275207,
"autogenerated": false,
"ratio": 3.4516775162744118,
"co... |
#!/bin/env python
from __future__ import absolute_import
from fuzzywuzzy import fuzz
from PyTeX import bib, lexer, tex
import re
def load(f):
P_BIB = re.compile(r'.+\.bib')
P_TEX = re.compile(r'.+\.tex')
if P_BIB.match(f.name):
return bib.Parser(lexer.FileIn(f, bib.SUB_DICT).tokenize(bib.REGEX_LI... | {
"repo_name": "deniederhut/PyTeX",
"path": "PyTeX/latex.py",
"copies": "1",
"size": "1570",
"license": "bsd-2-clause",
"hash": -226974206729993900,
"line_mean": 32.4042553191,
"line_max": 89,
"alpha_frac": 0.5592356688,
"autogenerated": false,
"ratio": 3.7292161520190024,
"config_test": false,
... |
#!/bin/env python
from __future__ import absolute_import
from PyTeX import error
import re
class Token(object):
def __init__(self, string, name):
self.data = string
self.name = name
class FileIn(object):
def __init__(self, f, substitute_dict):
self.data = f.read().strip()
i... | {
"repo_name": "deniederhut/PyTeX",
"path": "PyTeX/lexer.py",
"copies": "1",
"size": "1603",
"license": "bsd-2-clause",
"hash": 2153017066795780000,
"line_mean": 31.7142857143,
"line_max": 72,
"alpha_frac": 0.4978165939,
"autogenerated": false,
"ratio": 4.120822622107969,
"config_test": false,
... |
#!/bin/env python
from __future__ import absolute_import
import collections
from PyTeX import error
import re
# Character Escaping
ESC_MAP = {r'@' : r'\\@'}
REV_ESC_MAP = {value : key for key, value in ESC_MAP.items()}
SUB_DICT = {'\n' : ' '}
# Regular Expression Patterns
regex = collections.namedtuple('regex', [... | {
"repo_name": "deniederhut/PyTeX",
"path": "PyTeX/bib.py",
"copies": "1",
"size": "3776",
"license": "bsd-2-clause",
"hash": -43653996983144130,
"line_mean": 33.6422018349,
"line_max": 92,
"alpha_frac": 0.531779661,
"autogenerated": false,
"ratio": 3.731225296442688,
"config_test": false,
"ha... |
#!/bin/env python
from __future__ import absolute_import
import collections
from PyTeX import error, utilities
from PyTeX.lexer import Token
import re
# Character Escaping
ESC_MAP = {r'&' : r'\\&', r'%' : r'\\%', r'$' : r'\\$', r'#' : r'\\#', r'_' : r'\\_', r'{' : r'\\{', r'}' : r'\\{', r'~' : r'\\~', r'^' : r'\\^'... | {
"repo_name": "deniederhut/PyTeX",
"path": "PyTeX/tex.py",
"copies": "1",
"size": "6509",
"license": "bsd-2-clause",
"hash": 2912854053924496000,
"line_mean": 38.6890243902,
"line_max": 187,
"alpha_frac": 0.5469350131,
"autogenerated": false,
"ratio": 3.642417459429211,
"config_test": false,
... |
#!/bin/env python
from __future__ import division
import cv2
import os
import pickle
import numpy as np
import waveletcodec.intraframe as intra
import waveletcodec.sortspeck as sk
import waveletcodec.tools as tls
import waveletcodec.h264 as h264
import waveletcodec.entropy as etr
import waveletcodec.wave as wave
impor... | {
"repo_name": "zenathark/jg.waveletcodec",
"path": "waveletcodec/test/single_frame_tests.py",
"copies": "1",
"size": "4181",
"license": "mit",
"hash": -214762579275794620,
"line_mean": 31.4108527132,
"line_max": 75,
"alpha_frac": 0.5692418082,
"autogenerated": false,
"ratio": 3.036310820624546,
... |
#!/bin/env/python
from __future__ import division
import numpy as np
import numba
from .utils import top_k_idxs
# ================================================================ eigenvecs
# @numba.jit(nopython=True) # don't jit since take like 2.5s
# def top_principal_component(X, niters=50, return_eigenval=Fal... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/subspaces.py",
"copies": "1",
"size": "31027",
"license": "mpl-2.0",
"hash": -7036821616803290000,
"line_mean": 35.1199068685,
"line_max": 148,
"alpha_frac": 0.5075579334,
"autogenerated": false,
"ratio": 3.1832358674463936,
"config_tes... |
#!/bin/env python
from __future__ import division, print_function
import numpy as np
# import pyedflib as edf # pip install pyedflib
# import mne
from . import paths
from . import files
ECG_DIR = paths.UCD_ECG
NUM_RECORDINGS = 25
def main():
pass
print("ecg dir: ", ECG_DIR)
fpaths = files.list_files(... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/datasets/ucddb.py",
"copies": "1",
"size": "1478",
"license": "mpl-2.0",
"hash": 575554622808554800,
"line_mean": 27.9803921569,
"line_max": 76,
"alpha_frac": 0.550744249,
"autogenerated": false,
"ratio": 3.092050209205021,
"config_test... |
#! /bin/env python
"""
>>> from __future__ import print_function
>>> a = CREATED
>>> print(a)
Created
>>> b = INITIALIZING
>>> print(b)
Initializing
>>> c = INITIALIZED
>>> print(c)
Initialized
>>> (a>b, a==b, a<b)
(False, False, True)
>>> (a>=a, a==a, a<=a)
(True, True, True)
"""
class Status(object):
def __init... | {
"repo_name": "csdms/coupling",
"path": "deprecated/status.py",
"copies": "2",
"size": "1662",
"license": "mit",
"hash": 4533142152709989400,
"line_mean": 17.8863636364,
"line_max": 41,
"alpha_frac": 0.6173285199,
"autogenerated": false,
"ratio": 3.42680412371134,
"config_test": false,
"has_n... |
#!/bin/env python
from __future__ import print_function
from qds_sdk.qubole import Qubole
from qds_sdk.commands import *
from qds_sdk.cluster import *
import qds_sdk.exception
from qds_sdk.scheduler import SchedulerCmdLine
from qds_sdk.actions import ActionCmdLine
from qds_sdk.report import ReportCmdLine
from qds_sdk.... | {
"repo_name": "adeshr/qds-sdk-py",
"path": "bin/qds.py",
"copies": "1",
"size": "23373",
"license": "apache-2.0",
"hash": -1076153363875475700,
"line_mean": 38.0852842809,
"line_max": 242,
"alpha_frac": 0.6069396312,
"autogenerated": false,
"ratio": 3.8955,
"config_test": true,
"has_no_keywor... |
#!/bin/env python
from __future__ import print_function
import argparse
import collections
import pprint
import pickle
import os
import re
import fileinput
log_msg_start = re.compile( '\[[\d-]{10} [\d:,]{13} ([A-Z]+)/([a-zA-Z]+)\] ')
# Messages that are part of startup/shutdown
# or that are already reported in psyn... | {
"repo_name": "ncsa/psync",
"path": "bin/parse_worker_errlog.py",
"copies": "1",
"size": "5292",
"license": "bsd-3-clause",
"hash": 4362250931034536000,
"line_mean": 32.075,
"line_max": 87,
"alpha_frac": 0.5568783069,
"autogenerated": false,
"ratio": 3.5445411922304086,
"config_test": false,
... |
#!/bin/env python
from __future__ import print_function
import cbor
import pprint
import sys
import argparse
import collections
import ConfigParser
import logging
def process_cmdline():
parser = argparse.ArgumentParser()
parser.add_argument( 'infile' )
parser.add_argument( '--head', '-H', type=int, metav... | {
"repo_name": "ncsa/psync",
"path": "bin/catcbor.py",
"copies": "1",
"size": "2745",
"license": "bsd-3-clause",
"hash": 8896772493997150000,
"line_mean": 27.8947368421,
"line_max": 83,
"alpha_frac": 0.5599271403,
"autogenerated": false,
"ratio": 3.791436464088398,
"config_test": false,
"has_n... |
#!/bin/env python
from __future__ import print_function
import json, sys, pickle, struct, re
from warnings import warn
from datetime import datetime
# config constants -----------------------------
RIPPLED_HOST = "s2.ripple.com"
RIPPLED_PORT = 51234
RIPPLE_ID_HOST = "id.ripple.com"
RIPPLE_ID_PORT = 443
PICKLE_FILE ... | {
"repo_name": "mDuo13/txsplain",
"path": "txsplain.py",
"copies": "1",
"size": "36299",
"license": "mit",
"hash": -8311940261775334000,
"line_mean": 36.1155419223,
"line_max": 223,
"alpha_frac": 0.5818066613,
"autogenerated": false,
"ratio": 3.4939840215612668,
"config_test": false,
"has_no_k... |
#!/bin/env python
from __future__ import print_function
import logging
import grpc
from demo import demo_pb2
from demo import demo_pb2_grpc
def run():
with grpc.insecure_channel('localhost:50051') as channel:
stub = demo_pb2_grpc.DemoServiceStub(channel)
for ii in range(2) :
## Req / ... | {
"repo_name": "egustafson/sandbox",
"path": "Python/grpc-basic/client.py",
"copies": "1",
"size": "1047",
"license": "apache-2.0",
"hash": -5827032329725658000,
"line_mean": 32.7741935484,
"line_max": 93,
"alpha_frac": 0.6026743075,
"autogenerated": false,
"ratio": 3.660839160839161,
"config_te... |
#!/bin/env python
#from __future__ import print_function
import logging
import grpc
import service_pb2
import service_pb2_grpc
USE_TLS = True
CA_FILE = "../test-ca.pem"
CERT_FILE = "../test-cert.pem"
KEY_FILE = "../test-key.pem"
def read_pem(path):
with open(path, 'rb') as f:
data = f.read()
return... | {
"repo_name": "egustafson/sandbox",
"path": "_hybrid/grpc-tls-python-golang/client-py/client.py",
"copies": "1",
"size": "1256",
"license": "apache-2.0",
"hash": -2641118464835725300,
"line_mean": 25.1666666667,
"line_max": 93,
"alpha_frac": 0.6329617834,
"autogenerated": false,
"ratio": 3.204081... |
#!/bin/env python
from __future__ import print_function
import numpy as np
import tensorflow as tf
import argparse
import time
import os
from six.moves import cPickle
from rnn.utils import TextLoader
from rnn.model import Model
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--save_dir',... | {
"repo_name": "free-city-of-ulm/Hashbrowns",
"path": "sample.py",
"copies": "1",
"size": "1553",
"license": "mit",
"hash": 1768442981363814100,
"line_mean": 34.2954545455,
"line_max": 113,
"alpha_frac": 0.6310367032,
"autogenerated": false,
"ratio": 3.6455399061032865,
"config_test": false,
"... |
#!/bin/env python
from __future__ import print_function
import sys
import logger
try:
import pyaudio
except ImportError:
print('You have to do "workon pyopengl" first.')
sys.exit(10)
import wave
import time
import struct
import math
HOLD = 7
#CHUNK = 1024
CHUNK = 32
FORMAT = pyaudio.paInt16
#FORMAT = pyau... | {
"repo_name": "rzzzwilson/morse",
"path": "morse/test3.py",
"copies": "1",
"size": "4394",
"license": "mit",
"hash": 4875149669712523000,
"line_mean": 22.1263157895,
"line_max": 112,
"alpha_frac": 0.3907601274,
"autogenerated": false,
"ratio": 3.492845786963434,
"config_test": false,
"has_no_... |
#!/bin/env python
from __future__ import print_function
import boto3
import os
import logging
import pandas as pd
import requests
from dateutil.parser import parse
from s3fs.core import S3FileSystem
from datetime import datetime, timezone
# set up logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
ch... | {
"repo_name": "davidski/zestimate-lambda",
"path": "functions/update-zestimate/main.py",
"copies": "1",
"size": "3174",
"license": "mit",
"hash": -1096881295447476700,
"line_mean": 33.8791208791,
"line_max": 102,
"alpha_frac": 0.6320100819,
"autogenerated": false,
"ratio": 3.344573234984194,
"c... |
#!#!/bin/env/python
from __future__ import print_function
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from .utils import kmeans
from joblib import Memory
_memory = Memory('.', verbose=0)
def _to_np(A):
return A.cpu().detach().numpy()
def _class_balanced_sampli... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/misc_algorithms.py",
"copies": "1",
"size": "19199",
"license": "mpl-2.0",
"hash": 572980364790345300,
"line_mean": 35.5695238095,
"line_max": 91,
"alpha_frac": 0.5458617636,
"autogenerated": false,
"ratio": 3.2706984667802383,
"config_... |
#!/bin/env python
from __future__ import print_function
import pprint
import io
import csv
import os
import re
import cbor
import logging
import argparse
import pickle
import collections
logr = logging.getLogger( __name__ )
class PsyncWarning( object ):
re_errtypes = re.compile( 'LustreStripeInfoError'
... | {
"repo_name": "ncsa/psync",
"path": "bin/parse_psync_warnlog.py",
"copies": "1",
"size": "10586",
"license": "bsd-3-clause",
"hash": -3725025673849172000,
"line_mean": 34.0529801325,
"line_max": 90,
"alpha_frac": 0.5162478746,
"autogenerated": false,
"ratio": 3.9782036828260052,
"config_test": ... |
#! /bin/env python
from __future__ import print_function
import sys
import re
def parse_pair(s):
# Is there a - in there? (- is interval marker)
matcher = re.match('(.*)-(.*)', s)
if matcher:
# Yes, so try to parse the left and the right part as floats.
lhs_s = matcher.group(1)
r... | {
"repo_name": "hackvana/eagle-plated-slots",
"path": "eagle-slots.py",
"copies": "1",
"size": "3637",
"license": "cc0-1.0",
"hash": 5495939007578323000,
"line_mean": 35.37,
"line_max": 115,
"alpha_frac": 0.485839978,
"autogenerated": false,
"ratio": 3.74562306900103,
"config_test": false,
"ha... |
#!/bin/env python
from __future__ import print_function, unicode_literals
from six.moves.urllib import parse
import requests
class NotFoundException(LookupError):
pass
class PermissionDeniedException(IOError):
pass
class InvalidRequestException(ValueError):
def __init__(self, msg, extra):
su... | {
"repo_name": "20c/twentyc.rpc",
"path": "twentyc/rpc/client.py",
"copies": "1",
"size": "5358",
"license": "apache-2.0",
"hash": 7790818651668883000,
"line_mean": 26.1979695431,
"line_max": 98,
"alpha_frac": 0.5190369541,
"autogenerated": false,
"ratio": 4.031602708803612,
"config_test": false... |
#! /bin/env/python
from gi.repository import GLib
import subprocess
import dbus
import datetime
import threading
import time
from dbus.mainloop.glib import DBusGMainLoop
messages = []
messages_map = {}
counter = 1
cco = 1
def curTime():
ts = datetime.datetime.timestamp(datetime.datetime.now())
return ts
d... | {
"repo_name": "matthew-parlette/dotfiles",
"path": "conky/dbus-mon.py",
"copies": "4",
"size": "2464",
"license": "unlicense",
"hash": -6441223865053277000,
"line_mean": 27.9882352941,
"line_max": 130,
"alpha_frac": 0.5604707792,
"autogenerated": false,
"ratio": 3.7276853252647504,
"config_test... |
#!/bin/env/python
from . import amm, vq_amm
METHOD_EXACT = 'Exact'
METHOD_SCALAR_QUANTIZE = 'ScalarQuantize'
METHOD_SKETCH_SQ_SAMPLE = 'SketchSqSample'
METHOD_SVD = 'SVD' # truncated SVD run on the matrix at test time
METHOD_FD_AMM = 'FD-AMM'
METHOD_COOCCUR = 'CooccurSketch'
METHOD_PCA = 'PCA' # PCA projection, wit... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/amm_methods.py",
"copies": "1",
"size": "4992",
"license": "mpl-2.0",
"hash": -9064212832820842000,
"line_mean": 41.6666666667,
"line_max": 79,
"alpha_frac": 0.7335737179,
"autogenerated": false,
"ratio": 2.269090909090909,
"config_test... |
#!/bin/env python
from .iterators import pairwise, partition, enumerate_successively
from enum import Enum
class State(Enum):
NO_PRESENT_ITEM_HAVE_BEEN_APPENDED_YET = 1
APPENDING_PRESENT_ITEMS_BEFORE_ABSENT_ITEMS = 2
APPENDING_PRESENT_ITEMS_AFTER_ABSENT_ITEMS = 3
APPENDING_ABSENT_ITEMS = 4
class Con... | {
"repo_name": "radium226/interpol",
"path": "interpol/interpolate.py",
"copies": "1",
"size": "7972",
"license": "mit",
"hash": -8786466296263657000,
"line_mean": 45.3488372093,
"line_max": 204,
"alpha_frac": 0.565228299,
"autogenerated": false,
"ratio": 4.090302719343253,
"config_test": false,... |
#! /bin/env python
from landlab.io.vtk.encoders import AsciiEncoder, RawEncoder, Base64Encoder
class VtkEndian(object):
def __init__(self, endian):
self.name = endian
def __str__(self):
return self.name
def __repr__(self):
return 'VtkEndian(%s)' % self.name
class VtkType(obje... | {
"repo_name": "Carralex/landlab",
"path": "landlab/io/vtk/vtktypes.py",
"copies": "6",
"size": "2242",
"license": "mit",
"hash": 2618719522199368000,
"line_mean": 18,
"line_max": 75,
"alpha_frac": 0.6097234612,
"autogenerated": false,
"ratio": 2.834386852085967,
"config_test": false,
"has_no_... |
#! /bin/env python
from landlab.io.vtk.writer import VtkWriter
from landlab.io.vtk.vtktypes import VtkUniformRectilinear
from landlab.io.vtk.vtkxml import (VtkRootElement, VtkGridElement,
VtkPieceElement, VtkCoordinatesElement,
VtkPointDataElement, ... | {
"repo_name": "ManuSchmi88/landlab",
"path": "landlab/io/vtk/vti.py",
"copies": "7",
"size": "1346",
"license": "mit",
"hash": -1275299654467129600,
"line_mean": 37.4571428571,
"line_max": 75,
"alpha_frac": 0.559435364,
"autogenerated": false,
"ratio": 4.273015873015873,
"config_test": false,
... |
#!/bin/env python
from math import sin, cos, pow, exp, log, pi
import scipy.integrate
def ProjectedArea(theta, phi):
# projected area for a particle incident from theta, phi
# in cm^2
r = 22.875-0137
h = 2*20.44065
return ((pi*r**2*fabs(cos(phi))*sin(theta) +
2*r*h*sqrt(1-sin(theta)**... | {
"repo_name": "steveherrin/PhDThesis",
"path": "Thesis/scripts/muon_flux/miyake_parameterization.py",
"copies": "1",
"size": "8983",
"license": "mit",
"hash": 7746399348024094000,
"line_mean": 36.2738589212,
"line_max": 88,
"alpha_frac": 0.4619837471,
"autogenerated": false,
"ratio": 3.3208872458... |
#!/bin/env python
from netCDF4 import Dataset, num2date
from local_utils import get_month_slice, get_day_slice
import numpy as np
DATA_DIR = '/snfs4/assessment/brooke/20Century/z500_Members/'
LATS = 91
LONS = 180
GRIDS = [(lat, lon) for lat in range(LATS) for lon in range(LONS)]
ENSEMBLE = 0
for year in range(2012, ... | {
"repo_name": "abuddenb/agu2015",
"path": "calc_daily_anom_1.py",
"copies": "1",
"size": "2486",
"license": "mit",
"hash": -3194873718036207000,
"line_mean": 37.2461538462,
"line_max": 93,
"alpha_frac": 0.5880933226,
"autogenerated": false,
"ratio": 3.2202072538860103,
"config_test": false,
"... |
#!/bin/env python
from nose.tools import assert_equals
from interpol import Interpolate, linear_interpolator, enumerate_successively
from preggy import expect, create_assertions
from itertools import tee, zip_longest
import random
@create_assertions
def to_amount(topic, expected, comparator=lambda a, b: a == b):
... | {
"repo_name": "radium226/interpol",
"path": "tests/test_interpolate.py",
"copies": "1",
"size": "4037",
"license": "mit",
"hash": 8970845012527540000,
"line_mean": 40.193877551,
"line_max": 163,
"alpha_frac": 0.5670052019,
"autogenerated": false,
"ratio": 3.271474878444084,
"config_test": true,... |
#!/bin/env python
from numpy import random
import pandas as pd
class Generator(object):
def __init__(self):
self.alphabet = 'abcdefghijklmnopqrstuvwxyz'
self.people = {'name' : [], 'height' : [], 'city' : []}
self.cities = {
'name' : [
'Berkeley',
... | {
"repo_name": "deniederhut/workshop_pyintensive",
"path": "scripts/generate_tables.py",
"copies": "2",
"size": "1632",
"license": "bsd-2-clause",
"hash": 3707394903919136000,
"line_mean": 30.3846153846,
"line_max": 125,
"alpha_frac": 0.5379901961,
"autogenerated": false,
"ratio": 3.78654292343387... |
#!/bin/env python
from openeye.oechem import *
from openeye.oedepict import *
# Depiction drawing on code from https://docs.eyesopen.com/toolkits/python/depicttk/imagegrid.html
def DrawMoleculeData(cell, moldata):
gap = cell.GetHeight() / 4.0
font = OEFont()
font.SetAlignment(OEAlignment_Left)
mol... | {
"repo_name": "MobleyLab/benchmarksets",
"path": "paper/figure_source_files/2D_structures/make_structure_grid.py",
"copies": "1",
"size": "2328",
"license": "bsd-3-clause",
"hash": -6766212746048561000,
"line_mean": 23.5052631579,
"line_max": 98,
"alpha_frac": 0.6202749141,
"autogenerated": false,
... |
#!/bin/env python
from os import path
from setuptools import setup
from subprocess import Popen, PIPE
# check whether we're installing from an sdist archive or not
if path.exists('PKG-INFO'):
from substratestack import __version__ as version
else:
# write the git version to substratestack/version.py
# bas... | {
"repo_name": "bmachiel/python-substratestack",
"path": "setup.py",
"copies": "1",
"size": "1876",
"license": "bsd-2-clause",
"hash": 5204548656479717000,
"line_mean": 34.3962264151,
"line_max": 80,
"alpha_frac": 0.6433901919,
"autogenerated": false,
"ratio": 3.9329140461215935,
"config_test": ... |
#!/bin/env python
from os import popen
import sqlite3,json
from time import time, sleep
from os import fork, chdir, setsid, umask
from sys import exit
wait = 5 # minutes wait time between polls
def poll_top(t0, c):
host = popen('hostname').read().strip().split(".")[0]
cpus = int(popen('lscpu -p').readlines... | {
"repo_name": "pmelchior/hydra",
"path": "get_top.py",
"copies": "1",
"size": "1572",
"license": "mit",
"hash": -922291645443943600,
"line_mean": 26.5789473684,
"line_max": 158,
"alpha_frac": 0.5337150127,
"autogenerated": false,
"ratio": 3.175757575757576,
"config_test": false,
"has_no_keywo... |
#!/bin/env python
from os import popen,system
import sqlite3,json
from time import time, sleep
from math import floor, ceil
wait = 5 # minutes wait time between polls
def start_hosts():
fp = open("hosts")
hosts = []
for line in fp:
if line[0] != "#":
hosts.append(line.strip())
fp.... | {
"repo_name": "pmelchior/hydra",
"path": "cputils.py",
"copies": "1",
"size": "1857",
"license": "mit",
"hash": -4437558350049912300,
"line_mean": 27.1363636364,
"line_max": 119,
"alpha_frac": 0.6090468498,
"autogenerated": false,
"ratio": 3.2521891418563924,
"config_test": false,
"has_no_key... |
#!/bin/env python
from pmg.models import Bill, BillVersion, File, db, BillType
import json
import re
bills = json.load(open('data/bills-with-files.json'))
bill_pages = json.load(open('data/bill-pages.json'))
nids = json.load(open('data/nid_url.json'))
pages_by_nid = {p["nid"]: p for p in bill_pages}
nids_by_url = {n... | {
"repo_name": "Code4SA/pmg-cms-2",
"path": "bin/import-enacted-bills.py",
"copies": "1",
"size": "3889",
"license": "apache-2.0",
"hash": 7022395389027650000,
"line_mean": 29.8650793651,
"line_max": 312,
"alpha_frac": 0.5767549499,
"autogenerated": false,
"ratio": 3.1262057877813505,
"config_te... |
#!/bin/env python
from pygooglechart import QRChart
import os.path
import argparse
SIZE = 320
def parse_file(in_file, out_file):
with open(in_file) as f:
for line in f:
parse_data(line, out_file)
def parse_data(data, out_prefix):
chart = QRChart(SIZE, SIZE)
chart.add_data(data.stri... | {
"repo_name": "dtreichler/qr.py",
"path": "qr.py",
"copies": "1",
"size": "1507",
"license": "mit",
"hash": -6247490849942701000,
"line_mean": 26.4,
"line_max": 83,
"alpha_frac": 0.601194426,
"autogenerated": false,
"ratio": 3.488425925925926,
"config_test": false,
"has_no_keywords": false,
... |
#!/bin/env python
from pylab import *
import pysam
import re
from collections import defaultdict
import numpy as np
import sys
import collections
from numpy import binary_repr
from collections import OrderedDict
import os
##################################
## This script takes a BAM file ##
## and delivers a file wi... | {
"repo_name": "DCGenomics/hackathon_v001_dnaseq",
"path": "scripts/BAM_Test_Qual.py",
"copies": "1",
"size": "1847",
"license": "cc0-1.0",
"hash": -1996418993432017700,
"line_mean": 26.5671641791,
"line_max": 172,
"alpha_frac": 0.6464537087,
"autogenerated": false,
"ratio": 3.141156462585034,
"... |
#!/bin/env python
from pyparsing import *
from pprint import pprint
def first_as_str(tokens):
return str(tokens[0])
def first_as_int(tokens):
return int(tokens[0])
def get_tokens():
keywords = oneOf("Events States State")
word = ~keywords + Word(alphas, alphanums+'_')
transition = Group(word.setResultsName("f"... | {
"repo_name": "imzjy/dsl",
"path": "external/statemachine/rules_parser.py",
"copies": "1",
"size": "2059",
"license": "mit",
"hash": -8208952147211482000,
"line_mean": 24.4320987654,
"line_max": 79,
"alpha_frac": 0.6852841185,
"autogenerated": false,
"ratio": 2.9927325581395348,
"config_test": ... |
#!/bin/env python
from termcolor import colored
from twisted.web import server, resource
from twisted.internet import reactor
import datetime
class Simple(resource.Resource):
isLeaf = True
numRequests = 0
def logRequest(self, request):
self.numRequests += 1
print colored("[%s] - %s" % (st... | {
"repo_name": "meryt/python-proxies",
"path": "simple-web.py",
"copies": "1",
"size": "1758",
"license": "unlicense",
"hash": 658048005428406000,
"line_mean": 34.16,
"line_max": 135,
"alpha_frac": 0.6114903299,
"autogenerated": false,
"ratio": 3.6855345911949686,
"config_test": false,
"has_no... |
#! /bin/env python
### From VEP extracts and outputs separate annotation genotype,
from __future__ import print_function
import sys
import re
import argparse
import gzip
from pyfaidx import Fasta
import os
import json
from subprocess import call
parser=argparse.ArgumentParser(description='Arguments to vcf_parser.py... | {
"repo_name": "phenopolis/pheno4j",
"path": "python/vcf_parser.py",
"copies": "1",
"size": "5467",
"license": "mit",
"hash": 1392440021633363500,
"line_mean": 40.1052631579,
"line_max": 155,
"alpha_frac": 0.6409365283,
"autogenerated": false,
"ratio": 3.057606263982103,
"config_test": false,
... |
#!/bin/env python
from vmc_postproc import proc,load,stagflux,sfpnxphz
import numpy as np
import numpy.fft as fft
import re
import six
def get_stat_spin_struct(filenames,nsamp):
"""
Gets the static structure factor flatened.
The q-vectors are given by:
q=arange(L)
qx,qy=meshgrid(q,q)
qx=qx.fla... | {
"repo_name": "EPFL-LQM/gpvmc",
"path": "tools/vmc_postproc/hl.py",
"copies": "2",
"size": "5678",
"license": "mit",
"hash": 7328599930019530000,
"line_mean": 38.1586206897,
"line_max": 112,
"alpha_frac": 0.5501937302,
"autogenerated": false,
"ratio": 2.5974382433668803,
"config_test": false,
... |
from zope.interface import implements
from termcolor import colored
import datetime
from twisted.cred.error import UnhandledCredentials
from twisted.cred.error import UnauthorizedLogin
from twisted.cred.portal import IRealm, Portal
from twisted.cred.checkers import InMemoryUsernamePasswordDatabaseDontUse
from twisted... | {
"repo_name": "meryt/python-proxies",
"path": "basic-web.py",
"copies": "1",
"size": "3402",
"license": "unlicense",
"hash": 1012084706851755900,
"line_mean": 49.0294117647,
"line_max": 237,
"alpha_frac": 0.7066431511,
"autogenerated": false,
"ratio": 3.99764982373678,
"config_test": false,
"... |
#!/bin/env python
#function:
# a demo to show how to use the converted model genereated by caffe2fluid
#
#notes:
# only support imagenet data
import os
import sys
import inspect
import numpy as np
def import_fluid():
import paddle.fluid as fluid
return fluid
def load_data(imgfile, shape):
h, w ... | {
"repo_name": "lcy-seso/models",
"path": "fluid/image_classification/caffe2fluid/examples/imagenet/infer.py",
"copies": "3",
"size": "10249",
"license": "apache-2.0",
"hash": 5864549844414510000,
"line_mean": 30.2469512195,
"line_max": 98,
"alpha_frac": 0.5872768075,
"autogenerated": false,
"rati... |
#!/bin/env python
# Generate a CSV of names suitable for import into Eden
# via tasks.cfg:
# hrm,person,people.csv,person.xsl
# or via w2p:
# auth.override = True
# resource = s3db.resource("pr_person")
# stylesheet = os.path.join(request.folder, "static", "formats", "s3csv", "hrm", "person.xsl")
# filename = "peopl... | {
"repo_name": "ScottBuchanan/eden",
"path": "static/scripts/tools/people.py",
"copies": "35",
"size": "3628",
"license": "mit",
"hash": 7587348561234826000,
"line_mean": 28.024,
"line_max": 126,
"alpha_frac": 0.5824145535,
"autogenerated": false,
"ratio": 3.0436241610738257,
"config_test": fals... |
#! /bin/env python
#
# Generate random fake participant data
#
import argparse
# pylint: disable=superfluous-parens
# pylint: disable=broad-except
import csv
import logging
import sys
from time import sleep
from rdr_service.tools.tool_libs import GCPProcessContext
from rdr_service.services.gcp_utils import gcp_get_a... | {
"repo_name": "all-of-us/raw-data-repository",
"path": "rdr_service/client/client_libs/random_data_generator.py",
"copies": "1",
"size": "7259",
"license": "bsd-3-clause",
"hash": 5515098708397608000,
"line_mean": 39.5530726257,
"line_max": 118,
"alpha_frac": 0.612481058,
"autogenerated": false,
... |
#! /bin/env python
#
# Generate research ID
# when --type is 'import', import from csv file
# when --type is 'new', generate new research id for participant who doesn't have a research id yet
#
import argparse
import csv
import logging
import sys
import random
from sqlalchemy.exc import IntegrityError
from rdr_servic... | {
"repo_name": "all-of-us/raw-data-repository",
"path": "rdr_service/tools/tool_libs/research_id_generator.py",
"copies": "1",
"size": "6830",
"license": "bsd-3-clause",
"hash": 4646728857197053000,
"line_mean": 43.064516129,
"line_max": 117,
"alpha_frac": 0.5761346999,
"autogenerated": false,
"ra... |
#! /bin/env python
#
# Generate specific fake participant data
#
import argparse
# pylint: disable=superfluous-parens
# pylint: disable=broad-except
import csv
import datetime
import io
import logging
import os
import random
import sys
import time
import urllib.request, urllib.error, urllib.parse
from rdr_service im... | {
"repo_name": "all-of-us/raw-data-repository",
"path": "rdr_service/client/client_libs/spec_data_generator.py",
"copies": "1",
"size": "20753",
"license": "bsd-3-clause",
"hash": 7610184873994092000,
"line_mean": 38.3795066414,
"line_max": 116,
"alpha_frac": 0.5730737725,
"autogenerated": false,
... |
#!/bin/env python
"""
Geo and geohashing related JSON web service.
To be run behind an nginx server, and supervised by daemontools. That's how I want it to be.
"""
from flup.server.fcgi import WSGIServer
import datetime, time, os, sys
import optparse
import traceback
import simplejson as json
from decimal import Decim... | {
"repo_name": "relet/pygeohashing",
"path": "ws/geo.py",
"copies": "1",
"size": "9180",
"license": "mit",
"hash": 1920577212897497600,
"line_mean": 31.2105263158,
"line_max": 136,
"alpha_frac": 0.5894335512,
"autogenerated": false,
"ratio": 3.1267029972752045,
"config_test": false,
"has_no_ke... |
#!/bin/env python
# ---------------------------------------------------------------------
# getclmsched.py
# by John Cruz 2017-06-12
#
# Retrieves the Tagalog CLM schedule for a particular month and print
# it out in the screen.
#
# ---------------------------------------------------------------------
from __future__ i... | {
"repo_name": "johncruise/jw_tagalog",
"path": "getclmstudynum.py",
"copies": "1",
"size": "4513",
"license": "mit",
"hash": -8549647168643070000,
"line_mean": 33.4503816794,
"line_max": 136,
"alpha_frac": 0.6195435409,
"autogenerated": false,
"ratio": 2.74179829890644,
"config_test": false,
... |
#!/bin/env python
"""GimICQ2IM v2003-12-05 - Convert a Gim-ICQ user list file to people files w/ UINs.
Usage: GimICQ2PIM.py ~/config/settings/GimICQ/user-UIN Folder
Replace UIN for your UIN.
Creates People files named after the nick names in the user list -
attributes set for the IM Kit - in the directory Folder
... | {
"repo_name": "HaikuArchives/IMKit",
"path": "utils/gimicq-import/GimICQ2IM.py",
"copies": "1",
"size": "1695",
"license": "bsd-3-clause",
"hash": 5680778246249084000,
"line_mean": 23.5652173913,
"line_max": 85,
"alpha_frac": 0.6584070796,
"autogenerated": false,
"ratio": 2.7033492822966507,
"c... |
#! /bin/env python
#
# github decorator
# \m/ 2013, skazhy
import os
import fileinput
from datetime import date, timedelta
from subprocess import Popen
REPO = "decorator"
repodir = os.path.join(os.path.dirname(__file__), REPO)
densities = {".": 1, "-": 10, "+": 20, "#": 30}
class HumbleList(list):
def __getit... | {
"repo_name": "skazhy/github-decorator",
"path": "decorator.py",
"copies": "2",
"size": "1863",
"license": "mit",
"hash": 2201435128367885800,
"line_mean": 23.5131578947,
"line_max": 72,
"alpha_frac": 0.5748792271,
"autogenerated": false,
"ratio": 3.268421052631579,
"config_test": false,
"has... |
#!/bin/env python
"""
Given a pair of new regions for each hole number that matched vector sequence,
update the hole number's original region entry with the maximum of the two new
regions.
"""
usage = """%prog filename_prefix new_regions.tab"""
from collections import defaultdict
import csv
import h5py
from optparse i... | {
"repo_name": "JPascualAnaya/pacbio-protocols4bas.h5",
"path": "smrtanalysis-2.1.0/update_regions.py",
"copies": "1",
"size": "4948",
"license": "mit",
"hash": 7256864011389438000,
"line_mean": 41.2905982906,
"line_max": 120,
"alpha_frac": 0.5796281326,
"autogenerated": false,
"ratio": 4.04248366... |
#!/bin/env python
help = """
Load kibana dashboards or visualizations exported as json via the kibana ui on the command line.
Example:
$ python load_dashboards.py objects_visualizations.json 'http://localhost:9200'
Posting: Per-node-doc-count (visualization)
{"_index":".kibana","_type":"visualization","_... | {
"repo_name": "EthVentures/CryptoTracker",
"path": "resources/load_dashboards.py",
"copies": "1",
"size": "1722",
"license": "apache-2.0",
"hash": 3299555185478524000,
"line_mean": 37.2666666667,
"line_max": 159,
"alpha_frac": 0.6649245064,
"autogenerated": false,
"ratio": 3.3897637795275593,
"... |
#/bin/env python
helpstr="""
# This is a script showing an example to obtain
# the ground state energy, staggered magnetizatio
# and the static spin structure factor of the |SF+N>
# wavefunction.
# In a second step the q=(pi,0) component of the
# dynamical spin structure factor S(q,w) is calculated.
# This script requ... | {
"repo_name": "bdallapi/gpvmc",
"path": "example.py",
"copies": "2",
"size": "3010",
"license": "mit",
"hash": -3634921723673708000,
"line_mean": 34.8333333333,
"line_max": 199,
"alpha_frac": 0.7255813953,
"autogenerated": false,
"ratio": 2.723981900452489,
"config_test": false,
"has_no_keywo... |
#!/bin/env python
# Home to work
# https://maps.googleapis.com/maps/api/directions/json?origin=901+Clearview+Dr+Bedford+Tx&destination=111+Customer+Way+Irving+Tx&avoid=tolls&key=AIzaSyDg5cmsPRKv2BqH889-y1AS8Y2r-de9McU
# Home to parents
# https://maps.googleapis.com/maps/api/directions/json?origin=901+Clearview+Dr+Bed... | {
"repo_name": "bpfx/sysinfor",
"path": "modules/theDrive/getDrive.py",
"copies": "1",
"size": "2867",
"license": "bsd-3-clause",
"hash": -5812050314495576000,
"line_mean": 30.5054945055,
"line_max": 186,
"alpha_frac": 0.684687827,
"autogenerated": false,
"ratio": 3.069593147751606,
"config_test... |
# !/bin/env python
# http://community.topcoder.com/stat?c=problem_statement&pm=1918&rd=5006
from operator import add
def best_garden(flower_heights, flower_blooms, flower_wilts):
flowers = zip(flower_heights, flower_blooms, flower_wilts)
flowers.sort(key=lambda x: x[1]) # sort by bloom times
best_garde... | {
"repo_name": "ilonajulczuk/riddles",
"path": "python/flower_garden.py",
"copies": "1",
"size": "1984",
"license": "mit",
"hash": -1195649177153076200,
"line_mean": 37.1538461538,
"line_max": 106,
"alpha_frac": 0.5151209677,
"autogenerated": false,
"ratio": 2.782608695652174,
"config_test": fal... |
import argparse
from lib.httplog import HTTPLog, LogError, InitError, ConfigError
from lib.filter import Filter, InitErr, ConfErr
from datetime import datetime
__title__ = "httpdefender"
__author__ = "Leslie.A.Cordell"
__version__ = "1.0"
__year__ = datetime.now().year
def arguments():
"""
Set up command-line... | {
"repo_name": "nonapod/httpdefender",
"path": "httpdefender.py",
"copies": "1",
"size": "5033",
"license": "mit",
"hash": -8316497950359888000,
"line_mean": 38.015503876,
"line_max": 118,
"alpha_frac": 0.6363997616,
"autogenerated": false,
"ratio": 3.733679525222552,
"config_test": true,
"has... |
#!/bin/env/python
import abc
import numpy as np
# from sklearn.decomposition import PCA, SparsePCA
from sklearn import decomposition
from sklearn.decomposition import PCA, SparsePCA, MiniBatchSparsePCA
from sklearn.utils.extmath import randomized_svd
import numba # conda install numba
# import ffht # https://github... | {
"repo_name": "dblalock/bolt",
"path": "experiments/python/amm.py",
"copies": "1",
"size": "46227",
"license": "mpl-2.0",
"hash": 1475137474745764000,
"line_mean": 31.6001410437,
"line_max": 83,
"alpha_frac": 0.5401172475,
"autogenerated": false,
"ratio": 2.9194770746494885,
"config_test": fals... |
#!/bin/env python
import argparse
from base64 import b64encode, b64decode
from binascii import hexlify, unhexlify
debug = False
def XorPlease(string1, string2, outEnc):
normed = []
for (enc, inStr) in [string1, string2]:
if enc == "b64":
normed.append(bytearray(b64decode(inStr)))
elif enc == "hex":
norme... | {
"repo_name": "mischif/ctf-tools",
"path": "xorplease.py",
"copies": "1",
"size": "1961",
"license": "mpl-2.0",
"hash": 5683422925906077000,
"line_mean": 40.7234042553,
"line_max": 337,
"alpha_frac": 0.6909739929,
"autogenerated": false,
"ratio": 2.9667170953101363,
"config_test": false,
"has... |
#!/bin/env python
import argparse
from Crypto.Cipher import AES
from base64 import b64encode, b64decode
from binascii import hexlify, unhexlify
debug = False
def GetIV(ptEnc, pt, ctEnc, ct, keyEnc, encKey, ivEnc):
if ctEnc == "b64":
normct = b64decode(ct)
elif ctEnc == "hex":
normct = unhexlify(ct)
else:
r... | {
"repo_name": "mischif/ctf-tools",
"path": "getiv.py",
"copies": "1",
"size": "2521",
"license": "mpl-2.0",
"hash": 186256454959839740,
"line_mean": 37.7846153846,
"line_max": 360,
"alpha_frac": 0.7005156684,
"autogenerated": false,
"ratio": 2.9010356731875717,
"config_test": false,
"has_no_k... |
#!/bin/env python
import argparse
from vnc_api.vnc_api import *
class NetworkManager(object):
def __init__(self, api_server, api_port, project=None):
self._client = VncApi(api_server_host=api_server,
api_server_port=api_port)
self._project = project
def _netname... | {
"repo_name": "DreamLab/opencontrail-netns",
"path": "opencontrail_netns/network_manage.py",
"copies": "16",
"size": "8208",
"license": "apache-2.0",
"hash": -7150728708049177000,
"line_mean": 33.487394958,
"line_max": 83,
"alpha_frac": 0.5609161793,
"autogenerated": false,
"ratio": 3.73770491803... |
#!/bin/env python
import argparse
import ast
import glob
import json
import os
import re
import subprocess
import sys
import pyproj
from osgeo import gdal
#==============================================================================
def parse_wkt(text):
parts = None
n = 0
result = {}
final = False
while... | {
"repo_name": "kfieldho/vivia",
"path": "Tools/Scripts/gen-kst.py",
"copies": "2",
"size": "5658",
"license": "bsd-3-clause",
"hash": -6791348119548065000,
"line_mean": 27.29,
"line_max": 79,
"alpha_frac": 0.494874514,
"autogenerated": false,
"ratio": 3.086743044189853,
"config_test": false,
... |
#! /bin/env python
import argparse
import collections
import filecmp
import os
# Directories containing a file with this name will be linked to directly
# instead of having its contents linked individually.
SUBDIR_ANNOTATION = '.dotfiles-subdir'
def files_differ(path_a, path_b):
"""
True if the files at `pa... | {
"repo_name": "ChrisTM/dotfiles-linker",
"path": "link.py",
"copies": "1",
"size": "8226",
"license": "mit",
"hash": -5929781361349134000,
"line_mean": 34.4568965517,
"line_max": 94,
"alpha_frac": 0.567833698,
"autogenerated": false,
"ratio": 4.04424778761062,
"config_test": false,
"has_no_ke... |
#!/bin/env python
import argparse
import collections
import pprint
import pickle
import os
import re
import cbor
import logging
logr = logging.getLogger( __name__ )
# Exception type is part of the error signature
err_type_re_signature = {
"<type 'exceptions.OSError'>": re.compile( '([^:]+):?' ),
"<type 'e... | {
"repo_name": "ncsa/psync",
"path": "bin/parse_psync_errlog.py",
"copies": "1",
"size": "7770",
"license": "bsd-3-clause",
"hash": -1509371340052450000,
"line_mean": 35.8246445498,
"line_max": 90,
"alpha_frac": 0.5574002574,
"autogenerated": false,
"ratio": 3.698238933841028,
"config_test": fal... |
#!/bin/env python
import argparse
import csv
import zipfile
import os
import sqlite3
import time
import itertools
import sys
from collections import defaultdict
def declare_table(cur, column_types, table_name):
cur.execute('DROP TABLE IF EXISTS %s' % table_name)
# Build the main table
colspec = ', '.join([name + ... | {
"repo_name": "awleblang/DataCoyote",
"path": "src/data_coyote.py",
"copies": "1",
"size": "3373",
"license": "mit",
"hash": -741185059241784400,
"line_mean": 27.3529411765,
"line_max": 99,
"alpha_frac": 0.6878150015,
"autogenerated": false,
"ratio": 3.036003600360036,
"config_test": false,
"... |
#!/bin/env python
import argparse
import datetime
import requests
import os
from utils import ip_address, config_file
from packtpub import Packtpub
from upload import Upload, SERVICE_GOOGLE_DRIVE, SERVICE_ONEDRIVE, SERVICE_DROPBOX, SERVICE_SCP
from database import Database, DB_FIREBASE
from logs import *
from notify i... | {
"repo_name": "niqdev/packtpub-crawler",
"path": "script/spider.py",
"copies": "1",
"size": "6418",
"license": "mit",
"hash": -2518201606500591000,
"line_mean": 38.3742331288,
"line_max": 149,
"alpha_frac": 0.5832034902,
"autogenerated": false,
"ratio": 3.6779369627507164,
"config_test": true,
... |
#!/bin/env python
import argparse
import datetime
#CDAT
import cdms2
import numpy as np
#Matplotlib libraries
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.font_manager as font_manager
from pylab import legend
def plot(title,variable,ifil... | {
"repo_name": "paolap/cwsl-ctools",
"path": "visualisation/plot_timeseries.py",
"copies": "3",
"size": "2095",
"license": "apache-2.0",
"hash": -1869129390799307800,
"line_mean": 28.0972222222,
"line_max": 100,
"alpha_frac": 0.6806682578,
"autogenerated": false,
"ratio": 3.352,
"config_test": f... |
#!/bin/env python
import argparse
import logging
import os
import platform
import subprocess
import sys
import webbrowser
from PySide import QtGui
from tendo.singleton import SingleInstance
from app.core.auth import Authenticator
import app.core.common as common
from app.core.config import Config
from app.sync.synce... | {
"repo_name": "travcunn/kissync-python",
"path": "main.py",
"copies": "1",
"size": "4434",
"license": "mit",
"hash": 9053070028786820000,
"line_mean": 29.7916666667,
"line_max": 76,
"alpha_frac": 0.6346414073,
"autogenerated": false,
"ratio": 4.0791168353265865,
"config_test": false,
"has_no_... |
#!/bin/env python
import argparse
import os
import json
import logging
import sys
from common.utils import Util
from common.kerberos import Kerberos
from common.kafka_client import KafkaConsumer
script_path = os.path.dirname(os.path.abspath(__file__))
conf_file = "{0}/ingest_conf.json".format(script_path)
worker_conf... | {
"repo_name": "kpeiruza/incubator-spot",
"path": "spot-ingest/worker.py",
"copies": "1",
"size": "2671",
"license": "apache-2.0",
"hash": -8602734100053957000,
"line_mean": 36.0972222222,
"line_max": 158,
"alpha_frac": 0.6888805691,
"autogenerated": false,
"ratio": 3.5997304582210243,
"config_t... |
#!/bin/env python
import argparse
import os
import json
import sys
from common.utils import Util
from common.kerberos import Kerberos
from common.kafka_client import KafkaTopic
import datetime
# get master configuration.
script_path = os.path.dirname(os.path.abspath(__file__))
conf_file = "{0}/ingest_conf.json".form... | {
"repo_name": "kpeiruza/incubator-spot",
"path": "spot-ingest/master_collector.py",
"copies": "1",
"size": "2802",
"license": "apache-2.0",
"hash": -2682880195616674300,
"line_mean": 37.3835616438,
"line_max": 142,
"alpha_frac": 0.6795146324,
"autogenerated": false,
"ratio": 3.601542416452442,
... |
#!/bin/env python
import argparse
import os
import sys
import csv
import time
import datetime
import arrow
import re
from collections import defaultdict
from sqlalchemy import func
file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.path.abspath(os.path.join(file_path, os.pardir))... | {
"repo_name": "Code4SA/pmg-cms-2",
"path": "bin/import_meeting_attendance.py",
"copies": "1",
"size": "15943",
"license": "apache-2.0",
"hash": -5011514507692008000,
"line_mean": 47.9049079755,
"line_max": 151,
"alpha_frac": 0.5939910933,
"autogenerated": false,
"ratio": 3.718050373134328,
"con... |
#!/bin/env python
import argparse
import os
import sys
import csv
import time
import datetime
import arrow
import re
# from collections import defaultdict
file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.path.abspath(os.path.join(file_path, os.pardir)))
from pmg import db
from... | {
"repo_name": "Code4SA/pmg-cms-2",
"path": "bin/import_revised_attendance.py",
"copies": "1",
"size": "9552",
"license": "apache-2.0",
"hash": -8739487791717924000,
"line_mean": 42.4181818182,
"line_max": 105,
"alpha_frac": 0.5058626466,
"autogenerated": false,
"ratio": 3.5761886933732683,
"con... |
#!/bin/env python
import argparse
import os
import sys
import csv
file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.path.abspath(os.path.join(file_path, os.pardir)))
from pmg.models.resources import Committee, House
committee_name_map = {
'Standing Committee on Finance': '... | {
"repo_name": "Code4SA/pmg-cms-2",
"path": "bin/check_committees.py",
"copies": "1",
"size": "3702",
"license": "apache-2.0",
"hash": 5570996301481731000,
"line_mean": 45.8607594937,
"line_max": 130,
"alpha_frac": 0.6274986494,
"autogenerated": false,
"ratio": 3.9009483667017912,
"config_test":... |
#!/bin/env python
import argparse
import os
import sys
import logging
from utils import Util
# get script path.
script_path = os.path.dirname(os.path.abspath(__file__))
def main():
# input parameters.
parser = argparse.ArgumentParser(description="Master OA Script")
parser.add_argument('-d','--date',req... | {
"repo_name": "kpeiruza/incubator-spot",
"path": "spot-oa/oa/start_oa.py",
"copies": "1",
"size": "2049",
"license": "apache-2.0",
"hash": -3453752359267631000,
"line_mean": 31.03125,
"line_max": 144,
"alpha_frac": 0.6398243045,
"autogenerated": false,
"ratio": 3.5449826989619377,
"config_test"... |
#!/bin/env python
import argparse
import os
class CLIArgs(object):
def __init__(self):
self.AppName = 'authvault'
self.ProgramVersion = '0.1.0'
def parse(self):
globalArgs = argparse.ArgumentParser(add_help=False)
vaultArgs = argparse.ArgumentParser(add_help=False)
... | {
"repo_name": "velexio/pyLegos",
"path": "src/misc/AuthVault/bin/authvault.py",
"copies": "1",
"size": "4498",
"license": "mit",
"hash": -4378405337580534300,
"line_mean": 36.7983193277,
"line_max": 153,
"alpha_frac": 0.6064917741,
"autogenerated": false,
"ratio": 4.525150905432596,
"config_tes... |
#!/bin/env python
import argparse
import prettytable
import getpass
from fabric import api as fab
from fabric import state as fab_state
from fabric.main import find_fabfile, load_fabfile, parse_arguments
from aws import __version__
from libaws.conf import settings
from libaws.autoscale import ASService
from libaws.e... | {
"repo_name": "eofs/aws",
"path": "aws/main.py",
"copies": "1",
"size": "12965",
"license": "bsd-2-clause",
"hash": -6659458773132155000,
"line_mean": 37.8203592814,
"line_max": 111,
"alpha_frac": 0.6614731971,
"autogenerated": false,
"ratio": 3.658295711060948,
"config_test": false,
"has_no_... |
#!/bin/env python
import argparse
import random
import pysam
import re
import subprocess
def main(args):
genome = None
if args.fastaFile:
genome = pysam.Fastafile(args.fastaFile)
if args.requireseq and not args.fastaFile:
raise ValueError("--requireseq set without -f/--fasta")
mapta... | {
"repo_name": "chaelir/bamsurgeon",
"path": "etc/randomsites.py",
"copies": "1",
"size": "5800",
"license": "mit",
"hash": 3197539454793747000,
"line_mean": 37.1578947368,
"line_max": 144,
"alpha_frac": 0.565862069,
"autogenerated": false,
"ratio": 3.918918918918919,
"config_test": false,
"ha... |
#!/bin/env python
import argparse
import random
parser = argparse.ArgumentParser(
description='Generate a string to obfuscate your email address')
parser.add_argument('email', type=str, help='email address to obfuscate')
parser.add_argument('-m', '--with-mailto', dest='mailto', action='store_true',
... | {
"repo_name": "ioO/email-obfuscation",
"path": "email-obfuscation.py",
"copies": "1",
"size": "1105",
"license": "mit",
"hash": -3825408856350365000,
"line_mean": 34.6451612903,
"line_max": 79,
"alpha_frac": 0.6859728507,
"autogenerated": false,
"ratio": 3.622950819672131,
"config_test": false,... |
#!/bin/env python
import argparse
import urllib2
from lxml import etree
import logging
from time import time
import telnetlib
import sys
import multiprocessing
mapping = {
'CPDU-1BM11A.slac.stanford.edu': 'geist.xml',
'CPDU-1BM11B.slac.stanford.edu': 'geist.xml',
'CPDU-1BM12A.slac.stanford.edu': 'geist.x... | {
"repo_name": "yee379/pdu-polling",
"path": "pdu.py",
"copies": "1",
"size": "12692",
"license": "mit",
"hash": -8144866313243197000,
"line_mean": 35.7884057971,
"line_max": 161,
"alpha_frac": 0.5607469272,
"autogenerated": false,
"ratio": 2.913682277318641,
"config_test": false,
"has_no_keyw... |
#!/bin/env python
import array
from math import pi, sin, cos, asin, acos, fabs, sqrt
import ROOT
ROOT.gSystem.Load("libEXOUtilities")
ROOT.gStyle.SetOptStat(0)
ROOT.TGaxis.SetMaxDigits(3)
muon = ROOT.TChain("muon")
muon.Add("simulations/muonsim_*.root")
use_symmetry = False
max_theta = pi/2
def SetBins(h):
# S... | {
"repo_name": "steveherrin/PhDThesis",
"path": "Thesis/scripts/muon_flux/calculate_efficiencies.py",
"copies": "1",
"size": "13941",
"license": "mit",
"hash": 7832242615823614000,
"line_mean": 30.2578475336,
"line_max": 134,
"alpha_frac": 0.5698299978,
"autogenerated": false,
"ratio": 2.546766532... |
#!/bin/env python
import array
from math import pi, sin, cos, tan, acos, fabs, sqrt, pow, log, exp
import scipy.integrate
import glob
import ROOT
ROOT.gSystem.Load("libEXOUtilities")
ROOT.gStyle.SetOptStat(0)
ROOT.gStyle.SetOptFit(111)
ROOT.TGaxis.SetMaxDigits(3)
use_symmetry = False
max_theta = 80*pi/180
def flux(t... | {
"repo_name": "steveherrin/PhDThesis",
"path": "Thesis/scripts/muon_flux/calculate_rate.py",
"copies": "1",
"size": "24111",
"license": "mit",
"hash": -2736198912322189000,
"line_mean": 31.5384615385,
"line_max": 203,
"alpha_frac": 0.5489195803,
"autogenerated": false,
"ratio": 2.6551040634291376... |
#!/bin/env python
import base64
import httplib
import json
import urllib
import urlparse
import ssl
class IXFClient(object):
def __init__(self, **kwargs):
"""
IX-F database client
"""
self.host = 'ixf.20c.com'
self.port = 7010
self.path = '/api/'
self.use... | {
"repo_name": "DanAnkers/ixf-client-py",
"path": "ixf/client.py",
"copies": "1",
"size": "5215",
"license": "mit",
"hash": 5547812501617693000,
"line_mean": 25.4720812183,
"line_max": 112,
"alpha_frac": 0.5031639501,
"autogenerated": false,
"ratio": 3.9507575757575757,
"config_test": false,
"... |
#!/bin/env python
import base64
import httplib
import json
import urllib
import urlparse
class IXFClient(object):
def __init__(self, **kwargs):
"""
IX-F database client
"""
self.host = 'ixf.20c.com'
self.port = 7010
self.path = '/api/'
self.user = None
... | {
"repo_name": "euro-ix/ixf-client-py",
"path": "ixf/client.py",
"copies": "1",
"size": "5018",
"license": "mit",
"hash": 2637431699219313700,
"line_mean": 25.1354166667,
"line_max": 98,
"alpha_frac": 0.5001992826,
"autogenerated": false,
"ratio": 3.941869599371563,
"config_test": false,
"has_... |
#!/bin/env python
import base64
import numpy as np
class EncoderError(Exception):
pass
class UnknownEncoderError(EncoderError):
def __init__(self, name):
self._name
def __str__(self):
return '%s: Unknown encoder' % self._name
class EncoderInterface(object):
def encode(self, array)... | {
"repo_name": "decvalts/landlab",
"path": "landlab/io/vtk/encoders.py",
"copies": "1",
"size": "1564",
"license": "mit",
"hash": -9156867524458178000,
"line_mean": 22.3432835821,
"line_max": 74,
"alpha_frac": 0.5901534527,
"autogenerated": false,
"ratio": 3.7416267942583734,
"config_test": fals... |
#!/bin/env python
import base64
import numpy as np
class EncoderError(Exception):
pass
class UnknownEncoderError(EncoderError):
def __init__(self, name):
self._name
def __str__(self):
return '%s: Unknown encoder' % self._name
class EncoderInterface(object):
def encode(self, arr... | {
"repo_name": "laijingtao/landlab",
"path": "landlab/io/vtk/encoders.py",
"copies": "6",
"size": "1569",
"license": "mit",
"hash": -8254918180605317000,
"line_mean": 20.4931506849,
"line_max": 74,
"alpha_frac": 0.5882727852,
"autogenerated": false,
"ratio": 3.7535885167464116,
"config_test": fa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.