text stringlengths 0 1.05M | meta dict |
|---|---|
# analyze log files from the apache web server.
# log lines are in the 'combined' format.
from apachelogparser import ApacheLogParser
from useragent import UserAgent
import time
def ymd(epoch):
"""formats a unix timestamp as string of format yyyymmdd
ymd(1258308085) => '20091115'"""
time_tuple = time.gmti... | {
"repo_name": "zohmg/zohmg",
"path": "examples/apache/mappers/apache.py",
"copies": "1",
"size": "1093",
"license": "apache-2.0",
"hash": -1824033890397719600,
"line_mean": 29.3611111111,
"line_max": 66,
"alpha_frac": 0.6660567246,
"autogenerated": false,
"ratio": 4.003663003663004,
"config_tes... |
# Analyze reflectance signal data in an index
import os
import numpy as np
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import fatal_error
from plotnine import labs
from plantcv.plantcv.visualize import histogram
from plantcv.plan... | {
"repo_name": "stiphyMT/plantcv",
"path": "plantcv/plantcv/hyperspectral/analyze_index.py",
"copies": "2",
"size": "5653",
"license": "mit",
"hash": 787654139049483400,
"line_mean": 46.5042016807,
"line_max": 119,
"alpha_frac": 0.6562886963,
"autogenerated": false,
"ratio": 3.995053003533569,
"... |
# Analyze reflectance signal hyperspectral images
import os
import numpy as np
import pandas as pd
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plotnine import ggplot, aes, geom_line, scale_x_continuous
from plantcv.plantcv import deprecation_warning
from plantcv.plantcv._debug import _d... | {
"repo_name": "danforthcenter/plantcv",
"path": "plantcv/plantcv/hyperspectral/analyze_spectral.py",
"copies": "2",
"size": "6135",
"license": "mit",
"hash": 8260687495565371000,
"line_mean": 51.8879310345,
"line_max": 120,
"alpha_frac": 0.6588427058,
"autogenerated": false,
"ratio": 4.1536899119... |
"""Analyzer for audio feature extraction using Essentia"""
from __future__ import print_function
import os
import mimetypes
import subprocess
import json
from damn_at import logger
from damn_at import AssetId, FileId, FileDescription, AssetDescription
from damn_at.pluginmanager import IAnalyzer
from damn_at.analyzers.... | {
"repo_name": "peragro/peragro-at",
"path": "src/damn_at/analyzers/audio/feature_extraction.py",
"copies": "1",
"size": "5784",
"license": "bsd-3-clause",
"hash": 6673061830718431000,
"line_mean": 32.4335260116,
"line_max": 79,
"alpha_frac": 0.555670816,
"autogenerated": false,
"ratio": 4.0110957... |
"""Analyzer for audio files using AcoustID"""
from __future__ import print_function
import os
import mimetypes
import subprocess
import uuid
from damn_at import logger
from damn_at import AssetId, FileId, FileDescription, AssetDescription
from damn_at.pluginmanager import IAnalyzer
from damn_at.analyzers.audio import ... | {
"repo_name": "peragro/peragro-at",
"path": "src/damn_at/analyzers/audio/acoustid_analyzer.py",
"copies": "1",
"size": "2506",
"license": "bsd-3-clause",
"hash": 5108976354710713000,
"line_mean": 29.9382716049,
"line_max": 78,
"alpha_frac": 0.5865921788,
"autogenerated": false,
"ratio": 4.1081967... |
"""Analyzer for audio files using sox"""
from __future__ import print_function
import os
import re
import logging
import mimetypes
import subprocess
from damn_at import logger
from damn_at import AssetId, FileId, FileDescription, AssetDescription
from damn_at import MetaDataValue, MetaDataType
from damn_at.pluginmanag... | {
"repo_name": "peragro/peragro-at",
"path": "src/damn_at/analyzers/audio/soxanalyzer.py",
"copies": "1",
"size": "3438",
"license": "bsd-3-clause",
"hash": -2983946654614998000,
"line_mean": 31.1308411215,
"line_max": 77,
"alpha_frac": 0.5526468877,
"autogenerated": false,
"ratio": 4.102625298329... |
"""Analyzer for Videos """
# Standard
import os
import logging
import subprocess
# Damn
import mimetypes
from damn_at import (
MetaDataType,
MetaDataValue,
FileId,
FileDescription,
AssetDescription,
AssetId
)
from damn_at.pluginmanager import IAnalyzer
from damn_at.analyzers.video import metada... | {
"repo_name": "peragro/peragro-at",
"path": "src/damn_at/analyzers/video/videoanalyzer.py",
"copies": "1",
"size": "2654",
"license": "bsd-3-clause",
"hash": -5204380268657263000,
"line_mean": 28.4888888889,
"line_max": 72,
"alpha_frac": 0.5222305953,
"autogenerated": false,
"ratio": 4.0581039755... |
# analyzer / generator for historical models
import sys
import os
import pickle
libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')
sys.path.append(libdir)
from msp_isa import isa
import smt
import historical_models
def is_valid_mode(ins, rsname, rdname):
source_valid = True
dest_valid... | {
"repo_name": "billzorn/msp-pymodel",
"path": "getmodel.py",
"copies": "1",
"size": "13164",
"license": "mit",
"hash": 4605615075140933600,
"line_mean": 42.4455445545,
"line_max": 156,
"alpha_frac": 0.5116226071,
"autogenerated": false,
"ratio": 3.1172152498224013,
"config_test": false,
"has_... |
"""Analyzer
Analyzer module for setting menu bar setup for OSX
"""
__author__ = "ales lerch"
import os
import cv2
import numpy
from PIL import Image
def check_image_color(image):
"""Returns string containing 'ligh' or 'dark' that tells if image is for day or night,
Y -- converting to gray to detect if it's ... | {
"repo_name": "L3rchal/WallpDesk",
"path": "wall-desk/analyzer.py",
"copies": "1",
"size": "1734",
"license": "mit",
"hash": -5923397346266415000,
"line_mean": 28.3898305085,
"line_max": 92,
"alpha_frac": 0.5888119954,
"autogenerated": false,
"ratio": 3.32183908045977,
"config_test": false,
"... |
"""Analyzers decorate AgileTickets with contextual information.
Analyzers look at tickets through the lens of "this is my start state", or
"this is what defects look like" and modify AgileTickets to contain information
based on that context like "ended_at", "commited_at", "started_at", etc.
"""
from .models import An... | {
"repo_name": "cmheisel/agile-analytics",
"path": "agile_analytics/analyzers.py",
"copies": "2",
"size": "6558",
"license": "mit",
"hash": 4240071034936810000,
"line_mean": 36.0508474576,
"line_max": 131,
"alpha_frac": 0.6152790485,
"autogenerated": false,
"ratio": 4.27509778357236,
"config_tes... |
analyzers = {
"filter" : {
"lay_to_legalise" : {
"type" : "synonym",
"synonyms" : [
"dog catcher => idea_1234, idea_25",
"animal control => idea_1234, idea_25",
"spca officer => idea_1234, idea_25",
"rabies shot => idea_... | {
"repo_name": "o19s/semantic-search-course",
"path": "taxonomyDemo.py",
"copies": "1",
"size": "1783",
"license": "apache-2.0",
"hash": 6624088900943525000,
"line_mean": 27.3015873016,
"line_max": 63,
"alpha_frac": 0.4699943915,
"autogenerated": false,
"ratio": 3.691511387163561,
"config_test":... |
"""Analyzes an MP3 file, gathering statistics and looking for errors."""
import cStringIO
import hashlib
import os
from chirp.common import mp3_frame
# Files with fewer than this many MPEG frames will be rejected as
# invalid. 100 frames is about 2.6s of audio.
_MINIMUM_FRAMES = 100
_MINIMUM_REASONABLE_FILE_SIZE =... | {
"repo_name": "chirpradio/chirpradio-machine",
"path": "chirp/library/analyzer.py",
"copies": "1",
"size": "5178",
"license": "apache-2.0",
"hash": 3501255408051768300,
"line_mean": 35.7234042553,
"line_max": 78,
"alpha_frac": 0.6361529548,
"autogenerated": false,
"ratio": 3.735930735930736,
"c... |
# Analyzes an object and outputs numeric properties
import cv2
import numpy as np
from . import fatal_error
from . import print_image
from . import plot_image
from . import rgb2gray_hsv
from . import find_objects
from . import binary_threshold
from . import define_roi
from . import roi_objects
from . import object_com... | {
"repo_name": "AntonSax/plantcv",
"path": "plantcv/report_size_marker_area.py",
"copies": "2",
"size": "7900",
"license": "mit",
"hash": 8553613279588709000,
"line_mean": 38.3034825871,
"line_max": 118,
"alpha_frac": 0.5548101266,
"autogenerated": false,
"ratio": 3.4154777345438823,
"config_tes... |
# Analyzes an object and outputs numeric properties
import cv2
import numpy as np
import os
from plantcv.plantcv import fatal_error
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
from plantcv.plantcv import rgb2gray_hsv
from plantcv.plantcv import find_objects
from plantcv.plantcv.thres... | {
"repo_name": "danforthcenter/plantcv",
"path": "plantcv/plantcv/report_size_marker_area.py",
"copies": "2",
"size": "7276",
"license": "mit",
"hash": -5033075891600188000,
"line_mean": 48.4965986395,
"line_max": 118,
"alpha_frac": 0.6293293018,
"autogenerated": false,
"ratio": 4.071628427532177,... |
# Analyzes an object and outputs numeric properties
import os
import cv2
import numpy as np
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plantcv.plantcv import within_frame
from plantcv.plantcv._debug import _debug
def analyze_object(img, obj, mask, label="default"):
"""Outputs num... | {
"repo_name": "stiphyMT/plantcv",
"path": "plantcv/plantcv/analyze_object.py",
"copies": "1",
"size": "10586",
"license": "mit",
"hash": -5408985623731181000,
"line_mean": 47.3378995434,
"line_max": 119,
"alpha_frac": 0.6012658228,
"autogenerated": false,
"ratio": 3.4459635416666665,
"config_te... |
"""Analyzes backwards-optimization experiment."""
import numpy
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from generalexam.machine_learning import evaluation_utils
from gewittergefahr.deep_learning import backwards_optimization as backwards_opt
from gewittergefahr.plotting import plotting_ut... | {
"repo_name": "thunderhoser/GewitterGefahr",
"path": "gewittergefahr/interpretation_paper_2019/analyze_bwo_experiment.py",
"copies": "1",
"size": "3186",
"license": "mit",
"hash": 3920574737115734500,
"line_mean": 33.6304347826,
"line_max": 80,
"alpha_frac": 0.6572504708,
"autogenerated": false,
... |
"""Analyzes backwards-optimization experiment."""
import numpy
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from gewittergefahr.gg_utils import model_evaluation
from gewittergefahr.deep_learning import backwards_optimization as backwards_opt
from gewittergefahr.plotting import plotting_utils
... | {
"repo_name": "thunderhoser/GewitterGefahr",
"path": "gewittergefahr/dissertation/myrorss/analyze_bwo_experiment.py",
"copies": "1",
"size": "3152",
"license": "mit",
"hash": 6157690709022115000,
"line_mean": 31.8333333333,
"line_max": 80,
"alpha_frac": 0.6583121827,
"autogenerated": false,
"rati... |
"""Analyzes executables to find out which other executables anywhere
in the loaded libraries call that one. This is repeated recursively
to generate possible trees that end up in calling the one at the end.
"""
#NOTE: this was originally intended to augment the setting of breakpoints
#in the interactive debugging; I re... | {
"repo_name": "rosenbrockc/fortpy",
"path": "fortpy/stats/calltree.py",
"copies": "1",
"size": "2900",
"license": "mit",
"hash": -8595396519207858000,
"line_mean": 35.7088607595,
"line_max": 75,
"alpha_frac": 0.6420689655,
"autogenerated": false,
"ratio": 4.2212518195050945,
"config_test": fals... |
# Analyze signal data in NIR image
import os
import cv2
import numpy as np
from . import print_image
from . import plot_image
from . import plot_colorbar
from . import binary_threshold
from . import apply_mask
def analyze_NIR_intensity(img, rgbimg, mask, bins, device, histplot=False, debug=None, filename=False):
... | {
"repo_name": "AntonSax/plantcv",
"path": "plantcv/analyze_NIR_intensity.py",
"copies": "1",
"size": "4387",
"license": "mit",
"hash": 92303856101619540,
"line_mean": 30.3357142857,
"line_max": 114,
"alpha_frac": 0.6156826989,
"autogenerated": false,
"ratio": 3.6376451077943615,
"config_test": ... |
# Analyze signal data in Thermal image
import os
import numpy as np
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plotnine import labs
from plantcv.plantcv.visualize import histogram
from plantcv.plantcv import deprecation_warning
from plantcv.plantcv._debug import _debug
def analyze_th... | {
"repo_name": "danforthcenter/plantcv",
"path": "plantcv/plantcv/analyze_thermal_values.py",
"copies": "2",
"size": "3700",
"license": "mit",
"hash": -8001538498496774000,
"line_mean": 44.1219512195,
"line_max": 116,
"alpha_frac": 0.6697297297,
"autogenerated": false,
"ratio": 4.190260475651189,
... |
"""Analyzes part 2 of backwards-optimization experiment."""
import numpy
from gewittergefahr.deep_learning import backwards_optimization as backwards_opt
MINMAX_WEIGHTS = numpy.concatenate((
numpy.logspace(-4, 1, num=26), numpy.logspace(1, 3, num=21)[1:]
))
TOP_EXPERIMENT_DIR_NAME = (
'/glade/work/ryanlage/p... | {
"repo_name": "thunderhoser/GewitterGefahr",
"path": "gewittergefahr/interpretation_paper_2019/analyze_bwo_experiment_part2.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": 2791240383458750500,
"line_mean": 28.619047619,
"line_max": 80,
"alpha_frac": 0.6382636656,
"autogenerated": fals... |
"""Analyzes posts to determine whether they are considered recipes."""
from time import time, sleep
from datetime import datetime
import praw
from src.Recipe import Recipe, PostInfo, RefinedPost
from src.RecipeHandler import RecipeHandler
from src import Analyzer
DAY_SECONDS = 24 * 3600
class RedditAPI:
"""The ... | {
"repo_name": "IgorGee/Eat-Cheap-And-Healthy-Recipe-Centralizer",
"path": "src/Scraper.py",
"copies": "1",
"size": "6041",
"license": "mit",
"hash": -2729081771586332000,
"line_mean": 33.9190751445,
"line_max": 79,
"alpha_frac": 0.5868233736,
"autogenerated": false,
"ratio": 4.290482954545454,
... |
# Analyze stem characteristics
import os
import cv2
import numpy as np
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plantcv.plantcv import plot_image
from plantcv.plantcv import print_image
def analyze_stem(rgb_img, stem_objects, label="default"):
""" Calculate angle of segments (i... | {
"repo_name": "stiphyMT/plantcv",
"path": "plantcv/plantcv/morphology/analyze_stem.py",
"copies": "2",
"size": "3055",
"license": "mit",
"hash": 4460195969054543400,
"line_mean": 42.0281690141,
"line_max": 120,
"alpha_frac": 0.6271685761,
"autogenerated": false,
"ratio": 3.7576875768757687,
"co... |
'''Analyzes the visualize.py output'''
from numpy import log
import numpy as np
from scipy import optimize
from matplotlib import pyplot as plt
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
root.destroy()
saved_results = dict(np.load(file_... | {
"repo_name": "BehzadE/Sandpile",
"path": "analyze.py",
"copies": "1",
"size": "1110",
"license": "mit",
"hash": -3308559506646186000,
"line_mean": 24.8139534884,
"line_max": 75,
"alpha_frac": 0.6630630631,
"autogenerated": false,
"ratio": 2.817258883248731,
"config_test": false,
"has_no_keyw... |
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string as s
import re
def get_word_list(file_name):
''' Reads the specified project Gutenberg book. Header comments,
punctuation, and whitespace are stripped away. The function
returns a list of the words u... | {
"repo_name": "nshlapo/SoftwareDesignFall15",
"path": "toolbox/word_frequency_analysis/frequency.py",
"copies": "1",
"size": "3043",
"license": "mit",
"hash": 70296990955436800,
"line_mean": 29.7474747475,
"line_max": 82,
"alpha_frac": 0.6201117318,
"autogenerated": false,
"ratio": 3.609727164887... |
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
file_name = "pg32325.txt"
#print lines
punctuation = string.punctuation
whitespace = ['\t','\n','\x0b','\x0c','\r',' ']
def get_word_list(file_name):
""" Reads the specified project Gutenberg book. Header com... | {
"repo_name": "SKim4/SoftwareDesignFall15",
"path": "word_frequency_analysis/example.py",
"copies": "1",
"size": "2266",
"license": "mit",
"hash": 7546329251216296000,
"line_mean": 25.6588235294,
"line_max": 82,
"alpha_frac": 0.5962047661,
"autogenerated": false,
"ratio": 3.6666666666666665,
"c... |
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
from collections import Counter
def get_word_list(file_name):
""" Reads the specified project Gutenberg book. Header comments,
punctuation, and whitespace are stripped away. The function
returns a list of the words... | {
"repo_name": "bozzellaj/SoftwareDesignFall15",
"path": "WordFreqToolbox/myfrequency.py",
"copies": "1",
"size": "1752",
"license": "mit",
"hash": -3558886447493559300,
"line_mean": 25.9538461538,
"line_max": 79,
"alpha_frac": 0.7100456621,
"autogenerated": false,
"ratio": 3.1624548736462095,
"... |
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
def get_word_list(file_name):
""" Reads the specified project Gutenberg book. Header comments,
punctuation, and whitespace are stripped away. The function
returns a list of the words used in the book as a list.
A... | {
"repo_name": "SelinaWang/SoftwareDesignFall15",
"path": "toolbox/word_frequency_analysis/frequency.py",
"copies": "1",
"size": "2034",
"license": "mit",
"hash": 1181789207801207300,
"line_mean": 31.8225806452,
"line_max": 79,
"alpha_frac": 0.709439528,
"autogenerated": false,
"ratio": 3.18309859... |
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
punctuation = string.punctuation
def get_word_list(file_name):
""" Reads the specified project Gutenberg book. Header comments,
punctuation, and whitespace are stripped away. The function
returns a list of the ... | {
"repo_name": "SKim4/SoftwareDesignFall15",
"path": "word_frequency_analysis/frequency2.py",
"copies": "2",
"size": "1921",
"license": "mit",
"hash": 3521579035444359700,
"line_mean": 21.869047619,
"line_max": 79,
"alpha_frac": 0.6876626757,
"autogenerated": false,
"ratio": 3.0736,
"config_test... |
"""Analyze stock market data."""
import math
import click
import matplotlib.pyplot as plt
import pandas as pd
@click.command()
@click.option("-f", "--file", "filepath", required=True)
def main(filepath):
"""
Download data via
https://www.fondscheck.de/quotes/historic?boerse_id=5&secu=123822833&page=23
... | {
"repo_name": "MartinThoma/algorithms",
"path": "ML/stock-quotes/quote_analysis.py",
"copies": "1",
"size": "3009",
"license": "mit",
"hash": -6400631657040882000,
"line_mean": 28.7920792079,
"line_max": 109,
"alpha_frac": 0.5689597873,
"autogenerated": false,
"ratio": 3.242456896551724,
"confi... |
# Analyze the POS and NER results, look for correlations between them
import numpy as np
import matplotlib.pyplot as plt
import operator
class Token:
def __init__(self, word, postag, gold_postag, nertag, gold_nertag):
self.word = word
self.postag = postag
self.gold_postag = gold_postag
self.nertag = nertag
... | {
"repo_name": "strubell/nlp-class-proj",
"path": "analysis.py",
"copies": "1",
"size": "4594",
"license": "apache-2.0",
"hash": 8647015144497817000,
"line_mean": 33.0296296296,
"line_max": 105,
"alpha_frac": 0.6963430562,
"autogenerated": false,
"ratio": 2.7247924080664294,
"config_test": false... |
"""Analyze the tdc data from simulation. Usefull for tdc data comparison with real measurement.
"""
import tables as tb
import numpy as np
import progressbar
import os
import math
import sys
import glob
from pybar.analysis.analyze_raw_data import AnalyzeRawData
import pybar.scans.analyze_source_scan_tdc_data as tdc_an... | {
"repo_name": "DavidLP/SourceSim",
"path": "tools/fei4_tdc_analysis.py",
"copies": "1",
"size": "3186",
"license": "bsd-2-clause",
"hash": 1073614007138025000,
"line_mean": 49.5873015873,
"line_max": 235,
"alpha_frac": 0.6362209667,
"autogenerated": false,
"ratio": 3.271047227926078,
"config_te... |
# Analyze treatment regimens by patient
# Note: The treatment_resp dataset seems to be more complete, and the treatment_regimen dataset seems to have info
# on dosage (which we're tentatively ignoring for now)
import os
from load_patient_data import load_treatment_regimen, load_treatment_resp
import numpy as np
impo... | {
"repo_name": "xpspectre/multiple-myeloma",
"path": "analyze_treatments.py",
"copies": "1",
"size": "9130",
"license": "mit",
"hash": -2716888472312346000,
"line_mean": 39.3982300885,
"line_max": 135,
"alpha_frac": 0.6308871851,
"autogenerated": false,
"ratio": 3.5973207249802996,
"config_test"... |
"""Analyze unpacked OP-1 firmware directories."""
import os
import re
import time
UNKNOWN_VALUE = 'UNKNOWN'
def analyze_boot_ldr(target):
path = os.path.join(target, 'te-boot.ldr')
f = open(path, 'rb')
data = f.read()
f.close()
version_arr = re.findall(br'TE-BOOT .+?(\d*\.?\d+)', data)
boot... | {
"repo_name": "op1hacks/op1-fw-repacker",
"path": "op1repacker/op1_analyze.py",
"copies": "1",
"size": "2208",
"license": "mit",
"hash": -5855937890467880000,
"line_mean": 26.9493670886,
"line_max": 97,
"alpha_frac": 0.5865036232,
"autogenerated": false,
"ratio": 3.079497907949791,
"config_test... |
"""Analyzing classes"""
from functools import reduce, partial
from collections import defaultdict
import inspect
import re
from warnings import warn
import pandas as pd
super_methods_p = re.compile('super\(\)\.(?P<super_method>\w+)\(')
ordered_unik_elements = partial(reduce,
lambda uni... | {
"repo_name": "thorwhalen/ut",
"path": "util/class_analysis.py",
"copies": "1",
"size": "11522",
"license": "mit",
"hash": -8082292552589861000,
"line_mean": 37.0264026403,
"line_max": 121,
"alpha_frac": 0.5727304287,
"autogenerated": false,
"ratio": 3.62441019188424,
"config_test": false,
"h... |
# # Analyzing results from notebooks
#
# The `.ipynb` format is capable of storing tables and charts in a standalone file. This makes it a great choice for model evaluation reports. `NotebookCollection` allows you to retrieve results from previously executed notebooks to compare them.
# +
import papermill as pm
import... | {
"repo_name": "edublancas/sklearn-evaluation",
"path": "docs/source/nbs/NotebookCollection.py",
"copies": "1",
"size": "3930",
"license": "mit",
"hash": 5401046204740199000,
"line_mean": 33.1739130435,
"line_max": 289,
"alpha_frac": 0.7264631043,
"autogenerated": false,
"ratio": 3.546931407942238... |
""" An Ambry bundle for building geofile bundles
How to Create a New Geofile Bundle
==================================
Step 1: Setup source.
It's easiest to copy from a similar bundle and edit. You'll need these
sources:
* A dnlpage<year><release> for each year/release. These are URLs to the
download page for the... | {
"repo_name": "CivicKnowledge/censuslib",
"path": "censuslib/geofile.py",
"copies": "1",
"size": "9686",
"license": "mit",
"hash": 5970163995614014000,
"line_mean": 28.3515151515,
"line_max": 116,
"alpha_frac": 0.5768118935,
"autogenerated": false,
"ratio": 3.839080459770115,
"config_test": fal... |
A = {'name':'A','stack':[2,1]}
B = {'name':'B','stack':[]}
C = {'name':'C','stack':[]}
def moveDisk(fromPile,toPile):
fromStack = fromPile['stack']
toStack = toPile['stack']
disk = fromStack.pop()
if len(toStack) > 0:
temp = toStack.pop()
if disk > temp:
raise Exceptio... | {
"repo_name": "willettk/insight",
"path": "python/towers_of_hanoi.py",
"copies": "1",
"size": "1166",
"license": "apache-2.0",
"hash": 6636893625123877000,
"line_mean": 20.2,
"line_max": 79,
"alpha_frac": 0.5677530017,
"autogenerated": false,
"ratio": 3.0207253886010363,
"config_test": false,
... |
# An amendment id should be a unique string (a valid filename) built from a
# range of new taxon ids, in the form '{first_new_ottid}-{last_new_ottid}'.
# EXAMPLES: 'additions-8783730-8783738'
# 'additions-4999718-5003245'
# 'additions-9998974-10000005'
# N.B. We will somebay bump to 8 di... | {
"repo_name": "mtholder/peyotl",
"path": "peyotl/amendments/amendments_umbrella.py",
"copies": "2",
"size": "18442",
"license": "bsd-2-clause",
"hash": 4062668217054940700,
"line_mean": 47.6596306069,
"line_max": 124,
"alpha_frac": 0.5431081228,
"autogenerated": false,
"ratio": 4.053186813186813,... |
"""An analysis of tic-tac-toe.
The goal here is to simply iterate over all possible valid states in the
game of tic-tac-toe and perform some basic analyses such the number of
unique valid states and optimal moves for each state.
This implementation uses no classes, which would structure the code more,
although Python... | {
"repo_name": "langner/tictactoe",
"path": "tictactoe.py",
"copies": "1",
"size": "4411",
"license": "mit",
"hash": -7564383586187512000,
"line_mean": 35.1557377049,
"line_max": 123,
"alpha_frac": 0.6311493992,
"autogenerated": false,
"ratio": 3.304119850187266,
"config_test": false,
"has_no_... |
"""A nano HTTP server."""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
#from future.builtins import *
#from future.utils import native
#from future import standard_library
#standard_library.install_hooks()
from http.server import HTTPServer, BaseHTTPRequ... | {
"repo_name": "ilmanzo/scratch_extensions",
"path": "venv/lib/python3.4/site-packages/blockext/server.py",
"copies": "1",
"size": "3262",
"license": "mit",
"hash": -3891178590684320300,
"line_mean": 30.9803921569,
"line_max": 76,
"alpha_frac": 0.6397915389,
"autogenerated": false,
"ratio": 4.1186... |
"""An Apache Beam DoFn for lazily collecting GCS paths into a PCollection."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import apache_beam as beam
from google.cloud import storage
_SPLIT_INTO_BUCKET_AND_BLOB_REGEX = re.compile(r'^gs://([a-z... | {
"repo_name": "GoogleCloudPlatform/healthcare",
"path": "datathon/datathon_etl_pipelines/dofns/get_paths.py",
"copies": "1",
"size": "2606",
"license": "apache-2.0",
"hash": -3346455344118621000,
"line_mean": 33.2894736842,
"line_max": 80,
"alpha_frac": 0.6765157329,
"autogenerated": false,
"rati... |
"""An Apache Beam DoFn for resizing images."""
import apache_beam as beam
import tensorflow as tf
class ResizeImage(beam.DoFn):
"""Resize an image that is represented as an encoded byte-string.
Supports PNG and JPEG images.
Args:
height (int): the height to resize the images to.
width (int): the width... | {
"repo_name": "GoogleCloudPlatform/healthcare",
"path": "datathon/datathon_etl_pipelines/dofns/resize_image.py",
"copies": "1",
"size": "2657",
"license": "apache-2.0",
"hash": -5931455663368549000,
"line_mean": 33.5064935065,
"line_max": 79,
"alpha_frac": 0.6616484757,
"autogenerated": false,
"r... |
"""An API for accessing images."""
import atexit
import pathlib
import tkinter
from typing import Dict, List
# __path__[0] is the directory where this __init__.py is
__path__: List[str]
images_dir = pathlib.Path(__path__[0]).absolute()
# tkinter images destroy themselves on __del__. here's how cpython exits:
#
# ... | {
"repo_name": "Akuli/editor",
"path": "porcupine/images/__init__.py",
"copies": "2",
"size": "1641",
"license": "mit",
"hash": 7586439203305984000,
"line_mean": 31.82,
"line_max": 79,
"alpha_frac": 0.6879951249,
"autogenerated": false,
"ratio": 3.638580931263858,
"config_test": false,
"has_no... |
"""An API for feeding operations asynchronously to Chopsticks."""
from __future__ import print_function
import sys
import traceback
from functools import partial
from collections import deque
from .tunnel import loop, PY2, BaseTunnel
from .group import Group, GroupOp
__metaclass__ = type
class NotCompleted(Exception... | {
"repo_name": "lordmauve/chopsticks",
"path": "chopsticks/queue.py",
"copies": "1",
"size": "5971",
"license": "apache-2.0",
"hash": 4071369481175342000,
"line_mean": 30.4263157895,
"line_max": 112,
"alpha_frac": 0.5757829509,
"autogenerated": false,
"ratio": 4.436106983655275,
"config_test": f... |
"""An api for generating documentation from the codebase
"""
from os.path import dirname, join
from os import sep
from re import compile
import subprocess
def generate_documentation(dirs, output_dir):
"""Use doxygen to generate the documentation
Positional arguments:
dirs - the directories that doxygen ... | {
"repo_name": "radhika-raghavendran/mbed-os5.1-onsemi",
"path": "tools/misc/docs_gen.py",
"copies": "16",
"size": "1751",
"license": "apache-2.0",
"hash": 1222827911062095000,
"line_mean": 36.2553191489,
"line_max": 80,
"alpha_frac": 0.6259280411,
"autogenerated": false,
"ratio": 4.22946859903381... |
"""An API for managing OAuth2 tokens."""
from __future__ import unicode_literals
from django.db.models.query import Q
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_require... | {
"repo_name": "brennie/reviewboard",
"path": "reviewboard/webapi/resources/oauth_token.py",
"copies": "1",
"size": "11905",
"license": "mit",
"hash": -3903974834576161300,
"line_mean": 31.4386920981,
"line_max": 78,
"alpha_frac": 0.549601008,
"autogenerated": false,
"ratio": 4.711119905025722,
... |
"""An API for managing OAuth2 tokens."""
from __future__ import unicode_literals
from django.db.models.query import Q
from django.utils.translation import ugettext_lazy as _
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
... | {
"repo_name": "reviewboard/reviewboard",
"path": "reviewboard/webapi/resources/oauth_token.py",
"copies": "2",
"size": "12036",
"license": "mit",
"hash": -6183143365883414000,
"line_mean": 31.5297297297,
"line_max": 78,
"alpha_frac": 0.5508474576,
"autogenerated": false,
"ratio": 4.74792899408284... |
"""An API for recording stats about your Python application.
The goal of this library is to make it as simple as possible to record stats
about your running application.
The stats are written to a named pipe. By default, the named pipes are stored
in /tmp/stats-pipe. They are named "<PID>.stats". Integer and floating... | {
"repo_name": "dowski/statvent",
"path": "statvent/stats.py",
"copies": "1",
"size": "4636",
"license": "bsd-2-clause",
"hash": 5051000954746692000,
"line_mean": 27.2682926829,
"line_max": 79,
"alpha_frac": 0.5933994823,
"autogenerated": false,
"ratio": 3.866555462885738,
"config_test": false,
... |
"""An API to load config from a readthedocs.yml file."""
from os import path
from readthedocs.config import BuildConfigV1, ConfigFileNotFound
from readthedocs.config import load as load_config
from readthedocs.projects.models import ProjectConfigurationError
from .constants import DOCKER_IMAGE, DOCKER_IMAGE_SETTINGS... | {
"repo_name": "rtfd/readthedocs.org",
"path": "readthedocs/doc_builder/config.py",
"copies": "1",
"size": "2558",
"license": "mit",
"hash": 8067712825715650000,
"line_mean": 31.3797468354,
"line_max": 79,
"alpha_frac": 0.6395621579,
"autogenerated": false,
"ratio": 4.284757118927973,
"config_te... |
"""An Application for launching a kernel
Authors
-------
* MinRK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as pa... | {
"repo_name": "sodafree/backend",
"path": "build/ipython/IPython/zmq/kernelapp.py",
"copies": "3",
"size": "13305",
"license": "bsd-3-clause",
"hash": 8922095795768594000,
"line_mean": 38.954954955,
"line_max": 101,
"alpha_frac": 0.5998496806,
"autogenerated": false,
"ratio": 4.072543617998163,
... |
"""An Application for launching a kernel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import atexit
import os
import sys
import signal
import traceback
import logging
from tornado import ioloop
import zmq
from zmq.event... | {
"repo_name": "lancezlin/ml_template_py",
"path": "lib/python2.7/site-packages/ipykernel/kernelapp.py",
"copies": "5",
"size": "19344",
"license": "mit",
"hash": -1241053613651070200,
"line_mean": 38.6393442623,
"line_max": 101,
"alpha_frac": 0.6180727874,
"autogenerated": false,
"ratio": 4.03504... |
"""An application searcher"""
# -----------------------------
# - Imports
# -----------------------------
# Standard Library
import sys
from argparse import ArgumentParser
from pprint import pprint
from importlib import import_module
from warnings import warn
# Import from third party libraries
from xdg import Bas... | {
"repo_name": "SparklePigBang/indelve",
"path": "indelve/main.py",
"copies": "1",
"size": "5389",
"license": "mit",
"hash": -3854931554017206300,
"line_mean": 29.8,
"line_max": 147,
"alpha_frac": 0.7153460753,
"autogenerated": false,
"ratio": 3.9595885378398235,
"config_test": false,
"has_no_... |
# an application to generate the .xinfo file for data
# reduction from a directory full of images, optionally with scan and
# sequence files which will be used to add matadata.
import collections
import logging
import os
import sys
import traceback
import h5py
from libtbx import easy_mp
from xia2.Applications.xia2se... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Applications/xia2setup.py",
"copies": "1",
"size": "19381",
"license": "bsd-3-clause",
"hash": 365338163598673150,
"line_mean": 29.9600638978,
"line_max": 103,
"alpha_frac": 0.5546153449,
"autogenerated": false,
"ratio": 3.7407836325033776,
"config_t... |
""" An app to draw glacier geometry on top of a background image (local plotly)
"""
from outletglacierapp import app
import os
import warnings
import itertools
import json
import numpy as np
from flask import Flask, redirect, url_for, render_template, request, jsonify, flash, session, abort, make_response, send_from_d... | {
"repo_name": "perrette/webglacier1d",
"path": "outletglacierapp/views.py",
"copies": "1",
"size": "16362",
"license": "mit",
"hash": -4077231380146714000,
"line_mean": 34.0364025696,
"line_max": 168,
"alpha_frac": 0.6044493338,
"autogenerated": false,
"ratio": 3.432347388294525,
"config_test":... |
# Anarchic Society Optimization Algorithm
# As seen in the paper by Amir Ahmadi-Javid
# Implemented by Juanjo Sierra
from CreateInitialSociety import *
from CurrentMovementPolicy import CalculateFicklenessIndexes, GenerateCurrentMovementPolicy
from SocietyMovementPolicy import CalculateExternalIrregularityIndexes, Gen... | {
"repo_name": "JJSrra/Research-SocioinspiredAlgorithms",
"path": "ASO/ASO.py",
"copies": "1",
"size": "3198",
"license": "mit",
"hash": 1601501287151703300,
"line_mean": 48.2153846154,
"line_max": 168,
"alpha_frac": 0.7948717949,
"autogenerated": false,
"ratio": 3.4313304721030042,
"config_test... |
# anarchy.py by ApolloJustice
# for use with Python 3
# non PEP-8 compliant because honestly fuck that
# probably not commented because too lazy
__module_name__ = "Anarchizer"
__module_version__ = "1.0"
__module_description__ = "Makes a channel into an ANARCHY"
__author__ = "ApolloJustice"
import hexchat
def anarchi... | {
"repo_name": "ApolloJustice/HexChat-pyscripts",
"path": "anarchy.py",
"copies": "1",
"size": "1176",
"license": "mit",
"hash": 545094131093512800,
"line_mean": 33.6176470588,
"line_max": 166,
"alpha_frac": 0.675170068,
"autogenerated": false,
"ratio": 2.8066825775656326,
"config_test": false,
... |
"""An array class that has methods supporting the type of stencil
operations we see in finite-difference methods, like i+1, i-1, etc.
"""
from __future__ import print_function
import numpy as np
def _buf_split(b):
""" take an integer or iterable and break it into a -x, +x, -y, +y
value representing a ghost... | {
"repo_name": "harpolea/pyro2",
"path": "mesh/array_indexer.py",
"copies": "1",
"size": "11548",
"license": "bsd-3-clause",
"hash": -8349634212112382000,
"line_mean": 33.9939393939,
"line_max": 108,
"alpha_frac": 0.4825943886,
"autogenerated": false,
"ratio": 3.163835616438356,
"config_test": f... |
"""An asset card."""
from csrv.model import actions
from csrv.model import events
from csrv.model import game_object
from csrv.model import timing_phases
from csrv.model.cards import installable_card
from csrv.model.cards import card_info
class Asset(installable_card.InstallableCard):
TYPE = card_info.ASSET
REZ... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/cards/asset.py",
"copies": "1",
"size": "1276",
"license": "apache-2.0",
"hash": -2279621822591452000,
"line_mean": 26.1489361702,
"line_max": 80,
"alpha_frac": 0.723354232,
"autogenerated": false,
"ratio": 3.3142857142857145,
"config_t... |
"""An assortment of different useful functions."""
import os
def in_inventory(item_class, player):
for item in player.inventory:
if isinstance(item, item_class):
return True
return False
def get_item_from_name(item_name, item_list):
"""Retrieve an item's object from its name."""
... | {
"repo_name": "allanburleson/python-adventure-game",
"path": "pag/utils.py",
"copies": "2",
"size": "1096",
"license": "mit",
"hash": 8675506937762092000,
"line_mean": 24.488372093,
"line_max": 63,
"alpha_frac": 0.6295620438,
"autogenerated": false,
"ratio": 3.6411960132890364,
"config_test": f... |
"""An assortment of preconfigured client factories that represent "turnkey"
clients. This is particularly useful for a CLI based application that would
like to allow the user to select one or more preconfigured test patterns
(including Behaviours, Policy, etc)."""
import httplib
from ..behaviours import *
from polici... | {
"repo_name": "yaniv-aknin/labour",
"path": "labour/tester/factories.py",
"copies": "1",
"size": "1409",
"license": "mit",
"hash": -6622904260678328000,
"line_mean": 29.6304347826,
"line_max": 76,
"alpha_frac": 0.6806245564,
"autogenerated": false,
"ratio": 3.717678100263852,
"config_test": tru... |
# An assortment of utilities.
from contextlib import contextmanager
@contextmanager
def restoring_sels(view):
old_sels = list(view.sel())
yield
view.sel().clear()
for s in old_sels:
# XXX: If the buffer has changed in the meantime, this won't work well.
view.sel().add(s)
def has_dir... | {
"repo_name": "himacro/Vintageous",
"path": "vi/sublime.py",
"copies": "9",
"size": "1098",
"license": "mit",
"hash": -2908037155276550700,
"line_mean": 21.875,
"line_max": 79,
"alpha_frac": 0.5947176685,
"autogenerated": false,
"ratio": 3.4746835443037973,
"config_test": false,
"has_no_keywo... |
"""An async GitHub API library"""
__version__ = "5.0.1.dev"
import http
from typing import Any, Optional
class GitHubException(Exception):
"""Base exception for this library."""
class ValidationFailure(GitHubException):
"""An exception representing failed validation of a webhook event."""
# https://... | {
"repo_name": "brettcannon/gidgethub",
"path": "gidgethub/__init__.py",
"copies": "1",
"size": "3996",
"license": "apache-2.0",
"hash": -370685802248629100,
"line_mean": 26.5586206897,
"line_max": 139,
"alpha_frac": 0.6546546547,
"autogenerated": false,
"ratio": 4.048632218844984,
"config_test"... |
""" An asynchronous computation.
"""
import logging
from tensorflow.core.framework import graph_pb2
from google.protobuf.json_format import MessageToJson
from .proto import computation_pb2
from .utils import Path
from .row import CellWithType, as_python_object, as_pandas_object
__all__ = ['Computation']
logger = log... | {
"repo_name": "tjhunter/karps",
"path": "python/karps/computation.py",
"copies": "1",
"size": "6966",
"license": "apache-2.0",
"hash": 2213053648288413400,
"line_mean": 36.6540540541,
"line_max": 111,
"alpha_frac": 0.6637955785,
"autogenerated": false,
"ratio": 3.7941176470588234,
"config_test"... |
'''An asynchronous multi-process `HTTP proxy server`_. It works for both
``http`` and ``https`` (tunneled) requests.
Managing Headers
=====================
It is possible to add middleware to manipulate the original request headers.
If the header middleware is
an empty list, the proxy passes requests and responses un... | {
"repo_name": "tempbottle/pulsar",
"path": "examples/proxyserver/manage.py",
"copies": "5",
"size": "9763",
"license": "bsd-3-clause",
"hash": -752189318456567900,
"line_mean": 33.4982332155,
"line_max": 78,
"alpha_frac": 0.6099559562,
"autogenerated": false,
"ratio": 4.350713012477718,
"config... |
"""An asyncronous cyclus server that provides as JSON API over websockets.
The webserver has a number of 'events' that it may send or recieve. These
in turn affect how a cyclus simulation runs.
The server, which operates both asynchronously and in parallel, has five
top-level tasks which it manages:
* The cyclus sim... | {
"repo_name": "Baaaaam/cyclus",
"path": "cyclus/server.py",
"copies": "6",
"size": "15284",
"license": "bsd-3-clause",
"hash": -1981756631929826600,
"line_mean": 34.627039627,
"line_max": 98,
"alpha_frac": 0.6474744831,
"autogenerated": false,
"ratio": 4.032717678100264,
"config_test": false,
... |
'''A native ElasticSearch implementation for dossier.store.
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
'''
from __future__ import absolute_import, division, print_function
import base64
from collections import OrderedDict, Mapping, defaultdict
import logging... | {
"repo_name": "dossier/dossier.store",
"path": "dossier/store/elastic.py",
"copies": "1",
"size": "33398",
"license": "mit",
"hash": 1301133203779820500,
"line_mean": 36.3162011173,
"line_max": 79,
"alpha_frac": 0.5338942452,
"autogenerated": false,
"ratio": 4.395051980523753,
"config_test": fa... |
"""An attempt at making a period abstraction which does not suck.
Notably, a period abstraction which plays nice with timezones.
"""
from abc import ABCMeta, abstractmethod
from datetime import date, datetime, timedelta, time
from typing import Any, Iterator
from dateutil.tz import gettz
EUROPE_PARIS = gettz("Europ... | {
"repo_name": "ouihelp/yesaide",
"path": "yesaide/period.py",
"copies": "1",
"size": "6134",
"license": "mit",
"hash": -5793516975524761000,
"line_mean": 33.6553672316,
"line_max": 93,
"alpha_frac": 0.6493315944,
"autogenerated": false,
"ratio": 3.8194271481942716,
"config_test": false,
"has_... |
import numpy as np;
import numpy.linalg as LA;
import scipy.signal as SL;
from scipy.ndimage import imread;
import matplotlib;
matplotlib.use('tkagg');
import matplotlib.pyplot as plt;
img=imread('Lenna.png')/255.0;
img=np.mean(img, axis=2);
img=(img-np.mean(img))/np.sqrt(np.var(img)+10);
#
# plt.figure(1);
# plt.i... | {
"repo_name": "duguyue100/kmeans",
"path": "conv_kmeans.py",
"copies": "1",
"size": "1314",
"license": "mit",
"hash": -1864433349766909200,
"line_mean": 24.2884615385,
"line_max": 77,
"alpha_frac": 0.6301369863,
"autogenerated": false,
"ratio": 2.643863179074447,
"config_test": false,
"has_no... |
# An attempt to calculate the average A-level point score.
# Ended up not being able to.
#
# Update: Found out AS exam scores are also taken into account,
# at half the score of A-level. Maybe this will help you determine
# it, if for some weird reason you wanted to.
from pymongo import MongoClient
mongo = MongoCli... | {
"repo_name": "danielgavrilov/schools",
"path": "db/aps.py",
"copies": "1",
"size": "2420",
"license": "mit",
"hash": -8697362019777099000,
"line_mean": 35.1343283582,
"line_max": 123,
"alpha_frac": 0.5830578512,
"autogenerated": false,
"ratio": 3.9222042139384117,
"config_test": false,
"has_... |
# an attempt to parse s-expressions in the jankiest manner possible
import ast # use ast.literal_eval on text files, lol
import sys # for getting arguments
#fileName = "cccookies-reformatted"
fileName = sys.argv[1]
forbiddenChars = dict.fromkeys(("\n","\t","\\"), " ") # translate stuff that latex doesn't like to empty... | {
"repo_name": "jnj16180340/RecipeTypesetting",
"path": "recipes/parseRecipesToLatex.py",
"copies": "1",
"size": "1748",
"license": "bsd-3-clause",
"hash": 7865996657727096000,
"line_mean": 30.8,
"line_max": 111,
"alpha_frac": 0.6790617849,
"autogenerated": false,
"ratio": 3.0828924162257496,
"c... |
# An attempt to provide combinators for constructing documents.
from boxmodel import *
# A convenience wrapper to form a scope from a dictionary.
class Environ(object):
__slots__ = ('parent', 'values')
def __init__(self, parent, values):
self.parent = parent
self.values = values
def __geta... | {
"repo_name": "cheery/textended-edit",
"path": "minitex/__init__.py",
"copies": "1",
"size": "8041",
"license": "mit",
"hash": -5415065465998962000,
"line_mean": 28.8921933086,
"line_max": 94,
"alpha_frac": 0.5516726775,
"autogenerated": false,
"ratio": 3.8418537983755376,
"config_test": false,... |
# An attempt to rewrite the handmade penguin sound code in Python.
# This one didn't work, but soundtest2.py is based on it and does work.
# Link: https://davidgow.net/handmadepenguin/ch8.html
import sdl2
import ctypes
def init_audio(samples_per_second, buffer_size):
audio_settings = sdl2.SDL_AudioSpec(freq=sampl... | {
"repo_name": "MageJohn/CHIP8",
"path": "soundtests/handmadepenguin_squarwave.py",
"copies": "1",
"size": "2021",
"license": "mit",
"hash": -5175925471476281000,
"line_mean": 37.1320754717,
"line_max": 79,
"alpha_frac": 0.6501731816,
"autogenerated": false,
"ratio": 3.243980738362761,
"config_t... |
# A natural number, N, that can be written as the sum and
# product of a given set of at least two natural numbers,
# {a1, a2, ... , ak} is called a product-sum number:
# N = a_1 + a_2 + ... + a_k = a_1 x a_2 x ... x a_k.
# For example, 6 = 1 + 2 + 3 = 1 x 2 x 3.
# For a given set of size, k, we shall call the smalle... | {
"repo_name": "cloudzfy/euler",
"path": "src/88.py",
"copies": "1",
"size": "1356",
"license": "mit",
"hash": -487902855806499600,
"line_mean": 32.9,
"line_max": 63,
"alpha_frac": 0.5737463127,
"autogenerated": false,
"ratio": 2.515769944341373,
"config_test": false,
"has_no_keywords": false,... |
# an auc library that doesn't require sklearn
# thanks to https://github.com/benhamner/Metrics/blob/master/Python/ml_metrics/auc.py
# I made some changes to style to fit our code-base
import numpy as np
def tied_rank(x):
"""
Computes the tied rank of elements in x.
This function computes the tied rank of... | {
"repo_name": "yueranyuan/vector_edu",
"path": "learntools/libs/auc.py",
"copies": "1",
"size": "2879",
"license": "mit",
"hash": 5313534480106108000,
"line_mean": 34.5432098765,
"line_max": 85,
"alpha_frac": 0.5946509205,
"autogenerated": false,
"ratio": 3.6489226869455007,
"config_test": fals... |
"""An augmented version of the dict class"""
from hawkweed.computed import PY3
from hawkweed.classes.iterable import Iterable
from hawkweed.classes.repr import Repr
from hawkweed.classes.collection import Collection
class Dict(Repr, dict, Iterable, Collection):
"""An augmented version of the dict class"""
def ... | {
"repo_name": "hellerve/hawkweed",
"path": "hawkweed/classes/dict_cls.py",
"copies": "1",
"size": "3376",
"license": "mit",
"hash": -7251432227096227000,
"line_mean": 26.6721311475,
"line_max": 72,
"alpha_frac": 0.5438388626,
"autogenerated": false,
"ratio": 4.525469168900805,
"config_test": fa... |
"""An augmented version of the list class"""
from hawkweed.classes.iterable import Iterable
from hawkweed.classes.repr import Repr
from hawkweed.classes.collection import Collection
class List(Repr, list, Iterable, Collection):
"""An augmented version of the list class"""
def reset(self, other):
"""
... | {
"repo_name": "hellerve/hawkweed",
"path": "hawkweed/classes/list_cls.py",
"copies": "1",
"size": "4245",
"license": "mit",
"hash": -8453638778095210000,
"line_mean": 24.4191616766,
"line_max": 83,
"alpha_frac": 0.5210836278,
"autogenerated": false,
"ratio": 4.624183006535947,
"config_test": fa... |
"""An authentication plugin for ``repoze.who`` and SQLAlchemy."""
from zope.interface import implements
from repoze.who.interfaces import IAuthenticator
from repoze.who.interfaces import IMetadataProvider
from sqlalchemy.orm.exc import MultipleResultsFound
from sqlalchemy.orm.exc import NoResultFound
from lasco.mod... | {
"repo_name": "dbaty/Lasco",
"path": "lasco/whoplugins.py",
"copies": "1",
"size": "1721",
"license": "bsd-3-clause",
"hash": -6562619308561976000,
"line_mean": 25.4769230769,
"line_max": 65,
"alpha_frac": 0.635676932,
"autogenerated": false,
"ratio": 4.447028423772609,
"config_test": false,
... |
"""An automobile price research tool."""
import bottle
import craigslist
import json
APP = bottle.default_app()
@APP.route('/')
def html():
return bottle.static_file('till.html', '.')
@APP.route('/till.css')
def css():
return bottle.static_file('till_combined.css', 'compiled')
@APP.route('/till.js')
def js(... | {
"repo_name": "kjiwa/till",
"path": "server.py",
"copies": "1",
"size": "1299",
"license": "mpl-2.0",
"hash": -1091106403017044600,
"line_mean": 19.619047619,
"line_max": 68,
"alpha_frac": 0.662817552,
"autogenerated": false,
"ratio": 3.1605839416058394,
"config_test": false,
"has_no_keywords... |
"""A navigable completer for the qtconsole"""
# coding : utf-8
#-----------------------------------------------------------------------------
# Copyright (c) 2012, IPython Development Team.$
#
# Distributed under the terms of the Modified BSD License.$
#
# The full license is in the file COPYING.txt, distributed with t... | {
"repo_name": "initNirvana/Easyphotos",
"path": "env/lib/python3.4/site-packages/IPython/qt/console/completion_html.py",
"copies": "12",
"size": "12740",
"license": "mit",
"hash": -2221621554306232600,
"line_mean": 33.3396226415,
"line_max": 110,
"alpha_frac": 0.4895604396,
"autogenerated": false,
... |
"""A navigable completer for the qtconsole"""
# coding : utf-8
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import ipython_genutils.text as text
from qtconsole.qt import QtCore, QtGui
#--------------------------------------------------------------------------
... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "Lib/site-packages/qtconsole/completion_html.py",
"copies": "10",
"size": "12836",
"license": "mit",
"hash": 8379864692038278000,
"line_mean": 33.4128686327,
"line_max": 91,
"alpha_frac": 0.4942349642,
"autogenerated": false,
"ratio": 4.168886001948684... |
"""Anchore Jenkins plugin security warnings collector."""
from base_collectors import SourceCollector
from collector_utilities.functions import md5_hash
from collector_utilities.type import URL
from source_model import Entities, Entity, SourceResponses
class AnchoreJenkinsPluginSecurityWarnings(SourceCollector):
... | {
"repo_name": "ICTU/quality-time",
"path": "components/collector/src/source_collectors/anchore_jenkins_plugin/security_warnings.py",
"copies": "1",
"size": "2666",
"license": "apache-2.0",
"hash": 4955147504026345000,
"line_mean": 47.4727272727,
"line_max": 120,
"alpha_frac": 0.6541635409,
"autogen... |
"""Anchore security warnings collector."""
from base_collectors import JSONFileSourceCollector
from collector_utilities.functions import md5_hash
from source_model import Entities, Entity, SourceResponses
class AnchoreSecurityWarnings(JSONFileSourceCollector):
"""Anchore collector for security warnings."""
... | {
"repo_name": "ICTU/quality-time",
"path": "components/collector/src/source_collectors/anchore/security_warnings.py",
"copies": "1",
"size": "1958",
"license": "apache-2.0",
"hash": 5193818112186416,
"line_mean": 45.619047619,
"line_max": 117,
"alpha_frac": 0.6384065373,
"autogenerated": false,
"... |
"""Anchore sources."""
from typing import cast
from ..meta.entity import Color
from ..meta.source import Source
from ..parameters import access_parameters, Severities, URL
from .jenkins import jenkins_access_parameters
ALL_ANCHORE_METRICS = ["security_warnings", "source_up_to_dateness"]
SEVERITIES = Severities(va... | {
"repo_name": "ICTU/quality-time",
"path": "components/server/src/data_model/sources/anchore.py",
"copies": "1",
"size": "2506",
"license": "apache-2.0",
"hash": -7854353257797641000,
"line_mean": 32.8648648649,
"line_max": 119,
"alpha_frac": 0.6177174781,
"autogenerated": false,
"ratio": 3.88527... |
# anchorGenerator
from models.anchor import *
# main function
if __name__=='__main__':
# TEMP: Wipe existing anchors
# anchors = Anchor.all(size=1000)
# Anchor.delete_all(anchors)
# THIS IS TEMPORARY:
anchors = {'Vaccination', 'Vaccinations', 'Vaccine', 'Vaccines', 'Inoculation', 'Immunization', 'Shot', 'Chicken... | {
"repo_name": "ControCurator/controcurator",
"path": "python_code/anchorGenerator.py",
"copies": "1",
"size": "1229",
"license": "mit",
"hash": 963672568256329200,
"line_mean": 18.5238095238,
"line_max": 270,
"alpha_frac": 0.5573637103,
"autogenerated": false,
"ratio": 2.926190476190476,
"confi... |
"""Anchor management.
"""
__all__ = ['Anchor']
from typing import Optional
import numpy as np
from miles import CollectiveVariables
class Anchor:
"""Anchor point.
An anchor is a point in the space of collective variables that
serves as a seed for a Voronoi tessellation.
Attributes
---------... | {
"repo_name": "clsb/miles",
"path": "miles/anchor.py",
"copies": "1",
"size": "1977",
"license": "mit",
"hash": 4804176390494019000,
"line_mean": 25.7162162162,
"line_max": 70,
"alpha_frac": 0.5569044006,
"autogenerated": false,
"ratio": 4.741007194244604,
"config_test": false,
"has_no_keywor... |
""" Anchor Widget, use this to create the equivalent of the <a></a> tag.
Copyright(C) 2010, Martin Hellwig
Copyright(C) 2010, Luke Leighton <lkcl@lkcl.net>
License: Apache Software Foundation v2
Here is an example for using it with an image:
---------------------------------------------------------
if __name__ == '_... | {
"repo_name": "minghuascode/pyj",
"path": "library/pyjamas/ui/Anchor.py",
"copies": "1",
"size": "3373",
"license": "apache-2.0",
"hash": 904746525033527000,
"line_mean": 35.6630434783,
"line_max": 78,
"alpha_frac": 0.606581678,
"autogenerated": false,
"ratio": 3.935822637106184,
"config_test":... |
# Ancient Nordic Elvish translation
import numpy
import re
instructions = [line.rstrip("\n") for line in open("day6.txt", "r")]
theSize = 1000
lights = numpy.zeros((theSize, theSize))
def get_cells(start, end):
[startx, starty] = re.sub(r'\s', '', start).split(',')
[endx, endy] = re.sub(r'\s',... | {
"repo_name": "ksallberg/adventofcode",
"path": "2015/src/day6_2.py",
"copies": "1",
"size": "1079",
"license": "bsd-2-clause",
"hash": -6582546130277390000,
"line_mean": 28.9722222222,
"line_max": 68,
"alpha_frac": 0.5013901761,
"autogenerated": false,
"ratio": 3.0916905444126073,
"config_test... |
## ancillary functions for composite.py
## last updated: 09.14.2017 vitti@broadinstitute.org
import sys
import os
import math
import numpy as np
import gzip
####################
## PREPARE INPUT ###
####################
def write_perpop_ihh_from_xp(infilename, outfilename, popNum = 1):
outfile = open(outfilenam... | {
"repo_name": "broadinstitute/cms",
"path": "cms/combine/input_func.py",
"copies": "1",
"size": "3201",
"license": "bsd-2-clause",
"hash": 2919303304517595000,
"line_mean": 31.6632653061,
"line_max": 131,
"alpha_frac": 0.6776007498,
"autogenerated": false,
"ratio": 2.7150127226463106,
"config_t... |
import argparse
import time
import os
import logging
from sys import platform
from threading import Timer
class TimerPy:
def __init__(self, time, task_name):
self.duration = time
self.task_name = task_name
def start(self):
print("Starting Timer for %s at "%(self.task_name), time.strf... | {
"repo_name": "abhixec/timer",
"path": "timerpy.py",
"copies": "1",
"size": "2373",
"license": "apache-2.0",
"hash": 8553267503666584000,
"line_mean": 36.078125,
"line_max": 130,
"alpha_frac": 0.615676359,
"autogenerated": false,
"ratio": 3.6229007633587784,
"config_test": false,
"has_no_keyw... |
"""ANCP Client
Copyright (C) 2017-2021, Christian Giese (GIC-de)
SPDX-License-Identifier: MIT
"""
from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes
from ancp.subscriber import Subscriber
from datetime import datetime
from threading import Thread, Event, Lock
impor... | {
"repo_name": "GIC-de/PyANCP",
"path": "ancp/client.py",
"copies": "1",
"size": "13931",
"license": "mit",
"hash": 217604155026265800,
"line_mean": 32.4879807692,
"line_max": 118,
"alpha_frac": 0.5471251166,
"autogenerated": false,
"ratio": 3.7979825517993455,
"config_test": false,
"has_no_ke... |
"""ANCP Subscribers
Copyright (C) 2017-2021, Christian Giese (GIC-de)
SPDX-License-Identifier: MIT
"""
from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes
import struct
import logging
log = logging.getLogger(__name__)
class LineState(object):
"Line States"
... | {
"repo_name": "GIC-de/PyANCP",
"path": "ancp/subscriber.py",
"copies": "1",
"size": "8949",
"license": "mit",
"hash": 5177740520780844000,
"line_mean": 30.6219081272,
"line_max": 96,
"alpha_frac": 0.556710247,
"autogenerated": false,
"ratio": 3.185831256674973,
"config_test": false,
"has_no_k... |
""" AND and OR Searching """
# pylint: disable=unneeded-not,invalid-name,import-error
import json
import re
from models import Blog, App, Misc, Data
def search_and(term):
"""
Searches for 'and' results for all models
:param term: search term
:return: json of search results
"""
term = str(term)... | {
"repo_name": "jasonvila/jasonvila.com",
"path": "backend/searchdb.py",
"copies": "1",
"size": "5116",
"license": "mit",
"hash": -7253679503774416000,
"line_mean": 26.2127659574,
"line_max": 92,
"alpha_frac": 0.5222830336,
"autogenerated": false,
"ratio": 4.122481869460112,
"config_test": false... |
#a=["--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--"]
def calen(m,v,mm,tt,da):
k=m
z=1
j=v
mo=mm
ta=tt
dy=da
a=["--","--","--","--"... | {
"repo_name": "parichitran/py-hw",
"path": "Day_Finder.py",
"copies": "1",
"size": "2018",
"license": "apache-2.0",
"hash": 8743253450909166000,
"line_mean": 23.6097560976,
"line_max": 217,
"alpha_frac": 0.3622398414,
"autogenerated": false,
"ratio": 2.351981351981352,
"config_test": false,
"... |
#Anderson Evans
#August 3rd - 2013
import pygame
import sys, glob
from pygame import *
class Player(pygame.sprite.Sprite):
def __init__(self, *groups):
super(Player, self).__init__(*groups)
self.image = pygame.image.load('19man.png')
self.rect = pygame.rect.Rect((320, 240), self.image.get_... | {
"repo_name": "EliCash82/proto",
"path": "pygame/MrWilliams.py",
"copies": "1",
"size": "1720",
"license": "bsd-3-clause",
"hash": 3397278293236657000,
"line_mean": 28.1525423729,
"line_max": 81,
"alpha_frac": 0.5174418605,
"autogenerated": false,
"ratio": 3.6830835117773018,
"config_test": fal... |
#Anderson Evans
#August 3rd - 2013
#much of code taken from tutorial http://www.youtube.com/watch?v=mTmJfWdZzbo
import pygame
import sys, glob
from pygame import *
class Player(pygame.sprite.Sprite):
def __init__(self, *groups):
super(Player, self).__init__(*groups)
self.image = pygame.image.loa... | {
"repo_name": "EliCash82/proto",
"path": "pygame/MrWilliams2.py",
"copies": "1",
"size": "2895",
"license": "bsd-3-clause",
"hash": -8952027171455382000,
"line_mean": 28.5408163265,
"line_max": 81,
"alpha_frac": 0.5150259067,
"autogenerated": false,
"ratio": 3.7892670157068062,
"config_test": f... |
#-------------Anderson.py------------------------------------------------------#
#
# Anderson.py
#
# Purpose: Visualize the Quantum Monte Carlo code from earlier on stream!
#
# Notes: This code can be run by using the following command:
# blender -b -P demon.py
#
#---------------------------... | {
"repo_name": "Gustorn/simuleios",
"path": "QMC/visualization/Anderson.py",
"copies": "2",
"size": "8231",
"license": "mit",
"hash": 1198976324443049200,
"line_mean": 33.0123966942,
"line_max": 133,
"alpha_frac": 0.5678532378,
"autogenerated": false,
"ratio": 3.2688641779189833,
"config_test": ... |
#Anderson
#2-19
from __future__ import division
import numpy as np
import pandas as pd
from pylab import *
import random
#import the data
incidents = pd.read_csv('data/ArlingtonCensusFireDataYearly.csv')
#aggregate the yearly number of residential structure fires that ACFD responded to
yeardist = incident... | {
"repo_name": "FireCARES/fire-risk",
"path": "scripts/incident_draws.py",
"copies": "2",
"size": "1476",
"license": "mit",
"hash": -2667383581319791000,
"line_mean": 35.8461538462,
"line_max": 92,
"alpha_frac": 0.7689701897,
"autogenerated": false,
"ratio": 3.3698630136986303,
"config_test": fa... |
# AND gate. No hidden layer, basic logistic regression
import numpy as np
import theano
import theano.tensor as T
import matplotlib.pyplot as plt
# Set inputs and correct output values
inputs = [[0,0], [1,1], [0,1], [1,0]]
outputs = [0, 1, 0, 0]
# Set training parameters
alpha = 0.1 # Learning rate
training_iterati... | {
"repo_name": "sho-87/python-machine-learning",
"path": "Logistic Regression/and.py",
"copies": "1",
"size": "2183",
"license": "mit",
"hash": 3933415120988254700,
"line_mean": 29.3194444444,
"line_max": 78,
"alpha_frac": 0.6477324782,
"autogenerated": false,
"ratio": 3.0068870523415976,
"confi... |
# AND gate. No hidden layer, basic logistic regression. No bias
# Demonstration - can't learn as separator goes through origin w/o a bias unit
import numpy as np
import theano
import theano.tensor as T
import matplotlib.pyplot as plt
# Set inputs and correct output values
inputs = [[0,0], [1,1], [0,1], [1,0]]
outputs... | {
"repo_name": "sho-87/python-machine-learning",
"path": "Logistic Regression/and_no_bias.py",
"copies": "1",
"size": "2190",
"license": "mit",
"hash": -6719973431409343000,
"line_mean": 29.8450704225,
"line_max": 78,
"alpha_frac": 0.6561643836,
"autogenerated": false,
"ratio": 3.058659217877095,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.