text stringlengths 0 1.05M | meta dict |
|---|---|
"""A script to plot a circular array geometry with 20 telescopes, and output the array elements"""
from __future__ import print_function, division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import scipy.signal as sig
import scipy.ndimage as nd
import pdb
#Parameters here
outfile = ... | {
"repo_name": "mikeireland/pfi",
"path": "pfi/plot_circ_array.py",
"copies": "1",
"size": "4241",
"license": "mit",
"hash": 5696149668094220000,
"line_mean": 28.2551724138,
"line_max": 119,
"alpha_frac": 0.6154208913,
"autogenerated": false,
"ratio": 2.3124318429661943,
"config_test": false,
... |
# a script to process folio text and create files for each play
import Shax_Folio as sxf
import re
#create full text object to get all titles
fol_obj = sxf.Play()
# use titles to name documents and to access texts
all_titles = fol_obj.titles
# the string to write the html file, if contains acts
def act_grammar(tit... | {
"repo_name": "jsw3/shax-apps",
"path": "Folio_site/ff_processor.py",
"copies": "1",
"size": "3846",
"license": "mit",
"hash": 4787657753802926000,
"line_mean": 31.8717948718,
"line_max": 81,
"alpha_frac": 0.4810192408,
"autogenerated": false,
"ratio": 3.521978021978022,
"config_test": false,
... |
"""A script to produce the coefficients in mel_sparse_coeffs.ts.
Rather than recompute the Mel2Linear coefficients in javascript each time, we
save them as a large array in mel_sparse_coeffs.ts. When you run this scipt it
outputs to stdout a list of lists, with each list containing sparse information
[x_idx, y_idx, va... | {
"repo_name": "magenta/magenta-js",
"path": "music/src/gansynth/gansynth_make_mel_sparse_coeffs.py",
"copies": "1",
"size": "3777",
"license": "apache-2.0",
"hash": 2785661474897438000,
"line_mean": 32.7232142857,
"line_max": 80,
"alpha_frac": 0.6706380725,
"autogenerated": false,
"ratio": 2.7114... |
#a script to read out our json data
#and write them to a file
#readJson.py url interval filebase
#will write to the file:
#timestamp jsonData
#filenames: filebase-xxx.tst
#xxx - gps,ais,trk
import os
import sys
import time
import urllib2
types={
'gps':('request=gps',1),
'ais':('request=ais',10),
... | {
"repo_name": "wellenvogel/avnav",
"path": "test/readJson.py",
"copies": "1",
"size": "1363",
"license": "mit",
"hash": -2678496133787112000,
"line_mean": 18.4857142857,
"line_max": 51,
"alpha_frac": 0.6177549523,
"autogenerated": false,
"ratio": 2.8045267489711936,
"config_test": false,
"has... |
"""A script to run inference on a set of image files.
NOTE #1: The Attention OCR model was trained only using FSNS train dataset and
it will work only for images which look more or less similar to french street
names. In order to apply it to images from a different distribution you need
to retrain (or at least fine-tu... | {
"repo_name": "tensorflow/models",
"path": "research/attention_ocr/python/demo_inference.py",
"copies": "1",
"size": "3635",
"license": "apache-2.0",
"hash": -336090938136295360,
"line_mean": 36.4742268041,
"line_max": 78,
"alpha_frac": 0.7020632737,
"autogenerated": false,
"ratio": 3.65326633165... |
"""A script to run inference on a set of image files.
NOTE #1: The Attention OCR model was trained only using FSNS train dataset and
it will work only for images which look more or less similar to french street
names. In order to apply it to images from a different distribution you need
to retrain (or at least fine... | {
"repo_name": "jmhsi/justin_tinker",
"path": "data_science/courses/learning_dl_packages/models/research/attention_ocr/python/demo_inference.py",
"copies": "2",
"size": "3332",
"license": "apache-2.0",
"hash": -2757237602720901000,
"line_mean": 36.8636363636,
"line_max": 79,
"alpha_frac": 0.6830732293... |
#a script to run several replicates of several treatments locally
#RUN SIMPLE_REPEAT.PY FROM WITHIN THE FOLDER WHERE THE DATA SHOULD GO
#EX: INSIDE OF SymbulationEmp/Data, RUN python3 ../stats_scripts/simple_repeat.py
import sys
directory = "PartPop/"
#start_mois = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 40, 60... | {
"repo_name": "anyaevostinar/SymbulationEmp",
"path": "stats_scripts/simple_repeat.py",
"copies": "1",
"size": "2413",
"license": "mit",
"hash": 2982961040807141400,
"line_mean": 47.26,
"line_max": 190,
"alpha_frac": 0.6009117281,
"autogenerated": false,
"ratio": 2.8863636363636362,
"config_tes... |
# A script to scrape /r/India
import time
import praw
from collections import deque
import traceback
import datetime
import pickle
DEBUG = False
DAY_IN_SECONDS = 60 * 60 * 24
class subStats(object):
def __init__(self, user, passwd, subreddit, file):
USER_AGENT = 'Script by /u/kashre001'
... | {
"repo_name": "KaushikR/SubredditStats",
"path": "RandiaScrap.py",
"copies": "1",
"size": "5533",
"license": "bsd-3-clause",
"hash": -5335268507680527000,
"line_mean": 47.1130434783,
"line_max": 149,
"alpha_frac": 0.407554672,
"autogenerated": false,
"ratio": 5.1136783733826245,
"config_test": ... |
"""A script to strip out an ATS checkpoint file and write a "logically
structured" h5 version for use as ICs by PFLOTRAN
"""
import sys,os
sys.path.append(os.path.join(os.environ['ATS_SRC_DIR'],'tools','utils'))
import numpy as np
import h5py
import mesh
import parse_ats
def ats_to_pflotran_ic_h5(filename, directory... | {
"repo_name": "amanzi/ats-dev",
"path": "tools/utils/ats-vis-to-structured-h5.py",
"copies": "2",
"size": "2408",
"license": "bsd-3-clause",
"hash": -2077121318747921000,
"line_mean": 39.1333333333,
"line_max": 99,
"alpha_frac": 0.6241694352,
"autogenerated": false,
"ratio": 3.1725955204216074,
... |
# a script to test PyEEG on real EEG data
# just define the data folders
# original script
# for paper PyEEG:A Open Source Python Module for EEG/MEG Feature Extraction
# 2010/10/18 Xin Lin
# Graphical environment and improvements by Petrousov Giannis
# student University of Western Macedonia ICTE
import sys,string... | {
"repo_name": "gpetrousov/peeg",
"path": "peeg.py",
"copies": "1",
"size": "16435",
"license": "mit",
"hash": 6236527516263162000,
"line_mean": 34.1927194861,
"line_max": 180,
"alpha_frac": 0.4675387892,
"autogenerated": false,
"ratio": 3.0194745544736357,
"config_test": false,
"has_no_keywor... |
"""A script to test the extraction of a bunch of RHEA2 spectra.
The functions within this module should go in the Extractor if they
are general. Spectrograph specific functions should go in the RHEA module
********************************************************************************
NOTE:
----
The functions in thi... | {
"repo_name": "mikeireland/pymfe",
"path": "test_rhea2_extract.py",
"copies": "1",
"size": "16632",
"license": "mit",
"hash": 1001853231297649400,
"line_mean": 32.6,
"line_max": 179,
"alpha_frac": 0.6218133718,
"autogenerated": false,
"ratio": 3.0489459211732357,
"config_test": false,
"has_no... |
# A script to test the memory scaling properties of the algorithms. This script
# creates Erdos-Renyi graphs with weights randomly selected from the set {-1, 1}.
# One set of graphs is dense and the other is sparse. It tests all the heuristics
# on graphs of specified sizes, outputting the memory usage.
import csv
impo... | {
"repo_name": "MQLib/MQLib",
"path": "scripts/scaling.py",
"copies": "1",
"size": "4256",
"license": "mit",
"hash": -1198514721816574200,
"line_mean": 41.56,
"line_max": 96,
"alpha_frac": 0.5498120301,
"autogenerated": false,
"ratio": 3.6037256562235394,
"config_test": false,
"has_no_keywords... |
# A script to test tracking on the Raspberry Pi driving servos with the AdaFruit16ServoDriver service
# as at mrl development build version 2489
# a mashup of code taken from Mats:
# https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Mats/Tracking.py
# and also from Grog:
# http://myrobotlab.org/content/tracking... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "home/CheekyMonkey/tracking-i2c.py",
"copies": "1",
"size": "2639",
"license": "apache-2.0",
"hash": 3155660489897487400,
"line_mean": 24.1333333333,
"line_max": 101,
"alpha_frac": 0.7483895415,
"autogenerated": false,
"ratio": 2.6873727087576373,
... |
"""A script to train the DNC on implemented tasks.
You can start training the DNC model on any implemented task by executing:
> python -m src.tasks.train --task=<task_name>
TO SUPPORT NEW TASKS:
1) Import necessary code for task (follow necessary requirements listed below).
2) Create new section in flags and d... | {
"repo_name": "derrowap/DNC-TensorFlow",
"path": "src/tasks/train.py",
"copies": "1",
"size": "11555",
"license": "mit",
"hash": 4157049069585212400,
"line_mean": 40.7962962963,
"line_max": 79,
"alpha_frac": 0.6046733016,
"autogenerated": false,
"ratio": 3.955837042108867,
"config_test": true,
... |
# A script to turn a motifset object into a beta object
import os
import numpy as np
import sys
import jsonpickle
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
from decomposition.models import MotifSet,FeatureSet,GlobalFeature,GlobalMotifsToSets,Beta,FeatureMap
fro... | {
"repo_name": "sdrogers/ms2ldaviz",
"path": "ms2ldaviz/decomp_make_beta_from_motifset.py",
"copies": "1",
"size": "3008",
"license": "mit",
"hash": 8972011531042131000,
"line_mean": 32.0549450549,
"line_max": 101,
"alpha_frac": 0.6748670213,
"autogenerated": false,
"ratio": 3.1333333333333333,
... |
# a script to turn a normal sentence into a sequence of left-to-right and right-to-left strings, with the same rendering
import sys
import random
import codecs
START = u"\u202e"
END = u"\u202d"
def _(s):
return START + u"".join(s[::-1]) + END
def splitstr(s, c):
if c < 2:
return [s]
... | {
"repo_name": "angea/corkami",
"path": "misc/python/reversestr.py",
"copies": "1",
"size": "1298",
"license": "bsd-2-clause",
"hash": -4223012030739992600,
"line_mean": 22.037037037,
"line_max": 120,
"alpha_frac": 0.593990755,
"autogenerated": false,
"ratio": 2.9168539325842695,
"config_test": ... |
# A script to upload a bunch of images to see how your server
# handles the load.
#
# Based on http://atlee.ca/software/poster/
# https://bitbucket.org/chrisatlee/poster
import os
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
UPLOADS_PATH = "/home/ben/Proje... | {
"repo_name": "brousch/WaznexServer",
"path": "waznexserver/tests/hammeruploads/hammerit.py",
"copies": "3",
"size": "1024",
"license": "mit",
"hash": 7892549302219769000,
"line_mean": 34.3448275862,
"line_max": 97,
"alpha_frac": 0.662109375,
"autogenerated": false,
"ratio": 3.618374558303887,
... |
# A Script using the downhill simplex algorithm to optimize the seven parameters in the EMT calculator
# Written by: Rasmus E. Christiansen
import Optimize as Optim
from ErrorFunction import ErrorFunction as EF
import numpy
# Previously fittet Values for parameters:
parameters = {
# E0 s0 V0 eta... | {
"repo_name": "auag92/n2dm",
"path": "Asap-3.8.4/Python/asap3/Tools/ParameterOptimization/Rasmus2011/MinAlgorithm.py",
"copies": "1",
"size": "2299",
"license": "mit",
"hash": 8259573070075966000,
"line_mean": 41.5740740741,
"line_max": 110,
"alpha_frac": 0.6294040887,
"autogenerated": false,
"ra... |
# A ScrolledList widget feels like a list widget but also has a
# vertical scroll bar on its right. (Later, options may be added to
# add a horizontal bar as well, to make the bars disappear
# automatically when not needed, to move them to the other side of the
# window, etc.)
#
# Configuration options are passed to t... | {
"repo_name": "vlinhd11/vlinhd11-android-scripting",
"path": "python/src/Tools/modulator/ScrolledListbox.py",
"copies": "37",
"size": "1477",
"license": "apache-2.0",
"hash": -4334048460384505300,
"line_mean": 38.9189189189,
"line_max": 70,
"alpha_frac": 0.5951252539,
"autogenerated": false,
"rat... |
"""A ScrolledText widget feels like a text widget but also has a
vertical scroll bar on its right. (Later, options may be added to
add a horizontal bar as well, to make the bars disappear
automatically when not needed, to move them to the other side of the
window, etc.)
Configuration options are passed to the Text wi... | {
"repo_name": "phalax4/CarnotKE",
"path": "jyhton/lib-python/2.7/lib-tk/ScrolledText.py",
"copies": "133",
"size": "1836",
"license": "apache-2.0",
"hash": 1151451606693594800,
"line_mean": 32.3818181818,
"line_max": 76,
"alpha_frac": 0.6497821351,
"autogenerated": false,
"ratio": 3.6284584980237... |
# A ScrolledText widget feels like a text widget but also has a
# vertical scroll bar on its right. (Later, options may be added to
# add a horizontal bar as well, to make the bars disappear
# automatically when not needed, to move them to the other side of the
# window, etc.)
#
# Configuration options are passed to t... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-3.0/Lib/tkinter/scrolledtext.py",
"copies": "1",
"size": "1612",
"license": "mit",
"hash": -3439669908508929000,
"line_mean": 37.380952381,
"line_max": 78,
"alpha_frac": 0.6135235732,
"autogenerated": false,
... |
"""A ScrolledText widget feels like a text widget but also has a
vertical scroll bar on its right. (Later, options may be added to
add a horizontal bar as well, to make the bars disappear
automatically when not needed, to move them to the other side of the
window, etc.)
Configuration options are passed to the T... | {
"repo_name": "babyliynfg/cross",
"path": "tools/project-creator/Python2.6.6/Lib/lib-tk/ScrolledText.py",
"copies": "2",
"size": "1753",
"license": "mit",
"hash": 9090140477410211000,
"line_mean": 31.7115384615,
"line_max": 76,
"alpha_frac": 0.6320593269,
"autogenerated": false,
"ratio": 3.621900... |
# A ScrolledText widget feels like a text widget but also has a
# vertical scroll bar on its right. (Later, options may be added to
# add a horizontal bar as well, to make the bars disappear
# automatically when not needed, to move them to the other side of the
# window, etc.)
#
# Configuration options are passe... | {
"repo_name": "ericlink/adms-server",
"path": "playframework-dist/play-1.1/python/Lib/lib-tk/ScrolledText.py",
"copies": "2",
"size": "1681",
"license": "mit",
"hash": 1929850751923649800,
"line_mean": 37.0930232558,
"line_max": 70,
"alpha_frac": 0.5823914337,
"autogenerated": false,
"ratio": 3.7... |
"""asdl2html - generate HTML file from asdl
This was coded only to be able to convert python's ASDL.
I have not studied ASDL specification so the parsing is probably incomplete!
It uses a quick & dirty (inneficient and naive) parsing, but it did the job :)
Python code is represented as a `tree`.
Each `node` of the tr... | {
"repo_name": "schettino72/pyRegurgitator",
"path": "pyreg/asdlview.py",
"copies": "1",
"size": "9917",
"license": "mit",
"hash": -5710108721729461000,
"line_mean": 32.5033783784,
"line_max": 80,
"alpha_frac": 0.5566199455,
"autogenerated": false,
"ratio": 3.9166666666666665,
"config_test": fal... |
"""asdoc2dash
Convert form ASDoc to Dash Docset.
Usage:
asdoc2dash --name <name> --docdir <path> (--outdir <path>|--add-to-dash) [--icon <path>] [--force] [--log]
asdoc2dash (-h | --help)
asdoc2dash (-v | --version)
Options:
-h --help show help.
-v --version show version.
-n --name <name>... | {
"repo_name": "ton1517/asdoc2dash",
"path": "asdoc2dash/asdoc2dash.py",
"copies": "1",
"size": "2838",
"license": "mit",
"hash": 9128397879950394000,
"line_mean": 25.523364486,
"line_max": 108,
"alpha_frac": 0.6060606061,
"autogenerated": false,
"ratio": 3.44,
"config_test": false,
"has_no_ke... |
# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module.
import os
import sys
from pathlib import Path
import torch
from transformers.testing_utils import TestCasePlus, execute_subprocess_async, require_torch_multi_gpu
from utils import load_json
C... | {
"repo_name": "huggingface/pytorch-transformers",
"path": "examples/research_projects/seq2seq-distillation/_test_seq2seq_examples_multi_gpu.py",
"copies": "2",
"size": "5672",
"license": "apache-2.0",
"hash": 5934075902722955000,
"line_mean": 33.5853658537,
"line_max": 215,
"alpha_frac": 0.5946755994... |
"""A sed-style sentence breaker, with SQuAD/Wiki-specific tweaks.
This code is derived from a broad-coverage proof-of-concept sed script,
with some simplification/adaptation:
- Several substitution rules are simplified here to focus on the cases that
arise in the SQuAD sentences.
- Other substitution rules ar... | {
"repo_name": "google-research/xtreme",
"path": "third_party/processors/sb_sed.py",
"copies": "1",
"size": "5780",
"license": "apache-2.0",
"hash": -7439283027439730000,
"line_mean": 37.7986577181,
"line_max": 79,
"alpha_frac": 0.5626297578,
"autogenerated": false,
"ratio": 2.657471264367816,
"... |
""" A Seed File to seed the Mongo DB with Test Data """
# Import pymongo module to allow operations on mongo
from pymongo import MongoClient
def up():
""" Seed the database with test data """
# Mandatory for every mongodb call
client = MongoClient()
# Select which database to use
db = client.tes... | {
"repo_name": "hpsuenaa/servmon",
"path": "migrations/machine_data_seed.py",
"copies": "1",
"size": "7640",
"license": "mit",
"hash": -3470603413503654400,
"line_mean": 29.0787401575,
"line_max": 80,
"alpha_frac": 0.2672774869,
"autogenerated": false,
"ratio": 5.165652467883705,
"config_test": ... |
import numpy as np
import math
import logging
import datetime
from pycqed.utilities.timer import Timer
log = logging.getLogger(__name__)
from copy import deepcopy
import pycqed.measurement.waveform_control.pulse as bpl
import pycqed.measurement.waveform_control.pulse_library as pl
import pycqed.measurement.waveform_... | {
"repo_name": "QudevETH/PycQED_py3",
"path": "pycqed/measurement/waveform_control/segment.py",
"copies": "1",
"size": "66143",
"license": "mit",
"hash": 2053430329313236000,
"line_mean": 43.2132352941,
"line_max": 206,
"alpha_frac": 0.5027894108,
"autogenerated": false,
"ratio": 4.129549853280889... |
"""A selection of useful functions for optics, especially Fourier optics. The
documentation is designed to be used with sphinx (still lots to do)
Authors:
Dr Michael Ireland
Adam Rains
"""
from __future__ import print_function, division
import pdb
import numpy as np
import matplotlib.pyplot as plt
from scipy import s... | {
"repo_name": "mikeireland/opticstools",
"path": "opticstools/opticstools.py",
"copies": "1",
"size": "45771",
"license": "mit",
"hash": 103231941495800540,
"line_mean": 34.4539116964,
"line_max": 142,
"alpha_frac": 0.5978239497,
"autogenerated": false,
"ratio": 2.9794948574404376,
"config_test... |
"""A selection of useful functions for optics, especially Fourier optics. The
documentation is designed to be used with sphinx (still lots to do)
Note that this comes directly from a preliminary version of the astro-optics
repository. TODO: Replace this with either a release version of astro-optics
or an appropriate l... | {
"repo_name": "mikeireland/pymfe",
"path": "pymfe/optics.py",
"copies": "2",
"size": "17674",
"license": "mit",
"hash": 6504584304853360000,
"line_mean": 31.8513011152,
"line_max": 142,
"alpha_frac": 0.6008260722,
"autogenerated": false,
"ratio": 3.027406646111682,
"config_test": false,
"has_... |
# A self-dividing number is a number that is divisible by every digit it contains.
# For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.
# Also, a self-dividing number is not allowed to contain the digit zero.
# Given a lower and upper number bound, output a list of every... | {
"repo_name": "lanpong/LeetCode",
"path": "Python/self_dividing_numbers_728.py",
"copies": "1",
"size": "1385",
"license": "mit",
"hash": -3853217035903772700,
"line_mean": 31.8,
"line_max": 127,
"alpha_frac": 0.6111595466,
"autogenerated": false,
"ratio": 2.3895833333333334,
"config_test": fal... |
"""A semantic pond for content delivery.
See:
https://github.com/alexmilowski/duckpond
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
long_description = """
A [semantic data lake](http://cacm.acm.org/news/200095-the-data-lake-concept-is-maturing/fulltext) can
be thought of... | {
"repo_name": "alexmilowski/duckpond",
"path": "setup.py",
"copies": "1",
"size": "4780",
"license": "apache-2.0",
"hash": -7440236367435528000,
"line_mean": 37.5403225806,
"line_max": 127,
"alpha_frac": 0.6779661017,
"autogenerated": false,
"ratio": 3.866504854368932,
"config_test": false,
"... |
""" A semi automated solution for creating - installing new SSL certificates
1. Generate and install a Letsencrypt SSL certificate
2. Replace the HTTP host with an HTTPS
3. Register a cron job for certificate renewals
"""
import os
import subprocess
import config_loader
import template
import nginx
import ... | {
"repo_name": "stef-k/starter",
"path": "letsencrypt.py",
"copies": "1",
"size": "4473",
"license": "mit",
"hash": -4939739002800965000,
"line_mean": 32.8863636364,
"line_max": 79,
"alpha_frac": 0.5873015873,
"autogenerated": false,
"ratio": 3.6365853658536587,
"config_test": true,
"has_no_ke... |
"""A semi-secure external process keyring.
This allows storage (but not retrieval) of signing keys, by name, within an external process. Data may then be sent
for signing against a specific key. Theoretically, should the host application be compromised, your keys will remain
safe.
"""
from atexit import register, unr... | {
"repo_name": "marrow/web.security",
"path": "web/security/keyring.py",
"copies": "1",
"size": "3410",
"license": "mit",
"hash": -5968710111896781000,
"line_mean": 23.3571428571,
"line_max": 116,
"alpha_frac": 0.673313783,
"autogenerated": false,
"ratio": 3.434038267875126,
"config_test": false... |
"""A semi-synchronous Client for IPython parallel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import os
import json
from threading import Thread, Event, current_thread
import time
import types
import warnings
from datet... | {
"repo_name": "fzheng/codejam",
"path": "lib/python2.7/site-packages/ipyparallel/client/client.py",
"copies": "1",
"size": "70766",
"license": "mit",
"hash": 698515700502294500,
"line_mean": 35.9728317659,
"line_max": 111,
"alpha_frac": 0.555535144,
"autogenerated": false,
"ratio": 4.442031259807... |
"""A semi-synchronous Client for the ZMQ cluster
Authors:
* MinRK
"""
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is ... | {
"repo_name": "EricCline/CEM_inc",
"path": "env/lib/python2.7/site-packages/IPython/parallel/client/client.py",
"copies": "2",
"size": "67974",
"license": "mit",
"hash": 8875764157415380000,
"line_mean": 35.4276527331,
"line_max": 107,
"alpha_frac": 0.5515344102,
"autogenerated": false,
"ratio": ... |
"""A semi-synchronous Client for the ZMQ cluster
Authors:
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as... | {
"repo_name": "marcoantoniooliveira/labweb",
"path": "oscar/lib/python2.7/site-packages/IPython/parallel/client/client.py",
"copies": "1",
"size": "67460",
"license": "bsd-3-clause",
"hash": -4372829999402266600,
"line_mean": 35.4254859611,
"line_max": 103,
"alpha_frac": 0.5517047139,
"autogenerate... |
# A semordnilap is a word or a phrase that spells a different word when
# backwards ("semordnilap" is a semordnilap of "palindromes"). Here are some
# examples:
#
# nametag / gateman
# dog / god
# live / evil
# desserts / stressed
#
# Write a recursive program, `semordnilap`, that takes in two words and... | {
"repo_name": "emyarod/OSS",
"path": "1_intro/6.00.1x/Week 3/L5 Problems/L5 Problem 9.py",
"copies": "1",
"size": "1795",
"license": "mit",
"hash": -2730546031892387300,
"line_mean": 32.8867924528,
"line_max": 80,
"alpha_frac": 0.6846796657,
"autogenerated": false,
"ratio": 3.4786821705426356,
... |
"""A sensor for incoming calls using a USB modem that supports caller ID."""
import logging
import voluptuous as vol
from homeassistant.const import (
STATE_IDLE,
EVENT_HOMEASSISTANT_STOP,
CONF_NAME,
CONF_DEVICE,
)
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.en... | {
"repo_name": "joopert/home-assistant",
"path": "homeassistant/components/modem_callerid/sensor.py",
"copies": "4",
"size": "3582",
"license": "apache-2.0",
"hash": 7721196765802210000,
"line_mean": 28.85,
"line_max": 76,
"alpha_frac": 0.5971524288,
"autogenerated": false,
"ratio": 3.971175166297... |
"""A sensor for incoming calls using a USB modem that supports caller ID."""
import logging
import voluptuous as vol
from homeassistant.const import (STATE_IDLE,
EVENT_HOMEASSISTANT_STOP,
CONF_NAME,
CONF_DEVICE)
from home... | {
"repo_name": "auduny/home-assistant",
"path": "homeassistant/components/modem_callerid/sensor.py",
"copies": "7",
"size": "3584",
"license": "apache-2.0",
"hash": -7587118682884345000,
"line_mean": 31.2882882883,
"line_max": 76,
"alpha_frac": 0.5968191964,
"autogenerated": false,
"ratio": 4.0497... |
"""A sensor for incoming calls using a USB modem that supports caller ID."""
import logging
from basicmodem.basicmodem import BasicModem as bm
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_DEVICE,
CONF_NAME,
EVENT_HOMEASSISTANT_... | {
"repo_name": "mKeRix/home-assistant",
"path": "homeassistant/components/modem_callerid/sensor.py",
"copies": "14",
"size": "3579",
"license": "mit",
"hash": 6342872922084965000,
"line_mean": 28.3360655738,
"line_max": 76,
"alpha_frac": 0.5976529757,
"autogenerated": false,
"ratio": 3.95907079646... |
"""A sensor platform that give you information about the next space launch."""
from datetime import timedelta
import logging
from typing import Optional
from pylaunches import PyLaunches, PyLaunchesException
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const ... | {
"repo_name": "soldag/home-assistant",
"path": "homeassistant/components/launch_library/sensor.py",
"copies": "6",
"size": "2741",
"license": "apache-2.0",
"hash": -6936935101575951000,
"line_mean": 29.797752809,
"line_max": 86,
"alpha_frac": 0.6548704852,
"autogenerated": false,
"ratio": 4.06676... |
"""A sensor platform that give you information about the next space launch."""
from datetime import timedelta
import logging
from pylaunches.api import Launches
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
from homeass... | {
"repo_name": "GenericStudent/home-assistant",
"path": "homeassistant/components/launch_library/sensor.py",
"copies": "13",
"size": "2612",
"license": "apache-2.0",
"hash": 4469167184717340700,
"line_mean": 30.0952380952,
"line_max": 86,
"alpha_frac": 0.6558192956,
"autogenerated": false,
"ratio"... |
"""A sensor platform that give you information about the next space launch."""
from datetime import timedelta
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_... | {
"repo_name": "joopert/home-assistant",
"path": "homeassistant/components/launch_library/sensor.py",
"copies": "4",
"size": "2616",
"license": "apache-2.0",
"hash": 6650959488487365000,
"line_mean": 30.1428571429,
"line_max": 86,
"alpha_frac": 0.6548165138,
"autogenerated": false,
"ratio": 4.1923... |
"""A sensor platform that give you information about the next space launch."""
from __future__ import annotations
from datetime import timedelta
import logging
from pylaunches import PyLaunches, PyLaunchesException
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
fro... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/components/launch_library/sensor.py",
"copies": "5",
"size": "2714",
"license": "mit",
"hash": 8443492476257792000,
"line_mean": 29.4943820225,
"line_max": 86,
"alpha_frac": 0.6503316139,
"autogenerated": false,
"ratio": 4.038690... |
"""A sensor that monitors trends in other components."""
from collections import deque
import logging
import math
import numpy as np
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
BinarySensorDevice,
)
from homeas... | {
"repo_name": "Teagan42/home-assistant",
"path": "homeassistant/components/trend/binary_sensor.py",
"copies": "5",
"size": "6698",
"license": "apache-2.0",
"hash": 6482002634884211000,
"line_mean": 30.2990654206,
"line_max": 83,
"alpha_frac": 0.6058524933,
"autogenerated": false,
"ratio": 3.98453... |
"""A sensor that monitors trends in other components."""
from collections import deque
import logging
import math
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, ENTITY_ID_FORMAT, PLATFORM_SCHEMA,
BinarySensorDevice)
from homeassistant.const import (
AT... | {
"repo_name": "nugget/home-assistant",
"path": "homeassistant/components/binary_sensor/trend.py",
"copies": "3",
"size": "6437",
"license": "apache-2.0",
"hash": -6662413858287017000,
"line_mean": 33.6075268817,
"line_max": 79,
"alpha_frac": 0.6259126922,
"autogenerated": false,
"ratio": 3.920219... |
"""A separate Flask app that serves fake endpoints for demo purposes."""
# -*- coding: utf-8 -*-
from itertools import combinations
import json
import locale
import os
from datetime import timedelta as td
from datetime import datetime as dt
from random import randrange as rr
from random import choice, random
import t... | {
"repo_name": "christabor/flask_jsondash",
"path": "example_app/endpoints.py",
"copies": "1",
"size": "19032",
"license": "mit",
"hash": -6318417875860366000,
"line_mean": 26.2664756447,
"line_max": 78,
"alpha_frac": 0.5107187894,
"autogenerated": false,
"ratio": 3.6148148148148147,
"config_tes... |
"""A separate module for glyphname to filename functions.
glyphNameToShortFileName() generates a non-clashing filename for systems with
filename-length limitations.
"""
MAXLEN = 31
def glyphNameToShortFileName(glyphName, glyphSet):
"""Alternative glyphname to filename function.
Features a garuanteed maximum filen... | {
"repo_name": "adrientetar/robofab",
"path": "Lib/robofab/tools/glyphNameSchemes.py",
"copies": "11",
"size": "1330",
"license": "bsd-3-clause",
"hash": -84792869473121870,
"line_mean": 31.4390243902,
"line_max": 86,
"alpha_frac": 0.6954887218,
"autogenerated": false,
"ratio": 3.3842239185750635,... |
"""A separate terminal for every websocket opened.
"""
import tornado.web
# This demo requires tornado_xstatic and XStatic-term.js
import tornado_xstatic
from terminado import TermSocket, UniqueTermManager
from common_demo_stuff import run_and_show_browser, STATIC_DIR, TEMPLATE_DIR
class TerminalPageHandler(tornado.w... | {
"repo_name": "akalipetis/terminado",
"path": "demos/unique.py",
"copies": "4",
"size": "1270",
"license": "bsd-2-clause",
"hash": -678915599780590300,
"line_mean": 38.71875,
"line_max": 76,
"alpha_frac": 0.6078740157,
"autogenerated": false,
"ratio": 4.031746031746032,
"config_test": false,
... |
"""A seq2seq model"""
import theano
from theano import tensor
from blocks.bricks import (Initializable, Linear, NDimensionalSoftmax, MLP,
Tanh, Rectifier)
from blocks.bricks.base import application
from blocks.bricks.recurrent import LSTM
from blocks.bricks.lookup import LookupTable
from blo... | {
"repo_name": "tombosc/dict_based_learning",
"path": "dictlearn/seq2seq.py",
"copies": "1",
"size": "6778",
"license": "mit",
"hash": -1859169785513454600,
"line_mean": 41.8987341772,
"line_max": 91,
"alpha_frac": 0.588669224,
"autogenerated": false,
"ratio": 3.8207440811724918,
"config_test": ... |
import numpy as np
import pycqed.measurement.waveform_control.pulsar as ps
from collections import OrderedDict as odict
from copy import deepcopy
import logging
from pycqed.utilities.timer import Timer
log = logging.getLogger(__name__)
class Sequence:
"""
A Sequence consists of several segments, which can b... | {
"repo_name": "QudevETH/PycQED_py3",
"path": "pycqed/measurement/waveform_control/sequence.py",
"copies": "1",
"size": "17141",
"license": "mit",
"hash": 8284524679337477000,
"line_mean": 42.0703517588,
"line_max": 110,
"alpha_frac": 0.5367831515,
"autogenerated": false,
"ratio": 4.45452182952183... |
"""A serializer for serializing SQLAlchemy models to JSON API spec."""
import datetime
from inflection import dasherize, underscore
class JSONAPISerializer(object):
"""A JSON API serializer that serializes SQLAlchemy models."""
model = None
primary_key = 'id'
fields = []
dasherize = True
de... | {
"repo_name": "ColtonProvias/sqlalchemy-jsonapi",
"path": "sqlalchemy_jsonapi/declarative/serializer.py",
"copies": "1",
"size": "4651",
"license": "mit",
"hash": 7957508448204500000,
"line_mean": 35.3359375,
"line_max": 82,
"alpha_frac": 0.5431090088,
"autogenerated": false,
"ratio": 5.033549783... |
"""A series of classes for loading external data"""
import csv
import json
from .utils import find_file
class Loader(object):
"""Base loader class for :class:`LoadedDataStruct`"""
def __init__(*args, **kwargs): pass
def load(self): pass
class FileLoader(Loader):
filepath = None
def __init__(se... | {
"repo_name": "rmorshea/dstruct",
"path": "dstruct/loader.py",
"copies": "1",
"size": "3323",
"license": "mit",
"hash": -5534117996392747000,
"line_mean": 28.9369369369,
"line_max": 91,
"alpha_frac": 0.507071923,
"autogenerated": false,
"ratio": 4.027878787878788,
"config_test": false,
"has_n... |
import os
import re
import gtk, pango
import dialog
import browser
import utils
import preferences
import hig
import random
import ignore_info
from fractutils import flickr, slave
TOKEN = None
class FlickrGTKSlave(slave.GTKSlave):
def __init__(self,cmd,*args):
slave.GTKSlave.__init__(self,cmd,*args)
... | {
"repo_name": "ericchill/gnofract4d",
"path": "fract4dgui/flickr_assistant.py",
"copies": "1",
"size": "14246",
"license": "bsd-3-clause",
"hash": 1670102542822473500,
"line_mean": 33.3277108434,
"line_max": 258,
"alpha_frac": 0.5967289064,
"autogenerated": false,
"ratio": 3.5920322743318205,
"... |
"""A series of fixtures that are shared among all tests."""
import logging
import os
import pytest
import uuid
from flask_socketio import SocketIOTestClient
from webtest import TestApp
os.environ['MATL_ONLINE_ENV'] = 'test'
from matl_online.app import create_app
from matl_online.database import db as _db
from matl_... | {
"repo_name": "suever/MATL-Online",
"path": "tests/conftest.py",
"copies": "1",
"size": "1996",
"license": "mit",
"hash": -1933689359012865800,
"line_mean": 21.9425287356,
"line_max": 75,
"alpha_frac": 0.6828657315,
"autogenerated": false,
"ratio": 3.609403254972875,
"config_test": true,
"has... |
''' A series of functions that return a graph
'''
import random
import math
import networkx as nx
def get_graph(objects, properties):
graph_type = properties['graph_type']
n = len(objects)-1
if 'num_nodes_to_attach' in properties.keys():
k = properties['num_nodes_to_attach']
else:
k ... | {
"repo_name": "pankajk/MasterThesis",
"path": "Code/Graph_Kernels/SKG/GraphGen.py",
"copies": "1",
"size": "4474",
"license": "mit",
"hash": -5071038617852754000,
"line_mean": 29.8551724138,
"line_max": 75,
"alpha_frac": 0.5748770675,
"autogenerated": false,
"ratio": 3.4388931591083782,
"config... |
"""A series of helper functions to create a mapping from
yelp IDs to place IDs from other providers in our database.
Intended to be used from a REPL. Primary functions are:
- yelp_ids_to_tripadvisor_ids
- (for debugging) verify_yelp_id_to_tripadvisor_ids
- yelp_ids_to_wiki_pages
- write_to_db
TODO:
- Handle hitting... | {
"repo_name": "liuche/prox-server",
"path": "scripts/prox_crosswalk.py",
"copies": "1",
"size": "9286",
"license": "mpl-2.0",
"hash": 7607750083080483000,
"line_mean": 34.041509434,
"line_max": 116,
"alpha_frac": 0.6178117596,
"autogenerated": false,
"ratio": 3.1987599035480536,
"config_test": ... |
# a series of key value fields
class MiscDAO:
def __init__(self, db):
self.db = db
self.misc = self.db.misc
varsDict = self.misc.find_one()
if not varsDict:
self.misc.insert({})
def getCurrPeriod(self):
varsDict = self.misc.find_one()
if 'currPeriod' ... | {
"repo_name": "jac2130/BettingIsBelieving",
"path": "Betting/miscDAO.py",
"copies": "1",
"size": "2000",
"license": "mit",
"hash": 3576011046158988000,
"line_mean": 30.25,
"line_max": 80,
"alpha_frac": 0.582,
"autogenerated": false,
"ratio": 3.75234521575985,
"config_test": false,
"has_no_key... |
""" A series of mixins for reporting. """
from datetime import datetime as dt
from metapipe.templates import env
template = env.get_template('progress-report.tmpl.html')
class BaseReportingMixin(object):
""" An abstract mixin for reporting. """
message_format = '%Y-%m-%d %H:%M:%S'
def render(self, mess... | {
"repo_name": "Sonictherocketman/metapipe",
"path": "metapipe/models/reporting.py",
"copies": "2",
"size": "1313",
"license": "mit",
"hash": -6162293988671875000,
"line_mean": 28.8409090909,
"line_max": 88,
"alpha_frac": 0.6359482102,
"autogenerated": false,
"ratio": 3.942942942942943,
"config_... |
# A series of recursive functions:
# replaceString: replaces all instances of one type of separator with another type of separator
# countSiblings: count total siblings based on number of elves (each odd elf has 3 siblings while
# even elves have 1 sibling)
# extractor: extracts information from a string only i... | {
"repo_name": "caleighm/little-programs",
"path": "Assignment3-Recursion.py",
"copies": "1",
"size": "4547",
"license": "mit",
"hash": -3447854151058754000,
"line_mean": 39.7155963303,
"line_max": 100,
"alpha_frac": 0.6338244997,
"autogenerated": false,
"ratio": 3.859932088285229,
"config_test"... |
"""A series of reward functions."""
import numpy as np
def desired_velocity(env, fail=False, edge_list=None):
r"""Encourage proximity to a desired velocity.
This function measures the deviation of a system of vehicles from a
user-specified desired velocity peaking when all vehicles in the ring
are s... | {
"repo_name": "cathywu/flow",
"path": "flow/core/rewards.py",
"copies": "1",
"size": "9314",
"license": "mit",
"hash": -8708177784690541000,
"line_mean": 29.4379084967,
"line_max": 79,
"alpha_frac": 0.6400042946,
"autogenerated": false,
"ratio": 3.8203445447087776,
"config_test": false,
"has_... |
# A series of tests to check whether the python scripts of log-reconstruction perform correctly.
# Start the tests by writing
# py.test
# or
# python -m pytest
# in a terminal window on this folder
from os.path import dirname, abspath, join, exists
from os import walk, remove, rmdir, chdir, chmod, mkdir
def almost_e... | {
"repo_name": "PyQuake/earthquakemodels",
"path": "code/cocobbob/coco/code-preprocessing/log-reconstruction/test_reconstruction.py",
"copies": "1",
"size": "5712",
"license": "bsd-3-clause",
"hash": 1947312365431254800,
"line_mean": 32.0173410405,
"line_max": 115,
"alpha_frac": 0.6073179272,
"autog... |
AS_ERR_TYPE_NOT_SUPPORTED = -7
AS_ERR_COMMAND_REJECTED = -6
AS_ERR_QUERY_TERMINATED = -5
AS_ERR_SCAN_TERMINATED = -4
AS_ERR_INVALID_NODE_ERROR = -3
AS_ERR_PARSE_ERROR = -2
AS_ERR_SERIALIZE_ERROR = -1
AS_ERR_OK = 0
AS_ERR_SERVER_ERROR = 1
AS_ERR_KEY_NOT_FOUND_ERROR = 2
AS_ERR_GENERATION_ERROR = 3
AS_ERR_PARAMETER_ERRO... | {
"repo_name": "kaniini/aerospike-py",
"path": "aerospike_py/result_code.py",
"copies": "1",
"size": "1827",
"license": "isc",
"hash": -2259779566624375300,
"line_mean": 32.2181818182,
"line_max": 108,
"alpha_frac": 0.6951286262,
"autogenerated": false,
"ratio": 2.9804241435562804,
"config_test"... |
"""ASEr Setup Script."""
from setuptools import setup, find_packages
from codecs import open
from os import path
from os import listdir
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.... | {
"repo_name": "MikeDacre/ASEr",
"path": "setup.py",
"copies": "2",
"size": "1637",
"license": "mit",
"hash": 105676748971927060,
"line_mean": 30.4807692308,
"line_max": 104,
"alpha_frac": 0.6310323763,
"autogenerated": false,
"ratio": 3.771889400921659,
"config_test": false,
"has_no_keywords"... |
# aserver: parallel webserver in one file
import sys
import os
import threading
import traceback
import html
import urllib
import json
import mimetypes
from multiprocessing import Pool
from http.server import BaseHTTPRequestHandler, HTTPStatus
from socketserver import ThreadingMixIn, TCPServer
ERROR_MESSAGE = '''\
<... | {
"repo_name": "billzorn/fpunreal",
"path": "titanfp/web/fserver.py",
"copies": "1",
"size": "10956",
"license": "mit",
"hash": -7359330903605460000,
"line_mean": 31.6071428571,
"line_max": 130,
"alpha_frac": 0.562248996,
"autogenerated": false,
"ratio": 4.1737142857142855,
"config_test": false,... |
# A server-side implementation of the redis protocol using gevent
from gevent.server import StreamServer
BUFSIZE=1024
CRLF = '\r\n'
def sock_readlines(socket):
'''Iteratively read lines from the socket.
A line is considered to be everything up
to a CRLF'''
remainder = ''
while True:
data ... | {
"repo_name": "zhemao/lerner",
"path": "server/redisd.py",
"copies": "1",
"size": "3538",
"license": "mit",
"hash": 6372231003742261000,
"line_mean": 30.5892857143,
"line_max": 72,
"alpha_frac": 0.5070661391,
"autogenerated": false,
"ratio": 4.283292978208232,
"config_test": false,
"has_no_ke... |
# A server that accepts connections on a socket, reads parameters from it,
# passes the parameters to a likelihood function, and sends the result back to
# the socket
import os
import socket
import struct
import math
# log-likelihood function (modify according to problem)
def log_likelihood(x):
return math.log(... | {
"repo_name": "JohnGBaker/ptmcmc",
"path": "python/socket_interface/likelihood_server.py",
"copies": "1",
"size": "1717",
"license": "apache-2.0",
"hash": 5425339746593966000,
"line_mean": 32.6666666667,
"line_max": 82,
"alpha_frac": 0.5917297612,
"autogenerated": false,
"ratio": 3.82405345211581... |
"""A server that execute arbitrary Python code."""
# NOTE: This module is Python 2 compatible.
import argparse
import contextlib
import logging
import os
import os.path
import sys
import threading
from multiprocessing.connection import Listener
try:
import backport
except ImportError:
from . import backport
... | {
"repo_name": "clchiou/garage",
"path": "py/garage/garage/multiprocessing/server.py",
"copies": "1",
"size": "9306",
"license": "mit",
"hash": 8215171534444339000,
"line_mean": 29.5114754098,
"line_max": 79,
"alpha_frac": 0.5622179239,
"autogenerated": false,
"ratio": 4.123172352680549,
"config... |
"""A server that handles a connection with an OpenBCI board and serves that
data over both a UDP socket server and a WebSocket server.
Requires:
- pyserial
- asyncio
- websockets
"""
from __future__ import print_function
import argparse
try:
import cPickle as pickle
except ImportError:
import _pickle a... | {
"repo_name": "OpenBCI/OpenBCI_Python",
"path": "scripts/udp_server.py",
"copies": "1",
"size": "2211",
"license": "mit",
"hash": -8848139854823911000,
"line_mean": 26.6375,
"line_max": 87,
"alpha_frac": 0.6594301221,
"autogenerated": false,
"ratio": 3.618657937806874,
"config_test": false,
"... |
"""A server that handles a connection with an OpenBCI board and serves that
data over both a UDP socket server and a WebSocket server.
Requires:
- pyserial
- asyncio
- websockets
"""
import argparse
import cPickle as pickle
import json
import sys;
sys.path.append(
'..') # help python find open_bci_v3.py r... | {
"repo_name": "neurotechuoft/Wall-EEG",
"path": "Code/OpenBCIPy/src/scripts/udp_server.py",
"copies": "1",
"size": "2130",
"license": "mit",
"hash": -6893668619244504000,
"line_mean": 27.0263157895,
"line_max": 76,
"alpha_frac": 0.6507042254,
"autogenerated": false,
"ratio": 3.5618729096989967,
... |
"""A server that handles a connection with an OpenBCI board and serves that
data over both a UDP socket server and a WebSocket server.
Requires:
- pyserial
- asyncio
- websockets
"""
import cPickle as pickle
import json
import socket
import plugin_interface as plugintypes
# class PluginPrint(IPlugin):
# # ... | {
"repo_name": "neurotechuoft/Wall-EEG",
"path": "Code/OpenBCIPy/src/plugins/udp_server.py",
"copies": "1",
"size": "2293",
"license": "mit",
"hash": 8255637031738700000,
"line_mean": 26.9634146341,
"line_max": 111,
"alpha_frac": 0.5979066725,
"autogenerated": false,
"ratio": 3.5550387596899227,
... |
"""A server to send commands to the DDS Comb.
Author: Sepehr Ebadi
"""
import inspect
import zmq
import json
import socket
from subprocess import Popen, PIPE
from rampage.zmq_server import RequestProcessor
from rampage.zmq_server import ClientForServer
class DDSCombServer(RequestProcessor):
def __init__(self, ... | {
"repo_name": "shreyaspotnis/rampage",
"path": "rampage/daq/dds_server.py",
"copies": "1",
"size": "4208",
"license": "mit",
"hash": 8876833347157838000,
"line_mean": 28.4265734266,
"line_max": 131,
"alpha_frac": 0.506891635,
"autogenerated": false,
"ratio": 3.24191063174114,
"config_test": fal... |
"""A server to send commands to Windfreak SynthHD.
Based on Sepher's code
Author: Ramon Ramos
"""
import inspect
import zmq
import json
import socket
from subprocess import Popen, PIPE
import serial
class RequestProcessor():
def __init__(self, bind_port):
members = inspect.getmembers(self, predi... | {
"repo_name": "shreyaspotnis/rampage",
"path": "rampage/daq/mw_server.py",
"copies": "1",
"size": "4057",
"license": "mit",
"hash": -1331603623579921200,
"line_mean": 29.5037593985,
"line_max": 90,
"alpha_frac": 0.5439980281,
"autogenerated": false,
"ratio": 3.6353046594982077,
"config_test": f... |
"""A server wrapper around dealer operations."""
from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import logging
from .bank import Bank
QUERIES = {
"is_done": (lambda bank: bank.is_done(), True),
"get_output_path": (lambda bank: bank.output_path, None),
"get_header": (lambda b... | {
"repo_name": "nivbend/bdd_bot",
"path": "bddbot/server.py",
"copies": "1",
"size": "3820",
"license": "mit",
"hash": 2228595925238183200,
"line_mean": 32.8053097345,
"line_max": 95,
"alpha_frac": 0.5814136126,
"autogenerated": false,
"ratio": 4.263392857142857,
"config_test": false,
"has_no_... |
"""A service to run a pomodoro timer."""
from datetime import datetime
from .workblock import WorkBlock
from twisted.internet import task, defer, reactor
from twisted.python import log
class Pomodoro(WorkBlock):
"""Wrap a block of work with pomo stuff."""
class PomoTimer(object):
"""A pomodoro timer."""
... | {
"repo_name": "dpnova/devdaemon",
"path": "devdaemon/timer/pomodoro.py",
"copies": "1",
"size": "2955",
"license": "mit",
"hash": 7656887478497744000,
"line_mean": 29.4639175258,
"line_max": 75,
"alpha_frac": 0.5912013536,
"autogenerated": false,
"ratio": 3.872870249017038,
"config_test": false... |
"""A set of additional functions used across the whole project"""
from .const import *
import os
import platform
import sys
def printLine(txt):
#helper function for printing pretty lines
return ('-- '+txt + (ROW_LEN-len(txt)-6)*' ' + ' --\n')
if platform.system() == 'Windows':
clear_display = lambda: os.system('cl... | {
"repo_name": "wilk16/rpggame",
"path": "src/misc/misc.py",
"copies": "1",
"size": "1344",
"license": "mit",
"hash": 832611352925235100,
"line_mean": 25.88,
"line_max": 71,
"alpha_frac": 0.6391369048,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_keywords": false,
"few_a... |
"""A set of algorithms or models"""
from diot import Diot
from pyppl import Proc
from . import params, proc_factory
pRWR = proc_factory(
desc = 'Do random walk with restart (RWR).',
config = Diot(annotate = """
@input:
`Wfile:file`: The adjecent matrix
`Efile:file`: The start vector
@output:
`outfile:... | {
"repo_name": "pwwang/bioprocs",
"path": "bioprocs/algorithm.py",
"copies": "1",
"size": "4683",
"license": "mit",
"hash": 7818258702689222000,
"line_mean": 33.4338235294,
"line_max": 124,
"alpha_frac": 0.5742045697,
"autogenerated": false,
"ratio": 2.5858641634456103,
"config_test": false,
"... |
"""A set of AST classes that correspond to the code.
This AST format is desinged to be easy to parse into. See typed_ast for the AST
format that is used during the evaluation step.
"""
from __future__ import absolute_import
import collections
class Select(collections.namedtuple(
'Select', ['select_fields', ... | {
"repo_name": "Khan/tinyquery",
"path": "tinyquery/tq_ast.py",
"copies": "1",
"size": "6354",
"license": "mit",
"hash": -6555121143733884000,
"line_mean": 33.5326086957,
"line_max": 79,
"alpha_frac": 0.5845136922,
"autogenerated": false,
"ratio": 4.177514792899408,
"config_test": false,
"has_... |
"""A set of AST classes that correspond to the code.
This AST format is desinged to be easy to parse into. See typed_ast for the AST
format that is used during the evaluation step.
"""
import collections
class Select(collections.namedtuple(
'Select', ['select_fields', 'table_expr', 'where_expr', 'groups',
... | {
"repo_name": "burnhamup/tinyquery",
"path": "tinyquery/tq_ast.py",
"copies": "1",
"size": "4743",
"license": "mit",
"hash": 8957019290822566000,
"line_mean": 33.1223021583,
"line_max": 79,
"alpha_frac": 0.5932953827,
"autogenerated": false,
"ratio": 4.1936339522546415,
"config_test": false,
... |
"""A set of classes and functions for btd_sched.py (and others?)."""
import sys
import time
from datetime import datetime, timedelta
from pathlib import Path
import re
from iteration_utilities import deepflatten
from rivendell_lib import RDDatabase
def my_print(*p_args, **p_kwargs):
"""My print function that alwa... | {
"repo_name": "opensourceradio/ram",
"path": "usr/local/bin/btd_sched/schedlib.py",
"copies": "1",
"size": "14684",
"license": "bsd-2-clause",
"hash": 4520422525656754700,
"line_mean": 40.1316526611,
"line_max": 111,
"alpha_frac": 0.5732770362,
"autogenerated": false,
"ratio": 4.0307438923963765,... |
"""A set of classes for reading and writing packets from X-Plane."""
import socket
import struct
import pint
units = pint.UnitRegistry()
GRAVITY = 9.81 * (units.meter / units.second ** 2)
LEAVE_ALONE = -999
class DataPacket:
"""
Contains methods for reading data from a 'DATA' packet.
Parameters
... | {
"repo_name": "thomasleese/snakes-on-a-plane",
"path": "xplane/packets.py",
"copies": "2",
"size": "11000",
"license": "mit",
"hash": 3873570708193102300,
"line_mean": 24.5813953488,
"line_max": 81,
"alpha_frac": 0.5069090909,
"autogenerated": false,
"ratio": 3.6315615714757348,
"config_test": ... |
"""A set of classes that can be used to represent electric cars."""
from car import Car
class Battery():
"""A simple attempt to model a battery for an electric car."""
def __init__(self, battery_size=70):
"""Initialize the battery's attributes."""
self.battery_size = battery_size
def des... | {
"repo_name": "mccarrion/python-practice",
"path": "crash_course/chapter09/electric_car.py",
"copies": "1",
"size": "1478",
"license": "mit",
"hash": -98478923571663120,
"line_mean": 30.4468085106,
"line_max": 75,
"alpha_frac": 0.6136671177,
"autogenerated": false,
"ratio": 3.751269035532995,
"... |
"""A set of classes that can be used to represent electric cars."""
from car import Car
class Battery():
"""A simple attempt to model a battery for an electric car."""
def __init__(self, battery_size=60):
"""Initialize the batteery's attributes."""
self.battery_size = battery_size
... | {
"repo_name": "lluxury/pcc_exercise",
"path": "09/upgrade_battery.py",
"copies": "1",
"size": "1709",
"license": "mit",
"hash": 5899417994760458000,
"line_mean": 29.0185185185,
"line_max": 77,
"alpha_frac": 0.5953377167,
"autogenerated": false,
"ratio": 3.7936507936507935,
"config_test": false,... |
"""a set of common performance metrics"""
from scipy import stats
from functools import lru_cache
from itertools import chain, repeat, permutations
from operator import itemgetter
from decimal import Decimal
from .general_functions import groupby_unsorted
from . import log
import numpy as np
import pandas as pd
impo... | {
"repo_name": "TUW-GEO/rt1",
"path": "rt1/rtmetrics.py",
"copies": "1",
"size": "17538",
"license": "apache-2.0",
"hash": -6301392051732861000,
"line_mean": 26.1066460587,
"line_max": 113,
"alpha_frac": 0.5023947999,
"autogenerated": false,
"ratio": 4.152971820980346,
"config_test": false,
"h... |
"""A set of constants and methods to manage permissions and security"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from flask_appbuilder.security.sqla import models as ab_models
from superset impor... | {
"repo_name": "nekia/incubator-superset-dev",
"path": "superset/security.py",
"copies": "3",
"size": "6546",
"license": "apache-2.0",
"hash": -7094708657664469000,
"line_mean": 29.0275229358,
"line_max": 78,
"alpha_frac": 0.6729300336,
"autogenerated": false,
"ratio": 3.365552699228792,
"config... |
"""A set of datetime.datetime and datetime.date related functions"""
from __future__ import absolute_import
from datetime import timedelta, date, datetime
def start_of_day(val):
"""
Return a new datetime.datetime object with values that represent
a start of a day.
:param val: Date to ...
:type val... | {
"repo_name": "tomi77/python-t77-date",
"path": "t77_date/datetime.py",
"copies": "1",
"size": "3132",
"license": "mit",
"hash": -7109223718385193000,
"line_mean": 29.4077669903,
"line_max": 77,
"alpha_frac": 0.630587484,
"autogenerated": false,
"ratio": 3.6208092485549135,
"config_test": false... |
"""A set of datetime.timedelta related functions"""
from __future__ import absolute_import, division
import re
from datetime import timedelta
import six
from .constants import MICROSECONDS_IN_SECOND, SECONDS_IN_DAY, \
SECONDS_IN_HOUR, SECONDS_IN_MINUTE, HOURS_IN_DAY, INTERVAL_REGEX_STR
INTERVAL_REGEX = re.compi... | {
"repo_name": "tomi77/python-t77-date",
"path": "t77_date/timedelta.py",
"copies": "1",
"size": "2823",
"license": "mit",
"hash": 3443831297315643000,
"line_mean": 30.7191011236,
"line_max": 79,
"alpha_frac": 0.672334396,
"autogenerated": false,
"ratio": 4.103197674418604,
"config_test": false,... |
"""A set of dateutil.tz related functions"""
from __future__ import print_function, division
from datetime import datetime
from dateutil.tz import tzlocal, tzutc
def _convert(value, tzto, defaulttz):
"""Convert datetime.datetime object between timezones"""
if not isinstance(value, datetime):
raise V... | {
"repo_name": "tomi77/python-t77-date",
"path": "t77_date/tz.py",
"copies": "1",
"size": "1093",
"license": "mit",
"hash": -479674576662165250,
"line_mean": 27.0256410256,
"line_max": 68,
"alpha_frac": 0.6944190302,
"autogenerated": false,
"ratio": 4.048148148148148,
"config_test": false,
"ha... |
""" a set of defs used to manage xpi
"""
import os
import shutil
import simplejson
import subprocess
import time
import waffle
import commonware.log
from statsd import statsd
from django.conf import settings
#from django.utils.translation import ugettext as _
log = commonware.log.getLogger('f.xpi_utils')
def info... | {
"repo_name": "mozilla/FlightDeck",
"path": "apps/xpi/xpi_utils.py",
"copies": "1",
"size": "5076",
"license": "bsd-3-clause",
"hash": 1465651140780257300,
"line_mean": 32.1764705882,
"line_max": 80,
"alpha_frac": 0.5914105595,
"autogenerated": false,
"ratio": 3.375,
"config_test": false,
"ha... |
""" A set of descriptors that document intended types for attributes on
classes and implement convenience behaviors like default values, etc.
"""
from __future__ import print_function
import re
import datetime
import dateutil.parser
from importlib import import_module
from copy import copy
import inspect
import loggin... | {
"repo_name": "jakevdp/bokeh",
"path": "bokeh/properties.py",
"copies": "1",
"size": "38439",
"license": "bsd-3-clause",
"hash": 2298246690737897700,
"line_mean": 34.8907563025,
"line_max": 134,
"alpha_frac": 0.5968677645,
"autogenerated": false,
"ratio": 4.163218888768547,
"config_test": false... |
"""A set of equations for calculating various values for a starmade entity."""
# For example, thrust and max speed given mass and number of thrusters.
# TODO(danmcg): Pull number from blockBehaviorConfig.xml <PowerCeiling>
POWER_CEILING = 2000000
# TODO(danmcg): Pull number from blockBehaviorConfig.xml <PowerDivFacto... | {
"repo_name": "dmcgrath/starmade-blueprint-library",
"path": "starmade/equations.py",
"copies": "1",
"size": "6759",
"license": "apache-2.0",
"hash": 2951872896786239000,
"line_mean": 35.5351351351,
"line_max": 94,
"alpha_frac": 0.6900429058,
"autogenerated": false,
"ratio": 3.705592105263158,
... |
"""A set of examples used for demonstrating the physt capabilities / in tests."""
import io
import pkgutil
import numpy as np
from physt.histogram1d import Histogram1D
from physt.histogram_nd import Histogram2D, HistogramND
from physt.facade import h1, h2, h3
def normal_h1(size: int = 10000, mean: float = 0, sigma:... | {
"repo_name": "janpipek/physt",
"path": "physt/examples/__init__.py",
"copies": "1",
"size": "3574",
"license": "mit",
"hash": 1190186319664142000,
"line_mean": 26.4923076923,
"line_max": 89,
"alpha_frac": 0.5769445999,
"autogenerated": false,
"ratio": 3.6807415036045312,
"config_test": false,
... |
"""A set of extra ufuncs inspired from PDL: Fused operations.
- add3
- multiply3
- multiply3_add
- multiply_add
- multiply_add2
- multiply4
- multiply4_add
Note: for many use-cases, numba may provide a better solution
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from . im... | {
"repo_name": "ContinuumIO/gulinalg",
"path": "gulinalg/ufunc_extras.py",
"copies": "1",
"size": "8369",
"license": "bsd-2-clause",
"hash": -7210446646826693000,
"line_mean": 24.9906832298,
"line_max": 76,
"alpha_frac": 0.5933803322,
"autogenerated": false,
"ratio": 3.5826198630136985,
"config_... |
# A set of functions helpful for analysing the OD matrices produced from tools
# such as OpenTripPlanner, NetView, etc.
# Patrick Sunter, 2013-2014.
# Uses OGR library for shape file manipulation aspects.
import csv
import os
import operator
import itertools
import numpy
import taz_files
### General utility functi... | {
"repo_name": "PatSunter/pyOTPA",
"path": "od_matrix_analysis.py",
"copies": "1",
"size": "9063",
"license": "bsd-3-clause",
"hash": 3155621054549830700,
"line_mean": 33.9922779923,
"line_max": 79,
"alpha_frac": 0.6439368862,
"autogenerated": false,
"ratio": 3.5611001964636544,
"config_test": f... |
"""A set of functions to help the protocols implementation."""
import six
from .graph.nodes import Root
from .helper import Logger
def can_execute(operation, component):
"""Check if an operation can be executed on a component."""
assert isinstance(operation, six.string_types)
assert isinstance(component, ... | {
"repo_name": "di-unipi-socc/tosKer",
"path": "tosker/protocol_helper.py",
"copies": "1",
"size": "2598",
"license": "mit",
"hash": 7348810131905121000,
"line_mean": 49.9411764706,
"line_max": 96,
"alpha_frac": 0.6085450346,
"autogenerated": false,
"ratio": 4.639285714285714,
"config_test": fal... |
"""A set of functions to standardize some options for python scripts"""
import logging
import argparse
from os import getcwd, path
logger = logging.getLogger(__name__)
def setup_parser_help(parser, additional_docs=None):
"""
Set formatting for parser to raw and add docstring to help output
Parameters
... | {
"repo_name": "mwcraig/msumastro",
"path": "msumastro/scripts/script_helpers.py",
"copies": "1",
"size": "4983",
"license": "bsd-3-clause",
"hash": -9129508277166882000,
"line_mean": 26.3791208791,
"line_max": 76,
"alpha_frac": 0.6128838049,
"autogenerated": false,
"ratio": 4.371052631578947,
"... |
"""A set of functions used to validate HTTP input data.
These functions are primarily used to valid that arguments sent in http
requests are what they are supposed to be.
"""
from typing import Union, Any, Dict, List, cast, Optional, SupportsInt
from irisett.webapi.errors import InvalidData
def require_str(value: ... | {
"repo_name": "beebyte/irisett",
"path": "irisett/webapi/require.py",
"copies": "1",
"size": "3225",
"license": "mit",
"hash": -7142352400459288000,
"line_mean": 33.3085106383,
"line_max": 109,
"alpha_frac": 0.6096124031,
"autogenerated": false,
"ratio": 3.706896551724138,
"config_test": false,... |
"""A set of generic utility functions."""
import subprocess
import optparse
import sys
def run(cmd, echo=False, verbose=False):
"""Run a command in a sub-process."""
result = []
if echo:
print(cmd)
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
line = p.stdout.readline()
... | {
"repo_name": "vmlaker/pythonwildmagic",
"path": "tool/util.py",
"copies": "1",
"size": "3571",
"license": "mit",
"hash": -1125724373356811100,
"line_mean": 29.5213675214,
"line_max": 78,
"alpha_frac": 0.5317838141,
"autogenerated": false,
"ratio": 4.2461355529131986,
"config_test": false,
"h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.