text stringlengths 0 1.05M | meta dict |
|---|---|
# Built-in modules #
import tempfile, datetime, dateutil, hashlib
# One liners #
flatter = lambda x: [item for sublist in x for item in sublist]
################################################################################
def new_temp_path(**kwargs):
"""A new temporary path"""
handle = tempfile.NamedTempo... | {
"repo_name": "xapple/seqenv",
"path": "seqenv/common/__init__.py",
"copies": "1",
"size": "3453",
"license": "mit",
"hash": -7700354225854210000,
"line_mean": 38.2386363636,
"line_max": 106,
"alpha_frac": 0.5592238633,
"autogenerated": false,
"ratio": 4.300124533001245,
"config_test": false,
... |
# Built-in modules #
import tempfile
# Internal modules #
from autopaths import FilePath, DirectoryPath
################################################################################
def new_temp_path(**kwargs):
"""A new temporary path"""
handle = tempfile.NamedTemporaryFile(**kwargs)
path = handle.name... | {
"repo_name": "DC23/plumbing",
"path": "plumbing/tmpstuff.py",
"copies": "1",
"size": "1379",
"license": "mit",
"hash": 4026657482114034000,
"line_mean": 30.3636363636,
"line_max": 97,
"alpha_frac": 0.5199419869,
"autogenerated": false,
"ratio": 4.536184210526316,
"config_test": false,
"has_n... |
# Built-in modules #
import tempfile
# Internal modules #
from autopaths import FilePath
################################################################################
def new_temp_path(**kwargs):
"""A new temporary path"""
handle = tempfile.NamedTemporaryFile(**kwargs)
path = handle.name
handle.clo... | {
"repo_name": "xapple/seqenv",
"path": "seqenv/common/tmpstuff.py",
"copies": "1",
"size": "1380",
"license": "mit",
"hash": -7588492352396392000,
"line_mean": 29.6888888889,
"line_max": 97,
"alpha_frac": 0.515942029,
"autogenerated": false,
"ratio": 4.495114006514658,
"config_test": false,
"... |
# Built-in modules #
import tempfile
# Internal modules #
from gefes.common.autopaths import FilePath
################################################################################
def new_temp_path(**kwargs):
handle = tempfile.NamedTemporaryFile(**kwargs)
path = handle.name
handle.close()
return pa... | {
"repo_name": "inodb/gefes",
"path": "gefes/common/tmpstuff.py",
"copies": "1",
"size": "1331",
"license": "mit",
"hash": 4942170250594058000,
"line_mean": 29.976744186,
"line_max": 97,
"alpha_frac": 0.5146506386,
"autogenerated": false,
"ratio": 4.481481481481482,
"config_test": false,
"has_... |
# Built-in modules #
import time, pickle
# Internal modules #
# Third party modules #
from decorator import decorator
################################################################################
def property_cached(f):
"""Decorator for properties evaluated only once.
It can be used to created a cached pr... | {
"repo_name": "inodb/gefes",
"path": "gefes/common/cache.py",
"copies": "1",
"size": "2151",
"license": "mit",
"hash": -2414742815983068000,
"line_mean": 30.6470588235,
"line_max": 80,
"alpha_frac": 0.4834960483,
"autogenerated": false,
"ratio": 4.490605427974947,
"config_test": false,
"has_n... |
# Built-in modules #
import warnings, marshal, re
# Internal modules #
import seqenv
from seqenv.common.cache import property_cached
from seqenv.common.autopaths import DirectoryPath
# Third party modules #
import pandas
# We don't want the annoying h5py warning #
with warnings.catch_warnings():
warnings.sim... | {
"repo_name": "xapple/seqenv",
"path": "seqenv/outputs.py",
"copies": "1",
"size": "9924",
"license": "mit",
"hash": -1503689071567387100,
"line_mean": 41.5965665236,
"line_max": 118,
"alpha_frac": 0.5710399033,
"autogenerated": false,
"ratio": 3.65929203539823,
"config_test": false,
"has_no_... |
# Built-in modules #
import xml.etree.ElementTree as etree
# Internal modules #
from aggregate import Collection, Aggregate
from gefes.common.autopaths import AutoPaths
# Third party modules #
###############################################################################
class Runs(Collection):
"""A collection ... | {
"repo_name": "inodb/gefes",
"path": "gefes/groups/runs.py",
"copies": "1",
"size": "1574",
"license": "mit",
"hash": 5554359010479616000,
"line_mean": 34.7727272727,
"line_max": 116,
"alpha_frac": 0.5203303685,
"autogenerated": false,
"ratio": 4.005089058524173,
"config_test": false,
"has_no... |
# built-in modules
# installed modules
import numpy as np
# project modules
from . import elastic
from .core import deep_iterate
def get_colleciton_idf(terms, index_name, doc_type, field_name, cache=None):
es_client = elastic.get_client(
index_name=index_name, doc_type=doc_type, field_name=field_name
... | {
"repo_name": "lucasoldaini/python3-utils",
"path": "features.py",
"copies": "1",
"size": "4472",
"license": "unlicense",
"hash": -5565118283611044000,
"line_mean": 26.103030303,
"line_max": 76,
"alpha_frac": 0.5796064401,
"autogenerated": false,
"ratio": 3.2149532710280373,
"config_test": fals... |
# Built-in modules #
# Internal modules #
from aggregate import Collection, Aggregate
from gefes.common.autopaths import AutoPaths
# Third party modules #
from gefes.running.project_runner import ProjectRunner
from gefes.helper.assemble import Assembly
################################################################... | {
"repo_name": "inodb/gefes",
"path": "gefes/groups/projects.py",
"copies": "1",
"size": "1212",
"license": "mit",
"hash": -7486728009450106000,
"line_mean": 32.6666666667,
"line_max": 79,
"alpha_frac": 0.548679868,
"autogenerated": false,
"ratio": 4.407272727272727,
"config_test": false,
"has... |
# Built-in modules #
# Internal modules #
from gefes.graphs import Graph
# Third party modules #
import pandas
from matplotlib import pyplot
from Bio import SeqIO
# Constants #
__all__ = ['ContigDist']
################################################################################
class ContigDist(Graph):
"""G... | {
"repo_name": "inodb/gefes",
"path": "gefes/graphs/assembly_plots.py",
"copies": "1",
"size": "1059",
"license": "mit",
"hash": 2352760107583883300,
"line_mean": 31.1212121212,
"line_max": 112,
"alpha_frac": 0.5845136922,
"autogenerated": false,
"ratio": 3.75531914893617,
"config_test": false,
... |
# Built-in modules #
# Internal modules #
from gefes.running import Runner
from gefes.common.slurm import SLURMJob
# Third party modules #
# Constants #
###############################################################################
class PoolRunner(Runner):
"""Will run stuff on a pool"""
default_time = '1-... | {
"repo_name": "inodb/gefes",
"path": "gefes/running/pool_runner.py",
"copies": "1",
"size": "1534",
"license": "mit",
"hash": 2788980781675648000,
"line_mean": 32.3695652174,
"line_max": 104,
"alpha_frac": 0.5234680574,
"autogenerated": false,
"ratio": 3.7598039215686274,
"config_test": false,
... |
# Built-in modules #
# Third party modules #
import time
from Bio import Entrez
from Bio.Entrez.Parser import CorruptedXMLError
from tqdm import tqdm
# Constants #
Entrez.email = "I don't know who will be running this script"
################################################################################
def gis_to... | {
"repo_name": "xapple/seqenv",
"path": "tests/eutils.py",
"copies": "1",
"size": "1837",
"license": "mit",
"hash": 7711612605167092000,
"line_mean": 35.0392156863,
"line_max": 80,
"alpha_frac": 0.5514425694,
"autogenerated": false,
"ratio": 4.175,
"config_test": false,
"has_no_keywords": fals... |
# built in modules
import json
import random
import string
import numbers
import hashlib
import collections
import argparse
# project modules
from .core import is_list_or_tuple
SYMBOLS = '0123456789abcdefghujklmnopqrstuvwxyzABCDEFGHUJKLMNOPQRSTUVWXYZ_='
NEG_SYMBOL = '-'
BASE = len(SYMBOLS)
SYMBOLS_VA... | {
"repo_name": "lucasoldaini/python3-utils",
"path": "hashing.py",
"copies": "1",
"size": "3854",
"license": "unlicense",
"hash": 6654615418727287000,
"line_mean": 27.4198473282,
"line_max": 126,
"alpha_frac": 0.5983393876,
"autogenerated": false,
"ratio": 3.763671875,
"config_test": false,
"h... |
# built-in modules
import re
import string
# installed modules
import numpy
STOPWORDS = [
'a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', 'for',
'from', 'has', 'he', 'in', 'is', 'its', 'of', 'on', 'or',
'that', 'the', 'to', 'was ', 'were', 'will', 'with'
]
def len_utf8(s):
"""Retur... | {
"repo_name": "lucasoldaini/python3-utils",
"path": "stringutils.py",
"copies": "1",
"size": "3293",
"license": "unlicense",
"hash": -6707291484731964000,
"line_mean": 28.4907407407,
"line_max": 78,
"alpha_frac": 0.5192833283,
"autogenerated": false,
"ratio": 3.3533604887983706,
"config_test": ... |
# built-in
from collections import defaultdict
# css
from .utility import to_words, from_words
from .utility import expand_sided_value, collapse_sided_value
from .style import styles, Style, StylesContainer, SidedStylesContainer
class BorderSide(StylesContainer):
# prefix = one of 'left', 'top', 'right', 'bottom'
... | {
"repo_name": "Saluev/cocos2d-gui",
"path": "cocosgui/css/border.py",
"copies": "1",
"size": "2794",
"license": "mit",
"hash": -8842415079276042000,
"line_mean": 28.4105263158,
"line_max": 71,
"alpha_frac": 0.6403006442,
"autogenerated": false,
"ratio": 3.3784764207980653,
"config_test": false,... |
# built-in
from __future__ import print_function
# PyOpenGL
from OpenGL import GL
# pyglet
import pyglet
from pyglet.window import key
# gui
from .node import GUINode
# css
from css.color import Color
class Caret(GUINode):
def __init__(self):
super(Caret, self).__init__()
self.__glyph = None
@property
... | {
"repo_name": "Saluev/cocos2d-gui",
"path": "cocosgui/editors.py",
"copies": "1",
"size": "7325",
"license": "mit",
"hash": 3157582413610065400,
"line_mean": 31.4159292035,
"line_max": 84,
"alpha_frac": 0.6315358362,
"autogenerated": false,
"ratio": 3.318985047575895,
"config_test": false,
"h... |
# Built-in
from sys import stderr, exit, argv
from json import loads
from time import time
from urlparse import urlparse
from collections import Counter
from httplib import IncompleteRead
import re
import datetime
import pytz
import sqlite3
# 3rd Party
from requests import post
from requests_oauthlib import OAuth1
fro... | {
"repo_name": "nikhs/Twitter-Streaming-CLI",
"path": "stream.py",
"copies": "1",
"size": "6618",
"license": "mit",
"hash": -1733360012769469700,
"line_mean": 24.9568627451,
"line_max": 170,
"alpha_frac": 0.667724388,
"autogenerated": false,
"ratio": 3.127599243856333,
"config_test": false,
"h... |
# Built-in
from textwrap import dedent
from warnings import warn
# Third-party
import astropy.units as u
import astropy.coordinates as coord
from astropy.coordinates.transformations import (DynamicMatrixTransform,
FunctionTransform)
from astropy.coordinates.attributes i... | {
"repo_name": "adrn/gary",
"path": "gala/coordinates/greatcircle.py",
"copies": "2",
"size": "12707",
"license": "mit",
"hash": -45908802702475710,
"line_mean": 34.3955431755,
"line_max": 85,
"alpha_frac": 0.6282364051,
"autogenerated": false,
"ratio": 3.835496528825838,
"config_test": false,
... |
# built-in
from time import time
# third party library
from flask import Flask
# module library
# config
# library library
from library import response
from library import errors
from library import log
# blueprints
from status.controllers import status_blueprint
from projects.controllers import projects_blueprint... | {
"repo_name": "twoflowers/vUp",
"path": "api/endpoints/setup.py",
"copies": "1",
"size": "1092",
"license": "mit",
"hash": -6884567988270711000,
"line_mean": 20.4117647059,
"line_max": 113,
"alpha_frac": 0.7554945055,
"autogenerated": false,
"ratio": 3.627906976744186,
"config_test": false,
"... |
# built-in
import ctypes;
import os;
# import matey shared library
current_dir = os.path.dirname(__file__);
matey_path = os.path.join(current_dir, "matey.so");
libmatey = ctypes.CDLL(matey_path);
#### SUM #######################################################################
libmatey.sum.restype = ctypes.c_int;
lib... | {
"repo_name": "benrbray/matey",
"path": "matey_ctypes/ct_core.py",
"copies": "1",
"size": "1712",
"license": "mit",
"hash": -8072733151844984000,
"line_mean": 19.8780487805,
"line_max": 80,
"alpha_frac": 0.5771028037,
"autogenerated": false,
"ratio": 2.8111658456486044,
"config_test": false,
... |
# built-in
import ctypes;
# custom modules
import exceptions;
import numbers as numtypes;
################################################################################
class matrix(object):
def __init__(self, arraylike):
# flattened matrix
numbers = [];
# check if input is existing c array... | {
"repo_name": "benrbray/matey",
"path": "matey_ctypes/ct_matrix.py",
"copies": "1",
"size": "2426",
"license": "mit",
"hash": -729981036317873200,
"line_mean": 27.2093023256,
"line_max": 80,
"alpha_frac": 0.5222588623,
"autogenerated": false,
"ratio": 3.5261627906976742,
"config_test": false,
... |
# Built-in
import datetime
import logging
# Module
from app import db
from app.config import config
logger = logging.getLogger(config.root_logger + __name__)
class Member(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120))
password = db.Column(db.String(100))
#p... | {
"repo_name": "marcstreeter/ChatterBlog",
"path": "app/shared/Member/models.py",
"copies": "1",
"size": "3234",
"license": "apache-2.0",
"hash": 3901543075130493400,
"line_mean": 38.4390243902,
"line_max": 276,
"alpha_frac": 0.6617192331,
"autogenerated": false,
"ratio": 3.85,
"config_test": fa... |
# Built in
import json
import sqlite3
import threading
import time
from urllib3.util.url import parse_url
# Third party
from bottle import route, run, template, static_file, request
import requests
# First party
from website import Site
# The home page route
@route('/', method='GET')
def index():
return template('v... | {
"repo_name": "JakeOliger/CSCI230_FinalProject",
"path": "main.py",
"copies": "1",
"size": "6876",
"license": "mit",
"hash": 6948401624641802000,
"line_mean": 29.8385650224,
"line_max": 138,
"alpha_frac": 0.6612856312,
"autogenerated": false,
"ratio": 3.0013094718463553,
"config_test": false,
... |
# builtin
import logging
import json
from time import time
# shared
from library import db
from library import exc
from library import dockerhelper as docker
# config
from config import shared_config
# third party
from docker.errors import APIError
logger = logging.getLogger(shared_config.api_log_root_name + __name... | {
"repo_name": "twoflowers/vUp",
"path": "api/endpoints/projects/models.py",
"copies": "1",
"size": "5456",
"license": "mit",
"hash": -2304154418057763800,
"line_mean": 35.3733333333,
"line_max": 142,
"alpha_frac": 0.6532258065,
"autogenerated": false,
"ratio": 3.7653554175293307,
"config_test":... |
# built-in
import logging
# config
from api.config import shared_config
# third party
from flask import Blueprint, request
# shared
from library.response import jsonified
from library import errors, exc
# module
import models
projects_blueprint = Blueprint('projects', __name__, url_prefix=shared_config.api_url_pre... | {
"repo_name": "twoflowers/vUp",
"path": "api/endpoints/projects/controllers.py",
"copies": "1",
"size": "2539",
"license": "mit",
"hash": -1720955125551464400,
"line_mean": 30.7375,
"line_max": 107,
"alpha_frac": 0.6628593935,
"autogenerated": false,
"ratio": 3.936434108527132,
"config_test": f... |
# Built-in
import logging
# config
from app.config import config
# Library
from app.shared.response import jsonified
from app.shared import error
from app.shared.Member import Member
# 3rd Party
from flask import Blueprint, request
logger = logging.getLogger(config.root_logger + __name__)
member_blueprint = Bluepr... | {
"repo_name": "marcstreeter/ChatterBlog",
"path": "app/member/controllers.py",
"copies": "1",
"size": "1089",
"license": "apache-2.0",
"hash": -3137003343689882000,
"line_mean": 22.170212766,
"line_max": 89,
"alpha_frac": 0.6611570248,
"autogenerated": false,
"ratio": 3.794425087108014,
"config... |
# builtin
import logging
# config
from config import shared_config
logger = logging.getLogger(shared_config.api_log_root_name + __name__)
class Errors(Exception):
_message = "Whoops! You found a spot that's not working properly"
_log_level = logging.WARN
def __init__(self, message=None, log_level=None... | {
"repo_name": "twoflowers/vUp",
"path": "api/library/exc.py",
"copies": "1",
"size": "1486",
"license": "mit",
"hash": -4812013491288543000,
"line_mean": 24.6379310345,
"line_max": 97,
"alpha_frac": 0.6763122476,
"autogenerated": false,
"ratio": 3.931216931216931,
"config_test": false,
"has_n... |
# builtin
import logging
# config
from config import shared_config
# shared
from library import exc
logger = logging.getLogger(shared_config.api_log_root_name + __name__)
class Errors(Exception):
_message = "Whoops! You found a spot that's not working properly"
_status_code = 400
_log_level = logging.... | {
"repo_name": "twoflowers/vUp",
"path": "api/library/errors.py",
"copies": "1",
"size": "1807",
"license": "mit",
"hash": -8671314879797665000,
"line_mean": 22.7763157895,
"line_max": 111,
"alpha_frac": 0.6192584394,
"autogenerated": false,
"ratio": 3.8776824034334765,
"config_test": false,
"... |
# builtin
import logging
# config
from config import shared_config
# third party
from flask import jsonify
from werkzeug.exceptions import MethodNotAllowed
# shared
from library import errors
logger = logging.getLogger(shared_config.api_log_root_name + __name__)
def jsonified(data, code=None):
if isinstance(d... | {
"repo_name": "twoflowers/vUp",
"path": "api/library/response.py",
"copies": "1",
"size": "1459",
"license": "mit",
"hash": 1972278949262025700,
"line_mean": 28.18,
"line_max": 80,
"alpha_frac": 0.6449623029,
"autogenerated": false,
"ratio": 4.144886363636363,
"config_test": false,
"has_no_ke... |
# Built-in
import os
import itertools as itt
import warnings
# Generic common libraries
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon as mPolygon
from matplotlib.patches import Wedge as mWedge
from matplotlib.patches import Rectangle as mRectangle
... | {
"repo_name": "ToFuProject/tofu",
"path": "tofu/geom/_plot.py",
"copies": "2",
"size": "66660",
"license": "mit",
"hash": -3600067659293552000,
"line_mean": 38.7970149254,
"line_max": 155,
"alpha_frac": 0.4812181218,
"autogenerated": false,
"ratio": 3.13649837669976,
"config_test": true,
"has... |
# builtin
import os
import re
import subprocess
from glob import glob
from html import escape
from difflib import unified_diff
# external
import sass
import colorama
from colorama import Fore
class Builder(object):
style_tag = '<style type="text/css">{}</style>'
metadata_tag = '<meta name="{}" content="{}"/... | {
"repo_name": "LynnCo/TumblrDevKit",
"path": "scripts/builder.py",
"copies": "1",
"size": "3886",
"license": "mit",
"hash": 2258598302306660600,
"line_mean": 29.8412698413,
"line_max": 103,
"alpha_frac": 0.5280494081,
"autogenerated": false,
"ratio": 3.7691561590688654,
"config_test": false,
... |
# Built-in
import os
import warnings
# Common
import numpy as np
# #############################################################################
# Triangular meshes
# #############################################################################
def tri_checkformat_NodesFaces(nodes, indfaces, ids=... | {
"repo_name": "ToFuProject/tofu",
"path": "tofu/imas2tofu/_comp_mesh.py",
"copies": "2",
"size": "6909",
"license": "mit",
"hash": -4739656239134192000,
"line_mean": 36.9615384615,
"line_max": 79,
"alpha_frac": 0.4874800984,
"autogenerated": false,
"ratio": 3.4648946840521564,
"config_test": fa... |
# Built in
import re
import sqlite3
# Third party
from bs4 import BeautifulSoup
import requests
class Page:
def __init__(self, parent, path, linked_from='', depth=0):
# The site object
self.parent = parent
# Used to determine if the page succeeds in being processed
self.broken = False
# If there have be... | {
"repo_name": "JakeOliger/CSCI230_FinalProject",
"path": "page.py",
"copies": "1",
"size": "10351",
"license": "mit",
"hash": 8754341699991786000,
"line_mean": 25.5435897436,
"line_max": 139,
"alpha_frac": 0.6129842527,
"autogenerated": false,
"ratio": 2.8013531799729363,
"config_test": false,
... |
# Built in
import sqlite3
import time
from urllib3.util.url import parse_url
# Third party
from bs4 import BeautifulSoup
import requests
# First party
from page import Page
class Site:
def __init__(self, url):
self.pages = []
self.stylesheets = []
self.scripts = []
self.num_of_pages = 0
self.num_of_levels... | {
"repo_name": "JakeOliger/CSCI230_FinalProject",
"path": "website.py",
"copies": "1",
"size": "5232",
"license": "mit",
"hash": -9213680160008678000,
"line_mean": 23.3348837209,
"line_max": 138,
"alpha_frac": 0.6643730887,
"autogenerated": false,
"ratio": 3.017301038062284,
"config_test": false... |
# built-in
import time
import json
import logging
from datetime import datetime
from sqlite3 import dbapi2 as sqlite3
from urlparse import urlparse, parse_qs
# third party
from flask import Flask, render_template, request, g, flash, redirect, url_for, abort
import requests
app = Flask(__name__)
# Load default config... | {
"repo_name": "mhowsden/ball-of-snakes",
"path": "iris/iris.py",
"copies": "1",
"size": "5286",
"license": "bsd-3-clause",
"hash": 7860419691110607000,
"line_mean": 38.7443609023,
"line_max": 116,
"alpha_frac": 0.5690503216,
"autogenerated": false,
"ratio": 3.9984871406959153,
"config_test": tr... |
# built-in
import weakref
# PyOpenGL
from OpenGL import GL, GLU
# pyglet
import pyglet
# cocos2d
import cocos
from cocos.director import director
from .utility import reverse
class SmartNode(cocos.cocosnode.CocosNode, pyglet.event.EventDispatcher):
nodes_by_id = weakref.WeakValueDictionary()
def __init__(self,... | {
"repo_name": "Saluev/cocos2d-gui",
"path": "cocosgui/base.py",
"copies": "1",
"size": "5333",
"license": "mit",
"hash": -3314182640862973400,
"line_mean": 27.3670212766,
"line_max": 73,
"alpha_frac": 0.6514157135,
"autogenerated": false,
"ratio": 3.322741433021807,
"config_test": false,
"has... |
#----------- Built-in Packages -------------------------------
import os
import sys
from termcolor import cprint, colored
import colorama
from pyfiglet import Figlet
from constants import *
colorama.init(autoreset=True)
#----------- Windows Console Hacks -------------------------------
# Unicode Checking
if os.name == ... | {
"repo_name": "raymondchiang/Maze",
"path": "printing.py",
"copies": "1",
"size": "4616",
"license": "mit",
"hash": -8006760726891086000,
"line_mean": 28.5448717949,
"line_max": 77,
"alpha_frac": 0.5591234541,
"autogenerated": false,
"ratio": 3.626278520849725,
"config_test": false,
"has_no_k... |
#built-in
import time
#downloaded
import mechanize
from bs4 import BeautifulSoup
#local
import keys
def convert_from_abc(notation):
global browser
print("enter convert_notation")
#get page
url = 'http://www.mandolintab.net/abcconverter.php'
browser.open(url)
#use forms
brows... | {
"repo_name": "kschmidtjr1/abcConverterBot",
"path": "form_handler.py",
"copies": "1",
"size": "2114",
"license": "mit",
"hash": 803589343470283100,
"line_mean": 29.0882352941,
"line_max": 63,
"alpha_frac": 0.610217597,
"autogenerated": false,
"ratio": 3.695804195804196,
"config_test": false,
... |
#built-in
import time
#downloaded
import praw
#local
import keys
import file_uploader
import form_handler
def main():
global queue, timer, blocked
subreddit = r.subreddit('test')
#iterate through all comments in given subreddit
for comment in subreddit.stream.comments():
if check... | {
"repo_name": "kschmidtjr1/abcConverterBot",
"path": "musical_bot.py",
"copies": "1",
"size": "5807",
"license": "mit",
"hash": 625742555012609400,
"line_mean": 34.0683229814,
"line_max": 83,
"alpha_frac": 0.512312726,
"autogenerated": false,
"ratio": 4.032638888888889,
"config_test": false,
... |
"""Builtin Serilizers objects. for numerics mixin.
This Class Serializes current user and endpoint object to create
endpoint url.
"""
from django.contrib.auth import get_user_model
from djangonumerics.api import get_endpoint
from djangonumerics.api import get_endpoint_by_name
from djangonumerics.utils import encrypt... | {
"repo_name": "huseyinyilmaz/django-numerics",
"path": "djangonumerics/serializers.py",
"copies": "1",
"size": "3179",
"license": "mit",
"hash": -1997993172910616800,
"line_mean": 29.8640776699,
"line_max": 75,
"alpha_frac": 0.6376218937,
"autogenerated": false,
"ratio": 4.471167369901547,
"con... |
# builtins
from functools import wraps
import inspect
from os.path import dirname, join
def provider(dataProvider):
"""Search for a method named `dataProvider` and run the decorated method
once per each item returned by the provider. Each item is a tuple whose
values will be used as the test method *args.... | {
"repo_name": "riquito/crusca",
"path": "tests/decorators.py",
"copies": "1",
"size": "1238",
"license": "apache-2.0",
"hash": 1074847689791422600,
"line_mean": 32.4594594595,
"line_max": 76,
"alpha_frac": 0.6187399031,
"autogenerated": false,
"ratio": 4.298611111111111,
"config_test": false,
... |
# built-ins
from itertools import combinations, izip, repeat, product
import itertools as it
import argparse
import random
import sys
import logging
import json
from copy import deepcopy
from math import isnan
# libraries
from numpy import array, mean, zeros, zeros_like, uint8, int8, where, unique, \
ones_like, fin... | {
"repo_name": "jni/ray",
"path": "ray/agglo.py",
"copies": "1",
"size": "52787",
"license": "mit",
"hash": 6446504829179153000,
"line_mean": 42.0562805873,
"line_max": 90,
"alpha_frac": 0.5709170819,
"autogenerated": false,
"ratio": 3.6823857690966166,
"config_test": false,
"has_no_keywords":... |
# builtins
from unittest import TestCase, main
import requests
from time import sleep
# plugins
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.common.exceptions i... | {
"repo_name": "nueverest/vue_flask",
"path": "unit_tests/test_deployed_site.py",
"copies": "1",
"size": "6535",
"license": "mit",
"hash": -6654131722229938000,
"line_mean": 38.8536585366,
"line_max": 119,
"alpha_frac": 0.66013772,
"autogenerated": false,
"ratio": 4.021538461538461,
"config_test... |
# built ins
from uuid import uuid1
import json
# cqlengine
from cassandra.cqlengine.models import Model
from cassandra.cqlengine.columns import *
from db import connect_cassandra, connect_kafka
# To send messages synchronously
from kafka import SimpleProducer
connect_cassandra()
kafka = connect_kafka()
producer = S... | {
"repo_name": "rustyrazorblade/killranalytics",
"path": "killranalytics/models.py",
"copies": "1",
"size": "2344",
"license": "apache-2.0",
"hash": 8053063907467686000,
"line_mean": 25.3370786517,
"line_max": 85,
"alpha_frac": 0.6377986348,
"autogenerated": false,
"ratio": 3.524812030075188,
"c... |
# Built-ins
import datetime
# Stack Packages
from sqlalchemy import Column, Integer, Unicode, DateTime, Enum, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
PRIORITY_CHOICES = Enum(
"low",
"medium",
"high",
name='priority_types'
)
# ======
# Models
# ===... | {
"repo_name": "Dunlain/home_auto",
"path": "core/models.py",
"copies": "1",
"size": "3269",
"license": "mit",
"hash": 9215690049672979000,
"line_mean": 31.3762376238,
"line_max": 115,
"alpha_frac": 0.6595289079,
"autogenerated": false,
"ratio": 3.9865853658536587,
"config_test": false,
"has_n... |
# built-ins
import itertools as it
import sys
import argparse
import logging
import json
from copy import deepcopy
# libraries
from numpy import (array, mean, zeros, zeros_like, unique,
newaxis, nonzero, median, float, ones, arange, inf, isnan,
flatnonzero, unravel_index, bincount)
from tqdm import tqdm
import... | {
"repo_name": "janelia-flyem/gala",
"path": "gala/agglo.py",
"copies": "1",
"size": "81574",
"license": "bsd-3-clause",
"hash": 464343181404257600,
"line_mean": 37.0475746269,
"line_max": 81,
"alpha_frac": 0.5625689558,
"autogenerated": false,
"ratio": 4.071168338573639,
"config_test": false,
... |
# built-ins
import itertools as it
import sys
import argparse
import random
import logging
import json
import functools
from copy import deepcopy
# libraries
from numpy import (array, mean, zeros, zeros_like, where, unique,
newaxis, nonzero, median, float, ones, arange, inf, isnan,
flatnonzero, unravel_index, ... | {
"repo_name": "jni/gala",
"path": "gala/agglo.py",
"copies": "1",
"size": "80653",
"license": "bsd-3-clause",
"hash": 823506501394079000,
"line_mean": 37.1157844991,
"line_max": 81,
"alpha_frac": 0.5639467844,
"autogenerated": false,
"ratio": 4.065991127243396,
"config_test": false,
"has_no_k... |
# built-ins
import json
# PyPI packages
from bs4 import BeautifulSoup
import requests
# Constants
MAX_RETRY = 3
class MWDictionaryClient():
"""
Wrapper and convenience functions for dictionary functions of Google search.
"""
BASE_URL = "http://www.dictionaryapi.com/api/v1/references/collegiate/xml/... | {
"repo_name": "awyrough/mw-dictionary-client",
"path": "src/mw-dictionary-client/mw_dictionary_client.py",
"copies": "1",
"size": "3277",
"license": "mit",
"hash": 4081565914635541500,
"line_mean": 31.4455445545,
"line_max": 97,
"alpha_frac": 0.5437900519,
"autogenerated": false,
"ratio": 4.15862... |
# built-ins
import libNeuroProofRag as neuroproof
from . import morpho
import json
from numpy import zeros_like, array, double, zeros
import numpy
def get_prob_handle(classifier):
def get_prob(features):
prediction = classifier.predict_proba(array(features))[0,1]
return float(prediction)
retur... | {
"repo_name": "janelia-flyem/gala",
"path": "gala/stack_np.py",
"copies": "2",
"size": "10281",
"license": "bsd-3-clause",
"hash": 3850945590741566000,
"line_mean": 34.5743944637,
"line_max": 102,
"alpha_frac": 0.5662873261,
"autogenerated": false,
"ratio": 3.881087202718007,
"config_test": fal... |
# built-ins
import libNeuroProofRag as neuroproof
import morpho
import json
from numpy import zeros_like, array, double, zeros
import numpy
def get_prob_handle(classifier):
def get_prob(features):
prediction = classifier.predict_proba(array(features))[0,1]
return float(prediction)
return get_p... | {
"repo_name": "jni/ray",
"path": "ray/stack_np.py",
"copies": "1",
"size": "6977",
"license": "mit",
"hash": 5762393366808589000,
"line_mean": 35.1502590674,
"line_max": 102,
"alpha_frac": 0.5482298982,
"autogenerated": false,
"ratio": 3.9021252796420582,
"config_test": false,
"has_no_keyword... |
# built-ins
import libNeuroProofRag as neuroproof
import morpho
import json
import pdb
from numpy import zeros_like, array, double, zeros
import numpy
def get_prob_handle(classifier):
def get_prob(features):
prediction = classifier.predict_proba(array(features))[0,1]
return float(prediction)
... | {
"repo_name": "VCG/gp",
"path": "raveler/ray/ray/stack_np.py",
"copies": "1",
"size": "6969",
"license": "mit",
"hash": -5986343816170990000,
"line_mean": 34.7384615385,
"line_max": 102,
"alpha_frac": 0.5501506672,
"autogenerated": false,
"ratio": 3.893296089385475,
"config_test": false,
"has... |
# built-ins
import libNeuroProofRag as neuroproof
import morpho
from numpy import zeros_like, array, double, zeros
import numpy
class Stack:
"""Region adjacency graph for segmentation of nD volumes."""
def __init__(self, watershed=numpy.array([]), probabilities=numpy.array([])) :
"""Create a graph f... | {
"repo_name": "stuarteberg/ray",
"path": "ray/agglo_np.py",
"copies": "1",
"size": "1790",
"license": "mit",
"hash": 5390612383103453000,
"line_mean": 29.8620689655,
"line_max": 85,
"alpha_frac": 0.6525139665,
"autogenerated": false,
"ratio": 3.816631130063966,
"config_test": false,
"has_no_k... |
# Builtins
import logging
import warnings
# External libs
import numpy as np
import pandas as pd
import shapely.geometry as shpg
# Locals
from oggm import entity_task
from oggm.core.flowline import ParabolicBedFlowline
# Module logger
log = logging.getLogger(__name__)
def read_gmip_data(gdir, area_path=None, thic... | {
"repo_name": "OGGM/oggm",
"path": "oggm/sandbox/pygem_compat.py",
"copies": "2",
"size": "3857",
"license": "bsd-3-clause",
"hash": -8766918192418679000,
"line_mean": 30.8760330579,
"line_max": 79,
"alpha_frac": 0.5789473684,
"autogenerated": false,
"ratio": 3.4654088050314464,
"config_test": ... |
# built-ins
import os
import argparse
from math import floor, ceil
from random import shuffle
import json
import cPickle as pck
import itertools as it
from operator import __or__, __not__
from functools import partial
import fnmatch
# external libraries
import numpy as np
from gala import imio
from scipy import spatia... | {
"repo_name": "janelia-flyem/synapse-geometry",
"path": "syngeo/assignments.py",
"copies": "1",
"size": "7886",
"license": "bsd-3-clause",
"hash": 6068141122865520000,
"line_mean": 41.627027027,
"line_max": 114,
"alpha_frac": 0.5981486178,
"autogenerated": false,
"ratio": 3.319023569023569,
"co... |
# built-ins
import os
import json
from os.path import split as split_path, join as join_path
from fnmatch import filter as fnfilter
import logging
import itertools as it
import subprocess
import tempfile as tmp
# libraries
import h5py
from PIL import Image
from scipy.ndimage.measurements import label
from numpy impo... | {
"repo_name": "jni/gala",
"path": "gala/imio.py",
"copies": "2",
"size": "43060",
"license": "bsd-3-clause",
"hash": 3453067167363889700,
"line_mean": 35.8034188034,
"line_max": 83,
"alpha_frac": 0.6121690664,
"autogenerated": false,
"ratio": 3.6221399730820996,
"config_test": false,
"has_no_... |
# built-ins
import os
import sys
import argparse
import re
import json
from os.path import split as split_path, join as join_path
from fnmatch import filter as fnfilter
import logging
import json
import itertools as it
import subprocess
import tempfile as tmp
# libraries
import h5py, Image, numpy
from scipy.ndimage.m... | {
"repo_name": "jni/ray",
"path": "ray/imio.py",
"copies": "2",
"size": "23393",
"license": "mit",
"hash": 2391167601277607400,
"line_mean": 38.7164685908,
"line_max": 96,
"alpha_frac": 0.6017184628,
"autogenerated": false,
"ratio": 3.2463225090202608,
"config_test": false,
"has_no_keywords": ... |
# builtins
import unittest
from unittest.mock import patch, mock_open, Mock
import builtins
# ours
from src.crusca import create_app, config_lib, main
import src.crusca
class CruscaTests(unittest.TestCase):
@patch('src.crusca.github_bp')
def test_blueprint_loaded(self, github_bp_mock):
app = create_a... | {
"repo_name": "riquito/crusca",
"path": "tests/test_crusca.py",
"copies": "1",
"size": "1128",
"license": "apache-2.0",
"hash": 4213512725774227500,
"line_mean": 35.3870967742,
"line_max": 104,
"alpha_frac": 0.6710992908,
"autogenerated": false,
"ratio": 3.1508379888268156,
"config_test": true,... |
# builtins
import assembling
from compiling import CompileLater, NoodleFunction, NoodleModule, ExecStmt
from error import NoodleSyntaxError, NoodleCompilerError
from NoodleBasics import (Symbol, NoCompilation, unique_name, current_macros)
predefineds = {}
def make_special(funcname):
def add_to_predefineds(func):... | {
"repo_name": "thepaul/noodle",
"path": "Noodle/builtins.py",
"copies": "1",
"size": "49015",
"license": "mit",
"hash": -6682534683016917000,
"line_mean": 32.7568870523,
"line_max": 80,
"alpha_frac": 0.6064266041,
"autogenerated": false,
"ratio": 3.6283218595010736,
"config_test": false,
"has... |
"""builtin SQL writer"""
#
# very adhoc SQL writer, didn't find Python module to do this without too much hassle
#
from itertools import tee
def _stringify(value):
return "'%s'" % value.replace("'", "''")
def _build_insert(table, columns, values):
column_str = ",".join(["`%s`" % c for c in columns])
val... | {
"repo_name": "mattikl/tackle",
"path": "tackle/formats/sqlwriter.py",
"copies": "1",
"size": "1194",
"license": "mit",
"hash": -5320613628601534000,
"line_mean": 28.85,
"line_max": 88,
"alpha_frac": 0.6373534338,
"autogenerated": false,
"ratio": 3.244565217391304,
"config_test": false,
"has_... |
"""Built in Target functions."""
import base64
from amfast.class_def.as_types import AsNoProxy
from amfast.remoting.flex_messages import CommandMessage
from amfast.remoting.channel import ChannelError, SecurityError
from amfast.remoting.endpoint import AmfEndpoint
# ---- NetConnection Operations --- #
def nc_auth(pa... | {
"repo_name": "limscoder/amfast",
"path": "amfast/remoting/targets.py",
"copies": "1",
"size": "3681",
"license": "mit",
"hash": 3317882774094555600,
"line_mean": 34.7378640777,
"line_max": 91,
"alpha_frac": 0.7087747895,
"autogenerated": false,
"ratio": 4.076411960132891,
"config_test": false,... |
"""Built-in template filters used with the ``|`` operator."""
import math
import random
import re
from collections import abc
from collections import namedtuple
from itertools import chain
from itertools import groupby
from markupsafe import escape
from markupsafe import Markup
from markupsafe import soft_str
from .e... | {
"repo_name": "pallets/jinja2",
"path": "src/jinja2/filters.py",
"copies": "1",
"size": "40520",
"license": "bsd-3-clause",
"hash": -5120968527997027000,
"line_mean": 28.7722263042,
"line_max": 87,
"alpha_frac": 0.618065153,
"autogenerated": false,
"ratio": 4.058493589743589,
"config_test": fal... |
"""Built-in template filters used with the ``|`` operator."""
import math
import random
import re
import typing
import typing as t
import warnings
from collections import abc
from itertools import chain
from itertools import groupby
from markupsafe import escape
from markupsafe import Markup
from markupsafe import sof... | {
"repo_name": "pallets/jinja",
"path": "src/jinja2/filters.py",
"copies": "1",
"size": "52577",
"license": "bsd-3-clause",
"hash": 7126826851917920000,
"line_mean": 27.8251096491,
"line_max": 87,
"alpha_frac": 0.6106662609,
"autogenerated": false,
"ratio": 3.7477368308503816,
"config_test": fal... |
"""Built-in transports."""
from __future__ import absolute_import, unicode_literals
from kombu.five import string_t
from kombu.utils.compat import _detect_environment
from kombu.utils.imports import symbol_by_name
def supports_librabbitmq():
"""Return true if :pypi:`librabbitmq` can be used."""
if _detect_en... | {
"repo_name": "kawamon/hue",
"path": "desktop/core/ext-py/kombu-4.3.0/kombu/transport/__init__.py",
"copies": "4",
"size": "3244",
"license": "apache-2.0",
"hash": 8757466641302028000,
"line_mean": 35.8636363636,
"line_max": 76,
"alpha_frac": 0.6439580764,
"autogenerated": false,
"ratio": 3.75898... |
"""Built-in transports."""
from kombu.utils.compat import _detect_environment
from kombu.utils.imports import symbol_by_name
def supports_librabbitmq():
"""Return true if :pypi:`librabbitmq` can be used."""
if _detect_environment() == 'default':
try:
import librabbitmq # noqa
exc... | {
"repo_name": "celery/kombu",
"path": "kombu/transport/__init__.py",
"copies": "2",
"size": "3139",
"license": "bsd-3-clause",
"hash": -1150975745146407000,
"line_mean": 35.5,
"line_max": 74,
"alpha_frac": 0.6390570245,
"autogenerated": false,
"ratio": 3.777376654632972,
"config_test": false,
... |
# --- builtin types
class class_:
def __repr__(self):
return self.__name__
class int_:
def __add__(self, b):
return b
def __and__(self, b):
return 1
def __or__(self, b):
return 1
def __xor__(self, b... | {
"repo_name": "jplevyak/pyc",
"path": "lib/builtin.py",
"copies": "1",
"size": "17994",
"license": "bsd-3-clause",
"hash": 4963674504915328000,
"line_mean": 23.185483871,
"line_max": 106,
"alpha_frac": 0.4167500278,
"autogenerated": false,
"ratio": 4.126117862875487,
"config_test": false,
"ha... |
"""Built-in widgets for the dashboard_app."""
from django.utils.timezone import now
from dashboard_app.widget_base import DashboardWidgetBase
class DummyWidget(DashboardWidgetBase):
"""Use this widget to test your installation."""
template_name = 'dashboard_app/widgets/dummy_widget.html'
def get_context... | {
"repo_name": "bitmazk/django-dashboard-app",
"path": "dashboard_app/dashboard_widgets.py",
"copies": "1",
"size": "1201",
"license": "mit",
"hash": 8101227054327120000,
"line_mean": 34.3235294118,
"line_max": 75,
"alpha_frac": 0.6544546211,
"autogenerated": false,
"ratio": 4.170138888888889,
"... |
"""Built phase, amplitude and surrogates."""
import json
with open("../../paper.json", 'r') as f: cfg = json.load(f) # noqa
import numpy as np
from tensorpac import Pac
from tensorpac.signals import pac_signals_tort
from brainets.utils import normalize
import seaborn as sns
import matplotlib.pyplot as plt
plt.styl... | {
"repo_name": "EtienneCmb/tensorpac",
"path": "paper/manuscript/code/fig_1_pac_process.py",
"copies": "1",
"size": "4421",
"license": "bsd-3-clause",
"hash": 1720565194539798800,
"line_mean": 33.811023622,
"line_max": 79,
"alpha_frac": 0.4944582674,
"autogenerated": false,
"ratio": 3.525518341307... |
#Built with Python 3.3.2
#This script allows for the interactive input from a user to create an EBS volume snapshot and select from what date and time snapshots should be retained and anything older than the specified date and time will be deleted
#The script will prompt for access & secret keys as well as region infor... | {
"repo_name": "scottstickells/AWS-Scripts",
"path": "ebs_snapshot_date1.0.py",
"copies": "1",
"size": "3332",
"license": "mit",
"hash": -6447134854100941000,
"line_mean": 82.3,
"line_max": 293,
"alpha_frac": 0.7761104442,
"autogenerated": false,
"ratio": 4.201765447667087,
"config_test": false,... |
#Built with Python 3.3.2
#This script allows for the interactive input from a user to create an EBS volume snapshot and select how many snapshots should be retained
#The script will prompt for access & secret keys as well as region information
#The script will then prompt to enter the volume to snapshot and the amount ... | {
"repo_name": "scottstickells/AWS-Scripts",
"path": "ebs_snapshot_number1.0.py",
"copies": "1",
"size": "3621",
"license": "mit",
"hash": -2383935664331125000,
"line_mean": 76.0425531915,
"line_max": 262,
"alpha_frac": 0.7798950566,
"autogenerated": false,
"ratio": 4.33133971291866,
"config_tes... |
# Buisness-logic layer
# Provides connection between Data (Models) and UI(Templates)
# Importing Libraries
from builtins import super
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.template import RequestContext
from django.contrib.auth.models import User
from django.views... | {
"repo_name": "Diagon/CFApp",
"path": "cakefactory/views.py",
"copies": "1",
"size": "4447",
"license": "mit",
"hash": -874991410320423000,
"line_mean": 36.6949152542,
"line_max": 118,
"alpha_frac": 0.6408814931,
"autogenerated": false,
"ratio": 4.148320895522388,
"config_test": false,
"has_n... |
# Bukin Function #6
# https://www.sfu.ca/~ssurjano/bukin6.html
#
# Dimensions: 2
# The sixth Bukin function has many local minima, all of which lie in a ridge.
# Input Domain:
# The function is usually evaluated on the rectangle x1 in [-15, -5], x2 in [-3, 3].
# Global Minimum:
# f(x*) = 0 at x* = (-10, 1)
# Referen... | {
"repo_name": "d53dave/csaopt",
"path": "examples/bukin_6/bukin_6_opt.py",
"copies": "2",
"size": "1870",
"license": "mit",
"hash": 6254357764699211000,
"line_mean": 24.6164383562,
"line_max": 153,
"alpha_frac": 0.6737967914,
"autogenerated": false,
"ratio": 3.0161290322580645,
"config_test": f... |
"""bukkakegram URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | {
"repo_name": "delitamakanda/BukkakeGram",
"path": "bukkakegram/urls.py",
"copies": "1",
"size": "1172",
"license": "mit",
"hash": 3214569138307726000,
"line_mean": 36.8064516129,
"line_max": 80,
"alpha_frac": 0.70221843,
"autogenerated": false,
"ratio": 3.5195195195195197,
"config_test": false... |
# Bulb dropping puzzle, as seen on http://qntm.org/bulbs:
#
# The problem
#
# You have a 100-story building and 2 identical, supposedly-unbreakable
# light bulbs. You know for a fact that if you drop a bulb at floor 0 (i.e.
# ground level), the bulb will not break. You also know for a fact that if
# yo... | {
"repo_name": "jcarreiro/jmc-python",
"path": "puzzles/bulb_drop.py",
"copies": "1",
"size": "2991",
"license": "mit",
"hash": -9096217562853087000,
"line_mean": 39.5416666667,
"line_max": 92,
"alpha_frac": 0.6569709127,
"autogenerated": false,
"ratio": 3.003012048192771,
"config_test": false,
... |
"""Bulk geocoding API wrapper.
Attributes:
CENSUS_GEO_COLNAMES: column names in output from geocoding API.
"""
from __future__ import print_function
from __future__ import unicode_literals
from builtins import str
import csv
import fiona
from io import StringIO
from itertools import islice
import numpy as np
impo... | {
"repo_name": "nkrishnaswami/census",
"path": "uscensus/geocode/bulk.py",
"copies": "1",
"size": "9821",
"license": "apache-2.0",
"hash": 4140507421788180500,
"line_mean": 29.7868338558,
"line_max": 90,
"alpha_frac": 0.5246919866,
"autogenerated": false,
"ratio": 4.213213213213213,
"config_test... |
"""Bulk geocoding API wrapper.
Attributes:
CENSUS_GEO_COLNAMES: column names in output from geocoding API.
"""
import asyncio
import csv
from io import StringIO
from itertools import islice
import logging
import glob
import os
import os.path
import geopandas as gpd
import httpx
import pandas as pd
import shapely
... | {
"repo_name": "nkrishnaswami/uscensus",
"path": "uscensus/geocode/bulk.py",
"copies": "1",
"size": "9319",
"license": "apache-2.0",
"hash": -3035731369871310300,
"line_mean": 29.7557755776,
"line_max": 79,
"alpha_frac": 0.5355724863,
"autogenerated": false,
"ratio": 4.089074155331286,
"config_t... |
"""Bulk importer for manually-prepared tariff CSV.
This probably won't be used again following initial data load, so
could be deleted after that.
"""
import csv
import logging
from datetime import datetime
from django.core.management.base import BaseCommand
from django.db import transaction
from dmd.models import ... | {
"repo_name": "annapowellsmith/openpresc",
"path": "openprescribing/dmd/management/commands/bulk_import_drug_tariff.py",
"copies": "1",
"size": "2479",
"license": "mit",
"hash": 4689830445475476000,
"line_mean": 34.4142857143,
"line_max": 71,
"alpha_frac": 0.4868898749,
"autogenerated": false,
"r... |
# Bulk insert/update DB operations for the Django ORM. Useful when
# inserting/updating lots of objects where the bottleneck is overhead
# in talking to the database. Instead of doing this
#
# for x in seq:
# o = SomeObject()
# o.foo = x
# o.save()
#
# or equivalently this
#
# for x in seq:
# ... | {
"repo_name": "gtaylor/django-eve-db",
"path": "eve_db/ccp_importer/bulkops.py",
"copies": "1",
"size": "2751",
"license": "bsd-3-clause",
"hash": -1542970923207114800,
"line_mean": 33.835443038,
"line_max": 121,
"alpha_frac": 0.649218466,
"autogenerated": false,
"ratio": 3.6197368421052634,
"c... |
""" Bulk modes of operation
"""
# Standard Library
import glob
import os
import sys
import shutil
from dateutil.parser import parse
import itertools
import calendar
import datetime
# C Library
import pandas as pd
import numpy as np
# OfferPandas
from OfferPandas import Frame, load_offerframe
# Tessen extenions
im... | {
"repo_name": "NigelCleland/Tessen",
"path": "Tessen/bulk_operation.py",
"copies": "1",
"size": "6104",
"license": "bsd-3-clause",
"hash": -1508912957417262600,
"line_mean": 35.1183431953,
"line_max": 802,
"alpha_frac": 0.6798820446,
"autogenerated": false,
"ratio": 3.363085399449036,
"config_t... |
# Bulk object resolver.
# The purpose of this module is to quickly load objects of different
# types from the backend. It's typically used by the API serialiser
# to ensure that nested objects are loaded only once.
#
import logging
from normality import stringify
from collections import defaultdict
from aleph.core imp... | {
"repo_name": "alephdata/aleph",
"path": "aleph/logic/resolver.py",
"copies": "1",
"size": "2565",
"license": "mit",
"hash": 1510889323192013300,
"line_mean": 29.9036144578,
"line_max": 74,
"alpha_frac": 0.649122807,
"autogenerated": false,
"ratio": 3.617771509167842,
"config_test": false,
"h... |
"""Bulk operations for indexd"""
import json
import flask
from indexd.errors import UserError
from indexd.index.drivers.alchemy import IndexRecord, IndexRecordUrl
from sqlalchemy.orm import joinedload
blueprint = flask.Blueprint("bulk", __name__)
blueprint.config = dict()
blueprint.index_driver = None
@blueprint... | {
"repo_name": "LabAdvComp/indexd",
"path": "indexd/bulk/blueprint.py",
"copies": "1",
"size": "1661",
"license": "apache-2.0",
"hash": 2662447219430246400,
"line_mean": 30.9423076923,
"line_max": 80,
"alpha_frac": 0.686935581,
"autogenerated": false,
"ratio": 3.9360189573459716,
"config_test": ... |
""" Bulletins script for x/84. """
# More to be added as soon as we get a filebase going.
from x84.bbs import getsession, getterminal, echo, list_users, get_user
from x84.bbs import gosub, showart, getch
from common import waitprompt
import os
__author__ = 'Hellbeard'
__version__ = 1.1
# ----------------------------... | {
"repo_name": "x84-extras/bulletins",
"path": "bulletins.py",
"copies": "1",
"size": "3047",
"license": "mit",
"hash": -8262320469649975000,
"line_mean": 29.1683168317,
"line_max": 98,
"alpha_frac": 0.5037742041,
"autogenerated": false,
"ratio": 3.7113276492082825,
"config_test": false,
"has_... |
"""BulletML expression evaluator.
http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html
"""
# BulletML assumes 1/2 = 0.5.
from __future__ import division
import random
import re
from bulletml.errors import Error
__all__ = ["ExprError", "NumberDef", "INumberDef"]
class ExprError(Error):
"""Raised when an ... | {
"repo_name": "andarms/pyweek22",
"path": "bulletml/expr.py",
"copies": "1",
"size": "2700",
"license": "mit",
"hash": 4035890706955830300,
"line_mean": 29.6818181818,
"line_max": 80,
"alpha_frac": 0.5548148148,
"autogenerated": false,
"ratio": 3.8793103448275863,
"config_test": false,
"has_n... |
"""BulletML implementation."""
from __future__ import division
from math import atan2, sin, cos
__all__ = ["Action", "Bullet"]
class Action(object):
"""Running action implementation.
To implement new actions, add a new element/class pair to
parser.ActionDef.CONSTRUCTORS. It should support FromXML,
... | {
"repo_name": "andarms/pyweek22",
"path": "bulletml/impl.py",
"copies": "1",
"size": "7533",
"license": "mit",
"hash": 3897405444676559400,
"line_mean": 30.6512605042,
"line_max": 75,
"alpha_frac": 0.5591397849,
"autogenerated": false,
"ratio": 4.150413223140496,
"config_test": false,
"has_no... |
"""BulletML parser.
BulletML is the Bullet Markup Language. BulletML can describe the
barrage of bullets in shooting games. (For example Progear, Psyvariar,
Gigawing2, G DARIUS, XEVIOUS, ...) This module parses and executes
BulletML scripts in Python. All data structures in it are
renderer-agnostic. A sample renderer ... | {
"repo_name": "andarms/pyweek22",
"path": "bulletml/__init__.py",
"copies": "1",
"size": "1709",
"license": "mit",
"hash": 5216868033866334000,
"line_mean": 34.6041666667,
"line_max": 70,
"alpha_frac": 0.7355178467,
"autogenerated": false,
"ratio": 3.390873015873016,
"config_test": false,
"ha... |
"""BulletML parser.
This is based on the format described at
http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/bulletml_ref_e.html.
Unless you are adding support for new actions, the only class you
should care about in here is BulletML.
"""
from __future__ import division
from math import sin, cos, radians, pi as PI
f... | {
"repo_name": "andarms/pyweek22",
"path": "bulletml/parser.py",
"copies": "1",
"size": "32946",
"license": "mit",
"hash": -3979154955034896400,
"line_mean": 30.6484149856,
"line_max": 79,
"alpha_frac": 0.5509014751,
"autogenerated": false,
"ratio": 4.160373784568758,
"config_test": false,
"ha... |
"""Bully Algorithm."""
import time
import pickle
import thread
import socket
import select
def _send_election_messages(node):
"""Send election messages to all Node's with higher IDs than this one."""
#send election message to all higher ID processes
time.sleep(0.10)
for ID, ip_info in node._ip_table.i... | {
"repo_name": "nickmarton/Paxos-Distributed-Calendar",
"path": "Classes/Bully.py",
"copies": "1",
"size": "3381",
"license": "mit",
"hash": 7817472679188938000,
"line_mean": 34.5894736842,
"line_max": 79,
"alpha_frac": 0.5912451937,
"autogenerated": false,
"ratio": 4.029797377830751,
"config_te... |
# bultin library
from uuid import uuid4
# external libraries
from sanic import Sanic
from sanic.response import json
from sanic_cors import CORS
from passlib.hash import pbkdf2_sha256
app = Sanic()
USERS = []
SALT = "aslkdfjl@@#&/askdjf@@%#$(()(/l2kjrlkjlkejrlkwjer"
def hash_password(password):
return pbkdf... | {
"repo_name": "dsvalenciah/soc-net",
"path": "app.py",
"copies": "1",
"size": "2395",
"license": "mit",
"hash": 872597551547769600,
"line_mean": 25.6111111111,
"line_max": 77,
"alpha_frac": 0.5991649269,
"autogenerated": false,
"ratio": 3.446043165467626,
"config_test": false,
"has_no_keyword... |
"""Bump version and create Github release
This script should be run locally, not on a build server.
"""
import argparse
import contextlib
import os
import json
import re
import requests
import subprocess
import sys
import git
import github
import changelog
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__f... | {
"repo_name": "akinwale/lbry-app",
"path": "build/release.py",
"copies": "1",
"size": "8296",
"license": "mit",
"hash": -4045889350615348000,
"line_mean": 32.184,
"line_max": 121,
"alpha_frac": 0.6236740598,
"autogenerated": false,
"ratio": 3.635407537248028,
"config_test": false,
"has_no_key... |
"""Bump version and create Github release
This script should be run locally, not on a build server.
"""
import argparse
import contextlib
import os
import re
import requests
import subprocess
import sys
import git
import github
import changelog
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
DAE... | {
"repo_name": "MaxiBoether/lbry-app",
"path": "build/release.py",
"copies": "1",
"size": "7908",
"license": "mit",
"hash": -3668846911426289700,
"line_mean": 31.6776859504,
"line_max": 97,
"alpha_frac": 0.6160849772,
"autogenerated": false,
"ratio": 3.597816196542311,
"config_test": false,
"h... |
"""Bump version and create Github release
This script should be run locally, not on a build server.
"""
import argparse
import contextlib
import os
import re
import subprocess
import sys
import git
import github
import changelog
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def main():
b... | {
"repo_name": "lbryio/lbryum",
"path": "release/release.py",
"copies": "1",
"size": "6603",
"license": "mit",
"hash": -5492217341238083000,
"line_mean": 30.8985507246,
"line_max": 97,
"alpha_frac": 0.6238073603,
"autogenerated": false,
"ratio": 3.5711195240670635,
"config_test": false,
"has_n... |
# bumpversion patch
# python setup.py register sdist upload
# from distutils.core import setup
from setuptools import setup, find_packages
import sys
import os
import os.path as op
import distutils.spawn as ds
import distutils.dir_util as dd
from setuptools.command.install import install
import platform
## This file ... | {
"repo_name": "mjirik/skelet3d",
"path": "setup.py",
"copies": "1",
"size": "4113",
"license": "bsd-3-clause",
"hash": 8614109897944124000,
"line_mean": 31.904,
"line_max": 98,
"alpha_frac": 0.5905664965,
"autogenerated": false,
"ratio": 3.8224907063197024,
"config_test": false,
"has_no_keywo... |
""" Bunch is a subclass of dict with attribute-style access.
>>> b = Bunch()
>>> b.hello = 'world'
>>> b.hello
'world'
>>> b['hello'] += "!"
>>> b.hello
'world!'
>>> b.foo = Bunch(lol=True)
>>> b.foo.lol
True
>>> b.foo is b['foo']
True
It is safe to import *... | {
"repo_name": "mwaskom/moss",
"path": "moss/external/bunch.py",
"copies": "1",
"size": "14775",
"license": "bsd-3-clause",
"hash": 1482956176944805400,
"line_mean": 32.202247191,
"line_max": 94,
"alpha_frac": 0.5306260575,
"autogenerated": false,
"ratio": 3.9410509469191783,
"config_test": fals... |
""" Bunch of helping classes and functions """
import cStringIO as StringIO
import os
import subprocess
import threading
import traceback
from multiprocessing import Process, Queue
import logging
LOGGER = logging.getLogger(__name__)
def encoding_normalazer(messages):
""" encodes message report text to utf-8 """
... | {
"repo_name": "timvideos/slidelint",
"path": "src/slidelint/utils.py",
"copies": "1",
"size": "5631",
"license": "apache-2.0",
"hash": 5023012547753526000,
"line_mean": 32.921686747,
"line_max": 79,
"alpha_frac": 0.564908542,
"autogenerated": false,
"ratio": 4.537469782433521,
"config_test": fa... |
"""Bunch of random util functions."""
import flask
def limit_json_batch(events, max_size=10240):
"""Given a list of stuff, yeild lists of stuff
which, when json encoded, would be
of length less than max_size."""
# First lets go through and encode all the events
encoded_events = [flask.json.dumps(even... | {
"repo_name": "tomwilkie/awesomation",
"path": "src/common/utils.py",
"copies": "1",
"size": "1058",
"license": "mit",
"hash": 7110943029876881000,
"line_mean": 26.1282051282,
"line_max": 64,
"alpha_frac": 0.6285444234,
"autogenerated": false,
"ratio": 3.5384615384615383,
"config_test": false,
... |
# bunch of stuff that didn't work.
#costs, seq = shortest_sequences(grammar)
#print(costs)
#print(seq)
#print(rules)
##results = grammar.parse(tokenize("hello plus ppe"))
##print("count:", len(results))
##print("shortest:", results.shortest)
##tot = 0
##for result in results:
## print(list(result))
## if resul... | {
"repo_name": "cheery/grammarboy",
"path": "trash.py",
"copies": "1",
"size": "2789",
"license": "mit",
"hash": 8346240783340960000,
"line_mean": 28.0520833333,
"line_max": 64,
"alpha_frac": 0.5238436716,
"autogenerated": false,
"ratio": 3.2889150943396226,
"config_test": true,
"has_no_keywor... |
"""Bunch of tools helpful for working with vk api"""
import requests
api_url = 'https://api.vk.com/method/{method_name}?{parameters}&access_token={access_token}'
auth_url = 'https://oauth.vk.com/authorize?client_id={app_id}&scope={scope}&redirect_uri=http://oauth.vk.com/blank.html&display=page&response_type=token'
c... | {
"repo_name": "litvinchuck/python-scripts",
"path": "utils/vk.py",
"copies": "2",
"size": "3218",
"license": "mit",
"hash": 8607980170688350000,
"line_mean": 30.2427184466,
"line_max": 153,
"alpha_frac": 0.6131137352,
"autogenerated": false,
"ratio": 3.8911729141475213,
"config_test": false,
... |
# bunch of util codes
import time
import sys
import operator
from collections import defaultdict
import tensorflow as tf
import numpy as np
import json
# taken from kelvin guu's traversing_knowledge_graphs repo, (since I really liked it).
def verboserate(iterable, time_wait=5, report=None):
"""
Iterate verbos... | {
"repo_name": "thaihungle/deepexp",
"path": "kbtext-mann/util.py",
"copies": "3",
"size": "4213",
"license": "mit",
"hash": -2564252809085456000,
"line_mean": 32.9758064516,
"line_max": 132,
"alpha_frac": 0.5976738666,
"autogenerated": false,
"ratio": 3.4674897119341566,
"config_test": false,
... |
# bunch of utility objects
import theano
from deepmonster.nnet.theano.popstats import get_inference_graph
def tuplify(tup):
if tup is not None:
if isinstance(tup, str):
tup = (tup,)
else:
assert isinstance(tup, (list, tuple))
return tup
class VarsToTrackHolder(object):... | {
"repo_name": "olimastro/DeepMonster",
"path": "deepmonster/machinery/utils.py",
"copies": "1",
"size": "2103",
"license": "mit",
"hash": 7354971660888721000,
"line_mean": 32.380952381,
"line_max": 80,
"alpha_frac": 0.5791726106,
"autogenerated": false,
"ratio": 3.695957820738137,
"config_test"... |
'''Bunch utility class.
Developed at ESSS (http://esss.com.br) and provided under the MIT license.
@author: Bruno Oliveira
@author: Fabio Zadrozny
Based on implementation by Alex Martelli (http://mail.python.org/pipermail
/python-list/2002-July/112007.html).
To use:
class Point(Bunch):
x = 0
y = 0
p0 = P... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577999_Bunch_class_created_attributes/recipe-577999.py",
"copies": "1",
"size": "5763",
"license": "mit",
"hash": 3564385372054713000,
"line_mean": 32.701754386,
"line_max": 80,
"alpha_frac": 0.4825611661,
"autogenerated": false,
"ratio": ... |
"""Bundle HDF5 DLLs into an h5py wheel on Windows
This is meant to do something like auditwheel on Linux & delocate on Mac,
but h5py-specific.
"""
from base64 import urlsafe_b64encode
from contextlib import contextmanager
from glob import glob
import hashlib
import os
import os.path as osp
import shutil
import sys
imp... | {
"repo_name": "h5py/h5py",
"path": "ci/bundle_hdf5_whl.py",
"copies": "1",
"size": "2651",
"license": "bsd-3-clause",
"hash": 2809806253378994700,
"line_mean": 27.8152173913,
"line_max": 73,
"alpha_frac": 0.5846850245,
"autogenerated": false,
"ratio": 3.3684879288437104,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.