text stringlengths 0 1.05M | meta dict |
|---|---|
"""An abstract for Widget class"""
import abc
class Widget(metaclass=abc.ABCMeta):
def __init__(self):
self.encoder_idx = 0
"""Widget abstract"""
@abc.abstractmethod
def draw_widget(self, lcd, coords):
"""draw a tile"""
pass
@abc.abstractmethod
def draw_values(self, ... | {
"repo_name": "bkosciow/doton",
"path": "view/widget.py",
"copies": "1",
"size": "1209",
"license": "mit",
"hash": 4243051097942344000,
"line_mean": 27.1162790698,
"line_max": 86,
"alpha_frac": 0.5574855252,
"autogenerated": false,
"ratio": 3.887459807073955,
"config_test": false,
"has_no_key... |
"""An abstract interface for a terminal that allows for text output and
simple input. The default implementation assumes a simple text terminal.
Extensions may provide implementations to be used in more advanced
settings, like graphical user interfaces.
"""
class Terminal:
"""A simple text-based terminal.
"""
... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/util/terminal.py",
"copies": "1",
"size": "1845",
"license": "mit",
"hash": 3935772968536676000,
"line_mean": 28.2857142857,
"line_max": 72,
"alpha_frac": 0.5506775068,
"autogenerated": false,
"ratio": 3.7885010266940453,
"config_test": false,
"h... |
""" An abstract precompiler task for the `ligament` task automator """
import os
import glob
from ligament.helpers import (
remove_dups,
zip_with_output,
mkdir_recursive,
partition,
capture_exception,
pdebug)
from ligament.buildtarget import BuildTarget
from ligament.exceptions import TaskExec... | {
"repo_name": "Adjective-Object/ligament",
"path": "ligament_precompiler_template/__init__.py",
"copies": "1",
"size": "6275",
"license": "apache-2.0",
"hash": 4861530348135379000,
"line_mean": 32.0263157895,
"line_max": 79,
"alpha_frac": 0.5370517928,
"autogenerated": false,
"ratio": 4.501434720... |
""" An abstract Table
>>> accounts = TableSymbol('accounts', '{name: string, amount: int}')
>>> deadbeats = accounts['name'][accounts['amount'] < 0]
"""
from __future__ import absolute_import, division, print_function
from datashape import dshape, var, DataShape, Record, isdimension
import datashape
import operator
f... | {
"repo_name": "aterrel/blaze",
"path": "blaze/expr/table.py",
"copies": "1",
"size": "22627",
"license": "bsd-3-clause",
"hash": -5774427155019287000,
"line_mean": 25.9369047619,
"line_max": 82,
"alpha_frac": 0.5781588368,
"autogenerated": false,
"ratio": 3.8958333333333335,
"config_test": fals... |
""" An abstract Table
>>> accounts = TableSymbol('accounts', '{name: string, amount: int}')
>>> deadbeats = accounts.name[accounts.amount < 0]
"""
from __future__ import absolute_import, division, print_function
import datashape
from datashape.predicates import isscalar, iscollection, isrecord
from .expressions impor... | {
"repo_name": "cowlicks/blaze",
"path": "blaze/expr/table.py",
"copies": "15",
"size": "1260",
"license": "bsd-3-clause",
"hash": 6575153809470775000,
"line_mean": 24.7142857143,
"line_max": 78,
"alpha_frac": 0.6658730159,
"autogenerated": false,
"ratio": 3.7611940298507465,
"config_test": fals... |
"""An account classed based views.
.. module:: account.views
:platform: Linux, Unix
:synopsis: Classed based views for accounts handling operations
.. moduleauthor:: Nickolas Fox <tarvitz@blacklibrary.ru>
"""
# -*- coding: utf-8 -*-
import six
from apps.accounts.decorators import prevent_bruteforce
from djang... | {
"repo_name": "tarvitz/djtp",
"path": "apps/accounts/views.py",
"copies": "1",
"size": "5328",
"license": "bsd-3-clause",
"hash": -5376240365863480000,
"line_mean": 29.4457142857,
"line_max": 78,
"alpha_frac": 0.637012012,
"autogenerated": false,
"ratio": 4.098461538461539,
"config_test": false... |
from __future__ import division
import numpy as np
import subprocess
import json
class FFmpeg:
def __init__(self, filename):
self.filename = filename
self.proc = None
self.__set_video_info()
def get_video_info(self):
return (self.h, self.w, self.fps)
... | {
"repo_name": "samehkhamis/pyffmpeg",
"path": "ffmpeg.py",
"copies": "1",
"size": "2129",
"license": "bsd-2-clause",
"hash": -7411813572966561000,
"line_mean": 35.350877193,
"line_max": 130,
"alpha_frac": 0.5617660874,
"autogenerated": false,
"ratio": 3.5016447368421053,
"config_test": false,
... |
"""An achievement which can be reached in a pinball machine."""
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.events import event_handler
from mpf.core.mode import Mode
from mpf.core.mode_device import ModeDevice
from mpf.core.player import Player
@DeviceMonitor("state", "selected")
class Achievem... | {
"repo_name": "missionpinball/mpf",
"path": "mpf/devices/achievement.py",
"copies": "1",
"size": "10344",
"license": "mit",
"hash": -3471828787687972400,
"line_mean": 31.2242990654,
"line_max": 112,
"alpha_frac": 0.5697022428,
"autogenerated": false,
"ratio": 4.313594662218516,
"config_test": t... |
#!/anaconda2/bin/python2
'''Testing script.'''
import os
import os.path as op
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
from cycler import cycler
import numpy as np
import datetime as dtime
import subprocess as sp
import warnings
import collections
from exactpack.solvers.riemann import Sod
... | {
"repo_name": "OSUmageed/1DSweptCUDA",
"path": "SweptSource/Testing/testProcedure.py",
"copies": "2",
"size": "8634",
"license": "mit",
"hash": 940887861803962600,
"line_mean": 29.1888111888,
"line_max": 104,
"alpha_frac": 0.5449386148,
"autogenerated": false,
"ratio": 2.997916666666667,
"confi... |
# ~/anaconda2/bin/python
# coding:utf-8
from gensim import corpora, models, matutils
from sklearn.cluster import KMeans
if __name__ == '__main__':
word_list = []
for i in range(8000):
with open('../../8000_words/' + str(i) + '.txt') as ifs:
lines = ifs.readlines()
lines = map(l... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/topic_model.py",
"copies": "1",
"size": "1515",
"license": "mit",
"hash": -4800162080615834000,
"line_mean": 29.7045454545,
"line_max": 102,
"alpha_frac": 0.6262028127,
"autogenerated": false,
"ratio":... |
# ~/anaconda2/bin/python
# coding:utf-8
import operator
import re
# with open('output_all_words_sorted.txt') as ifs:
# lines = ifs.readlines()
# data_list = map(lambda ele: ele.rstrip().split(' '), lines)
# data_list = map(lambda ele: [ele[0].split(':')[1], ele[1].split(':')[1].split(',')], data_list)
# ... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/human_tag.py",
"copies": "1",
"size": "1633",
"license": "mit",
"hash": -2383531042676773000,
"line_mean": 34.5,
"line_max": 101,
"alpha_frac": 0.5750153092,
"autogenerated": false,
"ratio": 2.99084249... |
# ~/anaconda2/bin/python
# coding:utf-8
import operator
competition_key_word = ['足球', '篮球', '羽毛球', '客场', '主场', '队员', '联赛', '比赛', '棋手', '棋赛']
competition_file_name = 'competition.txt'
finance_key_word = ['上涨', '大盘', '股市', '指数', '投资']
finance_file_name = 'finance.txt'
def extract_key_words(file_name, key_words):
... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/statistics.py",
"copies": "1",
"size": "1900",
"license": "mit",
"hash": 3211918996458567000,
"line_mean": 30.1525423729,
"line_max": 87,
"alpha_frac": 0.5375408052,
"autogenerated": false,
"ratio": 3.... |
# ~/anaconda2/bin/python
# coding:utf-8
import os
import re
import jieba.analyse
stop_words_set = {}
stop_file_name = 'cn_stop_words.txt'
res_output_file_name = 'output_whole_corpus.txt'
res_output_all_words_file_name = 'output_all_words.txt'
bad_info_file_name = 'output_bad_info.txt'
def init_stop_words_set(file_... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/data_preprocessing_util.py",
"copies": "1",
"size": "3820",
"license": "mit",
"hash": 3799680655337158000,
"line_mean": 29.3174603175,
"line_max": 114,
"alpha_frac": 0.5620418848,
"autogenerated": false,... |
# ~/anaconda2/bin/python
# coding:utf-8
import re
import jieba.analyse
import os
stop_words_set = set()
stop_file_name = '../../cn_stop_words.txt'
noise_words_first = ['可能与主题无关的词', 'badcase', '噪音词', ]
noise_words_second = ['IT', '健康', '体育', '旅游', '教育', '文化', '军事', '财经']
map_res = map(lambda first: [first + second fo... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/jieba_wrapper.py",
"copies": "1",
"size": "3191",
"license": "mit",
"hash": 420706411698867200,
"line_mean": 30.0792079208,
"line_max": 107,
"alpha_frac": 0.5839439312,
"autogenerated": false,
"ratio":... |
# ~/anaconda2/bin/python
# coding:utf-8
import re
def check_error():
with open('/home/cheyulin/GitRepos/OJCodes/qlcoder/database/query/tuple_query/build/tmp.txt') as ifs:
lines = ifs.readlines()
to_used = lines[15: 15 + 13262]
to_used = map(lambda ele: ele.lstrip().rstrip(), to_used)
... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/database/query/check_error.py",
"copies": "1",
"size": "2080",
"license": "mit",
"hash": 1657614368806546000,
"line_mean": 31.4727272727,
"line_max": 112,
"alpha_frac": 0.4848824188,
"autogenerated": false,
"ratio": 2.1287246722288438,
"c... |
# ~/anaconda2/bin/python
# coding:utf-8
# with open('tmp.txt') as line_ifs:
# ref_words = line_ifs.readlines()
import operator
my_dict = {
0: '教育',
1: 'IT', # ..
2: '文化',
3: '旅游',
4: '体育',
5: '健康',
6: '财经',
7: '军事'
}
qlcoder_dict = {
'IT': 1,
'健康': 2,
'体育': 3,
'... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/lookup.py",
"copies": "1",
"size": "1946",
"license": "mit",
"hash": -1484252413989892400,
"line_mean": 22.9240506329,
"line_max": 90,
"alpha_frac": 0.5354497354,
"autogenerated": false,
"ratio": 2.854... |
# ~/anaconda2/bin/python
# coding:utf-8
tag_word_dict = dict()
with open('frequency_top_1000.txt') as ifs:
lines = ifs.readlines()
for line in lines:
info = line.rstrip().split(' ')
if len(info) > 2:
word = info[0]
tag = info[2]
if tag not in tag_word_dict:
... | {
"repo_name": "AlgorithmLover/OJCodes",
"path": "qlcoder/data_mining/topic_model/scripts/python/tag_preprocessing.py",
"copies": "1",
"size": "1768",
"license": "mit",
"hash": 4635893761364863000,
"line_mean": 30.0175438596,
"line_max": 110,
"alpha_frac": 0.5299773756,
"autogenerated": false,
"ra... |
#!/anaconda2/bin/python
import re
import json
from datetime import datetime
print('-------------------------------------------------------------------------------------')
print('-------------------------------------------------------------------------------------')
print(' Scrabble Scorec... | {
"repo_name": "chiragr/utils",
"path": "scrabble/scrabblescore.py",
"copies": "1",
"size": "5967",
"license": "mit",
"hash": 7037802657401360000,
"line_mean": 39.0469798658,
"line_max": 228,
"alpha_frac": 0.465057818,
"autogenerated": false,
"ratio": 4.323913043478261,
"config_test": false,
"... |
#!~/anaconda2/bin/python
import sys
if __name__=='__main__':
if len(sys.argv) < 3:
print("USAGE: python" + sys.argv[0] + " keyword_dir keyword_list_file")
exit(1)
keyword_dir = sys.argv[1]
keyword_list_file = sys.argv[2]
keyword_list = open(keyword_list_file).readlines()
for key... | {
"repo_name": "jingyonghou/TIMIT_STD",
"path": "script/phn2bnd.py",
"copies": "1",
"size": "1147",
"license": "mit",
"hash": 8274221762197997000,
"line_mean": 36,
"line_max": 84,
"alpha_frac": 0.5483870968,
"autogenerated": false,
"ratio": 3.1,
"config_test": false,
"has_no_keywords": false,
... |
#!~/anaconda2/bin/python -u
import numpy as np #--- To handle math processing
class IntegralImage:
"""Class to store Integral Image an their properties"""
def __init__(self, imData, label):
#self.imData = imData
self.label = label
self.weight = 0
self.computeII(imData)
def computeII(s... | {
"repo_name": "lquirosd/TFM",
"path": "ILA/code/IntegralImage.py",
"copies": "1",
"size": "5710",
"license": "apache-2.0",
"hash": 481117663569981100,
"line_mean": 32.7869822485,
"line_max": 104,
"alpha_frac": 0.3290718039,
"autogenerated": false,
"ratio": 4.746467165419784,
"config_test": fals... |
#!~/anaconda2/envs/ipython3/bin/python
import numpy as np
import scipy as sp
import scipy.stats as stats
import pandas as pd
import copy
import cv2
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import pickle
def N_A(**kwargs):
N = kwargs['N'] if 'N' in kwargs else 5
A = kwargs['A']... | {
"repo_name": "NickHoernle/Essil",
"path": "baseline_model/cw_utils.py",
"copies": "1",
"size": "17794",
"license": "mit",
"hash": 1067683530098730500,
"line_mean": 28.2664473684,
"line_max": 158,
"alpha_frac": 0.4887602563,
"autogenerated": false,
"ratio": 2.7643312101910826,
"config_test": fa... |
#!~/anaconda/bin/ python
# -*- coding: utf-8 -*-
################################################################################
# Imports
################################################################################
import data
import json
import csv
import vincent
from vincent import AxisProperties, PropertySet... | {
"repo_name": "DistrictDataLabs/03-censusables",
"path": "source/app.py",
"copies": "1",
"size": "6266",
"license": "apache-2.0",
"hash": -5292001156197864000,
"line_mean": 32.688172043,
"line_max": 177,
"alpha_frac": 0.5062240664,
"autogenerated": false,
"ratio": 3.607369027058146,
"config_tes... |
#!//anaconda/bin/python
from astropy.io import fits
import numpy as np
import scipy as sp
import itertools
import argparse
import os
import subprocess
import warnings
from pprint import pprint
__author__ = "Abigail Stevens, A.L.Stevens at uva.nl"
"""
This has not been rigorously tested.
There is no 'main' to this pro... | {
"repo_name": "abigailStev/whizzy_scripts",
"path": "tools.py",
"copies": "1",
"size": "22179",
"license": "mit",
"hash": 8492282498997742000,
"line_mean": 23.4273127753,
"line_max": 87,
"alpha_frac": 0.5989900356,
"autogenerated": false,
"ratio": 3.3172300329045767,
"config_test": false,
"ha... |
import argparse
from astropy.io import fits
__author__ = "Abigail Stevens"
__author_email__ = "A.L.Stevens at uva.nl"
__year__ = "2014-2015"
"""
fits_info.py
Prints HDU information, header keywords, column names, and some data. Easily
modifiable to print whatever you want!
Written in Python 2.7.
"""
########... | {
"repo_name": "abigailStev/whizzy_scripts",
"path": "fits_info.py",
"copies": "1",
"size": "2463",
"license": "mit",
"hash": 5055021476344963000,
"line_mean": 28.6746987952,
"line_max": 80,
"alpha_frac": 0.47909054,
"autogenerated": false,
"ratio": 3.731818181818182,
"config_test": false,
"ha... |
#!//anaconda/bin/python
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import leastsq ## Levenberg-Marquadt Algorithm
from astropy.io import fits
import argparse
import subprocess
import os.path
__author__ = "Abigail Stevens <A.L.Stevens at uva.nl>"
"""
Fits a QPO power spectrum (f*P(f)) with ... | {
"repo_name": "abigailStev/power_spectra",
"path": "power_spectra/fit_qpo.py",
"copies": "1",
"size": "9649",
"license": "mit",
"hash": 2241896828218103800,
"line_mean": 33.2163120567,
"line_max": 93,
"alpha_frac": 0.546688776,
"autogenerated": false,
"ratio": 3.110573823339781,
"config_test": ... |
__author__ = "Kris Peng"
# a implement of perceptron, based on Python2.7
from functools import reduce
class Perceptron(object):
def __init__(self, input_num, activator):
# initial the perceptron
self.activator = activator
self.weights = [0.0 for _ in range(input_num)]
self.bias = ... | {
"repo_name": "KrisCheng/ML-Learning",
"path": "archive/Model/basic/perceptron.py",
"copies": "1",
"size": "2233",
"license": "mit",
"hash": -2316389161905663500,
"line_mean": 30.9,
"line_max": 70,
"alpha_frac": 0.5588893865,
"autogenerated": false,
"ratio": 3.114365411436541,
"config_test": fa... |
#!~/anaconda/bin/ python
###############################################################################
#
# This uses PCA analysis tools to save the Final.csv file which
# will be used to rank zip codes according to the 4 parameters (income,
# housing, diversity, and population density
#
#
#########################... | {
"repo_name": "DistrictDataLabs/03-censusables",
"path": "source/Model/Model.py",
"copies": "1",
"size": "6255",
"license": "apache-2.0",
"hash": -475700859443467200,
"line_mean": 41.8424657534,
"line_max": 180,
"alpha_frac": 0.5828936851,
"autogenerated": false,
"ratio": 3.3288983501862695,
"c... |
#!/anaconda/bin/python -O
'''
attenuation.py
Estimates parameters in exponential attenuations.
Coded by jungerstein.
For Your original research, it would be nice to contact the coder
before the usage of this piece of codes in Your project.
'''
from fit_exp import fit_exponential
from numpy import array, zeros
f... | {
"repo_name": "jungerstein/plasmaPhyLib",
"path": "anders/python/tools/attenuation/attenuation.py",
"copies": "1",
"size": "2192",
"license": "apache-2.0",
"hash": 4090323891174918700,
"line_mean": 28.2266666667,
"line_max": 68,
"alpha_frac": 0.6145072993,
"autogenerated": false,
"ratio": 3.44654... |
"""An action graph game with additive function nodes"""
import itertools
import numpy as np
import scipy.stats as spt
from gameanalysis import rsgame
from gameanalysis import utils
class _AgfnGame(rsgame._CompleteGame): # pylint: disable=too-many-instance-attributes,protected-access
"""Action graph with functio... | {
"repo_name": "egtaonline/GameAnalysis",
"path": "gameanalysis/aggfn.py",
"copies": "1",
"size": "19626",
"license": "apache-2.0",
"hash": -3368134899194299000,
"line_mean": 40.4926004228,
"line_max": 102,
"alpha_frac": 0.6085804545,
"autogenerated": false,
"ratio": 3.8550383028874484,
"config_... |
# An action is permitted in any of the following scenarios:
#
# 1) the permissions field for the specified action contains the magic value
# 'group:__world__'
#
# 2) the user and consumer match those of the annotation (i.e. the
# authenticated user is the owner of the annotation)
#
# 3) a user and consumer are pr... | {
"repo_name": "nobita-isc/annotator-store",
"path": "annotator/authz.py",
"copies": "1",
"size": "3226",
"license": "mit",
"hash": -1511482796902639900,
"line_mean": 28.0630630631,
"line_max": 78,
"alpha_frac": 0.6029138252,
"autogenerated": false,
"ratio": 4.120051085568327,
"config_test": fal... |
# An action map represents a group of tiles mapping from the 'dungeon.png' spritesheet.
# A randomly generated map is in the constructor.
# TODO: Create more interesting maps.
# TODO: Allow map expansion.
class ActionMap():
tiles = [] # Tiles is a list of lists of rectangles. Reference a tile with tiles[x][y].
... | {
"repo_name": "Corrob/Action-Game",
"path": "action_map.py",
"copies": "1",
"size": "2751",
"license": "mit",
"hash": -1964015958565858000,
"line_mean": 37.2083333333,
"line_max": 91,
"alpha_frac": 0.5561613959,
"autogenerated": false,
"ratio": 3.0566666666666666,
"config_test": false,
"has_n... |
""" An action that resets *all* perspectives. """
# Enthought library imports.
from enthought.pyface.api import YES
# Local imports.
from workbench_action import WorkbenchAction
# The message used when confirming the action.
MESSAGE = 'Do you want to reset ALL perspectives to their defaults?'
class ResetAllPersp... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/action/reset_all_perspectives_action.py",
"copies": "1",
"size": "1179",
"license": "bsd-3-clause",
"hash": -6225161870719519000,
"line_mean": 28.475,
"line_max": 79,
"alpha_frac": 0.5131467345,
"autogenerated": false,
"rati... |
""" An action that resets *all* perspectives. """
# Enthought library imports.
from pyface.api import YES
# Local imports.
from workbench_action import WorkbenchAction
# The message used when confirming the action.
MESSAGE = 'Do you want to reset ALL perspectives to their defaults?'
class ResetAllPerspectivesAct... | {
"repo_name": "pankajp/pyface",
"path": "pyface/workbench/action/reset_all_perspectives_action.py",
"copies": "2",
"size": "1159",
"license": "bsd-3-clause",
"hash": 441862976656404700,
"line_mean": 27.975,
"line_max": 79,
"alpha_frac": 0.5064710958,
"autogenerated": false,
"ratio": 4.82916666666... |
""" An action that resets the active perspective. """
# Enthought library imports.
from enthought.pyface.api import YES
# Local imports.
from workbench_action import WorkbenchAction
# The message used when confirming the action.
MESSAGE = 'Do you want to reset the current "%s" perspective to its defaults?'
class... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/action/reset_active_perspective_action.py",
"copies": "1",
"size": "1231",
"license": "bsd-3-clause",
"hash": -745904422573880300,
"line_mean": 29.775,
"line_max": 79,
"alpha_frac": 0.5272136474,
"autogenerated": false,
"rat... |
""" An action that resets the active perspective. """
# Enthought library imports.
from pyface.api import YES
# Local imports.
from workbench_action import WorkbenchAction
# The message used when confirming the action.
MESSAGE = 'Do you want to reset the current "%s" perspective to its defaults?'
class ResetActi... | {
"repo_name": "brett-patterson/pyface",
"path": "pyface/workbench/action/reset_active_perspective_action.py",
"copies": "2",
"size": "1211",
"license": "bsd-3-clause",
"hash": 4954393924570950000,
"line_mean": 29.275,
"line_max": 79,
"alpha_frac": 0.5210569777,
"autogenerated": false,
"ratio": 4.... |
""" An action that resets the active perspective. """
# Enthought library imports.
from pyface.api import YES
# Local imports.
from .workbench_action import WorkbenchAction
# The message used when confirming the action.
MESSAGE = 'Do you want to reset the current "%s" perspective to its defaults?'
class ResetAct... | {
"repo_name": "geggo/pyface",
"path": "pyface/workbench/action/reset_active_perspective_action.py",
"copies": "3",
"size": "1212",
"license": "bsd-3-clause",
"hash": 3126381738285527000,
"line_mean": 29.3,
"line_max": 79,
"alpha_frac": 0.5206270627,
"autogenerated": false,
"ratio": 4.967213114754... |
""" An action that sets the active perspective. """
# Enthought library imports.
from enthought.pyface.workbench.api import IPerspective
from enthought.traits.api import Delegate, Instance, on_trait_change
# Local imports.
from workbench_action import WorkbenchAction
class SetActivePerspectiveAction(WorkbenchActio... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/action/set_active_perspective_action.py",
"copies": "1",
"size": "2040",
"license": "bsd-3-clause",
"hash": -5059343087948970000,
"line_mean": 29.447761194,
"line_max": 79,
"alpha_frac": 0.5093137255,
"autogenerated": false,
... |
""" An action that sets the active perspective. """
# Enthought library imports.
from pyface.workbench.api import IPerspective
from traits.api import Delegate, Instance, on_trait_change
# Local imports.
from .workbench_action import WorkbenchAction
class SetActivePerspectiveAction(WorkbenchAction):
""" An acti... | {
"repo_name": "geggo/pyface",
"path": "pyface/workbench/action/set_active_perspective_action.py",
"copies": "3",
"size": "2021",
"license": "bsd-3-clause",
"hash": -2923508972164040000,
"line_mean": 29.1641791045,
"line_max": 79,
"alpha_frac": 0.5051954478,
"autogenerated": false,
"ratio": 5.1687... |
""" An action that shows a dialog to allow the user to choose a view. """
# Local imports.
from view_chooser import ViewChooser
from workbench_action import WorkbenchAction
class ShowViewAction(WorkbenchAction):
""" An action that shows a dialog to allow the user to choose a view. """
#### 'Action' interfa... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/action/show_view_action.py",
"copies": "1",
"size": "1549",
"license": "bsd-3-clause",
"hash": 2612984805936846000,
"line_mean": 34.2045454545,
"line_max": 86,
"alpha_frac": 0.5196901227,
"autogenerated": false,
"ratio": 4.7... |
""" An action that shows a dialog to allow the user to choose a view. """
# Local imports.
from .view_chooser import ViewChooser
from .workbench_action import WorkbenchAction
class ShowViewAction(WorkbenchAction):
""" An action that shows a dialog to allow the user to choose a view. """
#### 'Action' inter... | {
"repo_name": "geggo/pyface",
"path": "pyface/workbench/action/show_view_action.py",
"copies": "3",
"size": "1541",
"license": "bsd-3-clause",
"hash": 3706138466711397400,
"line_mean": 34.0227272727,
"line_max": 86,
"alpha_frac": 0.5165476963,
"autogenerated": false,
"ratio": 4.7708978328173375,
... |
""" An action that toggles a view's visibility (ie. hides/shows it). """
# Enthought library imports.
from enthought.pyface.workbench.api import IView
from enthought.traits.api import Delegate, Instance
# Local imports.
from workbench_action import WorkbenchAction
class ToggleViewVisibilityAction(WorkbenchAction):... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/action/toggle_view_visibility_action.py",
"copies": "1",
"size": "3044",
"license": "bsd-3-clause",
"hash": 1520662447386261800,
"line_mean": 27.4485981308,
"line_max": 79,
"alpha_frac": 0.4878449409,
"autogenerated": false,
... |
""" An action that toggles a view's visibility (ie. hides/shows it). """
# Enthought library imports.
from pyface.workbench.api import IView
from traits.api import Delegate, Instance
# Local imports.
from .workbench_action import WorkbenchAction
class ToggleViewVisibilityAction(WorkbenchAction):
""" An action ... | {
"repo_name": "geggo/pyface",
"path": "pyface/workbench/action/toggle_view_visibility_action.py",
"copies": "3",
"size": "3025",
"license": "bsd-3-clause",
"hash": -7604641349772746000,
"line_mean": 27.2710280374,
"line_max": 79,
"alpha_frac": 0.4849586777,
"autogenerated": false,
"ratio": 4.9027... |
"""An action to open various source files.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
from os.path import isfile
import new
# Enthought library imports.
from traits.api import Instance, Str
from pyface.api imp... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/action/sources.py",
"copies": "2",
"size": "3708",
"license": "bsd-3-clause",
"hash": -2391001102031051300,
"line_mean": 31.2434782609,
"line_max": 79,
"alpha_frac": 0.4865156419,
"autogenerated": false,
"ratio": 4.866141732283465,
"config... |
"""An AdaNet evaluator implementation in Tensorflow using a single graph.
Copyright 2018 The AdaNet 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
https://www.ap... | {
"repo_name": "tensorflow/adanet",
"path": "adanet/core/evaluator.py",
"copies": "1",
"size": "4624",
"license": "apache-2.0",
"hash": 8247104374955044000,
"line_mean": 32.0285714286,
"line_max": 80,
"alpha_frac": 0.6818771626,
"autogenerated": false,
"ratio": 4.230558096980787,
"config_test": ... |
"""An AdaNet iteration implementation in Tensorflow using a single graph.
Copyright 2018 The AdaNet 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
https://www.ap... | {
"repo_name": "tensorflow/adanet",
"path": "adanet/core/iteration.py",
"copies": "1",
"size": "52252",
"license": "apache-2.0",
"hash": -8760696437804264000,
"line_mean": 41.481300813,
"line_max": 80,
"alpha_frac": 0.6580609355,
"autogenerated": false,
"ratio": 4.292097913586332,
"config_test":... |
"""An AdaNet subnetwork definition in Tensorflow using a single graph.
Copyright 2018 The AdaNet 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
https://www.apach... | {
"repo_name": "tensorflow/adanet",
"path": "adanet/subnetwork/generator.py",
"copies": "1",
"size": "14469",
"license": "apache-2.0",
"hash": -3540229054644324400,
"line_mean": 41.6814159292,
"line_max": 114,
"alpha_frac": 0.6996336996,
"autogenerated": false,
"ratio": 4.193913043478261,
"confi... |
""" An adaptation of pickle that directly links py2 str to py3 bytes, both when
writing and when reading. This means it is possible to write protocol=2
pickles containing byte objects (that will be written as python2 str),
as well as reading py2 str with non-ascii characters (and instead of being
conver... | {
"repo_name": "valhallasw/py2",
"path": "bytestrpickle.py",
"copies": "1",
"size": "2639",
"license": "mit",
"hash": 4845610135048010000,
"line_mean": 37.2463768116,
"line_max": 125,
"alpha_frac": 0.6331943918,
"autogenerated": false,
"ratio": 3.7971223021582734,
"config_test": false,
"has_no... |
"""An adaptation of Py2.3/2.4's Queue module which supports reentrant
behavior, using RLock instead of Lock for its mutex object.
This is to support the connection pool's usage of ``__del__`` to return
connections to the underlying Queue, which can apparently in extremely
rare cases be invoked within the ``get()`` met... | {
"repo_name": "ralfonso/theory",
"path": "theory/model/mpdqueue.py",
"copies": "6",
"size": "6453",
"license": "mit",
"hash": -1002302427001135200,
"line_mean": 32.2628865979,
"line_max": 81,
"alpha_frac": 0.5792654579,
"autogenerated": false,
"ratio": 4.51890756302521,
"config_test": false,
... |
"""An adaptation of Py2.3/2.4's Queue module which supports reentrant
behavior, using RLock instead of Lock for its mutex object.
This is to support the connection pool's usage of weakref callbacks to return
connections to the underlying Queue, which can in extremely
rare cases be invoked within the ``get()`` method o... | {
"repo_name": "obeattie/sqlalchemy",
"path": "lib/sqlalchemy/queue.py",
"copies": "1",
"size": "6223",
"license": "mit",
"hash": -4869716493296165000,
"line_mean": 33.0054644809,
"line_max": 81,
"alpha_frac": 0.5838020247,
"autogenerated": false,
"ratio": 4.532410779315367,
"config_test": false... |
"""An adapted copy of relevant site-packages functionality from Python stdlib.
This file contains some functions related to handling site-packages in Python
with jedi-specific modifications:
- the functions operate on sys_path argument rather than global sys.path
- in .pth files "import ..." lines that allow executi... | {
"repo_name": "nitin-cherian/LifeLongLearning",
"path": "Python/PythonProgrammingLanguage/Encapsulation/encap_env/lib/python3.5/site-packages/jedi/evaluate/site.py",
"copies": "16",
"size": "3592",
"license": "mit",
"hash": 171748310812535140,
"line_mean": 31.6545454545,
"line_max": 82,
"alpha_frac":... |
"""An adapter for Java DOM implementations that makes it possible to
access them through the same interface as the Python DOM implementations.
Supports:
- Sun's Java Project X
- Xerces
- David Brownell's SAX 2.0 Utilities / DOM2
- Indelv DOM
- SXP
- OpenXML
$Id: javadom.py,v 1.7 2001/02/19 15:21:50 fdrake Exp $
"""
... | {
"repo_name": "StephenHamilton/gini",
"path": "backend/src/gloader/xml/dom/javadom.py",
"copies": "12",
"size": "19282",
"license": "mit",
"hash": 3166134834478810000,
"line_mean": 26.7040229885,
"line_max": 90,
"alpha_frac": 0.6123846074,
"autogenerated": false,
"ratio": 3.934299122628035,
"co... |
"""An adapter for the standard blocking requests library."""
from __future__ import unicode_literals, absolute_import
import aiohttp
from collections import AsyncIterable, deque
from json import loads as load_json, dumps as dump_json
from helium.__about__ import __version__
from helium.session import Response, CB
... | {
"repo_name": "helium/helium-python",
"path": "helium/adapter/aiohttp.py",
"copies": "1",
"size": "7570",
"license": "bsd-3-clause",
"hash": -5396225908550262000,
"line_mean": 32.4955752212,
"line_max": 78,
"alpha_frac": 0.5443857332,
"autogenerated": false,
"ratio": 4.562989752863171,
"config_... |
"""An adapter for the standard blocking requests library."""
from __future__ import unicode_literals, absolute_import
import requests
from collections import Iterable, Iterator, deque
from json import loads as load_json
from helium.__about__ import __version__
from helium.session import Response, CB
from itertools im... | {
"repo_name": "helium/helium-python",
"path": "helium/adapter/requests.py",
"copies": "1",
"size": "7559",
"license": "bsd-3-clause",
"hash": 3513103072996349400,
"line_mean": 32.5955555556,
"line_max": 91,
"alpha_frac": 0.5459716894,
"autogenerated": false,
"ratio": 4.62041564792176,
"config_t... |
"""An adaptor between :class:`ControllerBlock` and the Klamp't C++ serial
controller interface (SerialController).
"""
import asyncore,socket
import errno
import json
import time
from .. import controller
headerlen = 4
def packStrlen(s):
l = len(s)
assert(l <= 0xffffffff)
bytes = [None]*4
bytes[0] = ... | {
"repo_name": "krishauser/Klampt",
"path": "Python/klampt/control/io/serialcontroller.py",
"copies": "1",
"size": "9226",
"license": "bsd-3-clause",
"hash": 2202591038443523800,
"line_mean": 32.0681003584,
"line_max": 98,
"alpha_frac": 0.590071537,
"autogenerated": false,
"ratio": 4.2555350553505... |
"""An adaptor between python controllers and the Klamp't serial controller
interface (SerialController).
"""
import asyncore,socket
import errno
import json
import time
import controller
headerlen = 4
def packStrlen(s):
l = len(s)
assert(l <= 0xffffffff)
bytes = [None]*4
bytes[0] = chr(l&0xff)
byt... | {
"repo_name": "hpbader42/Klampt",
"path": "Python/control/serialcontroller.py",
"copies": "11",
"size": "8460",
"license": "bsd-3-clause",
"hash": -9158912142291061000,
"line_mean": 31.4137931034,
"line_max": 82,
"alpha_frac": 0.5823877069,
"autogenerated": false,
"ratio": 4.261964735516373,
"c... |
# An ad hoc script to convert an lng file to the arclite format
import sys
def read_header():
with open("../bootstrap/msg.h", encoding="utf-8") as f:
RawContent = f.read()
content = RawContent.splitlines()
return [i[len("#define MSG_"):].split(" ") for i in content]
def read_lng(name):
with open(name, encod... | {
"repo_name": "data-man/FarAS",
"path": "plugins/arclite/tools/add_lng.py",
"copies": "2",
"size": "1280",
"license": "bsd-3-clause",
"hash": 8574222488666837000,
"line_mean": 21.4561403509,
"line_max": 70,
"alpha_frac": 0.61171875,
"autogenerated": false,
"ratio": 2.689075630252101,
"config_te... |
# Anadimos puntuaciones. Cada pelota incrementa un contador cuando
# rebota en el fondo del contrario.
import pygame
from pong_v0 import SharedState
from pong_v1 import PlayerRacket
from pong_v2 import Pong_v2
from pong_v2 import CPURacket
import lib.colors as Color
from pong_v0 import Ball
WIDTH = 0
HEIGHT = 1
clas... | {
"repo_name": "vicente-gonzalez-ruiz/YAPT",
"path": "workshops/programacion_python_ESO/pong_v3.py",
"copies": "2",
"size": "3838",
"license": "cc0-1.0",
"hash": -4633555864500381000,
"line_mean": 31.5254237288,
"line_max": 105,
"alpha_frac": 0.5914538822,
"autogenerated": false,
"ratio": 3.517873... |
#An administrator is a special kind of user. Write a class called
#Admin that inherits from the User class you wrote in Exercise 9-3 (page 166)
#or Exercise 9-5 (page 171). Add an attribute, privileges, that stores a list
#of strings like "can add post", "can delete post", "can ban user", and so on.
#Write a method cal... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ene-Jun-2019/NoemiFlores/PrimerParcial/PrimeraPractica/Admin.py",
"copies": "1",
"size": "2104",
"license": "mit",
"hash": -2912615444296082000,
"line_mean": 33.4590163934,
"line_max": 89,
"alpha_frac": 0.6316039981,
"autogenerated": false,
"ratio": ... |
""" An administrator is a special kind of user. Write a class called
Admin that inherits from the User class you wrote in Exercise 9-3 (page 166)
or Exercise 9-5 (page 171). Add an attribute, privileges, that stores a list
of strings like "can add post", "can delete post", "can ban user", and so on.
Write a method call... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ene-Jun-2019/Karla Berlanga/Practica 1/admin.py",
"copies": "1",
"size": "2161",
"license": "mit",
"hash": 4444334431379872000,
"line_mean": 36.7894736842,
"line_max": 125,
"alpha_frac": 0.6638811513,
"autogenerated": false,
"ratio": 3.54276315789473... |
"""An advanced association proxy example which
illustrates nesting of association proxies to produce multi-level Python
collections, in this case a dictionary with string keys and sets of integers
as values, which conceal the underlying mapped classes.
This is a three table model which represents a parent table refere... | {
"repo_name": "kawamon/hue",
"path": "desktop/core/ext-py/SQLAlchemy-1.3.17/examples/association/dict_of_sets_with_default.py",
"copies": "7",
"size": "2880",
"license": "apache-2.0",
"hash": 5106265876678727000,
"line_mean": 27.5148514851,
"line_max": 76,
"alpha_frac": 0.6927083333,
"autogenerated... |
# An adventure game
health = 10
enemy = 10
gold = 0
strength = 1
rat = False
bear = False
skeleton = False
from random import randint
from time import sleep
inventory = []
newinventory = ""
def healthbar(): #prints status bar
global health, g... | {
"repo_name": "CodeLuke/quiz_adventure",
"path": "adventure.py",
"copies": "1",
"size": "20085",
"license": "mit",
"hash": -2896831781872262700,
"line_mean": 28.2941176471,
"line_max": 127,
"alpha_frac": 0.4016928056,
"autogenerated": false,
"ratio": 3.6738613499176878,
"config_test": false,
... |
"""An Agenda is a list-like container of Appt (appointment).
Author: Megan McMillan for CIS 399, U. Oregon
Each Appt has a date, a start time, an end time, and
a textual description. They can be converted to and
from strings, using the from_string class method and the __str__
method. An Agenda can b... | {
"repo_name": "m364nm/final-project-cis399",
"path": "agenda.py",
"copies": "1",
"size": "10817",
"license": "artistic-2.0",
"hash": -4411812768681411000,
"line_mean": 31.8784194529,
"line_max": 98,
"alpha_frac": 0.567994823,
"autogenerated": false,
"ratio": 4.142857142857143,
"config_test": fa... |
"""An Agenda is a list-like container of Appt (appointment).
"""
# Date handling
import arrow # Replacement for datetime, based on moment.js
class Appt:
"""
A single appointment, starting on a particular
date and time, and ending at a later time the same day.
"""
def __init__(self, begin, end, ... | {
"repo_name": "Iseis/meetMe",
"path": "agenda.py",
"copies": "1",
"size": "11848",
"license": "artistic-2.0",
"hash": 7486518665533952000,
"line_mean": 30.5106382979,
"line_max": 140,
"alpha_frac": 0.5535111411,
"autogenerated": false,
"ratio": 4.235967107615302,
"config_test": false,
"has_no... |
""" An agent does actions in a game.
"""
import sys
class Base:
""" Agent interface.
"""
def optional_enemy(self, visible, enemy):
""" Returns boolean
"""
raise NotImplementedError()
def select_enemy(self, visible, enemies):
""" Returns index of selected enemy.
... | {
"repo_name": "cwahbong/tgif-py",
"path": "tgif/agent.py",
"copies": "1",
"size": "3029",
"license": "mit",
"hash": 971841065123777500,
"line_mean": 27.5754716981,
"line_max": 67,
"alpha_frac": 0.5216242984,
"autogenerated": false,
"ratio": 4.29645390070922,
"config_test": false,
"has_no_keyw... |
"""An agent is responbible for making a move decision based on a board. Players
will make two moves (unless it is the first turn, in which case only one move
is allowed)
This module will have support for getting all possible moves (or ranges for
all types of moves as there are many similar moves of the same type such ... | {
"repo_name": "nicholas-maltbie/Medina",
"path": "Agent.py",
"copies": "1",
"size": "16312",
"license": "mit",
"hash": 4664186159593956000,
"line_mean": 46.9764705882,
"line_max": 127,
"alpha_frac": 0.5891981363,
"autogenerated": false,
"ratio": 3.845355964167845,
"config_test": false,
"has_n... |
"""An agent that can restore and run a policy learned by PPO."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from pybullet_envs.agents.ppo import normalize
from pybullet_envs.agents import utility
class SimplePPOPolicy(object):... | {
"repo_name": "MTASZTAKI/ApertusVR",
"path": "plugins/physics/bulletPhysics/3rdParty/bullet3/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent.py",
"copies": "2",
"size": "4198",
"license": "mit",
"hash": -5634956141573160000,
"line_mean": 44.1397849462,
"line_max": 111,
"alpha_frac"... |
# Anagram another word.
import collections
ANAGRAM_INDICATORS = frozenset([
'about',
'awful',
'bad',
'badly',
'break',
'round',
'crash',
'crazy',
'confuse',
'destruction',
'downfall',
'from',
'kink',
'make',
'mess',
'odd',
'oddly',
'off',
'out',
'put',
'roll',
'round',
'sh... | {
"repo_name": "PhilHarnish/forge",
"path": "src/data/alphabets/cryptic_keywords.py",
"copies": "1",
"size": "1802",
"license": "mit",
"hash": -7530059613889115000,
"line_mean": 16.4951456311,
"line_max": 64,
"alpha_frac": 0.6182019978,
"autogenerated": false,
"ratio": 2.8467614533965246,
"confi... |
"""Anagram detecting problem.
Two strings are anagram if one is simply a rearrangement of the other.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def anagram_iter(s1, s2):
"""Anagram by iteration.
Time complexity: O(n^2).
Space complex... | {
"repo_name": "bowen0701/algorithms_data_structures",
"path": "alg_anagram.py",
"copies": "1",
"size": "2843",
"license": "bsd-2-clause",
"hash": 7038626322420975000,
"line_mean": 21.0387596899,
"line_max": 70,
"alpha_frac": 0.5290186423,
"autogenerated": false,
"ratio": 3.0935799782372144,
"co... |
"""Anagram finding functions."""
from nagaram.scrabble import blank_tiles, word_list, word_score
def _letter_map(word):
"""Creates a map of letter use in a word.
Args:
word: a string to create a letter map from
Returns:
a dictionary of {letter: integer count of letter in word}
"""
... | {
"repo_name": "a-tal/nagaram",
"path": "nagaram/anagrams.py",
"copies": "1",
"size": "1632",
"license": "bsd-3-clause",
"hash": 686752848658290400,
"line_mean": 26.6610169492,
"line_max": 72,
"alpha_frac": 0.5575980392,
"autogenerated": false,
"ratio": 3.9420289855072466,
"config_test": false,
... |
"""Anagramic squares
Problem 98
By replacing each of the letters in the word CARE with 1, 2, 9, and 6
respectively, we form a square number: 1296 = 362. What is remarkable is that,
by using the same digital substitutions, the anagram, RACE, also forms a square
number: 9216 = 962. We shall call CARE (and RACE) a square ... | {
"repo_name": "feliposz/project-euler-solutions",
"path": "python/euler98.py",
"copies": "1",
"size": "2628",
"license": "mit",
"hash": 9150874705929923000,
"line_mean": 30.2857142857,
"line_max": 83,
"alpha_frac": 0.6133942161,
"autogenerated": false,
"ratio": 3.5370121130551815,
"config_test"... |
from itertools import permutations
import argparse
wordSet = set()
# Strip whitespace from a string and lowercase it
def strip_and_lower(s):
return s.lower().strip()
# Return true if the lowercased/stripped inputWord appears
# in the global wordSet
def dictionaryLookup(inputWord):
return(strip_and_lower(inp... | {
"repo_name": "skotchandsoda/yay-anagrams",
"path": "anagram.py",
"copies": "1",
"size": "2096",
"license": "bsd-3-clause",
"hash": -3369552010673821700,
"line_mean": 33.3606557377,
"line_max": 76,
"alpha_frac": 0.6626908397,
"autogenerated": false,
"ratio": 3.7562724014336917,
"config_test": f... |
"""An aircraft electric system specification generator.
Generation for Yices and TuLiP were presented in a HSCC 2013 paper.
Huan Xu (mumu@caltech.edu)
October 30, 2012
Generation into SMT-LIB v2 language by SCL, 27 January 2013
"""
import sys, os
import re, copy
import numpy as np
import scipy
import scipy.io
import... | {
"repo_name": "pombredanne/nTLP",
"path": "contrib/AES/AES_specgen.py",
"copies": "1",
"size": "41531",
"license": "bsd-3-clause",
"hash": 3171836456135973400,
"line_mean": 31.44609375,
"line_max": 135,
"alpha_frac": 0.4561652741,
"autogenerated": false,
"ratio": 3.6704374723817943,
"config_tes... |
""" An aircraft electric system specification generator presented in the HSCC 2013 paper.
Huan Xu (mumu@caltech.edu)
October 30, 2012
"""
from __future__ import division
from __future__ import print_function
import sys, os
import re, copy
import numpy as np
import scipy
import scipy.io
import networkx as nx
import it... | {
"repo_name": "tulip-control/tulip-control",
"path": "contrib/AES/AES_specgen.py",
"copies": "1",
"size": "35673",
"license": "bsd-3-clause",
"hash": -3006080899344952300,
"line_mean": 31.0800359712,
"line_max": 135,
"alpha_frac": 0.455750848,
"autogenerated": false,
"ratio": 3.5848658426288815,
... |
""" An aircraft electric system specification generator presented in the HSCC 2013 paper.
Huan Xu (mumu@caltech.edu)
October 30, 2012
"""
import sys, os
import re, copy
import numpy as np
import scipy
import scipy.io
import networkx as nx
import itertools
import time
#************************************************... | {
"repo_name": "necozay/tulip-control",
"path": "contrib/AES/AES_specgen.py",
"copies": "1",
"size": "35890",
"license": "bsd-3-clause",
"hash": 376596043563363840,
"line_mean": 31.2751798561,
"line_max": 135,
"alpha_frac": 0.4524658679,
"autogenerated": false,
"ratio": 3.608848667672197,
"confi... |
"""A naive benchmark script."""
from __future__ import print_function
import textwrap
import timeit
def time_hashing(message_size):
setup = textwrap.dedent('''
import random
import csiphash
key = ''.join(chr(random.randint(0, 255)) for _ in xrange(16))
message = ''.join(chr(random.randint(0, 255... | {
"repo_name": "zacharyvoase/python-csiphash",
"path": "test/perf_test.py",
"copies": "1",
"size": "1317",
"license": "unlicense",
"hash": 5908028136633492000,
"line_mean": 33.6578947368,
"line_max": 144,
"alpha_frac": 0.6810933941,
"autogenerated": false,
"ratio": 3.2121951219512197,
"config_te... |
"""A naive example of dependency injection on Python.
Example implementation of dependency injection in Python from Martin Fowler's
article about dependency injection and inversion of control:
http://www.martinfowler.com/articles/injection.html
This mini application uses ``movies`` library, that is configured to wor... | {
"repo_name": "ets-labs/dependency_injector",
"path": "examples/miniapps/movie_lister/app_csv.py",
"copies": "1",
"size": "1566",
"license": "bsd-3-clause",
"hash": 2833055148077426700,
"line_mean": 30.9591836735,
"line_max": 78,
"alpha_frac": 0.6743295019,
"autogenerated": false,
"ratio": 4.4237... |
# A naive Python implementation of LIS problem
""" To make use of recursive calls, this function must return
two things:
1) Length of LIS ending with element arr[n-1]. We use
max_ending_here for this purpose
2) Overall maximum as the LIS may end with an element
before arr[n-1] max_ref is used this purpose.
The v... | {
"repo_name": "maazsq/Algorithms_Example",
"path": "Longest-Common-Subsequence/Python/Longest_increasing _subsequence.py",
"copies": "9",
"size": "1596",
"license": "apache-2.0",
"hash": -5368068176726014000,
"line_mean": 25.6,
"line_max": 67,
"alpha_frac": 0.6522556391,
"autogenerated": false,
"... |
# A Naive recursive Python program to fin minimum number
# operations to convert str1 to str2
def editDistance(str1, str2, m , n):
# If first string is empty, the only option is to
# insert all characters of second string into first
if m==0:
return n
# If second string is empty, the only op... | {
"repo_name": "Evanc123/interview_prep",
"path": "dynamic_programming/edit_distance.py",
"copies": "1",
"size": "2307",
"license": "mit",
"hash": 5823822797611899000,
"line_mean": 32.9411764706,
"line_max": 66,
"alpha_frac": 0.5886432596,
"autogenerated": false,
"ratio": 3.638801261829653,
"con... |
#Ana Jessye 1615310046
#Franklin Yuri 1615310033
#Bruno de Oliveira Freire- 1615310030
import random
nome=raw_input("digite seu nome:")
numero= random.randint(1,3)
x=0
while x !=1:
print("\n escolha o numero\n digite 1 para pedra \n digite 2 para tesoura \n digite 3 para papel")
resposta=int(input("d... | {
"repo_name": "any1m1c/ipc20161",
"path": "jokenpo/equipe1/jokenpo.py",
"copies": "1",
"size": "1368",
"license": "apache-2.0",
"hash": 7478189164922612000,
"line_mean": 37,
"line_max": 102,
"alpha_frac": 0.6564327485,
"autogenerated": false,
"ratio": 2.809034907597536,
"config_test": false,
... |
#Ana Jessye 1615310046
#Franklin Yuri 1615310033
#Bruno de Oliveira Freire- 1615310030
import random
nome=raw_input("digite seu nome:")
numero= random.randint(1,5)
x=0
while x !=1:
print("\n escolha o numero\n digite 1 para pedra \n digite 2 para tesoura \n digite 3 para papel \n digite 4 para lagarto \n digite 5 ... | {
"repo_name": "any1m1c/ipc20161",
"path": "jokenpo/equipe1/jokenpo_sheldon.py",
"copies": "1",
"size": "3214",
"license": "apache-2.0",
"hash": 489276649272721600,
"line_mean": 49.21875,
"line_max": 150,
"alpha_frac": 0.6795270691,
"autogenerated": false,
"ratio": 2.802092414995641,
"config_tes... |
# An algorithm to work out the number of end points of a 'long' cluster (beta, etc) in order to detect crossed or divergent tracks
# Note: This is currently only accurate for clusters of radius > ~20
# TODO Develop a similar algorithm for shorter blobs
# Author: Cal Hewitt
import numpy as np
def is_single_track(blob)... | {
"repo_name": "calhewitt/lucid-utils",
"path": "lucid_utils/classification/end_detection.py",
"copies": "2",
"size": "5414",
"license": "mit",
"hash": -6095883016788638000,
"line_mean": 44.8813559322,
"line_max": 148,
"alpha_frac": 0.6056520133,
"autogenerated": false,
"ratio": 3.650708024275118,... |
""" Analize test results for finding bottlenecks """
import re
import sys
import csv
import time
import bisect
import os.path
import argparse
import collections
import yaml
import texttable
try:
import pygraphviz as pgv
except ImportError:
pgv = None
sys.path.append("/mnt/other/work/disk_perf_test_tool")
f... | {
"repo_name": "Mirantis/disk_perf_test_tool",
"path": "scripts/postprocessing/bottleneck.py",
"copies": "1",
"size": "17445",
"license": "apache-2.0",
"hash": -6338950476395135000,
"line_mean": 30.4324324324,
"line_max": 77,
"alpha_frac": 0.5450272284,
"autogenerated": false,
"ratio": 3.588767743... |
"""Analog analysis module."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import datetime
from analog.exceptions import MissingFormatError
from analog.formats import LogFormat
from analog.report import Report
#: Default verbs to monitor if unconfigured... | {
"repo_name": "fabianbuechler/analog",
"path": "analog/analyzer.py",
"copies": "1",
"size": "7830",
"license": "mit",
"hash": 5325047117719476000,
"line_mean": 35.7605633803,
"line_max": 78,
"alpha_frac": 0.5946360153,
"autogenerated": false,
"ratio": 4.164893617021277,
"config_test": false,
... |
# AnalogClock constants
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 15 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
# Style options that control the general clock appearance,
# chosen via SetClockStyle.
SHOW_QUARTERS_TICKS = 1
SHO... | {
"repo_name": "CarlFK/clocky",
"path": "analogclock/styles.py",
"copies": "1",
"size": "1304",
"license": "mit",
"hash": -7314648424241791000,
"line_mean": 24.612244898,
"line_max": 76,
"alpha_frac": 0.5805214724,
"autogenerated": false,
"ratio": 2.716666666666667,
"config_test": false,
"has_... |
# AnalogClock demo
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 12 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
import wx
import wx.lib.analogclock as ac
#----------------------------------------------------------------------
class TestPa... | {
"repo_name": "walterfan/snippets",
"path": "python/exam/count_down_clock.py",
"copies": "1",
"size": "6002",
"license": "apache-2.0",
"hash": 5762391147293910000,
"line_mean": 41.5673758865,
"line_max": 82,
"alpha_frac": 0.467844052,
"autogenerated": false,
"ratio": 3.9564930784442978,
"config... |
# Analog Clock Demo
# Chapter 5
import sys, random, math, pygame
from pygame.locals import *
from datetime import datetime, date, time
def print_text(font, x, y, text, color=(255, 255, 255)):
imgText = font.render(text, True, color)
screen.blit(imgText, (x, y))
def wrap_angle(angle):
retu... | {
"repo_name": "Great-Li-Xin/PythonDev",
"path": "Games/resources/code/chap05/AnalogClock.py",
"copies": "1",
"size": "2625",
"license": "mit",
"hash": 3436825750612795400,
"line_mean": 27.4943820225,
"line_max": 80,
"alpha_frac": 0.5843809524,
"autogenerated": false,
"ratio": 3.0034324942791764,
... |
# AnalogClock's base classes
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 15 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
from time import strftime, localtime
from datetime import datetime
import math
import wx
from styles impor... | {
"repo_name": "CarlFK/clocky",
"path": "analogclock/helpers.py",
"copies": "1",
"size": "29716",
"license": "mit",
"hash": -4782367176190227000,
"line_mean": 27.1333333333,
"line_max": 99,
"alpha_frac": 0.4944474357,
"autogenerated": false,
"ratio": 3.9500199388541803,
"config_test": false,
"... |
# AnalogClock's colour selector for setup dialog
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 15 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
import wx
from wx.lib.newevent import NewEvent
from wx.lib.buttons import GenBitmapButton
... | {
"repo_name": "ktan2020/legacy-automation",
"path": "win/Lib/site-packages/wx-3.0-msw/wx/lib/analogclock/lib_setup/colourselect.py",
"copies": "2",
"size": "2342",
"license": "mit",
"hash": 1193119777742407000,
"line_mean": 27.275,
"line_max": 79,
"alpha_frac": 0.535439795,
"autogenerated": false,
... |
# AnalogClock's font selector for setup dialog
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 15 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
import wx
from wx.lib.newevent import NewEvent
from wx.lib.buttons import GenButton
#----... | {
"repo_name": "ktan2020/legacy-automation",
"path": "win/Lib/site-packages/wx-3.0-msw/wx/lib/analogclock/lib_setup/fontselect.py",
"copies": "2",
"size": "1713",
"license": "mit",
"hash": 3042094908907154000,
"line_mean": 26.0819672131,
"line_max": 77,
"alpha_frac": 0.5253940455,
"autogenerated": f... |
# AnalogClock's main class
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 15 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
#
# For more info please see the __init__.py file.
import wx
from styles import *
from helpers import Dyer, ... | {
"repo_name": "ktan2020/legacy-automation",
"path": "win/Lib/site-packages/wx-3.0-msw/wx/lib/analogclock/analogclock.py",
"copies": "1",
"size": "18239",
"license": "mit",
"hash": -1111179114490905500,
"line_mean": 26.8135860979,
"line_max": 79,
"alpha_frac": 0.5543067054,
"autogenerated": false,
... |
# ANALOG COLORS
# Import the library
try:
# This is the statement you normally use.
colors = ximport("colors")
except ImportError:
# But since these examples are "inside" the library
# we may need to try something different when
# the library is not located in /Application Support
colors = ximp... | {
"repo_name": "est/nodebox-gl",
"path": "libraries/colors/colors_example1.py",
"copies": "2",
"size": "2409",
"license": "bsd-3-clause",
"hash": 4561374311716880000,
"line_mean": 27.3529411765,
"line_max": 68,
"alpha_frac": 0.6272312163,
"autogenerated": false,
"ratio": 3.1204663212435233,
"con... |
"""Analog console entry point."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argparse
import sys
import textwrap
import analog
from analog.analyzer import DEFAULT_VERBS, DEFAULT_STATUS_CODES, DEFAULT_PATHS
from analog.utils import AnalogArgumentP... | {
"repo_name": "fabianbuechler/analog",
"path": "analog/main.py",
"copies": "1",
"size": "6057",
"license": "mit",
"hash": -1268754877132283400,
"line_mean": 37.335443038,
"line_max": 79,
"alpha_frac": 0.5159319795,
"autogenerated": false,
"ratio": 4.900485436893204,
"config_test": false,
"has... |
from machine import ADC
from uiot.device import Device
class Analog(Device):
# Handle devices connected to the analog port
# offers a digital mode through using threshold
def __init__(self, name, precision=1, threshold=None,
on_change=None, report_change=True, filter=None):
self... | {
"repo_name": "ulno/micropython-extra-ulno",
"path": "lib/node_types/esp8266/freeze/uiot/analog.py",
"copies": "1",
"size": "1208",
"license": "mit",
"hash": -4433291726577275400,
"line_mean": 33.5142857143,
"line_max": 100,
"alpha_frac": 0.5811258278,
"autogenerated": false,
"ratio": 4.253521126... |
"""Analog - Log Analysis Utitliy."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from setuptools import setup, find_packages
VERSION = '1.0.1+dev'
def read(path, strip=False):
"""Read file at ``path`` and return content. Opt., ``strip`` whitespace... | {
"repo_name": "fabianbuechler/analog",
"path": "setup.py",
"copies": "1",
"size": "1844",
"license": "mit",
"hash": 4911590560373688000,
"line_mean": 28.2698412698,
"line_max": 79,
"alpha_frac": 0.6339479393,
"autogenerated": false,
"ratio": 3.794238683127572,
"config_test": false,
"has_no_ke... |
"""Analog - Log Analysis Utitliy."""
# Analog documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 18 20:05:36 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated ... | {
"repo_name": "fabianbuechler/analog",
"path": "docs/conf.py",
"copies": "1",
"size": "8483",
"license": "mit",
"hash": -342896157558164400,
"line_mean": 30.9962264151,
"line_max": 79,
"alpha_frac": 0.7012619413,
"autogenerated": false,
"ratio": 3.7335975341259355,
"config_test": true,
"has_n... |
"""Analog log format definitions."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import namedtuple
import re
import weakref
from analog.exceptions import InvalidFormatExpressionError
class LogFormat:
"""Log format definition.
... | {
"repo_name": "fabianbuechler/analog",
"path": "analog/formats.py",
"copies": "1",
"size": "5018",
"license": "mit",
"hash": -4405383301565062000,
"line_mean": 37.3053435115,
"line_max": 80,
"alpha_frac": 0.5611797529,
"autogenerated": false,
"ratio": 4.227464195450716,
"config_test": false,
... |
"""Analog log report object."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import Counter, defaultdict, OrderedDict
import time
from analog.renderers import Renderer
from analog.utils import PrefixMatchingCounter
try:
from statisti... | {
"repo_name": "fabianbuechler/analog",
"path": "analog/report.py",
"copies": "1",
"size": "9266",
"license": "mit",
"hash": -2104843089820055800,
"line_mean": 31.975088968,
"line_max": 78,
"alpha_frac": 0.5995035614,
"autogenerated": false,
"ratio": 4.344116268166901,
"config_test": false,
"h... |
"""Analog log report renderers."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import abc
import csv
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
import textwrap
from tabulate import tabulate
from analog.except... | {
"repo_name": "fabianbuechler/analog",
"path": "analog/renderers.py",
"copies": "1",
"size": "12696",
"license": "mit",
"hash": 8133220540198397000,
"line_mean": 29.9658536585,
"line_max": 79,
"alpha_frac": 0.5642722117,
"autogenerated": false,
"ratio": 4.29790115098172,
"config_test": false,
... |
ANALOG_MAX = 255
# COMMANDS SENT TO ARDUINO
analog_0_sent = 0;
analog_1_sent = 0;
digital_0_sent = False;
digital_1_sent = False;
# RECORD MODE
record = False
record_file_number = None # None if not recording
record_array = [] # List that stores quads (PIN TYPE, PIN INDEX, value, time step)
record_start... | {
"repo_name": "DaveBuckingham/robosoft",
"path": "global_data.py",
"copies": "1",
"size": "1292",
"license": "mit",
"hash": -4061747097755971000,
"line_mean": 20.1803278689,
"line_max": 92,
"alpha_frac": 0.6122291022,
"autogenerated": false,
"ratio": 2.772532188841202,
"config_test": false,
"... |
'''Analog Port
=================
Instances of :mod:`~moa.device.port` that represent analog input/output
devices.
'''
from kivy.properties import (
NumericProperty, ObjectProperty, StringProperty, DictProperty)
from moa.device.port import Channel, Port
from functools import partial
from time import clock
__all__... | {
"repo_name": "matham/moa",
"path": "moa/device/analog.py",
"copies": "1",
"size": "14381",
"license": "mit",
"hash": -8804389085658274000,
"line_mean": 36.4505208333,
"line_max": 79,
"alpha_frac": 0.6216535707,
"autogenerated": false,
"ratio": 4.176880627359861,
"config_test": false,
"has_no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.