text
stringlengths
0
1.05M
meta
dict
# A simple tool to connect to the Ensembl server and retrieve sequences using # the Ensembl REST API. from __future__ import print_function import json import optparse from itertools import islice import requests from six.moves.urllib.parse import urljoin parser = optparse.OptionParser() parser.add_option('-i', '--i...
{ "repo_name": "PerlaTroncosoRey/tgac-galaxytools", "path": "tools/Ensembl-REST/get_sequences.py", "copies": "2", "size": "1979", "license": "mit", "hash": 3939747932937843700, "line_mean": 40.2291666667, "line_max": 144, "alpha_frac": 0.6503284487, "autogenerated": false, "ratio": 3.7623574144486...
"""A simple TV show renamer, no TVDB required Args: file (str): Path to the file you want to rename -s / --silent (bool): Program will run without any messages (except unknown exceptions). Attributes: SHOWNAMES_DICT_FILEPATH (str): showname match dictionary JSON filepath """ import re import argpa...
{ "repo_name": "ROldford/tvregex", "path": "tvregex/tvregex.py", "copies": "1", "size": "10618", "license": "mit", "hash": -8033595166736801000, "line_mean": 32.7079365079, "line_max": 76, "alpha_frac": 0.5936146167, "autogenerated": false, "ratio": 3.7559250088432967, "config_test": false, "h...
# A simple type validator to check types of bdecoded data that comes from # an untrusted source (say, network). # # This source module is in public domain. You may do whatever you want with it. # # Originally written by Heikki Orsila <heikki.orsila@iki.fi> on 2009-09-12 from types import FunctionType # BOOL*, INT*, S...
{ "repo_name": "japeq/bencode-tools", "path": "typevalidator.py", "copies": "1", "size": "6044", "license": "bsd-3-clause", "hash": 8296411709688626000, "line_mean": 32.7653631285, "line_max": 134, "alpha_frac": 0.5177035076, "autogenerated": false, "ratio": 3.3484764542936287, "config_test": fa...
# A Simple UDP class import socket class UDP(object): """simple UDP ping class""" handle = None # Socket for send/recv port = 0 # UDP port we work on address = '' # Own address broadcast = '' # Broadcast address def __init__(self, port, address=None, broadcast=None): if a...
{ "repo_name": "soscpd/bee", "path": "root/tests/zguide/examples/Python/udplib.py", "copies": "1", "size": "1329", "license": "mit", "hash": 329172411702204160, "line_mean": 31.4146341463, "line_max": 90, "alpha_frac": 0.5914221219, "autogenerated": false, "ratio": 3.9790419161676644, "config_te...
''' A simple UI that shows a valence arousal (VA) graph with 6 universal emotion touch points. Will write values to NAO memory. ''' from kivy.app import App from kivy.uix.widget import Widget from kivy.graphics import Color, Ellipse, Line from kivy.uix.button import Button from kivy.uix.label import Label from n...
{ "repo_name": "davesnowdon/nao-emotional-framework", "path": "python_prototypes/standalone_VA_based_UI.py", "copies": "1", "size": "5758", "license": "apache-2.0", "hash": -4573431949208360400, "line_mean": 36.3896103896, "line_max": 118, "alpha_frac": 0.5620006947, "autogenerated": false, "ratio...
# A simple upload script to add pictures to a database. # ARGV: # [0]: The script name # [1]: The packed ziparchive (named for it's directory: example.zip becomes example/) # [2]: The gallery directory # [3]: The name of the gallery import os, zipfile, re import MySQLdb as mdb from PIL import Image from fnmatc...
{ "repo_name": "justanr/PHP-Galleria", "path": "upload.py", "copies": "1", "size": "5589", "license": "mit", "hash": 5857253033757712000, "line_mean": 30.9371428571, "line_max": 97, "alpha_frac": 0.5428520308, "autogenerated": false, "ratio": 3.5644132653061225, "config_test": false, "has_no_k...
"""A simple URL shortener using Werkzeug and redis.""" import os import redis from jinja2 import Environment from jinja2 import FileSystemLoader from werkzeug.exceptions import HTTPException from werkzeug.exceptions import NotFound from werkzeug.middleware.shared_data import SharedDataMiddleware from werkzeug.routing ...
{ "repo_name": "pallets/werkzeug", "path": "examples/shortly/shortly.py", "copies": "1", "size": "4568", "license": "bsd-3-clause", "hash": -1792375020338852600, "line_mean": 32.3430656934, "line_max": 88, "alpha_frac": 0.6149299475, "autogenerated": false, "ratio": 3.8290025146689017, "config_t...
"""A simple utility to convert csv files to bibtex.""" import re import os import csv import sys import argparse import textwrap import numpy as np from nltk.corpus import stopwords from bibtexparser.bwriter import BibTexWriter from bibtexparser.bibdatabase import BibDatabase STOP_WORDS = stopwords.words('english') ...
{ "repo_name": "joandamerow/lit-mining-occurrencedb", "path": "util/csv_to_bibtex.py", "copies": "1", "size": "7434", "license": "isc", "hash": -399882508084543940, "line_mean": 26.5333333333, "line_max": 78, "alpha_frac": 0.5608017218, "autogenerated": false, "ratio": 3.8941854374017812, "confi...
# A simple value function iteration example: the standard dynamic investment/consumption problem # utility function is log() and production function is k^alpha from __future__ import division #use Python 3 division operation (Python 2 does integer division by default) import numpy as np #set parameters A = 1 alpha = 0...
{ "repo_name": "tobanw/py-econ-examples", "path": "value_function_iteration.py", "copies": "1", "size": "2628", "license": "mit", "hash": 2361679606427094000, "line_mean": 35.5, "line_max": 117, "alpha_frac": 0.6544901065, "autogenerated": false, "ratio": 3.0665110851808635, "config_test": false...
# A simple vector class def vec(*v): return apply(Vec, v) class Vec: def __init__(self, *v): self.v = [] for x in v: self.v.append(x) def fromlist(self, v): self.v = [] if type(v) <> type([]): raise TypeError self.v = v[:] return...
{ "repo_name": "OS2World/APP-INTERNET-torpak_2", "path": "Demo/classes/Vec.py", "copies": "1", "size": "1151", "license": "mit", "hash": -658614749522852000, "line_mean": 16.984375, "line_max": 44, "alpha_frac": 0.4448305821, "autogenerated": false, "ratio": 3.2061281337047354, "config_test": fa...
"""A simple view with a text box, to display log messages obtained from the stream handler""" from julesTk import view __author__ = "Joeri Jongbloets <joeri@jongbloets.net>" class LogView(view.Frame): """A view to show log messages""" def __init__(self, parent): super(LogView, self).__init__(parent...
{ "repo_name": "jjongbloets/julesTk", "path": "julesTk/utils/console.py", "copies": "1", "size": "1612", "license": "mit", "hash": -5604416678394960000, "line_mean": 28.8518518519, "line_max": 93, "alpha_frac": 0.6060794045, "autogenerated": false, "ratio": 3.5428571428571427, "config_test": tru...
""" A simple way of interacting to a ethereum node through JSON RPC commands. """ from __future__ import print_function from builtins import map from builtins import str from builtins import object import logging import warnings import json import gevent from ethereum.abi import ContractTranslator from ethereum.tools....
{ "repo_name": "ethereum/pyethapp", "path": "pyethapp/rpc_client.py", "copies": "1", "size": "30408", "license": "mit", "hash": 9204775271048691000, "line_mean": 34.816254417, "line_max": 125, "alpha_frac": 0.59234412, "autogenerated": false, "ratio": 4.514251781472684, "config_test": false, "...
""" A simple way of interacting to a ethereum node through JSON RPC commands. """ import logging import time import warnings import json import gevent from ethereum.abi import ContractTranslator from ethereum.keys import privtoaddr from ethereum.transactions import Transaction from ethereum.utils import denoms, int_to...
{ "repo_name": "RomanZacharia/pyethapp", "path": "pyethapp/rpc_client.py", "copies": "1", "size": "23308", "license": "mit", "hash": -8914590944920157000, "line_mean": 34.9691358025, "line_max": 123, "alpha_frac": 0.6040844345, "autogenerated": false, "ratio": 4.416903543680121, "config_test": f...
""" A simple way of interacting to a ethereum node through JSON RPC commands. """ import logging import warnings import json import gevent from ethereum.abi import ContractTranslator from ethereum.tools.keys import privtoaddr from ethereum.transactions import Transaction from ethereum.utils import denoms, int_to_big_e...
{ "repo_name": "changwu-tw/pyethapp", "path": "pyethapp/rpc_client.py", "copies": "1", "size": "30236", "license": "mit", "hash": 7640459665317167000, "line_mean": 35.0811455847, "line_max": 115, "alpha_frac": 0.5915465009, "autogenerated": false, "ratio": 4.522961854899028, "config_test": false...
"""A simple webapp2 server.""" import os.path import urllib from google.appengine.api import users from google.appengine.ext import ndb from google.appengine.api import memcache from google.appengine.runtime import DeadlineExceededError import jinja2 import webapp2 import models import geojson import time import l...
{ "repo_name": "arobrien/brisbanebikewaychecker", "path": "brisbanebikewaychecker.py", "copies": "1", "size": "9102", "license": "mit", "hash": -6031406756594941000, "line_mean": 35.7056451613, "line_max": 126, "alpha_frac": 0.5598769501, "autogenerated": false, "ratio": 4.285310734463277, "conf...
"""A simple webapp2 server.""" import sys sys.path.insert(0, 'lib') import cgi import webapp2 import rdflib from rdflib import Graph import pyparsing MAIN_PAGE_HTML = """\ <!doctype html> <html> <body> <script src="js/jquery/jquery-1.11.0.min.js"></script> <script src="js/arbor/arbor.js"></script> ...
{ "repo_name": "reinvantveer/semcontext", "path": "helloworld.py", "copies": "1", "size": "11648", "license": "mit", "hash": -4159816468294894600, "line_mean": 36.4488448845, "line_max": 687, "alpha_frac": 0.6265453297, "autogenerated": false, "ratio": 3.050013092432574, "config_test": false, ...
"""A simple web crawler -- classes implementing crawling logic.""" import asyncio import cgi from http.client import BadStatusLine import logging import re import time import urllib.parse logger = logging.getLogger(__name__) def unescape(s): """The inverse of cgi.escape().""" s = s.replace('&quot;', '"').re...
{ "repo_name": "mikar/60-days-of-python", "path": "webcrawler/crawling.py", "copies": "1", "size": "18360", "license": "mit", "hash": -151917443345292000, "line_mean": 35.6467065868, "line_max": 79, "alpha_frac": 0.5557734205, "autogenerated": false, "ratio": 4.084538375973303, "config_test": fa...
# A simple web crawler - still under development # 简单的网络爬虫 - 还在开发中 import urllib2 # for get_page(url) def crawler(seed): to_crawl = [seed] crawled = [] while to_crawl: url = to_crawl.pop to_crawl = get_links_in_a_page(url, to_crawl, crawled) crawled.append(url) def get_links_in...
{ "repo_name": "roy2020china/BingDemo", "path": "10_web_crawler.py", "copies": "1", "size": "1119", "license": "mit", "hash": -5968316038344713000, "line_mean": 23.8863636364, "line_max": 62, "alpha_frac": 0.5753424658, "autogenerated": false, "ratio": 2.9594594594594597, "config_test": false, ...
"""A simple web server for video annotation""" # parsing args import argparse # encoding / decoding import json # time / logging import time #import logging #import traceback # flask import flask from flask_cors import CORS, cross_origin import tornado.wsgi import tornado.httpserver # database import sqlite3 # re...
{ "repo_name": "happyharrycn/vatic_fpv", "path": "simple_vatic/server/web_app.py", "copies": "1", "size": "32608", "license": "mit", "hash": 3825575773130755600, "line_mean": 39.7103620474, "line_max": 130, "alpha_frac": 0.564892051, "autogenerated": false, "ratio": 4.161306789178152, "config_te...
"""A simple web server that accepts POSTS containing a list of feed urls, and returns the titles of those feeds. """ import eventlet feedparser = eventlet.import_patched('feedparser') # the pool provides a safety limit on our concurrency pool = eventlet.GreenPool() def fetch_title(url): d = feedparser.parse(url)...
{ "repo_name": "cloudera/hue", "path": "desktop/core/ext-py/eventlet-0.24.1/examples/feedscraper.py", "copies": "10", "size": "1125", "license": "apache-2.0", "hash": -5100363753745846000, "line_mean": 29.4054054054, "line_max": 77, "alpha_frac": 0.656, "autogenerated": false, "ratio": 3.800675675...
"""A simple web server that accepts POSTS containing a list of feed urls, and returns the titles of those feeds. """ import evy feedparser = evy.import_patched('feedparser') # the pool provides a safety limit on our concurrency pool = evy.GreenPool() def fetch_title (url): d = feedparser.parse(url) return d....
{ "repo_name": "inercia/evy", "path": "examples/feedscraper.py", "copies": "1", "size": "1102", "license": "mit", "hash": 4288047885381993500, "line_mean": 28, "line_max": 77, "alpha_frac": 0.6424682396, "autogenerated": false, "ratio": 3.6490066225165565, "config_test": false, "has_no_keyword...
#a simple web server to replace the buggy one in python's standard library import os, os.path, sys, time, socket, traceback, stat from math import * INDEXFILE = "/bluenoise6.html" PORT = 8080 mimetypes = { ".js" : "application/x-javascript", ".html" : "text/html", ".json" : "application/x-javascript", ".gl...
{ "repo_name": "joeedh/BlueNoiseStippling", "path": "serv.py", "copies": "1", "size": "5248", "license": "mit", "hash": -6771048206116360000, "line_mean": 20.3333333333, "line_max": 74, "alpha_frac": 0.5322027439, "autogenerated": false, "ratio": 3.265712507778469, "config_test": false, "has_n...
#a simple web server to replace the buggy one in python's standard library import os, os.path, sys, time, socket, traceback, stat from math import * INDEXFILE = "/main.html" PORT = 8079 mimetypes = { ".js" : "application/x-javascript", ".html" : "text/html", ".json" : "application/x-javascript", ".glsl" : ...
{ "repo_name": "joeedh/small-loader.es6", "path": "serv.py", "copies": "1", "size": "5241", "license": "mit", "hash": 7091665429418229000, "line_mean": 20.3048780488, "line_max": 74, "alpha_frac": 0.5315779431, "autogenerated": false, "ratio": 3.269494697442296, "config_test": false, "has_no_k...
"""A simple web spider implementation.""" __all__ = [ 'Document', 'Spider', 'Parser', ] import functools import logging import typing from garage.collections import NamedTuple from garage.http import clients from garage.threads import queues from garage.threads import supervisors from garage.threads impo...
{ "repo_name": "clchiou/garage", "path": "py/garage/garage/spiders.py", "copies": "1", "size": "6380", "license": "mit", "hash": 1405430948359090200, "line_mean": 30.4285714286, "line_max": 78, "alpha_frac": 0.6040752351, "autogenerated": false, "ratio": 4.36986301369863, "config_test": false, ...
"""A Simple Wildfire-inspired MDP model. Version 1.0""" import random, math, numpy def simulate(timesteps, policy=[0,0,0], random_seed=0, model_parameters={}, SILENT=False, PROBABILISTIC_CHOICES=True): random.seed(random_seed) constant_reward = 2 if "Constant Reward" in model_parameters.keys(): ...
{ "repo_name": "buckinha/gravity", "path": "SWIMM.py", "copies": "1", "size": "7661", "license": "mpl-2.0", "hash": 243023378303836450, "line_mean": 34.6325581395, "line_max": 139, "alpha_frac": 0.5914371492, "autogenerated": false, "ratio": 3.78320987654321, "config_test": false, "has_no_keyw...
"""A Simple Wildfire-inspired MDP model. Version 1.1""" import random, math, numpy def simulate(timesteps, policy=[0,0,0], random_seed=0, model_parameters={}, SILENT=False, PROBABILISTIC_CHOICES=True): random.seed(random_seed) #range of the randomly drawn, uniformally distributed "event" that corres...
{ "repo_name": "buckinha/gravity", "path": "SWIMMv1_1.py", "copies": "1", "size": "8713", "license": "mpl-2.0", "hash": 2658447383516361000, "line_mean": 35.9194915254, "line_max": 163, "alpha_frac": 0.5979570756, "autogenerated": false, "ratio": 3.8231680561649846, "config_test": false, "has_...
"""A simple wrapper for Asterisk call file actions.""" class Action(object): """A generic Asterisk action.""" pass class Application(Action): """Stores and manipulates Asterisk applications and data.""" def __init__(self, application, data): """Create a new `Application` object. :p...
{ "repo_name": "rdegges/pycall", "path": "pycall/actions.py", "copies": "1", "size": "1417", "license": "unlicense", "hash": 7019433707068752000, "line_mean": 27.9183673469, "line_max": 79, "alpha_frac": 0.6125617502, "autogenerated": false, "ratio": 4.4420062695924765, "config_test": false, "...
"""A simple wrapper for Asterisk call files.""" from __future__ import with_statement from shutil import move from time import mktime from pwd import getpwnam from tempfile import mkstemp from os import chown, error, utime import os from path import Path from .call import Call from .actions import Action, Context f...
{ "repo_name": "rdegges/pycall", "path": "pycall/callfile.py", "copies": "1", "size": "4959", "license": "unlicense", "hash": 8546422790357098000, "line_mean": 30.5859872611, "line_max": 79, "alpha_frac": 0.5854002823, "autogenerated": false, "ratio": 4.256652360515021, "config_test": false, "...
"""A simple wrapper for Asterisk calls.""" class Call(object): """Stores and manipulates Asterisk calls.""" def __init__(self, channel, callerid=None, variables=None, account=None, wait_time=None, retry_time=None, max_retries=None): """Create a new `Call` object. :param str chann...
{ "repo_name": "rdegges/pycall", "path": "pycall/call.py", "copies": "1", "size": "2476", "license": "unlicense", "hash": 9113417343231359000, "line_mean": 35.9552238806, "line_max": 79, "alpha_frac": 0.5868336026, "autogenerated": false, "ratio": 4.006472491909385, "config_test": false, "has_...
"""A simple wrapper for `tvtk.Cutter`. """ # Author: Prabhu Ramachandran <prabhu_r@users.sf.net> # Copyright (c) 2005-2008, Enthought, Inc. # License: BSD Style. # Enthought library imports. from traits.api import Instance, Property from traitsui.api import View, Group, Item from tvtk.api import tvtk # Local imports...
{ "repo_name": "dmsurti/mayavi", "path": "mayavi/components/cutter.py", "copies": "3", "size": "2478", "license": "bsd-3-clause", "hash": -8944235589836962000, "line_mean": 32.04, "line_max": 74, "alpha_frac": 0.4963680387, "autogenerated": false, "ratio": 4.631775700934579, "config_test": false...
'''A simple wrapper of logging that support color prompt on Linux''' import sys import logging from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL __all__ = ['getlogger', 'stdoutlogger', 'filelogger', 'streamlogger', 'ColorFormatter', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] # Note:...
{ "repo_name": "TylerTemp/docpie", "path": "docpie/bashlog.py", "copies": "1", "size": "5834", "license": "mit", "hash": 5387916541138713000, "line_mean": 30.5351351351, "line_max": 76, "alpha_frac": 0.6091875214, "autogenerated": false, "ratio": 3.6123839009287924, "config_test": false, "has_...
"""A simple wrapper to call sendmail-like binary.""" # ============================================================================= # CONTENTS # ----------------------------------------------------------------------------- # phlsys_sendmail # # Public Classes: # Sendmail # .set_default_binary # .set_default_pa...
{ "repo_name": "cs-shadow/phabricator-tools", "path": "py/phl/phlsys_sendmail.py", "copies": "4", "size": "2647", "license": "apache-2.0", "hash": -7504162105024252000, "line_mean": 34.2933333333, "line_max": 79, "alpha_frac": 0.5527011711, "autogenerated": false, "ratio": 4.486440677966102, "co...
"""A simple WSGI application that just echoes the request body. This is a good starting point for other WSGI applications. See the source for what's implemented and why. Configuration Options:: [wsgi_echo] call = brim.wsgi_echo.WSGIEcho # path = <path> # The request path to match and serve; any oth...
{ "repo_name": "gholt/python-brim", "path": "brim/wsgi_echo.py", "copies": "1", "size": "6078", "license": "apache-2.0", "hash": 1791162680371552300, "line_mean": 38.9868421053, "line_max": 72, "alpha_frac": 0.5904902929, "autogenerated": false, "ratio": 4.502222222222223, "config_test": true, ...
""" A simplified version mimicking the built-in property class. See https://docs.python.org/2/howto/descriptor.html """ class Property(object): def __init__(self, fget, fset=None): self.fget = fget self.fset = fset self.__name__ = fget.__name__ def __get__(self, obj, objtype=None): ...
{ "repo_name": "seanlin0800/python_snippets", "path": "simple_property.py", "copies": "1", "size": "1043", "license": "unlicense", "hash": -4860573266512922000, "line_mean": 22.7045454545, "line_max": 63, "alpha_frac": 0.573346117, "autogenerated": false, "ratio": 3.8773234200743496, "config_tes...
'''A simplistic LL(1) parser for lambda-terms @author: F. Peschanski ''' if __name__ == "__main__": import sys sys.path.append("../src") from popparser import Grammar, parsers, tokens from popparser.llparser import LLParsing from popparser.tokenizer import Tokenizer class Term: def __init__(self, start...
{ "repo_name": "fredokun/popparser", "path": "test/lambda_parser.py", "copies": "1", "size": "5718", "license": "mit", "hash": 9055428222434673000, "line_mean": 34.725, "line_max": 79, "alpha_frac": 0.5225682295, "autogenerated": false, "ratio": 4.033874382498236, "config_test": false, "has_no...
""" A simplistic pickle-and-file-based store for CRON urls, that failed to be executed """ import os.path import datetime from pickle import load, dump from functools import partial, wraps from twisted.web.client import Agent, WebClientContextFactory from twisted.web.http_headers import Headers from twisted.internet ...
{ "repo_name": "pytlakp/intranetref", "path": "src/intranet3/cron/failsafe.py", "copies": "1", "size": "6233", "license": "mit", "hash": -1238911578105851000, "line_mean": 37.245398773, "line_max": 119, "alpha_frac": 0.5482111343, "autogenerated": false, "ratio": 4.100657894736842, "config_test"...
"""A simply script to scrape zmq.h for the zeromq version. This is similar to the version.sh script in a zeromq source dir, but it searches for an installed header, rather than in the current dir. """ # Copyright (c) PyZMQ Developers # Distributed under the terms of the Modified BSD License. from __future__ import wi...
{ "repo_name": "Mustard-Systems-Ltd/pyzmq", "path": "zmqversion.py", "copies": "7", "size": "3916", "license": "bsd-3-clause", "hash": 9041915508493684000, "line_mean": 31.9075630252, "line_max": 105, "alpha_frac": 0.5990806946, "autogenerated": false, "ratio": 3.605893186003683, "config_test": ...
""" A simulation environment for simple blackjack (see blackjack.pdf) The state is playerSum in {12-20}, dealerCard in {1-10}, and usableAce (boolean) The actions are hit or stick, 1 or 0 """ from pylab import * playerSum = 0 dealerCard = 0 usableAce = False def card(): return min(10, randint(1,14)) def...
{ "repo_name": "smithe0/366Prog1", "path": "blackjack.py", "copies": "1", "size": "2887", "license": "apache-2.0", "hash": 6590946340741328000, "line_mean": 28.7628865979, "line_max": 91, "alpha_frac": 0.5992379633, "autogenerated": false, "ratio": 3.486714975845411, "config_test": false, "has...
""" A simulation of diffusion """ import importlib import math import numpy as np import matplotlib import matplotlib.pyplot as plt import mesh.patch as patch from simulation_null import NullSimulation, grid_setup, bc_setup import multigrid.MG as MG from util import msg class Simulation(NullSimulation): """ A s...
{ "repo_name": "zingale/pyro2", "path": "diffusion/simulation.py", "copies": "1", "size": "4732", "license": "bsd-3-clause", "hash": 6576336203106591000, "line_mean": 29.7272727273, "line_max": 92, "alpha_frac": 0.5338123415, "autogenerated": false, "ratio": 3.428985507246377, "config_test": fal...
""" A simulation of diffusion """ import importlib import math import numpy as np import matplotlib.pyplot as plt import mesh.patch as patch from simulation_null import NullSimulation, grid_setup, bc_setup import multigrid.MG as MG from util import msg class Simulation(NullSimulation): """ A simulation of diffu...
{ "repo_name": "harpolea/pyro2", "path": "diffusion/simulation.py", "copies": "1", "size": "4636", "license": "bsd-3-clause", "hash": -7553926476143549000, "line_mean": 29.5, "line_max": 92, "alpha_frac": 0.5299827437, "autogenerated": false, "ratio": 3.413843888070692, "config_test": false, "...
"""A simulator for Zombie Apocalypse. (see Munz et al. 2009) http://mysite.science.uottawa.ca/rsmith43/Zombies.pdf """ import os # Set this before import matplotlib os.environ['MPLCONFIGDIR'] = '/tmp' # This is needed before importing pyplot for rendering the image import matplotlib matplotlib.use('Agg') import nu...
{ "repo_name": "GoogleCloudPlatform/appengine-scipy-zombie-apocalypse-python", "path": "zombie_apocalypse.py", "copies": "1", "size": "5368", "license": "apache-2.0", "hash": 3910787837652989400, "line_mean": 37.3428571429, "line_max": 77, "alpha_frac": 0.6177347243, "autogenerated": false, "ratio...
"""A Simulator object holds together information about and functionality of cellular automaton simulators. """ # This file is part of zasim. zasim is licensed under the BSD 3-clause license. # See LICENSE.txt for details. try: from .external.qt import QObject, Signal except ImportError: from zasim.lightweig...
{ "repo_name": "timo/zasim", "path": "zasim/simulator.py", "copies": "1", "size": "8237", "license": "bsd-3-clause", "hash": 4566577815396524000, "line_mean": 32.2137096774, "line_max": 104, "alpha_frac": 0.6266844725, "autogenerated": false, "ratio": 4.2415036045314105, "config_test": true, "...
"""A single clock for all patchers.""" MIN_START_TIME = 86400.0 # Windows support unix times starting from 86,400. class TimeMachineClock(object): """Unifing class for clock types.""" def __init__(self, start_time=MIN_START_TIME, clock_listeners=None): """Initialise a unified clock.""" if ...
{ "repo_name": "snudler6/time-travel", "path": "src/time_travel/time_machine_clock.py", "copies": "1", "size": "1033", "license": "mit", "hash": 753145375360163800, "line_mean": 27.6944444444, "line_max": 77, "alpha_frac": 0.5876089061, "autogenerated": false, "ratio": 4.165322580645161, "config...
"""A single common terminal for all websockets. """ import tornado.web # This demo requires tornado_xstatic and XStatic-term.js import tornado_xstatic from terminado import TermSocket, SingleTermManager from common_demo_stuff import run_and_show_browser, STATIC_DIR, TEMPLATE_DIR class TerminalPageHandler(tornado.web....
{ "repo_name": "akalipetis/terminado", "path": "demos/single.py", "copies": "4", "size": "1267", "license": "bsd-2-clause", "hash": 2676608328521362400, "line_mean": 38.625, "line_max": 76, "alpha_frac": 0.6069455406, "autogenerated": false, "ratio": 4.0094936708860756, "config_test": false, "...
"""A single layer of black phosphorus""" from math import pi, sin, cos import pybinding as pb def monolayer_4band(num_hoppings=5): """Monolayer phosphorene lattice using the four-band model Parameters ---------- num_hoppings : int Number of hopping terms to consider: from t2 to t5. """ ...
{ "repo_name": "MAndelkovic/pybinding", "path": "pybinding/repository/phosphorene.py", "copies": "2", "size": "2298", "license": "bsd-2-clause", "hash": 3866831495226111500, "line_mean": 35.4761904762, "line_max": 74, "alpha_frac": 0.3416013925, "autogenerated": false, "ratio": 2.8092909535452324,...
"""A single place for constructing and exposing the main parser """ import os import sys from typing import List, Tuple from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.commands import commands_dict, get_similar_commands...
{ "repo_name": "pypa/pip", "path": "src/pip/_internal/cli/main_parser.py", "copies": "4", "size": "2614", "license": "mit", "hash": 1702276450586536200, "line_mean": 29.0459770115, "line_max": 86, "alpha_frac": 0.6534047437, "autogenerated": false, "ratio": 3.7994186046511627, "config_test": fal...
"""A single place for constructing and exposing the main parser """ import os import sys from pipenv.patched.notpip._internal.cli import cmdoptions from pipenv.patched.notpip._internal.cli.parser import ( ConfigOptionParser, UpdatingDefaultsHelpFormatter, ) from pipenv.patched.notpip._internal.commands import...
{ "repo_name": "kennethreitz/pipenv", "path": "pipenv/patched/notpip/_internal/cli/main_parser.py", "copies": "1", "size": "2927", "license": "mit", "hash": 8470825658093950000, "line_mean": 28.5656565657, "line_max": 88, "alpha_frac": 0.6508370345, "autogenerated": false, "ratio": 3.6957070707070...
"""A single place for constructing and exposing the main parser """ import os import sys from pip import __version__ from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ( ConfigOptionParser, UpdatingDefaultsHelpFormatter, ) from pip._internal.commands import ( commands_dict, get_simi...
{ "repo_name": "huguesv/PTVS", "path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/pip/_internal/cli/main_parser.py", "copies": "5", "size": "3002", "license": "apache-2.0", "hash": 5921931613611613000, "line_mean": 27.8653846154, "line_max": 77, "alpha_frac": 0.6332445037, "autogener...
"""A single place for constructing and exposing the main parser """ import os import sys from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.commands import commands_dict, get_similar_commands from pip._internal.exceptions ...
{ "repo_name": "jsirois/pex", "path": "pex/vendor/_vendored/pip/pip/_internal/cli/main_parser.py", "copies": "4", "size": "2830", "license": "apache-2.0", "hash": 1399369011953255700, "line_mean": 28.4791666667, "line_max": 86, "alpha_frac": 0.6462897527, "autogenerated": false, "ratio": 3.7783711...
"""A single place for constructing and exposing the main parser """ import os import sys from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ( ConfigOptionParser, UpdatingDefaultsHelpFormatter, ) from pip._internal.commands import commands_dict, get_similar_commands from pip._interna...
{ "repo_name": "mdworks2016/work_development", "path": "Python/20_Third_Certification/venv/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", "copies": "13", "size": "2843", "license": "apache-2.0", "hash": 3087813262610980000, "line_mean": 27.7171717172, "line_max": 77, "alpha_frac": 0.64...
"""A single place for constructing and exposing the main parser """ import os import sys from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ( ConfigOptionParser, UpdatingDefaultsHelpFormatter, ) from pip._internal.commands import ( commands_dict, get_similar_commands, get_summaries,...
{ "repo_name": "perlygatekeeper/glowing-robot", "path": "Little_Alchemy_2/Scraper_python/env/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", "copies": "9", "size": "2817", "license": "artistic-2.0", "hash": -7539006061369997000, "line_mean": 27.7448979592, "line_max": 77, "alpha_frac": ...
"""A single place for FHIR concepts.""" from collections import namedtuple from rdr_service.census_regions import census_regions Concept = namedtuple("Concept", ["system", "code"]) SYSTEM_CONSENT_FORM = "http://terminology.pmi-ops.org/CodeSystem/consent-form" ENROLLMENT_CONSENT_FORM = Concept(SYSTEM_CONSENT_FORM, ...
{ "repo_name": "all-of-us/raw-data-repository", "path": "rdr_service/concepts.py", "copies": "1", "size": "4142", "license": "bsd-3-clause", "hash": -5132223090346454000, "line_mean": 41.2653061224, "line_max": 98, "alpha_frac": 0.7508450024, "autogenerated": false, "ratio": 2.4906794948887554, ...
"""A single process, persistent multi-producer, multi-consumer queue.""" import os import pickle import sys import tempfile if sys.version_info < (3, 0): from Queue import Queue as SyncQ else: from queue import Queue as SyncQ def _truncate(fn, length): fd = os.open(fn, os.O_RDWR) os.ftruncate(fd, le...
{ "repo_name": "balena/python-pqueue", "path": "pqueue/pqueue.py", "copies": "1", "size": "4811", "license": "bsd-3-clause", "hash": 5164981360515170000, "line_mean": 30.8609271523, "line_max": 82, "alpha_frac": 0.554562461, "autogenerated": false, "ratio": 3.7733333333333334, "config_test": fal...
# A single sample test taken from: # https://github.com/EsriOceans/btm/tree/master/tests import arcpy import os import sys import unittest try: from tempdir import TempDir from scripts import bpi from scripts import utils except: print("Example only, see full testing suite for operational code.") ...
{ "repo_name": "scw/scipy-devsummit-2015-talk", "path": "examples/nose-test.py", "copies": "1", "size": "1861", "license": "apache-2.0", "hash": -2379910719131580400, "line_mean": 37.7708333333, "line_max": 81, "alpha_frac": 0.6217087587, "autogenerated": false, "ratio": 4.210407239819005, "conf...
# A singleton to handle flags, which can be imported more easily # as it will not suffer the problems with circular references that # the CommandLine singleton suffers from. # xia2#42: this is due for retirement & working into the Phil structure import os from xia2.Wrappers.XDS.XDS import xds_read_xparm class _Fla...
{ "repo_name": "xia2/xia2", "path": "src/xia2/Handlers/Flags.py", "copies": "1", "size": "2082", "license": "bsd-3-clause", "hash": -3996701249702875000, "line_mean": 25.3544303797, "line_max": 76, "alpha_frac": 0.6176753122, "autogenerated": false, "ratio": 3.47, "config_test": false, "has_no...
""" A singleton to process Python objects and spit out xml """ from lxml import etree def xmlify(object_): """ a generic Python function to take a python object and serialize it as XML. Note that the output is entirely dependent on the data structure of the input - which makes this function useful fo...
{ "repo_name": "commtrack/commtrack-old-to-del", "path": "apps/transformers/xml.py", "copies": "4", "size": "4960", "license": "bsd-3-clause", "hash": 630833529011874800, "line_mean": 44.9259259259, "line_max": 126, "alpha_frac": 0.5558467742, "autogenerated": false, "ratio": 4.279551337359793, ...
""" A singleton to process Python objects and spit out xml """ from lxml import etree def xmlify(object_): """ a generic Python function to take a python object and serialize it as XML. Note that the output is entirely dependent on the data structure of the input - which makes this function us...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/transformers/xml.py", "copies": "1", "size": "5068", "license": "bsd-3-clause", "hash": -1301307385871422700, "line_mean": 44.9259259259, "line_max": 126, "alpha_frac": 0.5440015785, "autogenerated": false, "ratio": 4.36896551724138, "confi...
""" A singly-linked-list implementation. """ class Node(object): """ The proverbial Node. Based initially on: http://stackoverflow.com/a/283630/577190 """ def __init__(self, data=None, next_node=None): self.data = data self.next_node = next_node class SinglyLinkedL...
{ "repo_name": "thisismyrobot/dsa", "path": "src/singly_linked_list.py", "copies": "1", "size": "3302", "license": "unlicense", "hash": 903107472618014800, "line_mean": 25.7478991597, "line_max": 78, "alpha_frac": 0.5175651121, "autogenerated": false, "ratio": 4.137844611528822, "config_test": f...
"""A singly-linked list""" class SLNode(object): """A single node in the list. Attributes: value: the value stored at this node next: the next node in the list """ def __init__(self, value, next_node): self.value = value self.next = next_node def __repr__(self): ...
{ "repo_name": "johnwilmes/py-data-structures", "path": "py_data_structures/slist.py", "copies": "1", "size": "4424", "license": "mit", "hash": 5246400173591173000, "line_mean": 27.358974359, "line_max": 78, "alpha_frac": 0.5592224231, "autogenerated": false, "ratio": 4.27852998065764, "config_t...
# A singular message for an error. An error is made up of multiple error messages # A error message defines the formatting of an error. class _ErrorMessage: def __init__(self, message:str = None, content:str = None, object = None, tokens:[] = None...
{ "repo_name": "CameronLonsdale/jam", "path": "compiler/errors.py", "copies": "2", "size": "3775", "license": "mit", "hash": -7392158869071803000, "line_mean": 29.4435483871, "line_max": 90, "alpha_frac": 0.5846357616, "autogenerated": false, "ratio": 4.241573033707865, "config_test": false, "...
"""A sink using the PhilDB timeseries database.""" from phildb.create import create from phildb.exceptions import AlreadyExistsError, DuplicateError from phildb.database import PhilDB from sensor_feed.sink import BufferedSink class PhilDBSink(BufferedSink): """ A buffered sink using the PhilDB timeseries...
{ "repo_name": "dmkent/sensor-feed", "path": "sensor_feed/sink_phildb.py", "copies": "1", "size": "2221", "license": "mit", "hash": -498506583046116860, "line_mean": 34.8225806452, "line_max": 86, "alpha_frac": 0.6118865376, "autogenerated": false, "ratio": 4.514227642276423, "config_test": fals...
"""askcoding URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/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') Class-b...
{ "repo_name": "akarambir/askcoding", "path": "askcoding/urls.py", "copies": "1", "size": "1220", "license": "mit", "hash": 8707821029722068000, "line_mean": 39.6666666667, "line_max": 105, "alpha_frac": 0.7081967213, "autogenerated": false, "ratio": 3.5057471264367814, "config_test": false, "...
"""a skeleton class for archive records""" from __future__ import print_function from gzip import GzipFile import re from hanzo.warctools.stream import open_record_stream strip = re.compile(br'[^\w\t \|\\\/]') def add_headers(**kwargs): """a useful helper for defining header names in record formats""" def...
{ "repo_name": "internetarchive/warctools", "path": "hanzo/warctools/record.py", "copies": "1", "size": "7116", "license": "mit", "hash": 2851246191979667500, "line_mean": 33.712195122, "line_max": 116, "alpha_frac": 0.6001967397, "autogenerated": false, "ratio": 4.142025611175786, "config_test"...
"""a skeleton class for archive records""" from gzip import GzipFile import re import urlparse from hanzo.warctools.stream import open_record_stream strip = re.compile(r'[^\w\t \|\\\/]') content_content_type = re.compile("Content-Type: (.*?)\r") def add_headers(**kwargs): """a useful helper for defining header...
{ "repo_name": "martinsbalodis/warc-tools", "path": "hanzo/warctools/record.py", "copies": "1", "size": "4320", "license": "mit", "hash": -6760290832787171000, "line_mean": 28.7931034483, "line_max": 89, "alpha_frac": 0.5763888889, "autogenerated": false, "ratio": 3.985239852398524, "config_test...
"""A skeleton file for a class dealing with different spectral models""" import numpy as np import pyspeckit from subcube import SubCube class MultiCube: def __init__(self, *args): """ A collection of Specfit objects mapped to SubCubes by the mapper method. Includes* methods to fit multiple...
{ "repo_name": "vlas-sokolov/multicube", "path": "multicube/multicube.py", "copies": "1", "size": "2587", "license": "mit", "hash": -6150599167763892000, "line_mean": 32.5974025974, "line_max": 72, "alpha_frac": 0.6238886741, "autogenerated": false, "ratio": 4.491319444444445, "config_test": fal...
#Ask for country ID from user then show all regions that belong to that country # then prompt region name and display more info about it. #Python 2.7, change raw_input to input for 3.x version from erepapi import api, CountryRegions api.public_key="your public key goes here" api.private_key="your private key goes her...
{ "repo_name": "Nikola-K/erepAPI", "path": "docs/examples/c_regions_example.py", "copies": "1", "size": "1828", "license": "mit", "hash": -4824405579554876000, "line_mean": 34.1730769231, "line_max": 117, "alpha_frac": 0.5393873085, "autogenerated": false, "ratio": 3.79253112033195, "config_test...
#Ask for country ID, name or just print list of all countries #Python 2.7, change raw_input to input for 3.x version from erepapi import api, Country api.public_key="your public key goes here" api.private_key="your private key goes here" country=Country() while True: user_choice=int(raw_input("Enter option.\n1...
{ "repo_name": "Nikola-K/erepAPI", "path": "docs/examples/country_example.py", "copies": "1", "size": "2738", "license": "mit", "hash": 4589752255759257600, "line_mean": 26.1188118812, "line_max": 72, "alpha_frac": 0.6150474799, "autogenerated": false, "ratio": 3.4834605597964376, "config_test":...
# ask for int, report runnig total / version 1 num = 0 total = 0 while num != -1: total = total + num print("total so far = " + str(total)) num = int(input("next int: ")) # ask for int, report runnig total / version 2 total = 0 while True: num = int(input("next int: ")) if num == -1: break...
{ "repo_name": "sgolitsynskiy/sergey.cs.uni.edu", "path": "www/courses/cs1510/fall2017/sessions/092117.py", "copies": "1", "size": "1456", "license": "mit", "hash": -2457461500574343000, "line_mean": 20.7313432836, "line_max": 50, "alpha_frac": 0.5178571429, "autogenerated": false, "ratio": 3.2355...
# Asks for price, if it isn't a number asks again while True: try: cost = float(raw_input("What is the cost of your meal? $")) break except ValueError: print("Please enter a monetary value.") # Asks for tax and then figures out said tax, if it isn't a number asks again while Tr...
{ "repo_name": "TheDeepEnd/python-snippets", "path": "kahlin_tip_calculator.py", "copies": "1", "size": "1243", "license": "mit", "hash": -2592000232586785000, "line_mean": 35.5882352941, "line_max": 132, "alpha_frac": 0.6403861625, "autogenerated": false, "ratio": 3.6666666666666665, "config_te...
# Ask the user to enter the names of files to compare fname1 = "output.txt" fname2 = "naive_output.txt" # Open file for reading in text mode (default mode) f1 = open(fname1) f2 = open(fname2) # Print confirmation print("-----------------------------------") print("Comparing files ", " > " + fname1, " < " +fname2, sep...
{ "repo_name": "saisankargochhayat/algo_quest", "path": "Rishav/workstation/comparer.py", "copies": "2", "size": "1647", "license": "apache-2.0", "hash": -4258296064730263600, "line_mean": 27.3965517241, "line_max": 76, "alpha_frac": 0.5634486946, "autogenerated": false, "ratio": 3.334008097165992...
### Ask the user to input a number # assign a number to a variable x=1 # then do a while loop while x==1: number1=int(input("Please enter the first number: ")) number2=int(input("Please enter the second number: ")) number3=int(input("Please enter the third number: ")) # conditions if (number1>num...
{ "repo_name": "dracaether/python", "path": "highestnumber_loop.py", "copies": "1", "size": "7768", "license": "mit", "hash": -2728737577738959000, "line_mean": 40.9891891892, "line_max": 118, "alpha_frac": 0.4997425335, "autogenerated": false, "ratio": 4.396151669496321, "config_test": false, ...
### Ask the user to input a number # define the first user-defined function. In this case, this is the main() def main(): number1=int(input("Please enter the first number: ")) number2=int(input("Please enter the second number: ")) number3=int(input("Please enter the third number: ")) if (number1>number...
{ "repo_name": "dracaether/python", "path": "highestnumber_function.py", "copies": "1", "size": "2083", "license": "mit", "hash": -693856223951467600, "line_mean": 35.5438596491, "line_max": 118, "alpha_frac": 0.6293807009, "autogenerated": false, "ratio": 3.8431734317343174, "config_test": fals...
"""ask URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/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') Class-based ...
{ "repo_name": "etanever/nginx-django-bootstrap", "path": "ask/ask/urls.py", "copies": "1", "size": "1179", "license": "mit", "hash": -1508746747125765400, "line_mean": 37.0322580645, "line_max": 79, "alpha_frac": 0.6624257846, "autogenerated": false, "ratio": 3.358974358974359, "config_test": f...
"""ask URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/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') Class-based v...
{ "repo_name": "takzhanov/stepic-web-tech", "path": "ask/ask/urls.py", "copies": "1", "size": "1184", "license": "mit", "hash": -5164911643556594000, "line_mean": 37.1935483871, "line_max": 77, "alpha_frac": 0.660472973, "autogenerated": false, "ratio": 3.316526610644258, "config_test": false, ...
"""Ask WolframAlpha questions.""" from bs4 import BeautifulSoup from plumeria import config from plumeria.command import commands, CommandError from plumeria.plugin import PluginSetupError from plumeria.util import http from plumeria.util.format import escape_markdown from plumeria.util.ratelimit import rate_limit a...
{ "repo_name": "sk89q/Plumeria", "path": "orchard/wolfram.py", "copies": "1", "size": "2030", "license": "mit", "hash": -1745920846239642000, "line_mean": 28.8529411765, "line_max": 108, "alpha_frac": 0.5862068966, "autogenerated": false, "ratio": 3.8666666666666667, "config_test": false, "has...
"""A skyrimsque dungeon""" minions_killed, boss_killed, money_looted, stuff_taken, potion_taken =\ False, False, False, False, False door_locked = True stairs_found = False health = 0 facing_towards = 'east' orientation = { 'ahead': 'east', 'left': 'north', 'right': 'south', 'back': 'west' } sente...
{ "repo_name": "anupamsr/TheAdventurer", "path": "ex36.py", "copies": "1", "size": "19388", "license": "unlicense", "hash": -3645461180374799400, "line_mean": 39.0578512397, "line_max": 100, "alpha_frac": 0.5215081494, "autogenerated": false, "ratio": 3.8399683105565456, "config_test": false, ...
"""A Slack bot using the real-time messaging API.""" from itertools import count import json import logging from random import randint from textwrap import dedent from aiohttp import MsgType, ws_connect from aslack import __name__ as mod_name, __version__ from aslack.slack_api import SlackApiError, SlackBotApi from ...
{ "repo_name": "textbook/aslack", "path": "aslack/slack_bot/bot.py", "copies": "1", "size": "9574", "license": "isc", "hash": -3928088515859787300, "line_mean": 32.5929824561, "line_max": 79, "alpha_frac": 0.5715479423, "autogenerated": false, "ratio": 4.247559893522626, "config_test": false, ...
"""ASL-English Translation Trials Usage: asl_english_trials.py [options] Options: -h, --help show this help -f, --ffmpeg EXE ffmpeg executable [default: c:/ffmpeg/bin/ffmpeg.exe] """ if __name__ == '__main__': import os, errno, sys from docopt import docopt config = docopt(__doc_...
{ "repo_name": "benjaminanible/dissertation", "path": "asl_english_trials.py", "copies": "1", "size": "2474", "license": "bsd-3-clause", "hash": 2625619195597705000, "line_mean": 27.7674418605, "line_max": 116, "alpha_frac": 0.6261115602, "autogenerated": false, "ratio": 3.853582554517134, "conf...
"""A slice factory that generates slices given an input stream.""" import random from math import pi from collections import OrderedDict def get_slice(frame_rate, stream_size, ratio=1.0): block = int(frame_rate * ratio) start = random.randint(0,stream_size-block-1) return slice(start, start+block) def ge...
{ "repo_name": "RemyPorter/Mangler", "path": "mangler/randomizers.py", "copies": "1", "size": "3311", "license": "mit", "hash": -6330077961818400000, "line_mean": 26.8235294118, "line_max": 82, "alpha_frac": 0.5738447599, "autogenerated": false, "ratio": 3.630482456140351, "config_test": false, ...
"""A slide which can show widgets.""" from bisect import bisect from typing import List, Optional from kivy.graphics.vertex_instructions import Rectangle from kivy.uix.screenmanager import Screen from kivy.uix.stencilview import StencilView from kivy.graphics import Color from kivy.properties import ListProperty, Alia...
{ "repo_name": "missionpinball/mpf-mc", "path": "mpfmc/uix/slide.py", "copies": "1", "size": "12290", "license": "mit", "hash": 8035044992925590000, "line_mean": 37.1677018634, "line_max": 119, "alpha_frac": 0.5983726607, "autogenerated": false, "ratio": 4.280738418669453, "config_test": true, ...
"""A slightly convoluted and stupid way of logging important information. """ import sys import traceback import os from functools import wraps from . import settings class logger: """A class that logs important info about the program. Same singleton implementation as the db module. """ __instance =...
{ "repo_name": "SeedyROM/kalci", "path": "kalci/logger.py", "copies": "1", "size": "1999", "license": "mit", "hash": -5287251369691053000, "line_mean": 29.7538461538, "line_max": 85, "alpha_frac": 0.5502751376, "autogenerated": false, "ratio": 4.627314814814815, "config_test": false, "has_no_k...
# A slightly earlier version of this module was submitted to the Python # standard library SIG, but never accepted (or rejected): # # https://mail.python.org/pipermail/stdlib-sig/2015-July/000990.html # # Copyright (c) 2015 Daniel Lenski <dlenski@gmail.com> # # Permission is hereby granted, free of charge, to any per...
{ "repo_name": "dlenski/python-vipaccess", "path": "vipaccess/patharg.py", "copies": "1", "size": "3808", "license": "apache-2.0", "hash": -7725460792836771000, "line_mean": 44.3333333333, "line_max": 87, "alpha_frac": 0.5913865546, "autogenerated": false, "ratio": 4.427906976744186, "config_tes...
"""A slightly smarter telnet client that, if available, supports readline.""" import telnetlib from telnetlib import IAC, WILL, DO, WONT, DONT, SB, SE from curses.ascii import NAK try: import readline old_readline_callback=readline.get_completer() except ImportError: readline=None def telnet_callback(sock...
{ "repo_name": "wallefan/cosmic-encounter", "path": "client.py", "copies": "1", "size": "2153", "license": "mit", "hash": -5599920687380048000, "line_mean": 36.7719298246, "line_max": 121, "alpha_frac": 0.6112401301, "autogenerated": false, "ratio": 3.618487394957983, "config_test": false, "ha...
'''A slugify function which handle unicode .. autofunction:: slugify ''' import re from unicodedata import normalize from html.entities import name2codepoint try: from unidecode import unidecode except ImportError: unidecode = None from .pep import to_string # character entity reference CHAR_ENTITY_REXP =...
{ "repo_name": "nooperpudd/pulsar", "path": "pulsar/utils/slugify.py", "copies": "6", "size": "2642", "license": "bsd-3-clause", "hash": -6022611373443985000, "line_mean": 24.6504854369, "line_max": 78, "alpha_frac": 0.6192278577, "autogenerated": false, "ratio": 3.7581792318634424, "config_test...
"""A small CLI application for tracking autoscaling of minions. For a minion to be auto-accepted by a Salt master there are two separate events that needs to happen: 1. new-instance: The autoscaling group must have published that minion will connect. 2. new-minion: The minion must have connected to the maste...
{ "repo_name": "JensRantil/saltstack-autoscaling", "path": "reactors/autoscaling/autoscale_registry.py", "copies": "1", "size": "8104", "license": "mit", "hash": 3799551181549672400, "line_mean": 31.2868525896, "line_max": 177, "alpha_frac": 0.6786771964, "autogenerated": false, "ratio": 3.7466481...
"""A small curses-based adventure game. By Tymewalk: https://scratch.mit.edu/users/Tymewalk https://github.com/Tymewalk """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(...
{ "repo_name": "Tymewalk/Tymeventure", "path": "setup.py", "copies": "1", "size": "3813", "license": "mit", "hash": -6507430046232397000, "line_mean": 33.9816513761, "line_max": 94, "alpha_frac": 0.6648308419, "autogenerated": false, "ratio": 4.022151898734177, "config_test": false, "has_no_ke...
# A small DNS server that anwsers all queries with the same IP. # From http://code.activestate.com/recipes/491264/ import socket class DNSQuery: def __init__(self, data): self.data=data self.dominio='' tipo = (ord(data[2]) >> 3) & 15 # Opcode bits if tipo == 0: # Standard quer...
{ "repo_name": "arkanis/minidyndns", "path": "references/fakedns.py", "copies": "1", "size": "1611", "license": "mit", "hash": 7110942148448881000, "line_mean": 32.5625, "line_max": 125, "alpha_frac": 0.5567970205, "autogenerated": false, "ratio": 3.0569259962049338, "config_test": false, "has...
"""A small function for listing installed Python instances on a Windows machine as defined by PEP 514.""" import os, winreg, collections # https://www.python.org/dev/peps/pep-0514/ def _enum_keys(key): nsub, nval, modified = winreg.QueryInfoKey(key) for i in range(nsub): yield winreg.EnumKey(key, i) ...
{ "repo_name": "SeanCline/PyExt", "path": "test/scripts/python_installations.py", "copies": "1", "size": "2537", "license": "mit", "hash": 6675060341210110000, "line_mean": 39.2857142857, "line_max": 105, "alpha_frac": 0.6306661411, "autogenerated": false, "ratio": 3.655619596541787, "config_tes...
# A small helper class to house functions needed by KeplerMapper.visualize import numpy as np from sklearn import preprocessing import json from collections import defaultdict from ast import literal_eval colorscale_default = [ [0.0, "rgb(68, 1, 84)"], # Viridis [0.1, "rgb(72, 35, 116)"], [0.2, "rgb(64, ...
{ "repo_name": "MLWave/kepler-mapper", "path": "kmapper/visuals.py", "copies": "1", "size": "12091", "license": "mit", "hash": -5311303685623446000, "line_mean": 28.134939759, "line_max": 117, "alpha_frac": 0.566123563, "autogenerated": false, "ratio": 3.3391328362330848, "config_test": false, ...
"""A small helper module to deal with sections in the control page. """ import os import re import wikiconnector def linesFromBulletlist(t): """Assume t is a mediawiki bullet list produced by readlines, one item per line. Return a list of the items, without the bullet syntax. """ regexp = " *(\*...
{ "repo_name": "hkarl/mw2pdf", "path": "section.py", "copies": "1", "size": "3372", "license": "bsd-3-clause", "hash": 1623517709730858800, "line_mean": 23.7941176471, "line_max": 84, "alpha_frac": 0.528173191, "autogenerated": false, "ratio": 3.943859649122807, "config_test": false, "has_no_k...
"""a small IOC container""" #TODO services (parallel for same runlevel) import inspect class Context(object): @classmethod def set_attribute(cls, obj, key, val): """recurisivly adds fields to obj according to key the final field will have val""" idx_dot = key.find('.') if idx_...
{ "repo_name": "toymachine/concurrence", "path": "lib/concurrence/application.py", "copies": "2", "size": "2706", "license": "bsd-3-clause", "hash": -1658141946087668500, "line_mean": 34.1428571429, "line_max": 104, "alpha_frac": 0.5450849963, "autogenerated": false, "ratio": 4.414355628058727, ...
"""A small library for interacting with the pactl command line tool. This library allows for a few simple interactions with linux pulseaudio, like viewing active sinks (sound outputs, usually loosely correlating with speakers) and their relative volumes, and setting volume absolutely or relatively. Most functions tak...
{ "repo_name": "bethebunny/powermate", "path": "pactl.py", "copies": "1", "size": "2412", "license": "apache-2.0", "hash": 1586372680451768800, "line_mean": 30.7368421053, "line_max": 81, "alpha_frac": 0.6608623549, "autogenerated": false, "ratio": 3.693721286370597, "config_test": false, "has...
"""A small library for parsing HTML.""" # standard library from html.parser import HTMLParser class PageParser(HTMLParser): ''' This is an HTML parser! All of the hard work is done by the superclass (which is a Python built-in). This class puts the HTML into a hierarchy that's (hopefully) easier to work ...
{ "repo_name": "undefx/delphi-epidata", "path": "src/acquisition/twtr/pageparser.py", "copies": "2", "size": "2208", "license": "mit", "hash": -8097969477504852000, "line_mean": 26.0253164557, "line_max": 86, "alpha_frac": 0.5987318841, "autogenerated": false, "ratio": 3.846689895470383, "config...
"""A small library for rich input. Adds validation and casting to builtins.input.""" import builtins from functools import wraps class TooManyAttempts(Exception): pass def limiter(limit, error=TooManyAttempts): """A decorator that limits the amount of times a function can be called. The decorated function ...
{ "repo_name": "bmispelon/putnik", "path": "putnik.py", "copies": "1", "size": "1787", "license": "bsd-2-clause", "hash": -4161650602700152000, "line_mean": 28.7833333333, "line_max": 79, "alpha_frac": 0.6373810856, "autogenerated": false, "ratio": 4.5470737913486, "config_test": false, "has_n...
""" A small library of time and data transformation functions. Author: Alastair Hughes """ from constants import MAX_FRAMES_PER_DAY, MIN_FRAMES_PER_DAY import math # Transformation functions: # These accept a map 'values' of the form values[row index][patch no], and # returns another map 'values' suitably transf...
{ "repo_name": "PlantandFoodResearch/IrrigationAnimation", "path": "transforms.py", "copies": "1", "size": "6058", "license": "mit", "hash": -8409265461337735000, "line_mean": 34.0173410405, "line_max": 81, "alpha_frac": 0.6041597887, "autogenerated": false, "ratio": 3.890815671162492, "config_t...
'''A small module for testing Serpent code, for use with py.test.''' import enum import operator from types import MethodType from warnings import simplefilter; simplefilter('ignore') from ethereum import tester as t from ethereum.utils import coerce_to_int Assert = enum.Enum("Assert", "eq,ne,lt,gt,le,ge") compare_ops...
{ "repo_name": "ChrisCalderon/SerpentTests", "path": "serpent_tests/__init__.py", "copies": "1", "size": "3458", "license": "mit", "hash": -3407190268443109400, "line_mean": 34.6494845361, "line_max": 112, "alpha_frac": 0.6353383459, "autogenerated": false, "ratio": 3.742424242424242, "config_te...
"""A small Python 3 module that keeps track of elapsed time and its current state""" import time import math __version__ = '0.1' class Clocker(object): """The time watcher class that keeps track of elapsed time and state""" def __init__(self): self.mode = 'init' self.startTime =...
{ "repo_name": "Fuchida/clocker", "path": "src/clocker.py", "copies": "1", "size": "3608", "license": "mit", "hash": -1216824103490420000, "line_mean": 30.8, "line_max": 85, "alpha_frac": 0.5579268293, "autogenerated": false, "ratio": 4.5786802030456855, "config_test": false, "has_no_keywords"...
# A small Python script to load the text files # output by the Haskell code, and compute log(Z) and H, # as well as create some plots. # Imports import matplotlib.pyplot as plt import numpy as np import numpy.random as rng import pandas as pd # Logsumexp function def logsumexp(x): biggest = x.max() y = x - bi...
{ "repo_name": "eggplantbren/NestedSampling.hs", "path": "showresults.py", "copies": "2", "size": "4141", "license": "mit", "hash": 506116487474145200, "line_mean": 27.3630136986, "line_max": 78, "alpha_frac": 0.5759478387, "autogenerated": false, "ratio": 3.4251447477253927, "config_test": fals...
# a small script which shows some of the possiblities of the # LKOpticalTrack filter # LKOpitcal is good low resource algorithm which is good at tracking points through a video # stream from org.myrobotlab.opencv import OpenCVFilterLKOpticalTrack # create services opencv = Runtime.createAndStart("opencv","OpenCV") #...
{ "repo_name": "sujitbehera27/MyRoboticsProjects-Arduino", "path": "src/resource/Python/examples/OpenCV.LKOpticalTrack.py", "copies": "5", "size": "1140", "license": "apache-2.0", "hash": -6641440500482467000, "line_mean": 29.8108108108, "line_max": 91, "alpha_frac": 0.7552631579, "autogenerated": f...
# A small SOCP formulation of minimizing the inverse of the top-left entry # of the positive 2x2 matrix [1,2; 3,4]. This example originally caused the # 30th SOCP IPM iteration to fail within the symmetric tridiagonal eigensolver # and was submitted by Steven Diamond. The original script was: # # from cvxpy import *...
{ "repo_name": "justusc/Elemental", "path": "examples/interface/InvPos.py", "copies": "1", "size": "2739", "license": "bsd-3-clause", "hash": -2670130170129702400, "line_mean": 21.825, "line_max": 78, "alpha_frac": 0.6370938299, "autogenerated": false, "ratio": 2.1772655007949124, "config_test":...