text stringlengths 0 1.05M | meta dict |
|---|---|
"""A tool for adding a new cluster / constellation from photographs."""
import os
import cv2
import numpy
import mel.lib.common
import mel.lib.image
def setup_parser(parser):
mel.lib.common.add_context_detail_arguments(parser)
parser.add_argument(
"destination",
type=str,
default=... | {
"repo_name": "aevri/mel",
"path": "mel/cmd/addcluster.py",
"copies": "1",
"size": "4081",
"license": "apache-2.0",
"hash": -4081191757329977000,
"line_mean": 31.3888888889,
"line_max": 79,
"alpha_frac": 0.654006371,
"autogenerated": false,
"ratio": 3.693212669683258,
"config_test": false,
"h... |
"""A tool for adding a single mole from photographs."""
import cv2
import mel.lib.common
import mel.lib.image
def setup_parser(parser):
mel.lib.common.add_context_detail_arguments(parser)
parser.add_argument(
"destination",
type=str,
default=None,
help="New path to create ... | {
"repo_name": "aevri/mel",
"path": "mel/cmd/addsingle.py",
"copies": "1",
"size": "2842",
"license": "apache-2.0",
"hash": 3103429904296938500,
"line_mean": 30.2307692308,
"line_max": 79,
"alpha_frac": 0.6632653061,
"autogenerated": false,
"ratio": 3.7345597897503287,
"config_test": false,
"h... |
"""A tool for compressing tile images."""
import io
import logging
import subprocess
logger = logging.getLogger(__name__)
class Compressor:
"""The abstract compressor class."""
def compress(self, data):
"""
Compress the input data and return the result, or raise an exception if
som... | {
"repo_name": "thomasleese/cartographer",
"path": "cartographer/compressors.py",
"copies": "1",
"size": "1318",
"license": "mit",
"hash": 4937737060334779000,
"line_mean": 24.3461538462,
"line_max": 79,
"alpha_frac": 0.593323217,
"autogenerated": false,
"ratio": 4.30718954248366,
"config_test":... |
"""A tool for converting my novel to other formats.
Only supports :- or >-delimited body text, as well as ;- or <-delimited
preformatted body text.
"""
import click
from .votl import tree_from_file
from .output.html import html_from_tree
from .output.markdown import markdown_from_tree, MarkdownError
from .output.text... | {
"repo_name": "fennekki/unikko",
"path": "unikko/unikko.py",
"copies": "1",
"size": "1751",
"license": "bsd-2-clause",
"hash": 4728297130163150000,
"line_mean": 24.75,
"line_max": 79,
"alpha_frac": 0.6219303255,
"autogenerated": false,
"ratio": 3.6555323590814197,
"config_test": false,
"has_n... |
"""A tool for downloading historical data"""
import argparse
import asyncio
import logging
from datetime import datetime, timedelta
from functools import reduce
from async_v20 import OandaClient
logger = logging.getLogger('async_v20')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.INFO)
parser =... | {
"repo_name": "jamespeterschinner/async_v20",
"path": "bin/candle_data.py",
"copies": "1",
"size": "3154",
"license": "mit",
"hash": 3919775900819370500,
"line_mean": 29.9215686275,
"line_max": 100,
"alpha_frac": 0.6347495244,
"autogenerated": false,
"ratio": 3.492801771871539,
"config_test": f... |
'''A tool for encrypting and decrypting data with the AWS KMS'''
from __future__ import print_function
import sys
import os
from argparse import ArgumentParser
from .kms import (
get_client,
EncryptionError,
)
from . import files
def parse_kv(kv_string):
values = {}
for kv in kv_string.split(','):
... | {
"repo_name": "slank/kmstool",
"path": "kmstool/cli.py",
"copies": "2",
"size": "2277",
"license": "mit",
"hash": -4298569366250346000,
"line_mean": 29.7702702703,
"line_max": 75,
"alpha_frac": 0.6095740009,
"autogenerated": false,
"ratio": 3.6142857142857143,
"config_test": false,
"has_no_ke... |
"A tool for generating HTML reports."
import datetime
from itertools import chain
import click
from yattag import Doc
from cosmic_ray.work_db import WorkDB, use_db
from cosmic_ray.work_item import TestOutcome
from cosmic_ray.tools.survival_rate import kills_count, survival_rate
@click.command()
@click.option("--o... | {
"repo_name": "sixty-north/cosmic-ray",
"path": "src/cosmic_ray/tools/html.py",
"copies": "1",
"size": "13851",
"license": "mit",
"hash": -2530627157612315600,
"line_mean": 43.6806451613,
"line_max": 120,
"alpha_frac": 0.4289942964,
"autogenerated": false,
"ratio": 4.357030512739855,
"config_te... |
"""A tool for randomly changing words in a Twitter profile.
Use requires creating an application via apps.twitter.com and generating
a Consumer Key, Consumer Secret, Access Token, and Access Token Secret.
The application also requires read and write permission.
Class:
ProfileBot - handles api access and profile ... | {
"repo_name": "mymsy/ProfileBot",
"path": "profilebot.py",
"copies": "1",
"size": "3631",
"license": "cc0-1.0",
"hash": 549323904157862460,
"line_mean": 37.2210526316,
"line_max": 76,
"alpha_frac": 0.6381162214,
"autogenerated": false,
"ratio": 4.777631578947369,
"config_test": false,
"has_no... |
"""A Tool for using yaml files to create templates for fpdf
"""
from setuptools import setup, find_packages
from os import path
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.read()... | {
"repo_name": "m42e/yamlfpdftemplate",
"path": "setup.py",
"copies": "1",
"size": "1035",
"license": "mit",
"hash": 6682284324862429000,
"line_mean": 30.3636363636,
"line_max": 84,
"alpha_frac": 0.6463768116,
"autogenerated": false,
"ratio": 3.484848484848485,
"config_test": false,
"has_no_ke... |
""" A tool to convert from Zimbra dicts to Python dicts
"Zimbra dicts" means lists in the following form::
[
{
"n": "key",
"_content": "value"
}
]
"""
def zimbra_to_python(zimbra_dict, key_attribute="n",
content_attribute="_content"):
"""
... | {
"repo_name": "Zimbra-Community/python-zimbra",
"path": "pythonzimbra/tools/dict.py",
"copies": "3",
"size": "1257",
"license": "bsd-2-clause",
"hash": 3820945885725757000,
"line_mean": 22.2777777778,
"line_max": 76,
"alpha_frac": 0.6221161496,
"autogenerated": false,
"ratio": 3.7299703264094957,... |
"""A tool to create an externally-hosted APK definition JSON from an APK.
For more information see README.md.
"""
import argparse
import base64
from distutils import spawn
import hashlib
import json
import logging
import os.path
import re
import subprocess
import sys
import tempfile
import zipfile
# Enable basic lo... | {
"repo_name": "google/play-work",
"path": "externally-hosted-apks/externallyhosted.py",
"copies": "1",
"size": "14819",
"license": "apache-2.0",
"hash": 3748343366583263700,
"line_mean": 34.7084337349,
"line_max": 88,
"alpha_frac": 0.6385721034,
"autogenerated": false,
"ratio": 3.89052244683644,
... |
"""A tool to create events for Sam."""
###############################################################################
# pylint: disable=global-statement
#
# TODO: [ ]
#
###############################################################################
# standard library imports
import datetime
import logging
# relate... | {
"repo_name": "Sirs0ri/PersonalAssistant",
"path": "samantha/tools/eventbuilder.py",
"copies": "1",
"size": "4453",
"license": "mit",
"hash": -6466909075252849000,
"line_mean": 27.1835443038,
"line_max": 80,
"alpha_frac": 0.5430047159,
"autogenerated": false,
"ratio": 4.244995233555767,
"config... |
"""A tool to inspect the binary size of a built binary file.
This script prints out a tree of symbols and their corresponding sizes, using
Linux's nm functionality.
Usage:
python binary_size.py -- \
--target=/path/to/your/target/binary \
[--nm_command=/path/to/your/custom/nm] \
... | {
"repo_name": "xzturn/caffe2",
"path": "caffe2/python/binarysize.py",
"copies": "3",
"size": "5666",
"license": "apache-2.0",
"hash": -2218679456037026300,
"line_mean": 33.5487804878,
"line_max": 80,
"alpha_frac": 0.5861277797,
"autogenerated": false,
"ratio": 3.762284196547145,
"config_test": ... |
#A tool to interpret DNA String is FASTA format
DNA = {}
codon = {'UUU': 'F',
'CUU': 'L',
'AUU': 'I',
'GUU': 'V',
'UUC': 'F',
'CUC': 'L',
'AUC': 'I',
'GUC': 'V',
'UUA': 'L',
'CUA': 'L',
'AUA': 'I',
'GUA': 'V',
'UUG': 'L',
'CUG': 'L',
'AUG': 'M',
'GUG': 'V',
'UCU': 'S',
'CCU': 'P',
'ACU': 'T',
'GCU': 'A',
'UCC': 'S',
... | {
"repo_name": "Zhyll/rosalind",
"path": "rosalind_orf.py",
"copies": "1",
"size": "2423",
"license": "mit",
"hash": -6564483075173655000,
"line_mean": 14.6322580645,
"line_max": 56,
"alpha_frac": 0.4271564177,
"autogenerated": false,
"ratio": 2.341062801932367,
"config_test": false,
"has_no_k... |
#A tool to interpret DNA String is FASTA format
DNA = {}
with open("rosalind_cons.txt") as f:
for line in f:
if line[0] == '>':
s = line.split()
current_dna = s[0].replace('>','')
DNA[current_dna] = ''
else:
DNA[current_dna] += line
for entry in DNA:
DNA[entry] = DNA[entry].replace('\n','')
l =... | {
"repo_name": "Zhyll/rosalind",
"path": "rosalind7.py",
"copies": "1",
"size": "1124",
"license": "mit",
"hash": -7722205258055666000,
"line_mean": 17.4262295082,
"line_max": 47,
"alpha_frac": 0.5097864769,
"autogenerated": false,
"ratio": 2.4172043010752686,
"config_test": false,
"has_no_key... |
# A tool to locate and extract the Windows 10 Spotlight lockscreen images. Filters files using [Pillow](https://python-pillow.org/), a Python Imaging Library (PIL) fork.
import os
import shutil
import glob
from PIL import Image
def invalidResolution(filePath):
width, height = Image.open(filePath).size
... | {
"repo_name": "AjayAujla/PythonUtilities",
"path": "Windows10SpotlightLockscreenImages.py",
"copies": "1",
"size": "1335",
"license": "mit",
"hash": 2381925169967214000,
"line_mean": 35.0810810811,
"line_max": 169,
"alpha_frac": 0.661423221,
"autogenerated": false,
"ratio": 4.045454545454546,
"... |
# A tool to setup the Python registry.
class error(Exception):
pass
import sys # at least we can count on this!
def FileExists(fname):
"""Check if a file exists. Returns true or false.
"""
import os
try:
os.stat(fname)
return 1
except os.error as details:
return 0
de... | {
"repo_name": "int19h/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32/scripts/regsetup.py",
"copies": "7",
"size": "20020",
"license": "apache-2.0",
"hash": -1263399927776883500,
"line_mean": 37.5741811175,
"line_max": 182,
"alpha_frac": 0.6448051948,
"autogenerated"... |
# A tool to setup the Python registry.
class error(Exception):
pass
import sys # at least we can count on this!
def FileExists(fname):
"""Check if a file exists. Returns true or false.
"""
import os
try:
os.stat(fname)
return 1
except os.error, details:
... | {
"repo_name": "chvrga/outdoor-explorer",
"path": "java/play-1.4.4/python/Lib/site-packages/win32/scripts/regsetup.py",
"copies": "4",
"size": "20267",
"license": "mit",
"hash": 1516416816643635000,
"line_mean": 37.6614481409,
"line_max": 182,
"alpha_frac": 0.6316672423,
"autogenerated": false,
"r... |
# A tool to use for the analysis and gathering of scaled intensity data
# from a single macromolecular crystal. This will be both a module (for
# use in xia2) and an application in it's own right, AMI.
#
# Example usage:
#
# ami hklin1 PEAK.HKL hklin2 INFL.HKL hklin3 LREM.HKL HKLOUT merged.mtz << eof
# drename file 1 p... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/AnalyseMyIntensities.py",
"copies": "1",
"size": "4353",
"license": "bsd-3-clause",
"hash": -7295326909630316000,
"line_mean": 35.5798319328,
"line_max": 88,
"alpha_frac": 0.5605329658,
"autogenerated": false,
"ratio": 3.6858594411515666,
"co... |
"""A tool used to orient joints with common orientations.
The tool mostly assumes the X axis is the primary axis and joints always rotate forward on the Z axis.
Usage:
import cmt.rig.orientjoints
cmt.rig.orientjoints.OrientJointsWindow()
"""
from __future__ import absolute_import
from __future__ import division
from ... | {
"repo_name": "chadmv/cmt",
"path": "scripts/cmt/rig/orientjoints.py",
"copies": "1",
"size": "17952",
"license": "mit",
"hash": 8369973373625696000,
"line_mean": 31.7591240876,
"line_max": 153,
"alpha_frac": 0.579823975,
"autogenerated": false,
"ratio": 3.566858732366382,
"config_test": false,... |
"""A tool used to run Python scripts on disk."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import partial
import logging
import os
import runpy
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from maya.app.general.mayaMix... | {
"repo_name": "chadmv/cmt",
"path": "scripts/cmt/pipeline/runscript.py",
"copies": "1",
"size": "5142",
"license": "mit",
"hash": -7214788095317972000,
"line_mean": 32.8289473684,
"line_max": 88,
"alpha_frac": 0.6637495138,
"autogenerated": false,
"ratio": 3.646808510638298,
"config_test": fals... |
"""A tool written in Python and Elementary to provide a GUI for configuring Unix users and groups"""
import elementary
import evas
#Import our internal parts
from optionsWindow import *
from UserManager import *
from TimeManager import *
from TaskManager import *
from ScreenSetup import *
class Eccess(object):
d... | {
"repo_name": "JeffHoogland/eccess",
"path": "opt/eccess/eccess.py",
"copies": "1",
"size": "2339",
"license": "bsd-3-clause",
"hash": 5365136896935670000,
"line_mean": 33.9104477612,
"line_max": 100,
"alpha_frac": 0.6460025652,
"autogenerated": false,
"ratio": 3.3224431818181817,
"config_test"... |
# A top-down merge sort
def mergesort(list_to_sort):
if len(list_to_sort) < 2: # A list of length 1 is sorted by definition
return list_to_sort
# Split the list into left and right halves
midpoint = len(list_to_sort)/2
right = mergesort(list_to_sort[midpoint:])
left = mergesort(list_to_sort[:midpoint])
# Recu... | {
"repo_name": "ross-t/python-ds",
"path": "Sorting/mergesort.py",
"copies": "1",
"size": "1046",
"license": "mit",
"hash": 833755693386460700,
"line_mean": 25.8461538462,
"line_max": 83,
"alpha_frac": 0.6692160612,
"autogenerated": false,
"ratio": 2.804289544235925,
"config_test": false,
"has... |
# A topic is root that data is attached to. It is the equivalent of a source in searchlight/solink and acts as a table which has columns(Fields) and rows(Feeds).
#
class Topic():
def __init__(self, client):
self.client = client
# Requires authorization of **read_any_data**, or **read_application_data**.
# '/api/... | {
"repo_name": "cwadding/sensit-python",
"path": "sensit/api/topic.py",
"copies": "1",
"size": "1878",
"license": "mit",
"hash": 5147568133228531000,
"line_mean": 29.7868852459,
"line_max": 161,
"alpha_frac": 0.6719914803,
"autogenerated": false,
"ratio": 3.3180212014134276,
"config_test": false... |
""" A top-level experimental script that run 100 iterations of
the Simple example (see simfMRI.exp_examples.Simple()). """
from simfMRI.exp_examples import Simple
from simfMRI.analysis.plot import hist_t_all_models
from simfMRI.runclass import Run
class RunSimple100(Run):
""" An example of a 100 iteration Simple... | {
"repo_name": "parenthetical-e/simfMRI",
"path": "bin/simple100.py",
"copies": "1",
"size": "1454",
"license": "bsd-2-clause",
"hash": 7356698313269691000,
"line_mean": 26.4339622642,
"line_max": 70,
"alpha_frac": 0.5522696011,
"autogenerated": false,
"ratio": 3.9086021505376345,
"config_test":... |
""" A top-level experimental script that run 100 iterations of
the TwoCond example (see simfMRI.exp_examples.TwoCond()). """
from simfMRI.exp_examples import TwoCond
from simfMRI.analysis.plot import hist_t_all_models
from simfMRI.runclass import Run
class RunTwoCond100(Run):
""" An example of a 100 iteration Tw... | {
"repo_name": "parenthetical-e/simfMRI",
"path": "bin/twocond100.py",
"copies": "1",
"size": "1463",
"license": "bsd-2-clause",
"hash": -697689086135735200,
"line_mean": 26.6037735849,
"line_max": 70,
"alpha_frac": 0.5550239234,
"autogenerated": false,
"ratio": 3.8398950131233596,
"config_test"... |
""" A top-level experimental script that run 100 iterations (on 2 cores) of
the RW example (see simfMRI.exp_examples.RW()). """
import functools
from simfMRI.exp_examples import RW
from simfMRI.analysis.plot import hist_t_all_models
from simfMRI.runclass import Run
class RunRW100(Run):
""" An example of a 100 it... | {
"repo_name": "parenthetical-e/simfMRI",
"path": "bin/rw100.py",
"copies": "1",
"size": "1654",
"license": "bsd-2-clause",
"hash": 8175993088069738000,
"line_mean": 27.5172413793,
"line_max": 76,
"alpha_frac": 0.5501813785,
"autogenerated": false,
"ratio": 3.776255707762557,
"config_test": fals... |
""" A top-level experimental script that run 100 iterations (on 2 cores) of
the Simple example (see simfMRI.exp_examples.Simple()). """
from simfMRI.exp_examples import Simple
from simfMRI.analysis.plot import hist_t_all_models
from simfMRI.runclass import Run
class RunSimple100(Run):
""" An example of a 100 ite... | {
"repo_name": "parenthetical-e/simfMRI",
"path": "bin/parallel100.py",
"copies": "1",
"size": "1465",
"license": "bsd-2-clause",
"hash": -2906993530622706000,
"line_mean": 26.641509434,
"line_max": 76,
"alpha_frac": 0.55221843,
"autogenerated": false,
"ratio": 3.885941644562334,
"config_test": ... |
# A top-level interface to the whole of xia2, for data processing & analysis.
import glob
import itertools
import logging
import math
import os
import platform
import sys
import h5py
from dials.util import Sorry
from xia2.Handlers.Citations import Citations
from xia2.Handlers.Environment import df
from xia2.XIA2Vers... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Applications/xia2_main.py",
"copies": "1",
"size": "6647",
"license": "bsd-3-clause",
"hash": 3900493567937999000,
"line_mean": 30.8038277512,
"line_max": 100,
"alpha_frac": 0.6229878141,
"autogenerated": false,
"ratio": 3.478283621140764,
"config_te... |
atores = []
##codigo_geral = 0
##
##def _gerar_codigo():
## global codigo_geral
## codigo_geral += 1
## return codigo_geral
def CadastrarAtor(cod_ator,nome,nacionalidade,idade):
#cod_ator = _gerar_codigo()
ator = [cod_ator,nome,nacionalidade,idade]
atores.append(ator)
print (" \n \n ====... | {
"repo_name": "ygorclima/apd",
"path": "Ator/ControllerAtor.py",
"copies": "1",
"size": "1162",
"license": "apache-2.0",
"hash": -8402252687898851000,
"line_mean": 23.1875,
"line_max": 62,
"alpha_frac": 0.5469422911,
"autogenerated": false,
"ratio": 2.8455882352941178,
"config_test": false,
"... |
from __future__ import division, print_function # For Python 2 compatibility
import numpy as np
import cmath
class Polynomial(object):
def __init__(self, *coeffs):
"""Creates a Polynomial with the coefficients, starting with the constant"""
self.coeffs = np.Array(coeffs)
self.order ... | {
"repo_name": "vulpicastor/pymisc",
"path": "polynomial.py",
"copies": "1",
"size": "3874",
"license": "mit",
"hash": 3485827588143269400,
"line_mean": 36.25,
"line_max": 93,
"alpha_frac": 0.5978316985,
"autogenerated": false,
"ratio": 3.7684824902723735,
"config_test": false,
"has_no_keyword... |
# A toy example to use python to control the game.
from unrealcv import client
from unrealcv.util import read_npy, read_png
import matplotlib.pyplot as plt
import numpy as np
help_message = '''
A demo showing how to control a game using python
a, d: rotate camera to left and right.
q, e: move camera up and down.
left... | {
"repo_name": "unrealcv/unrealcv",
"path": "examples/interactive_control.py",
"copies": "1",
"size": "2271",
"license": "mit",
"hash": 1570428569355378700,
"line_mean": 30.5416666667,
"line_max": 98,
"alpha_frac": 0.5887274328,
"autogenerated": false,
"ratio": 3.2723342939481266,
"config_test":... |
# A toy example to use python to control the game.
import sys
sys.path.append('..')
from unrealcv import client
import matplotlib.pyplot as plt
import numpy as np
help_message = '''
A demo showing how to control a game using python
a, d: rotate camera to left and right.
q, e: move camera up and down.
'''
plt.rcParams[... | {
"repo_name": "qiuwch/unrealcv",
"path": "client/examples/interactive-control.py",
"copies": "2",
"size": "1540",
"license": "mit",
"hash": -5199665551667525000,
"line_mean": 25.5517241379,
"line_max": 98,
"alpha_frac": 0.6064935065,
"autogenerated": false,
"ratio": 3.2285115303983227,
"config_... |
"""A Trade is a contract signed between two Counterparties at a given datetime.
The contract referred to is typically an instance of an Asset.
In addition to the claims described within the contract, there may optionally
be an initial settlement of a Bullet payment.
"""
from __future__ import absolute_import, divisi... | {
"repo_name": "caseyclements/pennies",
"path": "pennies/trading/trades.py",
"copies": "1",
"size": "4310",
"license": "apache-2.0",
"hash": -6813016562903712000,
"line_mean": 33.7580645161,
"line_max": 79,
"alpha_frac": 0.6220417633,
"autogenerated": false,
"ratio": 4.331658291457287,
"config_t... |
"""A Trained Supervised Model."""
import time
from datetime import datetime
import numpy as np
import pandas as pd
import healthcareai.common.database_writers
import healthcareai.common.file_io_utilities as hcai_io
import healthcareai.common.helpers as hcai_helpers
import healthcareai.common.model_eval as hcai_model_... | {
"repo_name": "HealthCatalyst/healthcareai-py",
"path": "healthcareai/trained_models/trained_supervised_model.py",
"copies": "2",
"size": "30435",
"license": "mit",
"hash": 8925085812735228000,
"line_mean": 44.0888888889,
"line_max": 124,
"alpha_frac": 0.6211927058,
"autogenerated": false,
"ratio... |
"""A training dojo for algorithms."""
from copy import deepcopy
import itertools
from time import time
__all__ = ["Dojo", "TimingDojo", "FitnessDojo"]
INFINITY = float("inf")
class Dojo(object):
"""A testing class for competing algorithms."""
def __init__(self, algorithms, environ, runs=100):
... | {
"repo_name": "NiclasEriksen/rpg_procgen",
"path": "utils/dojo.py",
"copies": "1",
"size": "2222",
"license": "cc0-1.0",
"hash": 5032576229112518000,
"line_mean": 31.1641791045,
"line_max": 79,
"alpha_frac": 0.5715571557,
"autogenerated": false,
"ratio": 4.297872340425532,
"config_test": false,... |
# A transformation is a dictionary of semantic checksums,
# representing the input pins, together with celltype and subcelltype
# The checksum of a transformation is the hash of the JSON buffer of this dict.
# A job consists of a transformation together with all relevant entries
# from the semantic-to-syntactic check... | {
"repo_name": "sjdv1982/seamless",
"path": "seamless/core/cache/transformation_cache.py",
"copies": "1",
"size": "39655",
"license": "mit",
"hash": 3741561023461508600,
"line_mean": 40.5246073298,
"line_max": 108,
"alpha_frac": 0.5888034296,
"autogenerated": false,
"ratio": 4.557522123893805,
"... |
"""A Transform takes a list of `Column` and returns a namedtuple of `Column`."""
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | {
"repo_name": "ivano666/tensorflow",
"path": "tensorflow/contrib/learn/python/learn/dataframe/transform.py",
"copies": "2",
"size": "9408",
"license": "apache-2.0",
"hash": -9087812181506814000,
"line_mean": 31.7804878049,
"line_max": 80,
"alpha_frac": 0.6444515306,
"autogenerated": false,
"ratio... |
"""A transient mempty value to serve as a placeholder when any monoidal value
can be used.
"""
from ..abc import Monoid
from ..utils.internal import Instance
from ..funcs.monoid import mconcat, mempty, mappend
__all__ = ('Mempty',)
class _Mempty(Monoid):
"""A class that acts as a transient mempty value, similar... | {
"repo_name": "justanr/pynads",
"path": "pynads/concrete/mempty.py",
"copies": "1",
"size": "2706",
"license": "mit",
"hash": -6841951416203960000,
"line_mean": 35.08,
"line_max": 77,
"alpha_frac": 0.6459719143,
"autogenerated": false,
"ratio": 3.973568281938326,
"config_test": false,
"has_no... |
"""A translation of an example from the Java Tutorial
http://java.sun.com/docs/books/tutorial/
This example converts between metric and english units
"""
from java import awt
from java.applet import Applet
from java.awt.event import ActionListener, ItemListener, AdjustmentListener
from pawt import GridBag
basicUnits... | {
"repo_name": "tunneln/CarnotKE",
"path": "jyhton/Demo/applet/deprecated/Converter.py",
"copies": "12",
"size": "2651",
"license": "apache-2.0",
"hash": -6001551510396182000,
"line_mean": 22.4601769912,
"line_max": 75,
"alpha_frac": 0.67710298,
"autogenerated": false,
"ratio": 3.068287037037037,
... |
# A translation of calc_fitness.pl into python! For analysis of Tn-Seq.
# This script requires BioPython, which in turn has a good number of dependencies (some optional but very helpful).
# How to install BioPython and a list of its dependencies can be found here: http://biopython.org/DIST/docs/install/Installation.htm... | {
"repo_name": "jsa-aerial/aerobio",
"path": "Scripts/calc_fitness.py",
"copies": "1",
"size": "43828",
"license": "mit",
"hash": 8200735867038334000,
"line_mean": 57.672021419,
"line_max": 313,
"alpha_frac": 0.3074746737,
"autogenerated": false,
"ratio": 4.81414762741652,
"config_test": false,
... |
"""ATRCalculator
ATR: Average True Range.
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr
"""
class ATRCalculator(object):
def __init__(self, window_size=10):
self.window_size = window_size
self.tr_list = []
self.last_tick = None
... | {
"repo_name": "dyno/LMK",
"path": "lmk/calculator/ATRCalculator.py",
"copies": "1",
"size": "1499",
"license": "mit",
"hash": 2169116107196417300,
"line_mean": 37.4358974359,
"line_max": 118,
"alpha_frac": 0.5670446965,
"autogenerated": false,
"ratio": 3.1557894736842105,
"config_test": false,
... |
# A tree data structure which stores a list of degrees and can quickly retrieve the min degree element,
# or modify any of the degrees, each in logarithmic time. It works by creating a binary tree with the
# given elements in the leaves, where each internal node stores the min of its two children.
import math
class M... | {
"repo_name": "shenghua-liu/HoloScope",
"path": "mytools/MinTree.py",
"copies": "1",
"size": "2293",
"license": "apache-2.0",
"hash": 7149728313982103000,
"line_mean": 39.2280701754,
"line_max": 107,
"alpha_frac": 0.5542956825,
"autogenerated": false,
"ratio": 3.474242424242424,
"config_test": ... |
# A tree is either () or (left, val, right).
T = (((),'a',()), 'b', ( ((),'c',()), 'd', ()))
# A zipper is a 'point' in the tree.
# zipper = (context, tree)
# context = ('top', _, _, _)
# | ('left', context, val, right) meaning a hole (*, val, right)
# | ('right', context, left, val) meaning a hole... | {
"repo_name": "JaDogg/__py_playground",
"path": "reference/sketchbook/zippers/treezip.py",
"copies": "1",
"size": "1477",
"license": "mit",
"hash": -5634698662520971000,
"line_mean": 27.4038461538,
"line_max": 85,
"alpha_frac": 0.4861205146,
"autogenerated": false,
"ratio": 2.7351851851851854,
... |
"""A tree-searching virtual machine, searching branch and match
implementation."""
from treepace.relations import Descendant
import treepace.trees
from treepace.utils import ReprMixin, IPythonDotMixin
from treepace.replace import ReplaceError
class SearchMachine(ReprMixin):
"""A tree-searching virtual machine."""... | {
"repo_name": "sulir/treepace",
"path": "treepace/search.py",
"copies": "1",
"size": "4032",
"license": "mit",
"hash": 2949209456118498000,
"line_mean": 38.145631068,
"line_max": 79,
"alpha_frac": 0.6083829365,
"autogenerated": false,
"ratio": 4.470066518847006,
"config_test": false,
"has_no_... |
# A tree viewer to use for debugging purposes, especially for debugging likelihood
# calculations and MCMC moves involving trees. Shows a graphical representation of
# the tree as it is laid out in memory.
#
# Features:
# o Background is shown in color_plot_background (colors defined below)
# o Initially, node numbers... | {
"repo_name": "plewis/phycas",
"path": "src/python/treeviewer/TreeViewer.py",
"copies": "1",
"size": "26124",
"license": "mit",
"hash": 5712189553416356000,
"line_mean": 41.616639478,
"line_max": 147,
"alpha_frac": 0.5864339305,
"autogenerated": false,
"ratio": 3.6187837650644132,
"config_test"... |
"""A tree with operator nodes and numeric value leaves."""
from __future__ import print_function
import re
OP_NAMES = ('+', '-', '*', '/')
RE_OPS = re.compile('^[\+\-\*\/]$')
RE_NUM = re.compile('^\d+$')
class TreeError(Exception):
"""The super class for tree errors."""
class OperatorNameError(TreeError):
""... | {
"repo_name": "kmggh/walk_expression_tree",
"path": "tree.py",
"copies": "1",
"size": "6788",
"license": "artistic-2.0",
"hash": -1034100279446858900,
"line_mean": 22.0884353741,
"line_max": 74,
"alpha_frac": 0.5989982322,
"autogenerated": false,
"ratio": 3.436962025316456,
"config_test": false... |
''' a Triangle
'''
import math
import collections
import itertools
from . import Polygon, Point, Segment, Circle
from .constants import Epsilon, Half_Pi, nearly_eq, Sqrt_3
from .exceptions import *
class Triangle(Polygon):
'''a pythonic Triangle
Implements a Triangle object in the XY plane having three
... | {
"repo_name": "JnyJny/Geometry",
"path": "Geometry/triangle2.py",
"copies": "1",
"size": "9993",
"license": "mit",
"hash": 7130236080199315000,
"line_mean": 23.0795180723,
"line_max": 82,
"alpha_frac": 0.5595917142,
"autogenerated": false,
"ratio": 3.8039588884659308,
"config_test": false,
"h... |
"""A triangle widget."""
from typing import Optional
from kivy.graphics import Triangle as KivyTriangle
from kivy.graphics.context_instructions import Color, Rotate, Scale
from kivy.properties import ListProperty, NumericProperty
from mpfmc.uix.widget import Widget
from mpfmc.core.utils import center_of_points_list
... | {
"repo_name": "missionpinball/mpf_mc",
"path": "mpfmc/widgets/triangle.py",
"copies": "1",
"size": "2317",
"license": "mit",
"hash": 6829097092122274000,
"line_mean": 27.256097561,
"line_max": 95,
"alpha_frac": 0.6262408287,
"autogenerated": false,
"ratio": 3.842454394693201,
"config_test": fal... |
"""A trie data structure implemented as a class."""
from collections import OrderedDict
class Node(object):
"""Node object to build a trie."""
def __init__(self, prev=None, end=False):
"""Init node object."""
self.prev = prev
self.children = OrderedDict()
self.end = end
cla... | {
"repo_name": "CCallahanIV/data-structures",
"path": "src/trie.py",
"copies": "2",
"size": "3333",
"license": "mit",
"hash": 508292811872656800,
"line_mean": 32.33,
"line_max": 114,
"alpha_frac": 0.5550555056,
"autogenerated": false,
"ratio": 4.1506849315068495,
"config_test": false,
"has_no_... |
# A trie implementation in Python
class Node(object):
"""
Trie node implementation
"""
def __init__(self, char):
self.char = char
self.children = []
self.complete = False
self.counter = 1
def add(root, word):
"""
Adding a word into the tree
"""
node = root
for char in word:
found_in_child = False
... | {
"repo_name": "paulmorio/grusData",
"path": "datastructures/trie.py",
"copies": "1",
"size": "1538",
"license": "mit",
"hash": -2632932881910173000,
"line_mean": 23.4285714286,
"line_max": 81,
"alpha_frac": 0.6827048114,
"autogenerated": false,
"ratio": 3.272340425531915,
"config_test": false,
... |
"""a trigram algorithm that generates text using a book-sized file as input."""
import io
import string
import re
import random
import sys
def main(file_path, num_words):
'''Call the primary functions of this module.'''
num_words = int(num_words)
data = input_file(file_path)
sentences = split_data(dat... | {
"repo_name": "midfies/trigrams",
"path": "src/trigrams.py",
"copies": "1",
"size": "3399",
"license": "mit",
"hash": -1698165840514505700,
"line_mean": 26.4112903226,
"line_max": 79,
"alpha_frac": 0.5966460724,
"autogenerated": false,
"ratio": 3.529595015576324,
"config_test": false,
"has_no... |
"""A trivia cog that uses Open Trivia Database."""
import os
import html
import asyncio
import time
import datetime
import random
import math
import aiohttp
import discord
from discord.ext import commands
from __main__ import send_cmd_help
from .utils import checks
from .utils.dataIO import dataIO
SAVE_FILEPATH = "da... | {
"repo_name": "keanemind/Keane-Cogs",
"path": "quiz/quiz.py",
"copies": "1",
"size": "18172",
"license": "mit",
"hash": 5391725456922098000,
"line_mean": 42.7325301205,
"line_max": 107,
"alpha_frac": 0.5393685603,
"autogenerated": false,
"ratio": 4.324279247081249,
"config_test": false,
"has_... |
"""A trivial base class to avoid circular imports for isinstance checks."""
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | {
"repo_name": "dendisuhubdy/tensorflow",
"path": "tensorflow/python/training/checkpointable/data_structures_base.py",
"copies": "3",
"size": "1122",
"license": "apache-2.0",
"hash": 5882976357665193000,
"line_mean": 40.5555555556,
"line_max": 80,
"alpha_frac": 0.7237076649,
"autogenerated": false,
... |
#A trivial demonstration of the RecurrentSig layer from iisignature_recurrent_keras.py
#relies on keras 2
import os
#os.environ["THEANO_FLAGS"]="floatX=float32,device=cpu,optimizer=fast_compile"
#os.environ["THEANO_FLAGS"]="floatX=float32,device=cpu,mode=DebugMode"
#os.environ["THEANO_FLAGS"]="floatX=float32,device=gp... | {
"repo_name": "bottler/iisignature",
"path": "examples/demo_rnn.py",
"copies": "1",
"size": "2853",
"license": "mit",
"hash": 5196889545030173000,
"line_mean": 48.1896551724,
"line_max": 228,
"alpha_frac": 0.7549947424,
"autogenerated": false,
"ratio": 2.7888563049853374,
"config_test": false,
... |
#A trivial demonstration of the RecurrentSig layer from iisignature_recurrent_torch.py
#No assertion is made that this model is a good idea, or that this code is idiomatic pytorch.
import numpy as np, sys, os, itertools
import torch
from torch.autograd import Variable
import torch.nn as nn
#add the parent directory, ... | {
"repo_name": "bottler/iisignature",
"path": "examples/demo_rnn_torch.py",
"copies": "1",
"size": "2144",
"license": "mit",
"hash": -3351368772519757300,
"line_mean": 31,
"line_max": 116,
"alpha_frac": 0.7056902985,
"autogenerated": false,
"ratio": 3.098265895953757,
"config_test": false,
"ha... |
"""A trivial spell checking API using Flask and TextBlob.
This app wraps a very simple JSON interface around TextBlob and provides very
basic spell checking and correction support (english only for now).
"""
# third-party imports
from flask import Flask
from flask import jsonify
from flask import request
from textblob... | {
"repo_name": "paddycarey/speelchecker",
"path": "app.py",
"copies": "1",
"size": "1916",
"license": "mit",
"hash": 8282732685870773000,
"line_mean": 29.4126984127,
"line_max": 82,
"alpha_frac": 0.6299582463,
"autogenerated": false,
"ratio": 3.698841698841699,
"config_test": false,
"has_no_ke... |
"""ATS input converter, moves SEB from the monolithic version in 0.87
and earlier to a newer, modularized version in 0.88."""
import sys, os
try:
amanzi_xml = os.path.join(os.environ["AMANZI_SRC_DIR"], "tools","amanzi_xml")
except KeyError:
pass
else:
if amanzi_xml not in sys.path:
sys.path.append(... | {
"repo_name": "amanzi/ats-dev",
"path": "tools/input_converters/seb_monolithic_to_evals.py",
"copies": "2",
"size": "7489",
"license": "bsd-3-clause",
"hash": 5480035926781949000,
"line_mean": 37.2091836735,
"line_max": 124,
"alpha_frac": 0.6235812525,
"autogenerated": false,
"ratio": 3.738891662... |
# at some point try
# from keras.utils import plot_model
# plot_model(model, to_file='model.png')
import matplotlib.lines as mlines
import warnings
import theano.sandbox.cuda.basic_ops as sbcuda
import numpy as np
import load_data
import realtime_augmentation as ra
import time
import sys
import json
from datetime impo... | {
"repo_name": "garbersc/keras-galaxies",
"path": "predict_convnet_on_train_data.py",
"copies": "1",
"size": "44757",
"license": "bsd-3-clause",
"hash": 297940264379752000,
"line_mean": 35.3287337662,
"line_max": 267,
"alpha_frac": 0.5589963581,
"autogenerated": false,
"ratio": 3.0261663286004055,... |
# at some point try
# from keras.utils import plot_model
# plot_model(model, to_file='model.png')
import theano.sandbox.cuda.basic_ops as sbcuda
import numpy as np
import load_data
import realtime_augmentation as ra
import time
import sys
import glob
import json
from datetime import timedelta
import os
import matplotl... | {
"repo_name": "garbersc/keras-galaxies",
"path": "ensembled_weights.py",
"copies": "1",
"size": "5847",
"license": "bsd-3-clause",
"hash": 2974064421774337000,
"line_mean": 29.7736842105,
"line_max": 89,
"alpha_frac": 0.5023088763,
"autogenerated": false,
"ratio": 3.2573816155988857,
"config_te... |
"""AT-specific Form helpers."""
from __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from .at_states import STATE_CHO... | {
"repo_name": "thor/django-localflavor",
"path": "localflavor/at/forms.py",
"copies": "3",
"size": "2571",
"license": "bsd-3-clause",
"hash": 6484882523526741000,
"line_mean": 34.2191780822,
"line_max": 93,
"alpha_frac": 0.6285492026,
"autogenerated": false,
"ratio": 3.6781115879828326,
"config... |
"""attach comments to files
Revision ID: 254ac5fc3941
Revises: 50344aecd1c2
Create Date: 2015-04-13 15:52:07.104397
"""
# revision identifiers, used by Alembic.
revision = '254ac5fc3941'
down_revision = '50344aecd1c2'
import sys
import warnings
from alembic import op
import sqlalchemy as sa
from gertty.dbsupport ... | {
"repo_name": "aspiers/gertty",
"path": "gertty/alembic/versions/254ac5fc3941_attach_comments_to_files.py",
"copies": "1",
"size": "2276",
"license": "apache-2.0",
"hash": -9217671783624476000,
"line_mean": 34.5625,
"line_max": 114,
"alpha_frac": 0.6221441125,
"autogenerated": false,
"ratio": 3.3... |
"""Attach devices to a ticket."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier', type=int)
@click.option('--hardware', 'hardware_i... | {
"repo_name": "softlayer/softlayer-python",
"path": "SoftLayer/CLI/ticket/attach.py",
"copies": "3",
"size": "1425",
"license": "mit",
"hash": -7774346059918943000,
"line_mean": 39.7142857143,
"line_max": 102,
"alpha_frac": 0.7235087719,
"autogenerated": false,
"ratio": 4.178885630498534,
"conf... |
"""Attached Files Utilities.
"""
#
# Copyright (c) 2009 shinGETsu Project.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# ... | {
"repo_name": "shingetsu/saku-ex",
"path": "shingetsu/attachutil.py",
"copies": "1",
"size": "1936",
"license": "bsd-2-clause",
"hash": 2969965270698690000,
"line_mean": 34.8518518519,
"line_max": 76,
"alpha_frac": 0.7267561983,
"autogenerated": false,
"ratio": 4.110403397027601,
"config_test":... |
"""Attaches a disk volume to a virtual machine."""
from baseCmd import *
from baseResponse import *
class attachVolumeCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""the ID of the disk volume"""
"""Required"""
self.id = None
self.typeInfo['id'... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/attachVolume.py",
"copies": "1",
"size": "8913",
"license": "apache-2.0",
"hash": -3640416543725088300,
"line_mean": 41.4428571429,
"line_max": 320,
"alpha_frac": 0.593627286,
"autogenerated": false,
"ratio": 4.14172862453... |
"""Attaches an ISO to a virtual machine."""
from baseCmd import *
from baseResponse import *
class attachIsoCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""the ID of the ISO file"""
"""Required"""
self.id = None
self.typeInfo['id'] = 'uuid'
... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/attachIso.py",
"copies": "1",
"size": "24235",
"license": "apache-2.0",
"hash": -2402080652488110600,
"line_mean": 37.6523125997,
"line_max": 131,
"alpha_frac": 0.5714462554,
"autogenerated": false,
"ratio": 4.397568499364... |
"""Attach genomes to a clinical report using the new flexible family report nomenclature.
"""
import csv
import simplejson as json
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
import argparse
# Load environment variables for request authentication parameters
if "FABRIC_API_PASSWORD" no... | {
"repo_name": "Omicia/omicia_api_examples",
"path": "python/ClinicalReportLaunchers/add_genomes_to_flexible_family.py",
"copies": "1",
"size": "9237",
"license": "mit",
"hash": -3217978379049963500,
"line_mean": 44.2794117647,
"line_max": 143,
"alpha_frac": 0.565984627,
"autogenerated": false,
"r... |
""" Attachments """
from email.encoders import encode_base64
from email.mime.base import MIMEBase
from email.mime.image import MIMEImage
from future.moves.urllib.parse import quote_plus
from .util import unicode_header
class Attachment(object):
""" File attachment information.
This can be provided to the [... | {
"repo_name": "kolypto/py-mailem",
"path": "mailem/attachment.py",
"copies": "1",
"size": "3197",
"license": "bsd-2-clause",
"hash": 4700480686617296000,
"line_mean": 30.3431372549,
"line_max": 128,
"alpha_frac": 0.6324679387,
"autogenerated": false,
"ratio": 4.151948051948052,
"config_test": f... |
"""Attachment utils."""
from pathlib import Path
from uuid import uuid4
from blobstash.docstore.error import DocStoreError
from blobstash.filetree import FileTreeClient
_FILETREE_POINTER_FMT = "@filetree/ref:{}"
_FILETREE_ATTACHMENT_FS_PREFIX = "_filetree:docstore"
class Attachment:
"""An attachment represents ... | {
"repo_name": "tsileo/blobstash-python-docstore",
"path": "blobstash/docstore/attachment.py",
"copies": "1",
"size": "2286",
"license": "mit",
"hash": -8760938269791560000,
"line_mean": 31.6571428571,
"line_max": 113,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 3.778512396694215,... |
"""Attach signals to this app's models."""
# -*- coding: utf-8 -*-
import json
import logging
import channels.layers
from asgiref.sync import async_to_sync
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Job, Log
logger = logging.getLogger(__name__) # pylint... | {
"repo_name": "ornl-ndav/django-remote-submission",
"path": "django_remote_submission/signals.py",
"copies": "1",
"size": "2175",
"license": "isc",
"hash": -3667463687333967400,
"line_mean": 24,
"line_max": 76,
"alpha_frac": 0.6179310345,
"autogenerated": false,
"ratio": 3.7760416666666665,
"co... |
# Attack agent thread. This performs the attack based on instructions from the main thread.
import time, threading, Queue
import attacks.syn2
import attacks.icmpflood
import attacks.httpflood
class Attacker(threading.Thread):
def __init__(self, Q):
threading.Thread.__init__(self) # Required for thread cl... | {
"repo_name": "mikeberkelaar/controlleddos",
"path": "Attack_Agent/Xattacker.py",
"copies": "1",
"size": "1697",
"license": "apache-2.0",
"hash": -2745641035464261600,
"line_mean": 32.94,
"line_max": 180,
"alpha_frac": 0.5715969358,
"autogenerated": false,
"ratio": 3.602972399150743,
"config_te... |
"""attack functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
def parameters(max_epsilon, image_factor, image_pixels,
manual_alpha=None):
# Images for inception classifier are normali... | {
"repo_name": "huschen/kaggle_nips17_adversarial",
"path": "submission_code/targeted/attack.py",
"copies": "1",
"size": "3952",
"license": "mit",
"hash": 1468147415904231200,
"line_mean": 32.2100840336,
"line_max": 78,
"alpha_frac": 0.6067813765,
"autogenerated": false,
"ratio": 3.070707070707070... |
"""attack graph functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.contrib.slim.nets import inception
from lib_adv import inception_resnet_v2
from lib_adv import utils
# from tensorfl... | {
"repo_name": "huschen/kaggle_nips17_adversarial",
"path": "models_targeted_attacks/target_mng/lib_adv/attack.py",
"copies": "1",
"size": "4876",
"license": "mit",
"hash": -3411833694992636400,
"line_mean": 31.5066666667,
"line_max": 79,
"alpha_frac": 0.6406890894,
"autogenerated": false,
"ratio"... |
# Attack master/manager
import threading, time, Queue # Python
import Xtcpconnector
import Xattacker # Own classes
# Statics
SERVER_IP = "145.100.102.108"
SERVER_PORT = 55555
class Agent():
def __init__(self, Q):
self.bla = "bla"
self.in_Q = Q
def slave(self):
while True:
... | {
"repo_name": "mikeberkelaar/controlleddos",
"path": "Attack_Agent/attack_agent.py",
"copies": "1",
"size": "1444",
"license": "apache-2.0",
"hash": -3160076877471000000,
"line_mean": 21.9206349206,
"line_max": 72,
"alpha_frac": 0.5657894737,
"autogenerated": false,
"ratio": 3.5831265508684864,
... |
"""Attack of the Grothons from Planet #25"""
# Imports.
from bs4 import BeautifulSoup
from textwrap import TextWrapper
# Classes.
class Engine(object):
def __init__(self, scene_map):
self.scene_map = scene_map
def play(self):
current_scene = self.scene_map.opening_scene()
while Tru... | {
"repo_name": "OzBonus/LPTHW",
"path": "Gothons/gothons_game.py",
"copies": "1",
"size": "4962",
"license": "unlicense",
"hash": -622556965240809000,
"line_mean": 21.4524886878,
"line_max": 70,
"alpha_frac": 0.53808948,
"autogenerated": false,
"ratio": 3.8554778554778553,
"config_test": false,
... |
ATTACK_PATTERN = {
'response': {
"id": "attack-pattern--01a5a209-b94c-450b-b7f9-946497d91055",
"name": "ATTACK_PATTERN 1",
"type": "attack-pattern",
"modified": "2020-05-13T22:50:51.258Z",
"created": "2017-05-31T21:30:44.329Z",
"description": "Adversaries may abuse Wi... | {
"repo_name": "demisto/content",
"path": "Packs/FeedMitreAttackv2/Integrations/FeedMitreAttackv2/test_data/mitre_test_data.py",
"copies": "1",
"size": "28200",
"license": "mit",
"hash": 5206370522935797000,
"line_mean": 50.9337016575,
"line_max": 149,
"alpha_frac": 0.4203900709,
"autogenerated": fa... |
attack_power = 100
# Print keyword only available python 2 and lower.
print "Attack Power:", attack_power
print "Attack Power: {} points".format(attack_power)
print "Attack Power: {attack_power} points".format(attack_power=100)
print "Attack Power: %s" % (attack_power) # python 1 and 2... won't work on 3
# Print a... | {
"repo_name": "LearnPythonAndMakeGames/BasicPythonTutorialSeries",
"path": "basic_tutorials/strings.py",
"copies": "1",
"size": "1126",
"license": "apache-2.0",
"hash": 2859369721345135000,
"line_mean": 33.1212121212,
"line_max": 79,
"alpha_frac": 0.6394316163,
"autogenerated": false,
"ratio": 3.... |
# Attacks when we multiple RSA Public keys available
# * Attack 1: Same e. Different N. (N_i, N_j) != 1 for some i, j
import sys
import daedmath
class MultiKey:
def __init__(self, keys):
if not keys:
print "ERROR: No Keys Loaded"
sys.exit(2)
self.keys = keys
def hack... | {
"repo_name": "sushant94/daedalus",
"path": "rsa_multiple_keys.py",
"copies": "1",
"size": "1152",
"license": "mit",
"hash": -3723282704392148000,
"line_mean": 36.1612903226,
"line_max": 96,
"alpha_frac": 0.4696180556,
"autogenerated": false,
"ratio": 3.4491017964071857,
"config_test": false,
... |
"""Attempt #1 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked fo... | {
"repo_name": "ctn-waterloo/neuron_models",
"path": "v1-attributes.py",
"copies": "1",
"size": "6523",
"license": "mit",
"hash": -2887944705496027000,
"line_mean": 23.7083333333,
"line_max": 78,
"alpha_frac": 0.5756553733,
"autogenerated": false,
"ratio": 3.113603818615752,
"config_test": false... |
"""Attempt #2 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked fo... | {
"repo_name": "ctn-waterloo/neuron_models",
"path": "v2-parameters.py",
"copies": "1",
"size": "7491",
"license": "mit",
"hash": 3800150249164001300,
"line_mean": 24.7422680412,
"line_max": 78,
"alpha_frac": 0.5857695902,
"autogenerated": false,
"ratio": 3.221935483870968,
"config_test": false,... |
"""Attempt #3 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked fo... | {
"repo_name": "ctn-waterloo/neuron_models",
"path": "v3-mixins.py",
"copies": "1",
"size": "7999",
"license": "mit",
"hash": -7366375373327847000,
"line_mean": 26.1152542373,
"line_max": 78,
"alpha_frac": 0.5913239155,
"autogenerated": false,
"ratio": 3.2635658914728682,
"config_test": false,
... |
#attempt #3
def treeScanner(directory):
import os
import re
from datetime import date
from markdown_processor import processMD
class Folder(object):
"""This is the folder Class
attributes:
self.name - the name in the filesystem for the folder
se... | {
"repo_name": "crmackay/lab-notebook-builder",
"path": "bin/builder/dir_scanner_3.py",
"copies": "1",
"size": "5037",
"license": "mit",
"hash": 1712399003461432000,
"line_mean": 30.6855345912,
"line_max": 76,
"alpha_frac": 0.4586063133,
"autogenerated": false,
"ratio": 4.694315004659832,
"confi... |
"""Attempt #4 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked fo... | {
"repo_name": "ctn-waterloo/neuron_models",
"path": "v4-fleshout.py",
"copies": "1",
"size": "8657",
"license": "mit",
"hash": -1873103159575087000,
"line_mean": 26.7467948718,
"line_max": 81,
"alpha_frac": 0.5799930692,
"autogenerated": false,
"ratio": 3.5034399028733305,
"config_test": false,... |
"""Attempt #5 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked fo... | {
"repo_name": "ctn-waterloo/neuron_models",
"path": "v5-separate.py",
"copies": "1",
"size": "9031",
"license": "mit",
"hash": -2438515772797290500,
"line_mean": 27.0465838509,
"line_max": 79,
"alpha_frac": 0.5854279703,
"autogenerated": false,
"ratio": 3.5429580227540214,
"config_test": false,... |
"""Attempt #6 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked fo... | {
"repo_name": "ctn-waterloo/neuron_models",
"path": "v6-dopamine.py",
"copies": "1",
"size": "10786",
"license": "mit",
"hash": -2103051528465433900,
"line_mean": 27.6861702128,
"line_max": 79,
"alpha_frac": 0.5716669757,
"autogenerated": false,
"ratio": 3.3045343137254903,
"config_test": false... |
""" attempt at a more general-purpose parallel simulation script using the 2D solver.
should do the following: simulate forces in the pore for a given list of ranges of parameter values.
distribute this simulation to a given number of processors.
create a data and metadata file for every range.
#if data file already e... | {
"repo_name": "mitschabaude/nanopores",
"path": "nanopores/scripts/simulation2D.py",
"copies": "1",
"size": "8550",
"license": "mit",
"hash": 2843646993336350700,
"line_mean": 36.012987013,
"line_max": 104,
"alpha_frac": 0.6371929825,
"autogenerated": false,
"ratio": 3.8220831470719716,
"config... |
"""Attempt at creating an autocomplete class."""
from trie import Trie
class Autocomplete(object):
"""Takes a vocab list on init., provides methods to autocomplete."""
def __init__(self, vocab, max_completions=5):
"""Initialize autocomplete."""
self.vocab = vocab
self.max_completions... | {
"repo_name": "pasaunders/code-katas",
"path": "src/autocomplete.py",
"copies": "1",
"size": "1520",
"license": "mit",
"hash": 6772944379606689000,
"line_mean": 35.1904761905,
"line_max": 97,
"alpha_frac": 0.6184210526,
"autogenerated": false,
"ratio": 4.305949008498583,
"config_test": false,
... |
# Attempt at implementing autoencoder for MNIST
# Multiple variations of this have been tried, eg. the linear (PCA),
# sigmoidal, and denoising. None of them end up producing local filters
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy
import... | {
"repo_name": "jfrancis71/TensorFlowApps",
"path": "TrainMNISTAutoencoder.py",
"copies": "1",
"size": "2609",
"license": "mit",
"hash": 116172512827372380,
"line_mean": 27.6703296703,
"line_max": 103,
"alpha_frac": 0.6830203143,
"autogenerated": false,
"ratio": 3.0301974448315914,
"config_test"... |
# Attempt at replicating the results from 'Recurrent Highway Networks' using keras
# Arxiv paper: https://arxiv.org/abs/1607.03474
# Reference implementation: https://github.com/julian121266/RecurrentHighwayNetworks
#
import time
import numpy as np
import keras.optimizers
from keras.layers import Embedding, Dense, LST... | {
"repo_name": "LaurentMazare/deep-models",
"path": "rhn/rhn-text8.py",
"copies": "1",
"size": "2654",
"license": "apache-2.0",
"hash": 8281991883817838000,
"line_mean": 33.0256410256,
"line_max": 97,
"alpha_frac": 0.7049736247,
"autogenerated": false,
"ratio": 2.8910675381263617,
"config_test":... |
"""Attempt at totalling up DCP data
Run from `RUN_12Z.sh` for previous day
Run from `RUN_20_AFTER.sh` for current day
"""
import datetime
import sys
import pytz
import numpy as np
from pandas.io.sql import read_sql
from pyiem.util import get_dbconn, utc, logger
LOG = logger()
def workflow(date):
"""Do... | {
"repo_name": "akrherz/iem",
"path": "scripts/hads/compute_hads_pday.py",
"copies": "1",
"size": "3548",
"license": "mit",
"hash": -4688594871699963000,
"line_mean": 30.1228070175,
"line_max": 77,
"alpha_frac": 0.5417136415,
"autogenerated": false,
"ratio": 3.3314553990610327,
"config_test": fa... |
# Attempted solution of Riddler at https://fivethirtyeight.com/features/riddler-nation-goes-to-war/
from random import shuffle
Reps = 10000000
# How many cards go face-down in a tie-break?
CardsDown = 1
# Play the next cards and break any ties. Return True if
# there are more cards to play. Result is 1 if the aces
... | {
"repo_name": "hectorpefo/hectorpefo.github.io",
"path": "_includes/GameOfWar.py",
"copies": "1",
"size": "1646",
"license": "mit",
"hash": 8296094936817178000,
"line_mean": 21.2432432432,
"line_max": 99,
"alpha_frac": 0.6391251519,
"autogenerated": false,
"ratio": 2.7479131886477464,
"config_t... |
# attempting the classify the charts, after armor/tests/imageToDataTest3.py
# Plan: 1. compute features and store them
# 2. classify
# 3. display
#
#sleepTime= 140000
sleepTime =0
import time
print time.asctime()
print 'sleeping now for ', sleepTime, 'seconds'
time.sleep(sleepTime)
import os... | {
"repo_name": "yaukwankiu/armor",
"path": "tests/imageToDataTest4.py",
"copies": "1",
"size": "5132",
"license": "cc0-1.0",
"hash": 3112838748372136000,
"line_mean": 28.6647398844,
"line_max": 147,
"alpha_frac": 0.6102883866,
"autogenerated": false,
"ratio": 2.959630911188005,
"config_test": fa... |
# attempting the classify the charts, after armor/tests/imageToDataTest3.py
# Plan: 1. compute features and store them
# *2. classify
# - basically, put all of the feature vectors in an array and perform k-means or others such as DBSCAN (once i know how to do it)
# 3. display
... | {
"repo_name": "yaukwankiu/armor",
"path": "tests/imageToDataTest5.py",
"copies": "1",
"size": "2976",
"license": "cc0-1.0",
"hash": 5528325042294674000,
"line_mean": 29.3673469388,
"line_max": 158,
"alpha_frac": 0.59375,
"autogenerated": false,
"ratio": 3.1162303664921467,
"config_test": false,... |
# attempting the classify the charts, after armor/tests/imageToDataTest3.py
# this is the loop version of imageToTest5.py
# Plan: 1. compute features and store them
# *2. classify
# - basically, put all of the feature vectors in an array and perform k-means or others such as DBSCAN (o... | {
"repo_name": "yaukwankiu/armor",
"path": "tests/imageToDataTest6.py",
"copies": "1",
"size": "3884",
"license": "cc0-1.0",
"hash": 8755037214743457000,
"line_mean": 32.1965811966,
"line_max": 162,
"alpha_frac": 0.5592173018,
"autogenerated": false,
"ratio": 3.351164797238999,
"config_test": fa... |
# Attempting to get very high accuracy with MNIST convnet
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
# Set random seed
np.random.seed(123456)
tf.set_random_seed(123456)
# Get data
mnist = input_data.read_data_sets("/tmp/data")
h = 28
w = 28
channels = 1
n_... | {
"repo_name": "KT12/hands_on_machine_learning",
"path": "MNIST_convnet_problem_9.py",
"copies": "1",
"size": "3774",
"license": "mit",
"hash": 8627815000793627000,
"line_mean": 31.5431034483,
"line_max": 95,
"alpha_frac": 0.5760466349,
"autogenerated": false,
"ratio": 3.1267605633802815,
"confi... |
"""Attempts Migration of a system virtual machine to the host specified."""
from baseCmd import *
from baseResponse import *
class migrateSystemVmCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""destination Host ID to migrate VM to"""
"""Required"""
se... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/migrateSystemVm.py",
"copies": "1",
"size": "4448",
"license": "apache-2.0",
"hash": -3466269384945375700,
"line_mean": 39.4363636364,
"line_max": 153,
"alpha_frac": 0.5959982014,
"autogenerated": false,
"ratio": 4.2121212... |
"""Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool"""
from baseCmd import *
from baseResponse import *
class migrateVirtualMachineCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""the ID of the virtual machine"""
... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/migrateVirtualMachine.py",
"copies": "1",
"size": "24552",
"license": "apache-2.0",
"hash": 6575136808959167000,
"line_mean": 38.0333863275,
"line_max": 131,
"alpha_frac": 0.5742098403,
"autogenerated": false,
"ratio": 4.4... |
"""Attempts Migration of a VM with its volumes to a different host"""
from baseCmd import *
from baseResponse import *
class migrateVirtualMachineWithVolumeCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""Destination Host ID to migrate VM to."""
"""Required"""... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/migrateVirtualMachineWithVolume.py",
"copies": "1",
"size": "25251",
"license": "apache-2.0",
"hash": -3703310376731175000,
"line_mean": 39.080952381,
"line_max": 847,
"alpha_frac": 0.5799770306,
"autogenerated": false,
"r... |
"""Attempts to create a test user,
as the empty JIRA instance isn't provisioned with one.
"""
import time
from os import environ
import requests
from jira import JIRA
CI_JIRA_URL = environ["CI_JIRA_URL"]
def add_user_to_jira():
try:
JIRA(
CI_JIRA_URL,
basic_auth=(environ["CI_JIR... | {
"repo_name": "pycontribs/jira",
"path": "make_local_jira_user.py",
"copies": "1",
"size": "1600",
"license": "bsd-2-clause",
"hash": 371357962708413000,
"line_mean": 29.1886792453,
"line_max": 110,
"alpha_frac": 0.566875,
"autogenerated": false,
"ratio": 3.8004750593824226,
"config_test": fals... |
# Attempts to display the line and column of violating code.
class ParserException(Exception):
def __init__(self, message='Error Message not found.', item=None):
self.message = message
self.lineno = None
self.col_offset = None
if item and hasattr(item, 'lineno'):
self.s... | {
"repo_name": "NedYork/viper",
"path": "viper/exceptions.py",
"copies": "1",
"size": "1461",
"license": "mit",
"hash": -5040325890434958000,
"line_mean": 22.1904761905,
"line_max": 70,
"alpha_frac": 0.6002737851,
"autogenerated": false,
"ratio": 4.234782608695652,
"config_test": false,
"has_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.