text stringlengths 0 1.05M | meta dict |
|---|---|
""" An OpenAI gym environment that uses a WorldModel trained on DonkeyCar data as the environment.
To pass in the arguments needed during environment creation:
your_env = gym.make('DKWMEnv', vae=vae_object, ...etc...)
From: https://stackoverflow.com/questions/54259338/how-to-pass-arguments-to-opena... | {
"repo_name": "Bleyddyn/malpi",
"path": "malpi/dkwm/gym_envs/dkwm_env.py",
"copies": "1",
"size": "6831",
"license": "mit",
"hash": -361775677509184060,
"line_mean": 31.0704225352,
"line_max": 128,
"alpha_frac": 0.5920070268,
"autogenerated": false,
"ratio": 3.312803103782735,
"config_test": fa... |
'''An opengl demo for PyQt5
test on Windows with Python3.6
'''
import array
from PyQt5 import QtGui
vertexShaderCode = '''#version 410
layout(location=0) in vec4 position;
layout(location=1) in vec4 color;
out vec4 theColor;
void main()
{
gl_Position = position;
theColor = color;
} ... | {
"repo_name": "mackst/opengl-samples",
"path": "triangle_PyQt5.py",
"copies": "1",
"size": "3444",
"license": "mit",
"hash": -8638971356057837000,
"line_mean": 24.5111111111,
"line_max": 94,
"alpha_frac": 0.6019163763,
"autogenerated": false,
"ratio": 3.292543021032505,
"config_test": false,
... |
'''An opengl demo for PyQt5
test on Windows with Python3.6
'''
import array
from PySide2 import QtGui
GL_FLOAT = 0x1406
GL_COLOR_BUFFER_BIT = 0x00004000
GL_TRIANGLES = 0x0004
GL_VERSION = 0x1F02
vertexShaderCode = '''#version 410
layout(location=0) in vec4 position;
layout(location=1) in vec4 color;
ou... | {
"repo_name": "mackst/opengl-samples",
"path": "triangle_PySide2.py",
"copies": "1",
"size": "3775",
"license": "mit",
"hash": 4647046154100015000,
"line_mean": 24.3355704698,
"line_max": 94,
"alpha_frac": 0.6098013245,
"autogenerated": false,
"ratio": 3.3348056537102475,
"config_test": false,
... |
"""An OpRegularizer that applies L1 regularization on batch-norm gammas."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from morph_net.framework import generic_regularizers
from morph_net.framework import tpu_util
import tensorflow.compat.v1 as tf
cla... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/op_regularizers/gamma_l1_regularizer.py",
"copies": "1",
"size": "1168",
"license": "apache-2.0",
"hash": 4904675211820868000,
"line_mean": 31.4444444444,
"line_max": 75,
"alpha_frac": 0.7183219178,
"autogenerated": false,
"ratio": 3.8... |
"""An OpRegularizer that applies regularization on Gating probabilities.
This regularizer targets the gating probability of a LogisticSigmoidGating OP.
It can do so directly by minimizing the log odds ratio of the probability
log(p/1-p), or by minimizing the L1 of the sampled mask.
"""
from __future__ import absolute... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/op_regularizers/prob_gating_regularizer.py",
"copies": "1",
"size": "2490",
"license": "apache-2.0",
"hash": 6977722329755907000,
"line_mean": 36.1641791045,
"line_max": 79,
"alpha_frac": 0.7048192771,
"autogenerated": false,
"ratio": ... |
"""An optimizer that switches between several methods."""
import tensorflow as tf
from tensorflow.python.training import optimizer
class CompositeOptimizer(optimizer.Optimizer):
"""Optimizer that switches between several methods.
"""
def __init__(self,
optimizer1,
optimizer2,
... | {
"repo_name": "hang-qi/models",
"path": "syntaxnet/dragnn/python/composite_optimizer.py",
"copies": "2",
"size": "1926",
"license": "apache-2.0",
"hash": 911418610909789600,
"line_mean": 34.0181818182,
"line_max": 80,
"alpha_frac": 0.6225337487,
"autogenerated": false,
"ratio": 4.397260273972603,... |
# An organization tool which uses the [eyeD3 API](https://eyed3.nicfit.net/index.html) to arrange .mp3 files into folders based on the artist name, album title, and album year as specified in the the .mp3 file's metadata.
import os
import shutil
import glob
import datetime
import eyed3
#http://eyed3.nicfit.net/index.h... | {
"repo_name": "AjayAujla/PythonUtilities",
"path": "OrganizeMusic.py",
"copies": "1",
"size": "2451",
"license": "mit",
"hash": -1926059623333608400,
"line_mean": 38.5322580645,
"line_max": 221,
"alpha_frac": 0.6401468788,
"autogenerated": false,
"ratio": 3.753445635528331,
"config_test": false... |
# A normal class instance can serve as a metaclass too
class MetaObj:
def __call__(self, classname, supers, classdict):
print('In MetaObj.call: ', classname, supers, classdict, sep='\n...')
Class = self.__New__(classname, supers, classdict)
self.__Init__(Class, classname, supers, classdict)... | {
"repo_name": "dreadrel/UWF_2014_spring_COP3990C-2507",
"path": "notebooks/scripts/book_code/code/metaclass4.py",
"copies": "1",
"size": "1063",
"license": "apache-2.0",
"hash": -5098011466827891000,
"line_mean": 35.6551724138,
"line_max": 82,
"alpha_frac": 0.6058325494,
"autogenerated": false,
"... |
# A normal superclass can provide __call__ for instance metaclass too
# Instances inherit from classes and their supers normally
class SuperMetaObj:
def __call__(self, classname, supers, classdict):
print('In SuperMetaObj.call: ', classname, supers, classdict, sep='\n...')
Class = self.__New__(clas... | {
"repo_name": "dreadrel/UWF_2014_spring_COP3990C-2507",
"path": "notebooks/scripts/book_code/code/metaclass4-super.py",
"copies": "1",
"size": "1184",
"license": "apache-2.0",
"hash": -2358559555562719000,
"line_mean": 37.1935483871,
"line_max": 82,
"alpha_frac": 0.6317567568,
"autogenerated": fals... |
""" A Nose Plugin for EARL.
See Also:
http://nose.python-hosting.com/
http://www.w3.org/TR/EARL10-Schema/
"""
import logging
from nose.plugins import Plugin
from rdflib.term import URIRef, BNode, Literal
from rdflib.namespace import RDF, RDFS
from rdflib.graph import Graph
from rdflib.namespace import Namesp... | {
"repo_name": "bhavanaananda/DataStage",
"path": "test/RDFDatabank/rdfextras/tools/EARLPlugin.py",
"copies": "3",
"size": "2313",
"license": "mit",
"hash": 2288939637219537200,
"line_mean": 27.9125,
"line_max": 86,
"alpha_frac": 0.6411586684,
"autogenerated": false,
"ratio": 3.155525238744884,
... |
"""An OSLOM Runner for Python."""
import sys
import os
import argparse
import re
import tempfile
import shutil
import time
import subprocess
import itertools
import logging
import simplejson as json
# Defaults
DEF_MIN_CLUSTER_SIZE = 0
DEF_OSLOM_EXEC = "oslom_dir"
DEF_OSLOM_ARGS = ["-w", "-r", "10", "-hr", "10"]
# C... | {
"repo_name": "hhromic/python-oslom-runner",
"path": "oslom/runner.py",
"copies": "1",
"size": "10932",
"license": "apache-2.0",
"hash": 2322373414513459700,
"line_mean": 38.6086956522,
"line_max": 94,
"alpha_frac": 0.6081229418,
"autogenerated": false,
"ratio": 3.6733870967741935,
"config_test... |
"""A notebook manager that uses Azure blob storage.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distrib... | {
"repo_name": "noslenfa/tdjangorest",
"path": "uw/lib/python2.7/site-packages/IPython/html/services/notebooks/azurenbmanager.py",
"copies": "2",
"size": "5554",
"license": "apache-2.0",
"hash": 9222624714568249000,
"line_mean": 37.8391608392,
"line_max": 118,
"alpha_frac": 0.5894850558,
"autogenera... |
"""A notebook manager that uses mongodb for storage.
Based on Travis Harrison's shocknbmanager and the azurenbmanager
Authors:
* Steve Chan <sychan@lbl.gov>
Copyright (C) 2013 The Regents of the University of California
Department of Energy contract-operators of the Lawrence Berkeley National Laboratory
1 Cyclotro... | {
"repo_name": "nlharris/narrative",
"path": "src/biokbase/narrative/mongonbmanager.py",
"copies": "4",
"size": "11865",
"license": "mit",
"hash": 36785415298946820,
"line_mean": 42.6213235294,
"line_max": 119,
"alpha_frac": 0.583817952,
"autogenerated": false,
"ratio": 4.080123796423659,
"confi... |
"""A notebook manager that uses Shock storage.
https://github.com/MG-RAST/Shock
Authors:
* Travis Harrison
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is i... | {
"repo_name": "aekazakov/narrative",
"path": "src/biokbase/narrative/shocknbmanager.py",
"copies": "4",
"size": "11410",
"license": "mit",
"hash": 2974782915371769300,
"line_mean": 44.0988142292,
"line_max": 172,
"alpha_frac": 0.5701139351,
"autogenerated": false,
"ratio": 3.88227288193263,
"co... |
"""A notebook manager that uses the KBase workspace for storage.
Authors:
* Steve Chan <sychan@lbl.gov>
* Bill Riehl <wjriehl@lbl.gov>
Copyright (C) 2013 The Regents of the University of California
Department of Energy contract-operators of the Lawrence Berkeley National Laboratory
1 Cyclotron Road, Berkeley, CA 9... | {
"repo_name": "msneddon/narrative",
"path": "src/biokbase/narrative/contents/kbasewsmanager.py",
"copies": "1",
"size": "20417",
"license": "mit",
"hash": -3595895161004785000,
"line_mean": 34.8210526316,
"line_max": 121,
"alpha_frac": 0.5754028506,
"autogenerated": false,
"ratio": 3.970633994554... |
"""A notebook manager that uses the KBase workspace for storage.
Based on Travis Harrison's shocknbmanager and the azurenbmanager
Authors:
* Steve Chan <sychan@lbl.gov>
* Bill Riehl <wjriehl@lbl.gov>
Copyright (C) 2013 The Regents of the University of California
Department of Energy contract-operators of the Lawre... | {
"repo_name": "nlharris/narrative",
"path": "src/biokbase/narrative/kbasewsmanager.py",
"copies": "4",
"size": "28981",
"license": "mit",
"hash": 565373236168708860,
"line_mean": 41.1848617176,
"line_max": 130,
"alpha_frac": 0.56347262,
"autogenerated": false,
"ratio": 3.983095107201759,
"confi... |
"""A notebook manager that uses the local file system for storage.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file C... | {
"repo_name": "marcoantoniooliveira/labweb",
"path": "oscar/lib/python2.7/site-packages/IPython/html/services/notebooks/filenbmanager.py",
"copies": "2",
"size": "14448",
"license": "bsd-3-clause",
"hash": 657297923716838400,
"line_mean": 39.2451253482,
"line_max": 101,
"alpha_frac": 0.5761351052,
... |
"""A notebook manager that uses the local file system for storage.
Authors:
* Brian Granger
* Zach Sailer
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in... | {
"repo_name": "poojavade/Genomics_Docker",
"path": "Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/ipython-2.2.0-py2.7.egg/IPython/html/services/notebooks/filenbmanager.py",
"copies": "1",
"size": "18231",
"license": "apache-2.0",
"hash": -4483239905273025000,
"line_mean": 36.98125,... |
"""A notebook manager that uses the local file system for storage.
Authors:
* Brian Granger
* Zach Sailer
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full li... | {
"repo_name": "wusung/ipython-notebook-store",
"path": "bookstore/filenotebookmanager.py",
"copies": "1",
"size": "20614",
"license": "apache-2.0",
"hash": 6155367249229893000,
"line_mean": 37.3396946565,
"line_max": 115,
"alpha_frac": 0.5489473174,
"autogenerated": false,
"ratio": 4.096581875993... |
## another case of deja-vu
## this time, we want the slashdot style (what Yahoo said to do) only allow
## certain tags... we'll make it an option
## we'll have to tie this in some way to our HTML body displayer...
##
## Ok, there are basically four types of tags:
## 1) safe - ie, <b>, <i>, etc.
## 2) render problems - ... | {
"repo_name": "WillYee/clearsilver",
"path": "python/examples/base/SafeHtml.py",
"copies": "11",
"size": "5434",
"license": "bsd-2-clause",
"hash": 5203651883341068000,
"line_mean": 36.475862069,
"line_max": 110,
"alpha_frac": 0.5875966139,
"autogenerated": false,
"ratio": 3.0022099447513813,
"... |
# another comment
from indentml.parser import QqTag
class QqXMLFormatter(object):
def __init__(self, root: QqTag=None, allowed_tags=None):
self.root = root
self.allowed_tags = allowed_tags or set()
self.enumerateable_envs = {name: name.capitalize() for name in ['remark', 'theorem', 'examp... | {
"repo_name": "ischurov/qqmbr",
"path": "qqmbr/qqxml.py",
"copies": "1",
"size": "3741",
"license": "mit",
"hash": -164475809783462700,
"line_mean": 24.4489795918,
"line_max": 115,
"alpha_frac": 0.4774124566,
"autogenerated": false,
"ratio": 4.048701298701299,
"config_test": false,
"has_no_ke... |
# another compareg: https://softwarerecs.stackexchange.com/questions/18134/python-library-for-taking-camera-images
# Timestamp: http://startgrid.blogspot.com/2012/08/tutorial-creating-timestamp-on.html
# short note on camera software
# started with opencv but it is such a large library
# used fswebcam for a while but ... | {
"repo_name": "uidaho/smartsettia-unit",
"path": "script/webcam.py",
"copies": "1",
"size": "3171",
"license": "mit",
"hash": -3630195178673902000,
"line_mean": 43.676056338,
"line_max": 121,
"alpha_frac": 0.6278776411,
"autogenerated": false,
"ratio": 3.6075085324232083,
"config_test": false,
... |
# another cool data type in python is tuple
# tuples contain every thing, even string and tuples themselves
my_tuple = (1, 2, 3)
print my_tuple
print type(my_tuple)
# we said every thing
another_tuple = (1, 2, 1.234, 'Hey')
print another_tuple
print type(another_tuple)
# Mmmm, EVERYTHING, I really mean it
amazin... | {
"repo_name": "iamvee/Python-Course",
"path": "Topics/00.Data_Types/03.tuples_and_lists.py",
"copies": "1",
"size": "2237",
"license": "mit",
"hash": -7777209009923675000,
"line_mean": 25.630952381,
"line_max": 73,
"alpha_frac": 0.6504246759,
"autogenerated": false,
"ratio": 2.8753213367609254,
... |
"""Another example on how to modify the Seamless environment,
adding Go support via "go build"
"""
import traceback
from seamless.highlevel import Context, Cell, Transformer
ctx = Context()
env = ctx.environment
# Define a transformer with signature
# (a: int, b: int) -> int
# and a=13, b=16
ctx.tf = Transfor... | {
"repo_name": "sjdv1982/seamless",
"path": "tests/highlevel/environment2.py",
"copies": "1",
"size": "3694",
"license": "mit",
"hash": -1438550479872588300,
"line_mean": 22.2327044025,
"line_max": 85,
"alpha_frac": 0.6786681104,
"autogenerated": false,
"ratio": 3.088628762541806,
"config_test":... |
# An other speel checker
import re
import collections
class SpellChecker(object):
def __init__(self):
def words(text):
return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
return model
print('[...] Initia... | {
"repo_name": "WilliamDiakite/ExperimentationsACA",
"path": "processing/text_processing/spell_checker.py",
"copies": "1",
"size": "1286",
"license": "mit",
"hash": 3820882804178967000,
"line_mean": 25.2448979592,
"line_max": 103,
"alpha_frac": 0.6423017107,
"autogenerated": false,
"ratio": 2.7478... |
""" Another (sub)set of models, this one contains only those with literature
driven RL (or related) terms. Prior analyses were more exploratory.
In this set we allow for seperate regressors matching behavoiral accuracy,
as well as inverted and positive-value-only coding schemes. """
from roi.base import Mean
class... | {
"repo_name": "parenthetical-e/fmri",
"path": "catreward/roi/exps/base2.py",
"copies": "1",
"size": "26356",
"license": "bsd-2-clause",
"hash": 5347236819236171000,
"line_mean": 28.98407281,
"line_max": 78,
"alpha_frac": 0.5733798756,
"autogenerated": false,
"ratio": 3.282191780821918,
"config_... |
#Anoushka Alavilli
#tutorial3.py
from ggame import App, RectangleAsset, ImageAsset, SoundAsset
from ggame import LineStyle, Color, Sprite, Sound
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, no... | {
"repo_name": "anoushkaalavilli/ggame-tutorials",
"path": "tutorial3.py",
"copies": "1",
"size": "1569",
"license": "mit",
"hash": -6537469672937807000,
"line_mean": 25.15,
"line_max": 69,
"alpha_frac": 0.6998087954,
"autogenerated": false,
"ratio": 2.6548223350253806,
"config_test": false,
"... |
""" An overlay for drawing "infinite" vertical and horizontal lines.
This module defines the CoordinateLineOverlay class, a Chaco overlay
for Plot (and similar) objects.
"""
from __future__ import with_statement
from traits.api import Instance, Float, Array
from enable.api import black_color_trait, LineStyle, Compon... | {
"repo_name": "ContinuumIO/chaco",
"path": "chaco/overlays/coordinate_line_overlay.py",
"copies": "3",
"size": "3158",
"license": "bsd-3-clause",
"hash": 4411595335378269000,
"line_mean": 34.4831460674,
"line_max": 78,
"alpha_frac": 0.5702976567,
"autogenerated": false,
"ratio": 4.128104575163399... |
"""An overlay that aligns itself to the plot
"""
from traits.api import Enum, Any
from container_overlay import ContainerOverlay
class AlignedContainerOverlay(ContainerOverlay):
""" Container overlay that aligns itself to the plot
This overlay takes an alignment which specifies which corner of its
conta... | {
"repo_name": "burnpanck/chaco",
"path": "chaco/overlays/aligned_container_overlay.py",
"copies": "3",
"size": "2600",
"license": "bsd-3-clause",
"hash": 8896666761208180000,
"line_mean": 33.2105263158,
"line_max": 75,
"alpha_frac": 0.5761538462,
"autogenerated": false,
"ratio": 4.16,
"config_t... |
"""An overview window showing thumbnails of the image set.
"""
import sys
import math
from PySide import QtCore, QtGui
class ThumbnailWidget(QtGui.QLabel):
def __init__(self, image):
super().__init__()
self.setFrameStyle(self.Box | self.Plain)
self.setLineWidth(4)
palette = self... | {
"repo_name": "RKrahl/photo-tools",
"path": "photo/qt/overviewWindow.py",
"copies": "1",
"size": "4586",
"license": "apache-2.0",
"hash": -5513328793468195000,
"line_mean": 31.9928057554,
"line_max": 70,
"alpha_frac": 0.6011774967,
"autogenerated": false,
"ratio": 4.262081784386617,
"config_tes... |
# An Python interface to the Scintilla control.
#
# Exposes Python classes that allow you to use Scintilla as
# a "standard" MFC edit control (eg, control.GetTextLength(), control.GetSel()
# plus many Scintilla specific features (eg control.SCIAddStyledText())
from pywin.mfc import window
from pywin import default_sci... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "Lib/site-packages/pythonwin/pywin/scintilla/control.py",
"copies": "7",
"size": "17921",
"license": "mit",
"hash": 5117654561724590000,
"line_mean": 40.2926267281,
"line_max": 139,
"alpha_frac": 0.7505719547,
"autogenerated": false,
"ratio": 2.9087810... |
# An Python interface to the Scintilla control.
#
# Exposes Python classes that allow you to use Scintilla as
# a "standard" MFC edit control (eg, control.GetTextLength(), control.GetSel()
# plus many Scintilla specific features (eg control.SCIAddStyledText())
from pywin.mfc import window
import win32con
impor... | {
"repo_name": "Southpaw-TACTIC/Team",
"path": "src/python/Lib/site-packages/pythonwin/pywin/scintilla/control.py",
"copies": "1",
"size": "16522",
"license": "epl-1.0",
"hash": -4646137268723455000,
"line_mean": 36.6932084309,
"line_max": 139,
"alpha_frac": 0.7163781625,
"autogenerated": false,
"... |
"""An Python re-implementation of hierarchical module import.
This code is intended to be read, not executed. However, it does work
-- all you need to do to enable it is "import knee".
(The name is a pun on the klunkier predecessor of this module, "ni".)
"""
import sys, imp, __builtin__
# Replacement for __impor... | {
"repo_name": "Lh4cKg/sl4a",
"path": "python/src/Demo/imputil/knee.py",
"copies": "40",
"size": "3482",
"license": "apache-2.0",
"hash": 5068636659474182000,
"line_mean": 26.6349206349,
"line_max": 73,
"alpha_frac": 0.5476737507,
"autogenerated": false,
"ratio": 3.805464480874317,
"config_test"... |
# An question entirely solved by recurrences.
# Memoization to chache answers is helpful.
# Apart from that I see no need for DP.
#
# It is helpful to note that if T(n) is the required answer
# for 3xn grid, then:
# T(0) = 1
# T(1) = 0
# T(2) = 3
# T(3) = 0
#
# There are a few ways to find the correct recurrence.
# Mos... | {
"repo_name": "babhishek21/oj-sols",
"path": "spoj/M3TILE.py",
"copies": "1",
"size": "1399",
"license": "mit",
"hash": -3333090388318665700,
"line_mean": 25.9038461538,
"line_max": 91,
"alpha_frac": 0.5439599714,
"autogenerated": false,
"ratio": 2.1424196018376724,
"config_test": false,
"has... |
# An reimplementation of the XDS indexer to work for harder cases, for example
# cases where the whole sweep needs to be read into memory in IDXREF to get
# a decent indexing solution (these do happen) and also cases where the
# crystal is highly mosaic. Perhaps. This will now be directly inherited from
# the original ... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Modules/Indexer/XDSIndexerII.py",
"copies": "1",
"size": "13625",
"license": "bsd-3-clause",
"hash": 8029959414767275000,
"line_mean": 34.8552631579,
"line_max": 87,
"alpha_frac": 0.5757798165,
"autogenerated": false,
"ratio": 3.788932146829811,
"con... |
"""An rle reader.
Use:
rle_string = rle.string # See rle.string
data = parse_rle(rle_string, xborder = 10, yborder = 10)
data['matrix'] : 2d numpy array matrix.
data['rulestring'] : rule_string in the form "B(somedigits)/S(somedigits)"
data['dimensions'] : {'y' : integer, 'x' : integer}
"""
import re
import numpy as ... | {
"repo_name": "JacobPaulette/PyLife",
"path": "rle.py",
"copies": "1",
"size": "3429",
"license": "mit",
"hash": 6763275576439078000,
"line_mean": 28.5603448276,
"line_max": 84,
"alpha_frac": 0.5780110819,
"autogenerated": false,
"ratio": 2.6397228637413397,
"config_test": false,
"has_no_keyw... |
"""An RSS feed mining tool developed for Full Fact https://fullfact.org/"""
import argparse
import pathlib
import sys
import time
from xml.etree.ElementTree import ElementTree
import yaml
from tinydb import TinyDB
from . import PKG_DIR
from .content import fetch_article_content
from .feeds import fetch_new_entries
f... | {
"repo_name": "MrKriss/full-fact-rss-miner",
"path": "package/src/rss_miner/main.py",
"copies": "1",
"size": "4057",
"license": "mit",
"hash": 4597383072384571000,
"line_mean": 28.6131386861,
"line_max": 95,
"alpha_frac": 0.6184372689,
"autogenerated": false,
"ratio": 4.1062753036437245,
"confi... |
"""
Sets up the application to run.
"""
##########################################################################
## Imports
##########################################################################
from ingestor import *
from generate import *
from twisted.internet import reactor
################################... | {
"repo_name": "bbengfort/ansible",
"path": "ansible/app.py",
"copies": "1",
"size": "1496",
"license": "mit",
"hash": 8238658569223519000,
"line_mean": 21,
"line_max": 74,
"alpha_frac": 0.4953208556,
"autogenerated": false,
"ratio": 4.2259887005649714,
"config_test": false,
"has_no_keywords":... |
"""Ansible callback plugin to print a nicely formatted summary of failures.
The file / module name is prefixed with `zz_` to make this plugin be loaded last
by Ansible, thus making its output the last thing that users see.
"""
from collections import defaultdict
import traceback
from ansible.plugins.callback import ... | {
"repo_name": "ivanhorvath/openshift-tools",
"path": "openshift/installer/vendored/openshift-ansible-3.6.173.0.59/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py",
"copies": "14",
"size": "9289",
"license": "apache-2.0",
"hash": 8591786346551739000,
"line_mean": 38.5276595745,
"li... |
"""Ansible callback plugin to print a summary completion status of installation
phases.
"""
from ansible.plugins.callback import CallbackBase
from ansible import constants as C
DOCUMENTATION = '''
'''
EXAMPLES = '''
---------------------------------------------
Example display of a successful playbook run:
PLAY REC... | {
"repo_name": "rhdedgar/openshift-tools",
"path": "openshift/installer/vendored/openshift-ansible-3.7.0/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py",
"copies": "1",
"size": "7241",
"license": "apache-2.0",
"hash": -2344724517227394000,
"line_mean": 37.7219251337,
"line_max": 95,... |
"""Ansible callback plugin to print a summary completion status of installation
phases.
"""
from datetime import datetime
from ansible.plugins.callback import CallbackBase
from ansible import constants as C
class CallbackModule(CallbackBase):
"""This callback summarizes installation phase status."""
CALLBACK... | {
"repo_name": "jwhonce/openshift-ansible",
"path": "roles/installer_checkpoint/callback_plugins/installer_checkpoint.py",
"copies": "3",
"size": "3112",
"license": "apache-2.0",
"hash": -4389648990408254000,
"line_mean": 34.7701149425,
"line_max": 97,
"alpha_frac": 0.5832262211,
"autogenerated": fa... |
"""
A blocking client that can read data from the Twisted Server
"""
##########################################################################
## Imports
##########################################################################
import json
import socket
NL = "\r\n"
class AnsibleConnection(object):
def __ini... | {
"repo_name": "bbengfort/ansible",
"path": "ansible/client.py",
"copies": "1",
"size": "1637",
"license": "mit",
"hash": -8029701579175442000,
"line_mean": 23.4328358209,
"line_max": 74,
"alpha_frac": 0.5369578497,
"autogenerated": false,
"ratio": 4.022113022113022,
"config_test": false,
"has... |
"""
Data Generators - simulates incoming data from sensors.
"""
##########################################################################
## Imports
##########################################################################
import time
import random
import string
from ingestor import get_timestamp
from twisted.pro... | {
"repo_name": "bbengfort/ansible",
"path": "ansible/generate.py",
"copies": "1",
"size": "2820",
"license": "mit",
"hash": 4219393817898404000,
"line_mean": 27.2,
"line_max": 76,
"alpha_frac": 0.5840425532,
"autogenerated": false,
"ratio": 4.318529862174579,
"config_test": false,
"has_no_keyw... |
"""
The Basic LineReceiver Protocol for ingesting action predicates.
Right now, just implementing websockets using Twisted...
"""
##########################################################################
## Imports
##########################################################################
import json
import time
... | {
"repo_name": "bbengfort/ansible",
"path": "ansible/ingestor.py",
"copies": "1",
"size": "2295",
"license": "mit",
"hash": 4954352241896145000,
"line_mean": 28.0506329114,
"line_max": 86,
"alpha_frac": 0.6209150327,
"autogenerated": false,
"ratio": 3.9365351629502574,
"config_test": false,
"h... |
# Ansible lookup plugin for getting the first available file
# (c) 2015,2016 David Lundgren <dlundgren@syberisle.net>
# For each item if the path exists along the regular paths then the first found entry will be returned.
# This operates differently from the file or found-file plugins as it is not an error if the file... | {
"repo_name": "dlundgren/ansible-plugins",
"path": "plugins/lookup/overrides/vars_files.py",
"copies": "1",
"size": "2767",
"license": "mit",
"hash": -3830800646878701000,
"line_mean": 34.0379746835,
"line_max": 115,
"alpha_frac": 0.5999277196,
"autogenerated": false,
"ratio": 3.9415954415954415,... |
# {{ ansible_managed }}
# -*- coding: utf-8 -*-
import os
from django.utils.translation import ugettext_lazy as _
from horizon.utils import secret_key
from openstack_dashboard import exceptions
from openstack_dashboard.settings import HORIZON_CONFIG
DEBUG = False
COMPRESS_OFFLINE = True
# WEBROOT is the location ... | {
"repo_name": "panxia6679/ursula",
"path": "roles/horizon/templates/etc/openstack-dashboard/local_settings.py",
"copies": "1",
"size": "28670",
"license": "mit",
"hash": -680072743102626600,
"line_mean": 35.1994949495,
"line_max": 141,
"alpha_frac": 0.6605859784,
"autogenerated": false,
"ratio": ... |
# {{ ansible_managed }}
## Graphite local_settings.py
# Edit this file to customize the default Graphite webapp settings
#
# Additional customizations to Django settings can be added to this file as well
#####################################
# General Configuration #
#####################################
#
# Set this ... | {
"repo_name": "kiv-box/graphite_stack_single",
"path": "graphite-web/conf/local_settings.py",
"copies": "1",
"size": "15030",
"license": "mit",
"hash": 7852382464633420000,
"line_mean": 40.4049586777,
"line_max": 108,
"alpha_frac": 0.7222887558,
"autogenerated": false,
"ratio": 3.6454038321610476... |
""" Ansible module for building projects with CMake.
See the DOCUMENTATION and EXAMPLES strings below for more information.
"""
from __future__ import print_function
from glob import glob
from os.path import abspath
from subprocess import Popen
from subprocess import PIPE
from ansible.module_utils.basic import Ansi... | {
"repo_name": "mdklatt/ansible-cmake-module",
"path": "src/cmake.py",
"copies": "1",
"size": "4070",
"license": "mit",
"hash": 2610537777597762600,
"line_mean": 26.3154362416,
"line_max": 78,
"alpha_frac": 0.6272727273,
"autogenerated": false,
"ratio": 3.883587786259542,
"config_test": false,
... |
"""Ansible playbook tools"""
from collections import OrderedDict
import os.path
import sys
import yaml
def get_tags_from_playbook(playbook_file):
"""Get available tags from Ansible playbook"""
tags = []
playbook_path = os.path.dirname(playbook_file)
with open(playbook_file) as playbook_fp:
pl... | {
"repo_name": "markosamuli/macos-machine",
"path": "machine/playbook.py",
"copies": "1",
"size": "1137",
"license": "mit",
"hash": -7311439656643516000,
"line_mean": 29.7297297297,
"line_max": 86,
"alpha_frac": 0.5848724714,
"autogenerated": false,
"ratio": 4.180147058823529,
"config_test": fal... |
ANSI_CODES = {
'reset': (0, 0),
'bold': (1, 22),
'faint': (2, 22),
'italic': (3, 23),
'underline': (4, 24),
'blinking': (5, 25),
'inverse': (7, 27),
'invisible': (8, 28),
'strikethrough': (9, 29),
'black': (30, 39),
'red': (31, 39),
'green': (32, 39),
'yellow': (33,... | {
"repo_name": "fgimian/painter",
"path": "painter/ansi_styles.py",
"copies": "1",
"size": "2714",
"license": "mit",
"hash": 4442513639723536000,
"line_mean": 24.3644859813,
"line_max": 72,
"alpha_frac": 0.5092114959,
"autogenerated": false,
"ratio": 3.022271714922049,
"config_test": false,
"h... |
""" ANSI Color codes module """
class _Text:
"""
ANSI text color codes for easy formatting
"""
black = "\033[30m"
red = "\033[31m"
green = "\033[32m"
yellow = "\033[33m"
blue = "\033[34m"
magenta = "\033[35m"
cyan = "\033[36m"
white = "\033[37m"
b_black = "\033[90m"
... | {
"repo_name": "SpoopySaitama/snake",
"path": "cogs/utils/colors.py",
"copies": "2",
"size": "1800",
"license": "mit",
"hash": 5571378224083937000,
"line_mean": 23,
"line_max": 70,
"alpha_frac": 0.5605555556,
"autogenerated": false,
"ratio": 2.985074626865672,
"config_test": false,
"has_no_key... |
ANSI_RESET = "\x1b[0m"
def rgb(r, g, b):
"""Returns a xterm256 color index that represents the specified RGB color.
Each argument should be an integer in the range [0, 5]."""
if r < 0 or r > 5 or g < 0 or g > 5 or b < 0 or b > 5:
raise ValueError("Value out of range")
return 16 + r * 36 + g ... | {
"repo_name": "yellcorp/floppy-recovery",
"path": "utils/xterm.py",
"copies": "1",
"size": "1395",
"license": "mit",
"hash": 5467394577387333000,
"line_mean": 23.4736842105,
"line_max": 79,
"alpha_frac": 0.5906810036,
"autogenerated": false,
"ratio": 3.558673469387755,
"config_test": false,
"... |
"""An SMTP and POP3 server that anonymize all traffic using mixminion
Syntax: python minionProxy.py [-Vh] [-H imap_host] [-P pop3_port] [-S smtp_port] [-L local_host]
-h, --help - prints this help message
-V, --version - prints the version
-H, --host - The remote IMAP host to connect and fetch ... | {
"repo_name": "nmathewson/mixminion",
"path": "etc/minionProxy.py",
"copies": "6",
"size": "3824",
"license": "mit",
"hash": -5747209665741122000,
"line_mean": 36.4901960784,
"line_max": 96,
"alpha_frac": 0.6391213389,
"autogenerated": false,
"ratio": 3.7162293488824103,
"config_test": false,
... |
"""A NSUPDATE server class for gevent, emulating apple's mDNSResponder SPS server"""
# Copyright (c) 2013 Russell Cloran
# Copyright (c) 2014 Joey Korkames
import traceback
import struct
import logging
import dns.name
import dns.flags
import dns.message
import dns.reversename
import dns.edns
import ipaddress
import ... | {
"repo_name": "kfix/SleepProxyServer",
"path": "sleepproxy/dnsserve.py",
"copies": "1",
"size": "8824",
"license": "bsd-2-clause",
"hash": 2033440557068590000,
"line_mean": 41.2200956938,
"line_max": 181,
"alpha_frac": 0.6193336355,
"autogenerated": false,
"ratio": 3.446875,
"config_test": fals... |
answ = '4cbf522049d7cc0e46a337fcc3cad331'
match = ''
import hashlib
import binascii
import hashlib # Hash algorithms always present in hashlib: md5(), sha1(), sha224(), sha256(), sha384(), and sha512(). Additional algorithms may be available from OpenSSL library
hashdict = {'TelenorRemoteAdmin': '4caacf3fd454786eed5... | {
"repo_name": "wittrup/crap",
"path": "crack/hashing/hashiter.py",
"copies": "1",
"size": "1305",
"license": "mit",
"hash": 5384718746054141000,
"line_mean": 25.6326530612,
"line_max": 178,
"alpha_frac": 0.632183908,
"autogenerated": false,
"ratio": 2.594433399602386,
"config_test": false,
"h... |
answer1 = widget_inputs["check1"]
answer2 = widget_inputs["check2"]
answer3 = widget_inputs["check3"]
answer4 = widget_inputs["check4"]
is_correct = False
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
if answer1 == False:
is_correct = True
else:
is_correct = is_... | {
"repo_name": "udacity/responsive-images",
"path": "grading_scripts/2_17_q.py",
"copies": "1",
"size": "1482",
"license": "mit",
"hash": -1375862521177584400,
"line_mean": 35.1707317073,
"line_max": 233,
"alpha_frac": 0.7226720648,
"autogenerated": false,
"ratio": 3.6774193548387095,
"config_te... |
answer1 = widget_inputs["radio1"]
answer2 = widget_inputs["radio2"]
answer3 = widget_inputs["radio3"]
answer4 = widget_inputs["radio4"]
answer5 = widget_inputs["radio5"]
answer6 = widget_inputs["radio6"]
answer7 = widget_inputs["radio7"]
answer8 = widget_inputs["radio8"]
answer9 = widget_inputs["radio9"]
answer10 = wid... | {
"repo_name": "udacity/responsive-images",
"path": "grading_scripts/2_14_q.py",
"copies": "1",
"size": "1414",
"license": "mit",
"hash": -7444165287377427000,
"line_mean": 25.6981132075,
"line_max": 103,
"alpha_frac": 0.698019802,
"autogenerated": false,
"ratio": 3.31924882629108,
"config_test"... |
answer1 = widget_inputs["radio1"]
answer2 = widget_inputs["radio2"]
answer3 = widget_inputs["radio3"]
answer4 = widget_inputs["radio4"]
is_correct = False
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
if answer1 == True:
is_correct = True
else:
is_correct = is_c... | {
"repo_name": "udacity/responsive-images",
"path": "grading_scripts/3_12.4_q.py",
"copies": "1",
"size": "1045",
"license": "mit",
"hash": 2391542710361420000,
"line_mean": 33.8666666667,
"line_max": 189,
"alpha_frac": 0.7167464115,
"autogenerated": false,
"ratio": 3.3069620253164556,
"config_t... |
"""Answer a data request with the following
1) lat/lon of 'F0' first point
2) Picture of location? Hmmm, I did huc12 previously
3) elevation of F0 and G1 through G6 nodes
4) horizontal distance from F0 to G1-G6
5) OFE positions along this path
6) Generic properties, perhaps can ignore?
"""
from __future__ impor... | {
"repo_name": "akrherz/dep",
"path": "scripts/gridorder/flowpath_attrs.py",
"copies": "2",
"size": "3969",
"license": "mit",
"hash": 6958308869863463000,
"line_mean": 28.1838235294,
"line_max": 77,
"alpha_frac": 0.5575711766,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_k... |
""" Answer extraction for QA """
from operator import itemgetter
from collections import defaultdict
import importlib
import string
import logging as log
import nltk
from ner import SocketNER
from inquire import config
question_types = {
'DESC': 'description',
'ENTY': 'entity',
'ABBR': 'abbreviation',
... | {
"repo_name": "jcelliott/inquire",
"path": "inquire/extraction/extractors.py",
"copies": "1",
"size": "5468",
"license": "mit",
"hash": -3691992798613264400,
"line_mean": 37.780141844,
"line_max": 93,
"alpha_frac": 0.6228968544,
"autogenerated": false,
"ratio": 4.117469879518072,
"config_test":... |
""" Answer for https://stackoverflow.com/questions/35757560 """
from collections import Counter
from sklearn.feature_extraction.text import TfidfVectorizer
import pandas as pd
import numpy as np
corpus = ["The dog ate a sandwich and I ate a sandwich",
"The wizard transfigured a sandwich"]
vectorizer = Tfid... | {
"repo_name": "totalgood/nlpia",
"path": "src/nlpia/posts/so_tfidf.py",
"copies": "1",
"size": "1567",
"license": "mit",
"hash": 5983500431527357000,
"line_mean": 38.175,
"line_max": 85,
"alpha_frac": 0.6145500957,
"autogenerated": false,
"ratio": 2.7157712305026,
"config_test": false,
"has_n... |
# Answer
s0 = 'azzf'
def palindrome_string(s):
mid,left = divmod(len(s0), 2) # (3,0)
s1 = bytearray(s0)
while s1[:mid] != s1[-mid:][::-1]:
for i in range(mid):
a,b = s1[i], s1[-i-1]
if a > b:
s1[-i-1] = a
elif a < b:
s1[-i-1] = a
... | {
"repo_name": "rodriggs/pipeline",
"path": "data_transfer_object/__init__.py",
"copies": "1",
"size": "2860",
"license": "mit",
"hash": -2523392714996909600,
"line_mean": 30.7777777778,
"line_max": 113,
"alpha_frac": 0.5174825175,
"autogenerated": false,
"ratio": 2.2274143302180685,
"config_tes... |
# read in the text file
f = open('beginner.txt', 'r')
# store the text file into a list, one entry per line
values = f.readlines()
# if you've set verbose=True (or verbose=1.), print out the list
if verbose:
print "My list of lines:", values
# turn each value in the list from a string to an integer
# Note th... | {
"repo_name": "astro313/REU2017",
"path": "beginner_soln.py",
"copies": "1",
"size": "2188",
"license": "mit",
"hash": 6111083891715289000,
"line_mean": 38.7818181818,
"line_max": 94,
"alpha_frac": 0.6526508227,
"autogenerated": false,
"ratio": 4.03690036900369,
"config_test": false,
"has_no_... |
# Note that each line contains one gaussian time series
for line in f.readlines():
################### CONVERT THE DATA TO A NUMPY ARRAY ####################
# strip the new line character (\n) off the end of the line, then split
# the line into a list of entries
data = line.strip().split(',')
# co... | {
"repo_name": "astro313/REU2017",
"path": "intermediate_soln.py",
"copies": "1",
"size": "2413",
"license": "mit",
"hash": 3883647921487865000,
"line_mean": 44.5283018868,
"line_max": 138,
"alpha_frac": 0.5785329465,
"autogenerated": false,
"ratio": 3.8856682769726247,
"config_test": false,
"... |
''' answers_views
annotating answers
'''
from flask import (render_template, request, flash, redirect, url_for, session
, abort)
from decorators import *
from models import *
from ivrhub import app
answer_route = '/organizations/<org_label>/forms/<form_label>/responses'
answer_route += '/<response_sid>/answers/<... | {
"repo_name": "aquaya/ivrhub",
"path": "ivrhub/answer_views.py",
"copies": "1",
"size": "4274",
"license": "mit",
"hash": -5924125180934332000,
"line_mean": 39.7047619048,
"line_max": 79,
"alpha_frac": 0.6186242396,
"autogenerated": false,
"ratio": 4.043519394512772,
"config_test": false,
"ha... |
""" answer to """
import numpy as np
# terminiology:
# - segment are prefixed by `s` and followed by upper case nodes: e.g. `sAB` is the length of the semgnet from A to B
# - angles are prefixed with `ang` and followed by upper case nodes: e.g. `angABC` is the angle between A, B, and C
# - area are prefixed with `ar... | {
"repo_name": "jboissard/mathExperiments",
"path": "quoraAnswer.py",
"copies": "1",
"size": "1227",
"license": "apache-2.0",
"hash": -4120841009554108000,
"line_mean": 21.7407407407,
"line_max": 129,
"alpha_frac": 0.6862265689,
"autogenerated": false,
"ratio": 2.6790393013100435,
"config_test":... |
A = [
0x8e20faa72ba0b470, 0x47107ddd9b505a38, 0xad08b0e0c3282d1c, 0xd8045870ef14980e,
0x6c022c38f90a4c07, 0x3601161cf205268d, 0x1b8e0b0e798c13c8, 0x83478b07b2468764,
0xa011d380818e8f40, 0x5086e740ce47c920, 0x2843fd2067adea10, 0x14aff010bdd87508,
0x0ad97808d06cb404, 0x05e23c0468365a02, 0x8c711e02341b2d01, 0x46b60f01... | {
"repo_name": "quarkslab/arybo",
"path": "examples/stribog.py",
"copies": "1",
"size": "9714",
"license": "bsd-3-clause",
"hash": -8711922549137011000,
"line_mean": 40.8706896552,
"line_max": 96,
"alpha_frac": 0.7004323657,
"autogenerated": false,
"ratio": 1.5119066147859923,
"config_test": fal... |
#ant1 201410
#Support functions for image display in Planets4X game
from PIL import Image
def ColorAsAlpha(im, colorin, alphalevel):
''' im is PIL RGBA image, color is color index or RGB or RGBA.
ant1 20100826'''
k = []
for i in im.getdata():
match = True
for j in range(3):
... | {
"repo_name": "ant1b/Planets4X",
"path": "Planets4X_archives/Planets4X_v00.07/ImageSupport.py",
"copies": "1",
"size": "2704",
"license": "mit",
"hash": -5516549123296641000,
"line_mean": 27.7659574468,
"line_max": 90,
"alpha_frac": 0.5325443787,
"autogenerated": false,
"ratio": 3.2,
"config_te... |
from __future__ import absolute_import, print_function
from ant.easy.node import Node
from ant.easy.channel import Channel
from ant.base.message import Message
import logging
import struct
import threading
import sys
NETWORK_KEY= [0xb9, 0xa5, 0x21, 0xfb, 0xbd, 0x72, 0xc3, 0x45]
class Monitor():
def __init__(se... | {
"repo_name": "jforge/openant",
"path": "examples/cadence_speed_heart.py",
"copies": "1",
"size": "3127",
"license": "mit",
"hash": 2585055084866475500,
"line_mean": 31.5729166667,
"line_max": 126,
"alpha_frac": 0.6952350496,
"autogenerated": false,
"ratio": 3.4552486187845304,
"config_test": f... |
from ant.easy.node import Node
from ant.easy.channel import Channel
from ant.base.message import Message
import logging
import struct
import threading
import sys
NETWORK_KEY = [0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45]
class Monitor:
def __init__(self):
self.heartrate = "n/a"
self.cadenc... | {
"repo_name": "Tigge/openant",
"path": "examples/cadence_speed_heart.py",
"copies": "1",
"size": "3153",
"license": "mit",
"hash": -1896475997238575400,
"line_mean": 29.6116504854,
"line_max": 80,
"alpha_frac": 0.6758642563,
"autogenerated": false,
"ratio": 3.4916943521594686,
"config_test": fa... |
"""Antenna-based gain solver based on StefCal."""
#
# Ludwig Schwardt
# 22 April 2013
#
import numpy as np
def stefcal(vis, num_ants, antA, antB, weights=1.0, num_iters=10, ref_ant=0, init_gain=None):
"""Solve for antenna gains using StefCal (array dot product version).
The observed visibilities are provide... | {
"repo_name": "SKA-ScienceDataProcessor/algorithm-reference-library",
"path": "util/stefcal.py",
"copies": "1",
"size": "7165",
"license": "apache-2.0",
"hash": -3913275405251715000,
"line_mean": 41.1529411765,
"line_max": 100,
"alpha_frac": 0.6107466853,
"autogenerated": false,
"ratio": 3.234762... |
from __future__ import absolute_import, print_function, division
import array
import datetime
import logging
import threading
try:
# Python 3
import queue
except ImportError:
# Python 2
import Queue as queue
from ant.easy.channel import Channel
from ant.easy.node import Node, Message
import ant.fs.... | {
"repo_name": "jforge/openant",
"path": "ant/fs/manager.py",
"copies": "1",
"size": "14912",
"license": "mit",
"hash": 1669999059778428000,
"line_mean": 35.7290640394,
"line_max": 118,
"alpha_frac": 0.5861051502,
"autogenerated": false,
"ratio": 4.127318018267368,
"config_test": false,
"has_n... |
from __future__ import absolute_import, print_function
# http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.arc
def crc(data, seed=0x0000):
rem = seed
for byte in data:
rem ^= byte
for _ in range(0, 8):
if rem & 0x0001:
rem = (rem >> 1)
rem ^... | {
"repo_name": "jforge/openant",
"path": "ant/fs/commons.py",
"copies": "1",
"size": "1518",
"license": "mit",
"hash": 6252535277960930000,
"line_mean": 38.9473684211,
"line_max": 77,
"alpha_frac": 0.7048748353,
"autogenerated": false,
"ratio": 4.091644204851752,
"config_test": false,
"has_no_... |
from __future__ import absolute_import, print_function
import array
from collections import OrderedDict
import copy
import logging
import struct
_logger = logging.getLogger("ant.fs.command")
class Command:
class Type:
# Commands
LINK = 0x02
DISCONNECT = 0x03
AUTHENTICATE = 0x04... | {
"repo_name": "jforge/openant",
"path": "ant/fs/command.py",
"copies": "1",
"size": "11429",
"license": "mit",
"hash": -1424589343109327400,
"line_mean": 29.972899729,
"line_max": 104,
"alpha_frac": 0.6217516843,
"autogenerated": false,
"ratio": 3.734967320261438,
"config_test": false,
"has_n... |
from __future__ import absolute_import, print_function
import array
from collections import OrderedDict
import logging
import struct
from ant.fs.command import Command
_logger = logging.getLogger("ant.fs.commandpipe")
class CommandPipe(object):
class Type:
REQUEST = 0x01
RESPONSE = 0x02
... | {
"repo_name": "jforge/openant",
"path": "ant/fs/commandpipe.py",
"copies": "1",
"size": "6913",
"license": "mit",
"hash": 4139704367677866000,
"line_mean": 31.3037383178,
"line_max": 106,
"alpha_frac": 0.6395197454,
"autogenerated": false,
"ratio": 3.7652505446623095,
"config_test": false,
"h... |
from __future__ import absolute_import, print_function
import datetime
import logging
import struct
_logger = logging.getLogger("ant.fs.file")
class Directory:
def __init__(self, version, time_format, current_system_time,
last_modified, files):
self._version = version
self._tim... | {
"repo_name": "jforge/openant",
"path": "ant/fs/file.py",
"copies": "1",
"size": "5477",
"license": "mit",
"hash": -3259529306105505000,
"line_mean": 30.6589595376,
"line_max": 110,
"alpha_frac": 0.6003286471,
"autogenerated": false,
"ratio": 3.746238030095759,
"config_test": false,
"has_no_k... |
# http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.arc
def crc(data, seed=0x0000):
rem = seed
for byte in data:
rem ^= byte
for _ in range(0, 8):
if rem & 0x0001:
rem = (rem >> 1)
rem ^= 0xa001
else:
rem = rem >>... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/commons.py",
"copies": "1",
"size": "1463",
"license": "mit",
"hash": 24684835045567064,
"line_mean": 39.6388888889,
"line_max": 77,
"alpha_frac": 0.7019822283,
"autogenerated": false,
"ratio": 4.098039215686274,
"co... |
import array
import collections
import copy
import logging
import struct
_logger = logging.getLogger("garmin.ant.fs.command")
class Command:
class Type:
# Commands
LINK = 0x02
DISCONNECT = 0x03
AUTHENTICATE = 0x04
PING ... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/command.py",
"copies": "1",
"size": "11844",
"license": "mit",
"hash": 3465298511343774000,
"line_mean": 31.272479564,
"line_max": 90,
"alpha_frac": 0.5923674434,
"autogenerated": false,
"ratio": 3.8268174474959613,
... |
import array
import collections
import logging
import struct
_logger = logging.getLogger("garmin.ant.fs.commandpipe")
class CommandPipe:
class Type:
REQUEST = 0x01
RESPONSE = 0x02
TIME = 0x03
CREATE_FILE ... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/commandpipe.py",
"copies": "1",
"size": "6600",
"license": "mit",
"hash": 4156722777131538000,
"line_mean": 31.6732673267,
"line_max": 77,
"alpha_frac": 0.6063636364,
"autogenerated": false,
"ratio": 3.8619075482738445... |
import array
import datetime
import logging
import threading
import queue
from ant.easy.channel import Channel
from ant.easy.node import Node, Message
import ant.fs.command
from ant.fs.beacon import Beacon
from ant.fs.command import (
LinkCommand,
DownloadRequest,
DownloadResponse,
AuthenticateComman... | {
"repo_name": "Tigge/openant",
"path": "ant/fs/manager.py",
"copies": "1",
"size": "14937",
"license": "mit",
"hash": -3456147101239535600,
"line_mean": 33.5763888889,
"line_max": 118,
"alpha_frac": 0.5784963513,
"autogenerated": false,
"ratio": 4.105827377680044,
"config_test": false,
"has_n... |
import array
import logging
import struct
import threading
import traceback
import Queue
from ant.easy.channel import Channel
from ant.easy.node import Node, Message
import ant.fs.command
from ant.fs.beacon import Beacon
from ant.fs.command import LinkCommand, DownloadRequest, DownloadResponse, \
Authenticat... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/manager.py",
"copies": "1",
"size": "13590",
"license": "mit",
"hash": 5905373989090769000,
"line_mean": 35.7297297297,
"line_max": 117,
"alpha_frac": 0.5741721854,
"autogenerated": false,
"ratio": 4.163602941176471,
... |
import array
from ant.fs.command import parse, DownloadRequest, DownloadResponse,\
AuthenticateCommand
def authenticate_command():
command = AuthenticateCommand(
AuthenticateCommand.Type.REQUEST_SERIAL, 123456789)
assert command.get() == array.array('B',
[0x44, 0x04, 0x01, 0x... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/test/command_test.py",
"copies": "1",
"size": "4464",
"license": "mit",
"hash": 7379738992366373000,
"line_mean": 50.9069767442,
"line_max": 82,
"alpha_frac": 0.5719086022,
"autogenerated": false,
"ratio": 2.5998835177... |
import array
from ant.fs.commandpipe import parse, CreateFile
def main():
# Test create file
data = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09]
request = CreateFile(len(data), 0x80, [0x04, 0x00, 0x00], [0x00, 0xff, 0xff])
print request
print request.get()
# Test create fil... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/test/commandpipe_test.py",
"copies": "1",
"size": "1838",
"license": "mit",
"hash": -5167285978668780000,
"line_mean": 41.7441860465,
"line_max": 92,
"alpha_frac": 0.7149075082,
"autogenerated": false,
"ratio": 3.57587... |
import array
# Most significant bit first (big-endian)
# x^16+x^12+x^5+1 = (1) 0001 0000 0010 0001 = 0x1021
def crc(data):
rem = 0
# A popular variant complements rem here
for byte in data:
rem ^= (byte << 8) # n = 16 in this example
for _ in range(0, 8): # Assuming 8 bits per byte
... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/test/commons.py",
"copies": "1",
"size": "1764",
"license": "mit",
"hash": 7757229784319395000,
"line_mean": 40.023255814,
"line_max": 77,
"alpha_frac": 0.6859410431,
"autogenerated": false,
"ratio": 3.92,
"config_te... |
import datetime
import logging
import struct
_logger = logging.getLogger("garmin.ant.fs.file")
class Directory:
def __init__(self, version, time_format, current_system_time,
last_modified, files):
self._version = version
self._time_format = time_format
self._current_system_tim... | {
"repo_name": "ddboline/Garmin-Forerunner-610-Extractor_fork",
"path": "ant/fs/file.py",
"copies": "1",
"size": "4725",
"license": "mit",
"hash": 8841981054005178000,
"line_mean": 32.75,
"line_max": 96,
"alpha_frac": 0.5961904762,
"autogenerated": false,
"ratio": 3.729281767955801,
"config_test... |
# http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.arc
def crc(data, seed=0x0000):
rem = seed
for byte in data:
rem ^= byte
for _ in range(0, 8):
if rem & 0x0001:
rem = rem >> 1
rem ^= 0xA001
else:
rem = rem >> 1... | {
"repo_name": "Tigge/openant",
"path": "ant/fs/commons.py",
"copies": "1",
"size": "1460",
"license": "mit",
"hash": 405633578248670850,
"line_mean": 39.5555555556,
"line_max": 77,
"alpha_frac": 0.7034246575,
"autogenerated": false,
"ratio": 4.112676056338028,
"config_test": false,
"has_no_ke... |
import array
from collections import OrderedDict
import copy
import logging
import struct
_logger = logging.getLogger("ant.fs.command")
class Command:
class Type:
# Commands
LINK = 0x02
DISCONNECT = 0x03
AUTHENTICATE = 0x04
PING = 0x05
DOWNLOAD_REQUEST = 0x09
... | {
"repo_name": "Tigge/openant",
"path": "ant/fs/command.py",
"copies": "1",
"size": "11746",
"license": "mit",
"hash": -89785591063087120,
"line_mean": 29.1179487179,
"line_max": 86,
"alpha_frac": 0.6082070492,
"autogenerated": false,
"ratio": 3.756315957787016,
"config_test": false,
"has_no_k... |
import array
from collections import OrderedDict
import logging
import struct
from ant.fs.command import Command
_logger = logging.getLogger("ant.fs.commandpipe")
class CommandPipe(object):
class Type:
REQUEST = 0x01
RESPONSE = 0x02
TIME = 0x03
CREATE_FILE = 0x04
DIREC... | {
"repo_name": "Tigge/openant",
"path": "ant/fs/commandpipe.py",
"copies": "1",
"size": "6956",
"license": "mit",
"hash": 3118821827656961500,
"line_mean": 30.3333333333,
"line_max": 88,
"alpha_frac": 0.6293847039,
"autogenerated": false,
"ratio": 3.7866086009798585,
"config_test": false,
"has... |
import array
import unittest
import datetime
from ant.fs.commandpipe import (
parse,
CreateFile,
Request,
CommandPipe,
Time,
TimeResponse,
)
class CreateFileTest(unittest.TestCase):
def runTest(self):
# Test create file
data = b"\x01\x02\x03\x04\x05\x06\x07\x08\x09"
... | {
"repo_name": "Tigge/openant",
"path": "ant/tests/fs/test_commandpipe.py",
"copies": "1",
"size": "4299",
"license": "mit",
"hash": -1573662784471485000,
"line_mean": 36.0603448276,
"line_max": 86,
"alpha_frac": 0.6166550361,
"autogenerated": false,
"ratio": 3.4474739374498795,
"config_test": t... |
import datetime
import logging
import struct
import sys
_logger = logging.getLogger("ant.fs.file")
class Directory:
def __init__(self, version, time_format, current_system_time, last_modified, files):
self._version = version
self._time_format = time_format
self._current_system_time = cu... | {
"repo_name": "Tigge/openant",
"path": "ant/fs/file.py",
"copies": "1",
"size": "5824",
"license": "mit",
"hash": -8530480695355583000,
"line_mean": 27.4097560976,
"line_max": 88,
"alpha_frac": 0.5674793956,
"autogenerated": false,
"ratio": 3.8518518518518516,
"config_test": false,
"has_no_ke... |
"""
Ant-style ``**/*`` globbing functionality, as used by `xpybuild.pathsets.FindPaths`.
"""
from xpybuild.utils.buildexceptions import BuildException
import re, logging, sys
from xpybuild.utils.flatten import flatten
_log = logging.getLogger('antglob')
#def dbg(s, *args): # for manual use with doc tests
# sys.std... | {
"repo_name": "xpybuild/xpybuild",
"path": "xpybuild/utils/antglob.py",
"copies": "1",
"size": "21342",
"license": "apache-2.0",
"hash": 7064831275719730000,
"line_mean": 32.9856687898,
"line_max": 347,
"alpha_frac": 0.6727110861,
"autogenerated": false,
"ratio": 3.274317275237803,
"config_test... |
from __future__ import absolute_import, print_function
from ant.easy.node import Node
from ant.easy.channel import Channel
from ant.base.message import Message
import logging
import struct
import threading
import sys
NETWORK_KEY= [0xb9, 0xa5, 0x21, 0xfb, 0xbd, 0x72, 0xc3, 0x45]
def on_data(data):
hearthrate =... | {
"repo_name": "jforge/openant",
"path": "examples/hearth_rate_monitor.py",
"copies": "1",
"size": "2128",
"license": "mit",
"hash": 5815614907119842000,
"line_mean": 29.4,
"line_max": 77,
"alpha_frac": 0.7161654135,
"autogenerated": false,
"ratio": 3.643835616438356,
"config_test": false,
"ha... |
from ant.easy.node import Node
from ant.easy.channel import Channel
from ant.base.message import Message
import logging
import struct
import threading
import sys
NETWORK_KEY = [0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45]
def on_data(data):
heartrate = data[7]
string = "Heartrate: " + str(heartrate) + ... | {
"repo_name": "Tigge/openant",
"path": "examples/scan.py",
"copies": "1",
"size": "2513",
"license": "mit",
"hash": -525958061769856800,
"line_mean": 31.2179487179,
"line_max": 78,
"alpha_frac": 0.7027457222,
"autogenerated": false,
"ratio": 3.569602272727273,
"config_test": false,
"has_no_ke... |
'''(Anti-)Affinity Server Groups Pool plugin for Cloudify's OpenStack plugin'''
from os import sep, path
import filelock
import json
from tempfile import gettempdir
from cloudify import ctx, manager
from cloudify.exceptions import NonRecoverableError, RecoverableError
from cloudify.decorators import operation
from ope... | {
"repo_name": "01000101/cloudify-test-app",
"path": "affinity/plugins/affinity/plugin/tasks.py",
"copies": "1",
"size": "10206",
"license": "mit",
"hash": 1579324263875012400,
"line_mean": 34.4375,
"line_max": 79,
"alpha_frac": 0.589457182,
"autogenerated": false,
"ratio": 4.205191594561187,
"c... |
#antialias graph
import getsdata
DIM = getsdata.DIM
TRAIN_DIR = "/home/banditcat/tfmuse/train/"
TRAIN_FILE = "t"
STOCK_DIR = getsdata.STOCK_DIR
PATCH_SIZE = 5
L1_FEATURES = 32
L2_FEATURES = 64
DENSE_FEATURES = 1024
BATCH_SIZE = 50
STEPS = 15
NUM_STOCKS = 3
GOOD_TICKER_THRESHHOLD = 0
BAD_TICKER_THRESHHOLD = -1
POINT... | {
"repo_name": "BanditCat/tfstocks",
"path": "emnist.py",
"copies": "1",
"size": "10133",
"license": "apache-2.0",
"hash": -7423618805212884000,
"line_mean": 34.6795774648,
"line_max": 134,
"alpha_frac": 0.5915326162,
"autogenerated": false,
"ratio": 2.7784480394845077,
"config_test": false,
"... |
import math
curve_distance_epsilon = 1e-30
curve_collinearity_epsilon = 1e-30
curve_angle_tolerance_epsilon = 0.01
curve_recursion_limit = 32
m_cusp_limit = 0.0
m_angle_tolerance = 10 * math.pi / 180.0
m_approximation_scale = 1.0
m_distance_tolerance_square = (0.5 / m_approximation_scale)**2
epsilon = 1e-10
def cal... | {
"repo_name": "ktritz/vispy",
"path": "vispy/util/svg/geometry.py",
"copies": "19",
"size": "15753",
"license": "bsd-3-clause",
"hash": -7571036668125745000,
"line_mean": 31.9560669456,
"line_max": 94,
"alpha_frac": 0.4967307814,
"autogenerated": false,
"ratio": 3.1785714285714284,
"config_test... |
from antioch.core import models
from django.contrib import admin
class VerbInline(admin.TabularInline):
model = models.Verb
fk_name = 'origin'
extra = 1
exclude = ('code',)
readonly_fields = ('filename', 'ability', 'method', 'owner')
class PropertyInline(admin.TabularInline):
model = models.P... | {
"repo_name": "philchristensen/antioch",
"path": "antioch/core/admin.py",
"copies": "1",
"size": "1292",
"license": "mit",
"hash": -1839875877234735400,
"line_mean": 23.8653846154,
"line_max": 66,
"alpha_frac": 0.6648606811,
"autogenerated": false,
"ratio": 3.588888888888889,
"config_test": fal... |
from django.core import validators
from django.db import models
class URLField(models.CharField):
default_validators = [validators.URLValidator(schemes=['https'])]
class Object(models.Model):
class Meta:
db_table = 'object'
name = models.CharField(max_length=255)
unique_name = models.Boo... | {
"repo_name": "philchristensen/antioch",
"path": "antioch/core/models.py",
"copies": "1",
"size": "8021",
"license": "mit",
"hash": -8654298277764845000,
"line_mean": 34.0262008734,
"line_max": 126,
"alpha_frac": 0.6273531979,
"autogenerated": false,
"ratio": 3.8158896289248334,
"config_test": ... |
"""
A variety of antioch error classes
"""
class UserError(Exception):
"""
This is the superclass for all Errors that may be generated which
should be reported to the user who "caused" them. At construction,
additional information can be supplied that will be presented to the
user if they are a "w... | {
"repo_name": "philchristensen/antioch",
"path": "antioch/core/errors.py",
"copies": "1",
"size": "5570",
"license": "mit",
"hash": 1700023661697592600,
"line_mean": 32.1607142857,
"line_max": 126,
"alpha_frac": 0.6003590664,
"autogenerated": false,
"ratio": 4.128984432913269,
"config_test": fa... |
"""
Connect the verb environment to the database
This is the connecting thread between the database and verb code
during a transaction. it is responsible for loading and saving objects,
verbs, properties and permissions, as well as caching objects loaded
during a single verb transaction.
"""
import crypt, string, ran... | {
"repo_name": "philchristensen/antioch",
"path": "antioch/core/exchange.py",
"copies": "1",
"size": "48923",
"license": "mit",
"hash": 149457760698841860,
"line_mean": 36.6041506533,
"line_max": 149,
"alpha_frac": 0.519019684,
"autogenerated": false,
"ratio": 4.340993788819876,
"config_test": f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.