text stringlengths 0 1.05M | meta dict |
|---|---|
from etk.extractors.date_extractor import DateExtractor, DateResolution
from etk.wikidata.value import Precision
def parse_datetime_string(s, *args, **kwargs):
"""
Automatically convert string to iso datetime string
:param s:
:return: iso format datetime string, wikidata date precision
"""
k... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/wikidata/utils.py",
"copies": "1",
"size": "1231",
"license": "mit",
"hash": -7093453677474021000,
"line_mean": 30.5641025641,
"line_max": 71,
"alpha_frac": 0.685621446,
"autogenerated": false,
"ratio": 4.022875816993464,
"config_test": false,
"has... |
from etk.extractors.regex_extractor import RegexExtractor
from etk.extractor import Extractor, InputType
from typing import List
from etk.extraction import Extraction
class CryptographicHashExtractor(Extractor):
"""
**Description**
This class inherits RegexExtractor by predefine the regex patterns for... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/extractors/cryptographic_hash_extractor.py",
"copies": "1",
"size": "1539",
"license": "mit",
"hash": -2382403239113573000,
"line_mean": 30.4081632653,
"line_max": 99,
"alpha_frac": 0.5886939571,
"autogenerated": false,
"ratio": 4.028795811518324,
"c... |
from etk.extractors.regex_extractor import RegexExtractor
class URLExtractor(RegexExtractor):
"""
**Description**
This class inherits the RegexExtractor and pre-defines the url pattern as the regex pattern.
Example:
::
url_extractor = URLExtractor(allow_missing_http=True)
... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/extractors/url_extractor.py",
"copies": "1",
"size": "2229",
"license": "mit",
"hash": -7157627740082388000,
"line_mean": 52.0714285714,
"line_max": 118,
"alpha_frac": 0.3974876626,
"autogenerated": false,
"ratio": 2.6285377358490565,
"config_test": ... |
from etk.knowledge_graph.node import URI, BNode, Literal
from etk.etk_exceptions import InvalidParameter
class Subject:
def __init__(self, s):
if not isinstance(s, (URI, BNode)):
raise InvalidParameter('Subject needs to be URI or BNode')
self._resource = dict()
self._s = s
... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/knowledge_graph/subject.py",
"copies": "1",
"size": "4235",
"license": "mit",
"hash": 1808963316560110300,
"line_mean": 33.7131147541,
"line_max": 105,
"alpha_frac": 0.5546635183,
"autogenerated": false,
"ratio": 4.273461150353179,
"config_test": fal... |
from etk.knowledge_graph.node import URI, Literal, LiteralType
from etk.knowledge_graph.subject import Subject
from enum import Enum
class Precision(Enum):
# https://www.wikidata.org/wiki/Help:Dates#Time_datatype
second = Literal('14', type_=LiteralType.integer)
minute = Literal('13', type_=LiteralType.in... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/wikidata/value.py",
"copies": "1",
"size": "8072",
"license": "mit",
"hash": 8824315740840565000,
"line_mean": 37.0754716981,
"line_max": 118,
"alpha_frac": 0.639122894,
"autogenerated": false,
"ratio": 3.716390423572744,
"config_test": false,
"has... |
from etk.knowledge_graph.node import URI
from etk.knowledge_graph.subject import Subject
from enum import Enum
import uuid
class Rank(Enum):
Normal = URI('wikibase:NormalRank')
Preferred = URI('wikibase:PreferredRank')
Deprecated = URI('wikibase:DeprecatedRank')
# never set the rank to BestRank. This... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/wikidata/statement.py",
"copies": "1",
"size": "1755",
"license": "mit",
"hash": -1877791778796896800,
"line_mean": 32.1132075472,
"line_max": 73,
"alpha_frac": 0.6290598291,
"autogenerated": false,
"ratio": 3.3301707779886147,
"config_test": false,
... |
from etk.knowledge_graph.subject import Subject
from etk.knowledge_graph.node import URI, BNode
from etk.knowledge_graph.namespacemanager import NamespaceManager
from functools import lru_cache
import rdflib
class Graph(object):
def __init__(self, graph=None, identifier=None):
if graph:
self._... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/knowledge_graph/graph.py",
"copies": "1",
"size": "3035",
"license": "mit",
"hash": 4138297866692575000,
"line_mean": 33.8850574713,
"line_max": 102,
"alpha_frac": 0.5808896211,
"autogenerated": false,
"ratio": 3.7285012285012287,
"config_test": fals... |
from etk.knowledge_graph.subject import Subject
from etk.knowledge_graph.node import URI, Literal
from etk.wikidata.statement import Statement, Rank
from etk.wikidata.value import Item, Property, Datatype
from collections import defaultdict
from uuid import uuid4
change_recorder = set()
revision = None
def revise(en... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/wikidata/entity.py",
"copies": "1",
"size": "4032",
"license": "mit",
"hash": 437377045903799040,
"line_mean": 40.1428571429,
"line_max": 104,
"alpha_frac": 0.6401289683,
"autogenerated": false,
"ratio": 3.3967986520640268,
"config_test": false,
"h... |
from etk.origin_record import OriginRecord
from functools import reduce
import itertools
class ProvenanceAPI:
def __init__(self, doc):
self.origin_doc = doc
def get_origins(self, field: str = None, index: int = None, value: str = None):
origins = []
if value == None:
if i... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/provenance_api.py",
"copies": "1",
"size": "1871",
"license": "mit",
"hash": -292855426034051800,
"line_mean": 44.6341463415,
"line_max": 116,
"alpha_frac": 0.6012827365,
"autogenerated": false,
"ratio": 3.5235404896421847,
"config_test": false,
"h... |
from etk.timeseries.annotation import block_detector
from etk.timeseries.annotation import date_utilities
from etk.timeseries.annotation import utility
import logging
class parsed_table:
# we defind a table when we find a time header for that
def __init__(self, time_header, parent_sheet):
self.time_bl... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/timeseries/annotation/table_processor.py",
"copies": "1",
"size": "24373",
"license": "mit",
"hash": -970222054132011600,
"line_mean": 49.2536082474,
"line_max": 267,
"alpha_frac": 0.5709596685,
"autogenerated": false,
"ratio": 3.9540882543802724,
"c... |
from etk.timeseries.annotation import input_processor
import json
import numpy as np
import re
from etk.timeseries.annotation.table_processor import parsed_table
from etk.timeseries.annotation.granularity_detector import GranularityDetector
def is_number(value):
if is_int(value) or is_float(value):
return... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/timeseries/simple_annotator.py",
"copies": "1",
"size": "4672",
"license": "mit",
"hash": 4090842024215379000,
"line_mean": 24.5300546448,
"line_max": 101,
"alpha_frac": 0.4884417808,
"autogenerated": false,
"ratio": 4.243415077202543,
"config_test":... |
from etk.timeseries.annotation import utility, block_detector
from etk.timeseries.annotation.table_processor import parsed_table
from etk.timeseries.annotation import cell_classifier
import logging
from etk.timeseries.annotation import multi_table_processor
class parsed_sheet:
def __init__(self, name, index, real_... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/timeseries/annotation/sheet_processor.py",
"copies": "1",
"size": "9489",
"license": "mit",
"hash": 7501159030161393000,
"line_mean": 43.5492957746,
"line_max": 184,
"alpha_frac": 0.5511645063,
"autogenerated": false,
"ratio": 4.010566356720203,
"con... |
from etk.timeseries.annotation.table_processor import parsed_table
from etk.timeseries.annotation.utility import column_orientation
from etk.timeseries.annotation import date_utilities
class complex_table(parsed_table):
# finding the overlapp in the time block based on monotonicity of the time block
@classmet... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/timeseries/annotation/multi_table_processor.py",
"copies": "1",
"size": "1918",
"license": "mit",
"hash": -7268281513002522000,
"line_mean": 52.2777777778,
"line_max": 115,
"alpha_frac": 0.633472367,
"autogenerated": false,
"ratio": 3.6533333333333333,... |
from etk.timeseries.annotation.utility import date_cell, text_cell, empty_cell, blank_cell, number_cell, row_key, column_key, column_orientation
import logging
class rectangular_block:
def __init__(self):
self.upper_row = 0
self.lower_row = 0
self.left_col = 0
self.right_col = 0
... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/timeseries/annotation/block_detector.py",
"copies": "1",
"size": "7525",
"license": "mit",
"hash": 6459712029828527000,
"line_mean": 35.3526570048,
"line_max": 243,
"alpha_frac": 0.5603986711,
"autogenerated": false,
"ratio": 3.351893095768374,
"conf... |
from etk.wikidata.truthy import TruthyUpdater
def add_arguments(parser):
parser.add_argument('-e', '--endpoint', action='store', type=str, dest='endpoint')
parser.add_argument('-c', '--creator', default='http://www.isi.edu/datamart', action='store', type=str,
dest='creator')
parser... | {
"repo_name": "usc-isi-i2/etk",
"path": "etk/cli/wd_cleanup.py",
"copies": "1",
"size": "2381",
"license": "mit",
"hash": 3746682028411251700,
"line_mean": 35.0757575758,
"line_max": 198,
"alpha_frac": 0.574548509,
"autogenerated": false,
"ratio": 3.4457308248914615,
"config_test": false,
"ha... |
from etlalchemy_exceptions import DBApiNotFound
from sqlalchemy_utils import database_exists, create_database, drop_database
from sqlalchemy import create_engine, MetaData
# import dill
import logging
class ETLAlchemyTarget():
def __init__(self, conn_string, drop_database=False):
self.drop_database = drop... | {
"repo_name": "seanharr11/etlalchemy",
"path": "etlalchemy/ETLAlchemyTarget.py",
"copies": "1",
"size": "4525",
"license": "mit",
"hash": -1203435697501310500,
"line_mean": 45.6494845361,
"line_max": 80,
"alpha_frac": 0.5049723757,
"autogenerated": false,
"ratio": 4.4232649071358745,
"config_te... |
from etld import get_eTLD_service
from base64 import b64decode
from java.security.cert import X509Certificate, CertificateFactory
from java.io import StringBufferInputStream
from javax.naming.ldap import LdapName
cert_factory = CertificateFactory.getInstance('X.509')
svc = get_eTLD_service()
class CertChainFilter:
... | {
"repo_name": "mozmark/TLS-Report-Consumer",
"path": "certfilter.py",
"copies": "1",
"size": "1455",
"license": "bsd-2-clause",
"hash": 3818113750004531700,
"line_mean": 35.375,
"line_max": 88,
"alpha_frac": 0.5993127148,
"autogenerated": false,
"ratio": 3.911290322580645,
"config_test": false,... |
from etl.pipeline.tableuploader import CombineTable, UploadTable
import etl.db_schema.SQLtables_cols as SQLtables_cols
import etl.cleaners.gen_persistence_dummies as gen_persistence_dummies
def main():
# Student IDs
CombineTable(sqltable_name = 'common.studentid',
sqltable_cols = SQLtables_cols.studentid,
... | {
"repo_name": "dssg/education-college-public",
"path": "code/etl/uploaders/combine_common.py",
"copies": "1",
"size": "10634",
"license": "mit",
"hash": 8406577508911231000,
"line_mean": 31.5229357798,
"line_max": 131,
"alpha_frac": 0.641151025,
"autogenerated": false,
"ratio": 2.927863436123348,... |
from etl.pipeline.tableuploader import UploadTable
import etl.cleaners.clean_noble as clean_noble
import etl.db_schema.SQLtables_cols as SQLtables_cols
import config
def main():
# Student IDs
UploadTable(rawcsv_dict = { 'contacts': config.DATA_PATH + 'noble/raw_data/jun_24/Contact_06_19_2015.csv' },
rawtoclean_... | {
"repo_name": "dssg/education-college-public",
"path": "code/etl/uploaders/load_noble.py",
"copies": "1",
"size": "5230",
"license": "mit",
"hash": 378635826425699100,
"line_mean": 36.3642857143,
"line_max": 119,
"alpha_frac": 0.6634799235,
"autogenerated": false,
"ratio": 2.7239583333333335,
"... |
from etl.pipeline.tableuploader import UploadTable
import pandas as pd
import config
def main():
###################
### Common Bits ###
###################
lookup_cols = {
'commonids': '''
''',
'partnerids': '''
''',
'data': 'name VARCHAR PRIMARY KEY'
}
def prep_lookup_cleandf(rawdf, lookupcol):
... | {
"repo_name": "dssg/education-college-public",
"path": "code/etl/uploaders/load_lookuptables.py",
"copies": "1",
"size": "1793",
"license": "mit",
"hash": -7514547030223121000,
"line_mean": 29.406779661,
"line_max": 124,
"alpha_frac": 0.6625766871,
"autogenerated": false,
"ratio": 3.0134453781512... |
from etl.text import join_with_single_quotes
class ETLError(Exception):
"""Parent to all ETL-oriented exceptions which allows to write effective except statements."""
class ETLSystemError(ETLError):
"""
Blunder in the ETL code -- you'll need to check the ETL code, sorry about that.
This exception s... | {
"repo_name": "harrystech/arthur-redshift-etl",
"path": "python/etl/errors.py",
"copies": "1",
"size": "5686",
"license": "mit",
"hash": -5950892666539855000,
"line_mean": 27.7171717172,
"line_max": 104,
"alpha_frac": 0.722652128,
"autogenerated": false,
"ratio": 4.449139280125196,
"config_test... |
from euclid import inverse
from numpy import poly1d
from collections import deque
import pdb
def reduce_prime_poly(f,p):
# if type(f) != numpy.lib.polynomial.poly1d
if type(f) == int:
f = poly1d([f])
r = deque(f.c.tolist())
l = []
while r:
# take c off of the right
c = r.po... | {
"repo_name": "momahajogami/Prime-Numbers",
"path": "poly_divmod.py",
"copies": "1",
"size": "1707",
"license": "mit",
"hash": 4561012441198217700,
"line_mean": 23.0422535211,
"line_max": 70,
"alpha_frac": 0.5348564733,
"autogenerated": false,
"ratio": 3.1206581352833638,
"config_test": false,
... |
from euclid import *
from itertools import*
from math import *
__all__ = ['Polygon']
class Polygon(object):
def __init__(self, vertices, closed=True):
self.vertices = list(v.copy() for v in vertices)
assert len(self.vertices) >= 1
assert all(isinstance(v, Point2) for v in self.vertices)
... | {
"repo_name": "elemel/torn",
"path": "lib/torn/geometry.py",
"copies": "1",
"size": "1614",
"license": "mit",
"hash": 8502174400492820000,
"line_mean": 27.3157894737,
"line_max": 80,
"alpha_frac": 0.5260223048,
"autogenerated": false,
"ratio": 3.412262156448203,
"config_test": false,
"has_no_... |
from eulagizer import Eulagizer
import twitter
import random
import os
def run():
# set up eulagizer
gizer = Eulagizer('corpus')
# initialize
tweet = None
# 20 attempts to generate real tweet
for i in range(20):
# make eula
try:
eula = gizer.run(length=500,
... | {
"repo_name": "aschn/eulabot",
"path": "eulabot.py",
"copies": "1",
"size": "1349",
"license": "mit",
"hash": 8202226748148533000,
"line_mean": 26.5306122449,
"line_max": 86,
"alpha_frac": 0.5604151223,
"autogenerated": false,
"ratio": 4.026865671641791,
"config_test": false,
"has_no_keywords... |
from euler007 import eratosthenes
def stirling_count(n, k):
# number of ways to partition set of size n into k blocks
if n == 0 and k == 0:
return 1
elif n == 0 or k == 0:
return 0
return k * stirling_count(n-1,k) + stirling_count(n-1,k-1)
def hamming(base, target):
# ... | {
"repo_name": "branning/euler",
"path": "problems/euler009.py",
"copies": "1",
"size": "2634",
"license": "mit",
"hash": -3571572493602668000,
"line_mean": 26.0212765957,
"line_max": 93,
"alpha_frac": 0.5554290053,
"autogenerated": false,
"ratio": 2.85373781148429,
"config_test": false,
"has_... |
from euler_funcs import divisor_list
from itertools import takewhile, chain
from functools import reduce
from operator import mul
prod = lambda L: reduce(mul, L, 1)
def pair_solutions(k):
dvs = chain([1],takewhile(lambda e: e<=(k-1)//2, divisor_list(k-1)))
l = set([(1+d, 1+(k-1)//d) for d in dvs])
l = [li... | {
"repo_name": "gillett-hernandez/project-euler",
"path": "Python/problem_88.py",
"copies": "1",
"size": "2187",
"license": "mit",
"hash": -9006740096424734000,
"line_mean": 23.5730337079,
"line_max": 126,
"alpha_frac": 0.5057155921,
"autogenerated": false,
"ratio": 2.951417004048583,
"config_te... |
from euler_funcs import get_primes, div, timed
from euler_funcs import prime_factorization as pf
from math import log
global debug
debug = False
def order(a, p):
m = 1
for i in range(p):
m *= a
m %= p
if m == 1:
return i+1
else:
assert False, (a, p, m, i)
def p... | {
"repo_name": "gillett-hernandez/project-euler",
"path": "Python/problem_133.py",
"copies": "1",
"size": "3685",
"license": "mit",
"hash": 2670236066742815000,
"line_mean": 22.6217948718,
"line_max": 104,
"alpha_frac": 0.4428765265,
"autogenerated": false,
"ratio": 2.7479492915734527,
"config_t... |
from eulerian_magnification.base import show_frequencies
from eulerian_magnification.io import _load_video, play_vid_data, load_image, load_video_float
from eulerian_magnification.transforms import uint8_to_float, float_to_uint8
from tests.base import DISPLAY_RESULTS
from .base import get_test_media_filepath, TEST_VID... | {
"repo_name": "brycedrennan/eulerian-magnification",
"path": "tests/test_transforms.py",
"copies": "1",
"size": "1117",
"license": "mit",
"hash": -1240830248271575300,
"line_mean": 31.8529411765,
"line_max": 94,
"alpha_frac": 0.7099373321,
"autogenerated": false,
"ratio": 2.931758530183727,
"co... |
from euler import digitize, permuteInts, undigitize
# 0 to 9
DIGITS = set(xrange(10))
def compute(nums, digitList, digitSet, answerList):
''' Recursively find the answer. '''
# Should be at a base case
if not nums:
if len(digitList) != 9: return
answer = undigitize(list(DIGITS.difference(... | {
"repo_name": "WalrusCow/euler",
"path": "Solutions/problem43.py",
"copies": "1",
"size": "1259",
"license": "mit",
"hash": -497797948814994370,
"line_mean": 25.2291666667,
"line_max": 74,
"alpha_frac": 0.6044479746,
"autogenerated": false,
"ratio": 3.439890710382514,
"config_test": false,
"h... |
from euler import digitize, undigitize
def isPalindrome(li):
''' Determine if a list is a palindrome. '''
# We don't need to check the middle elem
l = len(li)
for i in xrange(l / 2):
if li[i] != li[l - 1 - i]:
return False
return True
def dblPal():
''' Find sum of all doub... | {
"repo_name": "WalrusCow/euler",
"path": "Solutions/problem36.py",
"copies": "1",
"size": "1295",
"license": "mit",
"hash": -2721415706143248400,
"line_mean": 24.9,
"line_max": 77,
"alpha_frac": 0.5444015444,
"autogenerated": false,
"ratio": 3.354922279792746,
"config_test": false,
"has_no_ke... |
from Euler import prime_sieve
def divisors(n):
# get factors and their counts
factors = {}
nn = n
i = 2
while i*i <= nn:
while nn % i == 0:
if not i in factors:
factors[i] = 0
factors[i] += 1
nn //= i
i += 1
if nn > 1:
f... | {
"repo_name": "arvganesh/Project-Euler-Log",
"path": "Python/124.py",
"copies": "1",
"size": "1303",
"license": "unlicense",
"hash": 7645926760998877000,
"line_mean": 22.6909090909,
"line_max": 95,
"alpha_frac": 0.4811972371,
"autogenerated": false,
"ratio": 3.20935960591133,
"config_test": fal... |
##from eulerlib import generatePrimesSieve
##
##primes = []
##
### Not sure if this is a great way to factorate
##def factorate(num):
## """Return factors for a given number"""
## if num < 2:
## return {}
## factors = {}
## for p in primes:
## #if (primes[-1] < num): # generate only as many pr... | {
"repo_name": "feliposz/project-euler-solutions",
"path": "python/euler99.py",
"copies": "1",
"size": "1352",
"license": "mit",
"hash": -1302098039402329000,
"line_mean": 27.1666666667,
"line_max": 84,
"alpha_frac": 0.5939349112,
"autogenerated": false,
"ratio": 3.1737089201877935,
"config_test... |
from eulerlib import sumDigits
from time import time
import math
start = time()
a = [None]
##count = 0
##num = 10
##while len(a) <= 30:
## base = sumDigits(num)
## power = base
## if power > 1:
## while power <= num:
## power *= base
## if power == num:
## count +... | {
"repo_name": "feliposz/project-euler-solutions",
"path": "python/euler119.py",
"copies": "1",
"size": "1069",
"license": "mit",
"hash": 8899613510144445000,
"line_mean": 18.0892857143,
"line_max": 63,
"alpha_frac": 0.5135640786,
"autogenerated": false,
"ratio": 3.080691642651297,
"config_test"... |
from euler_math import primes_upto, divisors
from itertools import takewhile, combinations_with_replacement
class Abundant(object):
def __init__(self, limit):
self.limit = limit
self.primes = list(primes_upto(limit))
self.calculate_abundant_numbers()
self.calculate_pairs()
def... | {
"repo_name": "mre/the-coding-interview",
"path": "problems/euler/23/non_abundant.py",
"copies": "1",
"size": "1131",
"license": "mit",
"hash": 6628336690046825000,
"line_mean": 27.275,
"line_max": 69,
"alpha_frac": 0.6109637489,
"autogenerated": false,
"ratio": 3.4693251533742333,
"config_test... |
from euler_math import primes_upto
"""
Note: This is a pretty slow solution.
Here's some profiling output (using https://github.com/rkern/line_profiler)
python -m line_profiler consecutive_primes.py.lprof ✱ ◼
Timer unit: 1e-06 s
Total time: 30.2917 s
File: consecutive_primes.py
Function: find_prime_sequence at ... | {
"repo_name": "mre/the-coding-interview",
"path": "problems/euler/50/consecutive_primes.py",
"copies": "1",
"size": "2607",
"license": "mit",
"hash": -2411033862880795600,
"line_mean": 42.3833333333,
"line_max": 101,
"alpha_frac": 0.5240107568,
"autogenerated": false,
"ratio": 3.2496878901373285,... |
from euler_numbers import *
def four_digits(fun):
result = []
n = 1
while True:
value = fun(n)
digits = number_digits(value)
if digits == 4:
result.append(value)
elif digits > 4:
return result
n += 1
def first_two_digits(n):
# Assumes n is four digits
return n // 100
def las... | {
"repo_name": "brunorijsman/euler-problems-python",
"path": "euler/problem061.py",
"copies": "1",
"size": "1911",
"license": "bsd-2-clause",
"hash": 609589481675493900,
"line_mean": 23.5,
"line_max": 73,
"alpha_frac": 0.5907901622,
"autogenerated": false,
"ratio": 3.4745454545454546,
"config_te... |
from eulfedora.server import DigitalObject
import rdflib
from rdflib.namespace import RDF, Namespace
from eulfedora.models import ReverseRelation
from eulfedora.server import Repository
from eulfedora.server import DigitalObject
from django.conf import settings
from pidservices.djangowrapper.shortcuts import DjangoPid... | {
"repo_name": "emory-libraries/readux",
"path": "readux/books/management/commands/update_pid_ecds.py",
"copies": "1",
"size": "9129",
"license": "apache-2.0",
"hash": -4912225131126147000,
"line_mean": 39.3938053097,
"line_max": 135,
"alpha_frac": 0.5489100668,
"autogenerated": false,
"ratio": 3.... |
from eulfedora.server import Repository
from eulxml.xmlmap import load_xmlobject_from_file
from django.core.management.base import BaseCommand, CommandError
import shutil
from readux.books import annotate, export
from readux.books.models import Volume
from readux.books.tei import Facsimile
class Command(BaseCommand)... | {
"repo_name": "emory-libraries/readux",
"path": "readux/books/management/commands/web_export.py",
"copies": "1",
"size": "1332",
"license": "apache-2.0",
"hash": 6835819437949067000,
"line_mean": 36,
"line_max": 83,
"alpha_frac": 0.6306306306,
"autogenerated": false,
"ratio": 4.0120481927710845,
... |
from eulxml import xmlmap
from eulxml.xmlmap import mods
class MODS(mods.MODS):
'''Extend base :class:`eulxml.xmlmap.mods.MODS` with short-cut
fields for identifiers and access conditions with custom types.'''
ark = xmlmap.StringField('mods:identifier[@type="ark"]')
'''ARK (Archival Resource Key)... | {
"repo_name": "emory-libraries/eulcm",
"path": "eulcm/xmlmap/mods.py",
"copies": "1",
"size": "1452",
"license": "apache-2.0",
"hash": -5167961076553201000,
"line_mean": 47.4,
"line_max": 101,
"alpha_frac": 0.664600551,
"autogenerated": false,
"ratio": 3.989010989010989,
"config_test": false,
... |
from eulxml import xmlmap
from eulxml.xmlmap import teimap
class RocheTEI(teimap.Tei):
title_en = xmlmap.StringField('tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@xml:lang="en"]')
chapter = xmlmap.IntegerField('tei:text/tei:body/tei:div/@n')
chapter_title = xmlmap.StringField('tei:text/tei:body/te... | {
"repo_name": "beijingren/roche-website",
"path": "browser/models.py",
"copies": "1",
"size": "1035",
"license": "mit",
"hash": -8881748889186594000,
"line_mean": 33.5,
"line_max": 104,
"alpha_frac": 0.6975845411,
"autogenerated": false,
"ratio": 3.2043343653250775,
"config_test": false,
"has... |
from eulxml.xmlmap import XmlObject
from eulxml.xmlmap import load_xmlobject_from_string, load_xmlobject_from_file
from eulxml.xmlmap.fields import StringField, NodeListField, IntegerField
from hashlib import md5
from os import path, walk
from re import search
from shutil import copy2
import sys
import fileinput
class... | {
"repo_name": "jkylefenton/digitization_scripts",
"path": "book_digitization/checksumfix.py",
"copies": "1",
"size": "4588",
"license": "unlicense",
"hash": 6183395614988583000,
"line_mean": 37.2333333333,
"line_max": 124,
"alpha_frac": 0.5980819529,
"autogenerated": false,
"ratio": 3.11473183978... |
from eunike.objects import BackendInterface, Order
from eunike.textservices import unicode_to_sane_ascii
from threading import Lock
from satella.threads import BaseThread
from time import sleep, time
import serial
from Queue import Queue
from eunike.oxm.atcommand.notify import SMTPNotifier
from satella.instrumentation.... | {
"repo_name": "piotrmaslanka/eunike",
"path": "oxm/atcommand/__init__.py",
"copies": "1",
"size": "8318",
"license": "mit",
"hash": 2061542815112028400,
"line_mean": 31.1158301158,
"line_max": 116,
"alpha_frac": 0.527290214,
"autogenerated": false,
"ratio": 3.94218009478673,
"config_test": fals... |
from eunike.objects import BackendInterface, Order
from satella.threads import BaseThread
from time import sleep
import os, copy, json
import os.path
SMS_FILE_DEFAULTS = {
'tag': None,
'qos': 0,
'backend': None
}
class FileScan(BaseThread):
def __init__(self, eio, confsection):
BaseThread.__i... | {
"repo_name": "piotrmaslanka/eunike",
"path": "oam/filescan/__init__.py",
"copies": "1",
"size": "1834",
"license": "mit",
"hash": 4063678475528817700,
"line_mean": 27.671875,
"line_max": 80,
"alpha_frac": 0.5294438386,
"autogenerated": false,
"ratio": 4.030769230769231,
"config_test": false,
... |
from eunike.objects import EIOOAM, EIOOXM
from eunike.routing.backendmgr import BackendManager
from satella.instrumentation import CounterCollection
def register_objects(rlayer, confobjs, oams, oxms, insmgr):
"""
Called as part of Routing Layer initialization
@type oams: dict(handle::str => OAMInterface)
... | {
"repo_name": "piotrmaslanka/eunike",
"path": "routing/prepare.py",
"copies": "1",
"size": "1171",
"license": "mit",
"hash": 8771528673430459000,
"line_mean": 31.5277777778,
"line_max": 75,
"alpha_frac": 0.6157130658,
"autogenerated": false,
"ratio": 2.9129353233830844,
"config_test": false,
... |
from eunike.routing.prepare import register_objects
from satella.threads import BaseThread
import heapq
from satella.instrumentation.counters import CallbackCounter
import pickle
class RoutingLayer(BaseThread):
def terminate(self):
BaseThread.terminate(self)
self.bm.on_interesting_shit()
def _... | {
"repo_name": "piotrmaslanka/eunike",
"path": "routing/__init__.py",
"copies": "1",
"size": "2636",
"license": "mit",
"hash": 1414261779515335200,
"line_mean": 35.1095890411,
"line_max": 81,
"alpha_frac": 0.5569044006,
"autogenerated": false,
"ratio": 4.2176,
"config_test": false,
"has_no_key... |
from eupheme.cookies import CookieManager, InvalidOperationException
import codecs
import nose
CookieManager.key = "bzuz8RDABLhqt"
CookieManager.codec = codecs.lookup('utf-8')
cookies = CookieManager()
cookies_ro = CookieManager.load({'testcookie': 'testval'}, ro=True)
def test_valid_cookie():
""" Test if valid... | {
"repo_name": "Parnassos/Eupheme",
"path": "tests/test_cookies.py",
"copies": "1",
"size": "2398",
"license": "bsd-3-clause",
"hash": 1560989370039928300,
"line_mean": 28.243902439,
"line_max": 120,
"alpha_frac": 0.7051709758,
"autogenerated": false,
"ratio": 3.7943037974683542,
"config_test": ... |
from euphoria import connection as cn
from euphoria import room
class AgentIdRoom(room.Room):
"""
An agent ID room keeps track of your agent ID.
"""
def __init__(self, roomname, password=None, attempts=None):
super().__init__(roomname, password, attempts)
self.connection.add_callback... | {
"repo_name": "ArkaneMoose/BotBot",
"path": "botbot/agentid_room.py",
"copies": "1",
"size": "1120",
"license": "mit",
"hash": 7532613414391028000,
"line_mean": 25.0465116279,
"line_max": 88,
"alpha_frac": 0.5553571429,
"autogenerated": false,
"ratio": 4.102564102564102,
"config_test": false,
... |
from euphoria import connection as cn
from euphoria import room
class LongMessageRoom(room.Room):
"""
A long message room allows your bot to automatically retrieve long messages.
If this room is implemented, handle_chat(message) should be ignored if
message.get('truncated') == True, as the handle_chat... | {
"repo_name": "ArkaneMoose/BotBot",
"path": "botbot/longmessage_room.py",
"copies": "1",
"size": "1375",
"license": "mit",
"hash": -4532684982396311000,
"line_mean": 29.5555555556,
"line_max": 86,
"alpha_frac": 0.6392727273,
"autogenerated": false,
"ratio": 4.166666666666667,
"config_test": fal... |
from eurekaclinical import APISession, API, Struct, construct_api_session_context_manager
class Job(Struct):
def __init__(self):
super(Job, self).__init__()
self.sourceConfigId = None
self.destinationId = None
self.dateRangePhenotypeKey = None
self.earliestDate = None
... | {
"repo_name": "eurekaclinical/eureka-python-client",
"path": "eurekaclinical/analytics/client.py",
"copies": "1",
"size": "2069",
"license": "apache-2.0",
"hash": 5527508772419956000,
"line_mean": 30.3484848485,
"line_max": 109,
"alpha_frac": 0.6070565491,
"autogenerated": false,
"ratio": 3.52470... |
from eurreca.models import Study, Genotype, Phenotype, Panel, Interaction, Link_to_dbSNP
from eurreca.forms import StudyFormSet, StudyForm, GenotypeFormSet, GenotypeForm, PhenotypeFormSet, PhenotypeForm, PanelForm, PanelFormSet, InteractionForm, InteractionFormSet
from itertools import chain
import operator, time, u... | {
"repo_name": "thehyve/variant",
"path": "eurreca/utils.py",
"copies": "1",
"size": "28189",
"license": "apache-2.0",
"hash": -3235793665178280400,
"line_mean": 42.6060126582,
"line_max": 325,
"alpha_frac": 0.55078222,
"autogenerated": false,
"ratio": 4.117586912065439,
"config_test": false,
... |
from eurreca.models import Study, Genotype, Phenotype, Panel, Interaction
from itertools import chain
import utils
from django.db.models import Q
def search(search_terms):
q_dicts = {'genotype':{},'phenotype':{},'panel':{},'study':{},
'interaction':{}}
q_objects = {'genotype':[],'phenotype... | {
"repo_name": "thehyve/variant",
"path": "eurreca/advanced_search.py",
"copies": "1",
"size": "4955",
"license": "apache-2.0",
"hash": -7197316450417274000,
"line_mean": 42.2589285714,
"line_max": 136,
"alpha_frac": 0.5711402624,
"autogenerated": false,
"ratio": 4.074835526315789,
"config_test"... |
from eutester.testcase_utils.eutestcase import EutesterTestCase, SkipTestException
from cloud_utils.net_utils.sshconnection import SshConnection
##################################################################################################
# Create the testcase object ... | {
"repo_name": "nephomaniac/eutester",
"path": "eutester/testcases/sample_testsuite.py",
"copies": "1",
"size": "9815",
"license": "bsd-2-clause",
"hash": -33861169493102430,
"line_mean": 64.8724832215,
"line_max": 98,
"alpha_frac": 0.4421803362,
"autogenerated": false,
"ratio": 5.811130846654826,... |
from eutils import Client
from bioprocs.utils.tsvio import TsvWriter, TsvRecord
from time import sleep
term = {{i.term | repr}}
outfile = {{o.outfile | quote}}
prog = {{args.prog | quote}}
apikey = {{args.apikey | quote}} or None
db = {{args.db | quote}}
joiner = {{args.joiner | quote}}
record = {... | {
"repo_name": "pwwang/bioprocs",
"path": "bioprocs/scripts/misc/pNCBI.py",
"copies": "1",
"size": "1729",
"license": "mit",
"hash": 7636643003054708000,
"line_mean": 23.7,
"line_max": 71,
"alpha_frac": 0.6252168884,
"autogenerated": false,
"ratio": 2.7314375987361768,
"config_test": false,
"h... |
from ev3control.rpc import Robot
from nn_object_detection.object_detectors import NNObjectDetector
import cv2
from brain.controllers import move_to_brick_blind_and_grip, wait_for_brick
from brain.core import State
from brain.core import main_loop
import time
# Path to frozen detection graph. This is the actual model t... | {
"repo_name": "TheCamusean/DLRCev3",
"path": "scripts/benchmarks/neural_network_object_detection_benchmark.py",
"copies": "1",
"size": "1597",
"license": "mit",
"hash": -1119028694553334100,
"line_mean": 32.2708333333,
"line_max": 155,
"alpha_frac": 0.6186599875,
"autogenerated": false,
"ratio": ... |
from ev3dev.auto import *
import time
import cwiid
def clamp(value, lower, upper):
return min(upper, max(value, lower))
print('press 1+2 on the wiimote now')
time.sleep(1)
w = cwiid.Wiimote()
print('connected?')
w.led = 6
w.rpt_mode = cwiid.RPT_ACC | cwiid.RPT_BTN
left_motor = Motor(OUTPUT_B)
left_motor.reset(... | {
"repo_name": "luca-and-sons/ev3dev",
"path": "wiimote.py",
"copies": "1",
"size": "2102",
"license": "apache-2.0",
"hash": 9176501489196118000,
"line_mean": 24.6341463415,
"line_max": 88,
"alpha_frac": 0.5409134158,
"autogenerated": false,
"ratio": 3.1186943620178043,
"config_test": false,
"... |
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor, InfraredSensor
from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor
import time
import ev3dev.auto as auto
import ev3dev.ev3 as ev3
#from ev3dev.ev3 import *
import ev3dev.core as core
#ultrasonicSensor = UltrasonicSenso... | {
"repo_name": "chandlercr/aima-python",
"path": "submissions/Kinley/Lego/lego.py",
"copies": "2",
"size": "88653",
"license": "mit",
"hash": 5705633325550721000,
"line_mean": 48.4715401786,
"line_max": 93,
"alpha_frac": 0.7034505318,
"autogenerated": false,
"ratio": 2.4080673638462584,
"config_... |
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor
from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor
import time
import ev3dev.ev3 as ev3
#ultrasonicSensor = UltrasonicSensor(INPUT_1)
#colorSensor = ColorSensor(INPUT_2)
clawMotor = MediumMotor(OUTPUT_B)
leftTire = Large... | {
"repo_name": "chandlercr/aima-python",
"path": "submissions/Kinley/lego.py",
"copies": "2",
"size": "2118",
"license": "mit",
"hash": -3706094382131662000,
"line_mean": 29.2714285714,
"line_max": 77,
"alpha_frac": 0.7058545798,
"autogenerated": false,
"ratio": 2.4068181818181817,
"config_test"... |
from ev3dev.ev3 import GyroSensor
from sensor_watcher import SensorWatcher
class CalibrationError(Exception):
def __init__(self, msg, value = None):
self.msg = msg
self.value = value
class GyroWatcher(SensorWatcher):
def __init__(self, event_receiver, watch_frequency = 0.2):
self.gs ... | {
"repo_name": "alriedel/ev3-control",
"path": "input/gyro_watcher.py",
"copies": "1",
"size": "1047",
"license": "mit",
"hash": -3157960002428513000,
"line_mean": 33.9,
"line_max": 94,
"alpha_frac": 0.6017191977,
"autogenerated": false,
"ratio": 3.4440789473684212,
"config_test": false,
"has_... |
from ev3dev.ev3 import Leds
import threading
from time import sleep
_MIN_BLINK_PERIOD_ = 0.7
class LedControl(threading.Thread):
def __init__(self, init_left_color = Leds.GREEN, init_right_color = Leds.GREEN):
self.init_left_color = init_left_color
self.init_right_color = init_right_color
... | {
"repo_name": "alriedel/ev3-control",
"path": "output/led_control.py",
"copies": "1",
"size": "2190",
"license": "mit",
"hash": 4607038634724149000,
"line_mean": 34.3225806452,
"line_max": 84,
"alpha_frac": 0.596347032,
"autogenerated": false,
"ratio": 3.5842880523731586,
"config_test": false,
... |
from ev3dev.ev3 import MediumMotor, ColorSensor
from argparse import ArgumentParser
import time
import zmq
context = zmq.Context()
socket = context.socket(zmq.REQ)
parser = ArgumentParser()
parser.add_argument('server')
parser.add_argument('-p', '--port', type=int, default=5000)
parser.add_argument('-m', '--motor-por... | {
"repo_name": "pep-dortmund/mindstorms",
"path": "python-examples/marble_sort/marble_sort_brick.py",
"copies": "1",
"size": "2309",
"license": "mit",
"hash": -5181631488692903000,
"line_mean": 25.2386363636,
"line_max": 67,
"alpha_frac": 0.5803378086,
"autogenerated": false,
"ratio": 3.5144596651... |
from ev3dev import ev3
import code
from controller import PID
import time
from threading import Thread, Event
class GyroBoy:
def __init__(
self,
left_motor_port='outD',
right_motor_port='outA',
arm_motor_port='outB',
color_port='in1',
gyro_p... | {
"repo_name": "pep-dortmund/mindstorms",
"path": "python-examples/gyro-boy/gyroboy.py",
"copies": "1",
"size": "3724",
"license": "mit",
"hash": 5715296598399913000,
"line_mean": 26.7910447761,
"line_max": 69,
"alpha_frac": 0.5249731472,
"autogenerated": false,
"ratio": 3.5980676328502414,
"con... |
from .ev3dev import I2CS
from .ev3dev import LegoSensor
class MindSensorI2CS(I2CS):
@property
def version(self):
return self.read_byte_array_as_string(0x00, 8)
@property
def vendor_id(self):
return self.read_byte_array_as_string(0x08, 8)
@property
def device_id(self):
... | {
"repo_name": "evz/python-ev3",
"path": "ev3/mindsensors.py",
"copies": "3",
"size": "3673",
"license": "apache-2.0",
"hash": -70958674403846856,
"line_mean": 19.9885714286,
"line_max": 71,
"alpha_frac": 0.5711952083,
"autogenerated": false,
"ratio": 3.0305280528052805,
"config_test": false,
... |
from .ev3dev import I2CS
class MindSensorI2CS(I2CS):
@property
def version(self):
return self.read_byte_array_as_string(0x00, 8)
@property
def vendor_id(self):
return self.read_byte_array_as_string(0x08, 8)
@property
def device_id(self):
return self.read_byte_array_a... | {
"repo_name": "dan-ionut-fechete/ev3",
"path": "ev3/mindsensors.py",
"copies": "1",
"size": "2430",
"license": "apache-2.0",
"hash": -515576754084426900,
"line_mean": 22.1428571429,
"line_max": 85,
"alpha_frac": 0.5650205761,
"autogenerated": false,
"ratio": 2.5,
"config_test": false,
"has_no... |
from .ev3dev import LegoSensor, Motor
class TouchSensor(LegoSensor):
def __init__(self, port=-1):
# Both lego-nxt-touch and lego-ev3-touch support auto
LegoSensor.__init__(self, port, name='lego-ev3-touch')
@property
def is_pushed(self):
self.mode = 'TOUCH'
return bool(se... | {
"repo_name": "MaxNoe/python-ev3",
"path": "ev3/lego.py",
"copies": "3",
"size": "5401",
"license": "apache-2.0",
"hash": 7343470262661690000,
"line_mean": 23.8894009217,
"line_max": 80,
"alpha_frac": 0.5669320496,
"autogenerated": false,
"ratio": 3.3989930774071744,
"config_test": false,
"ha... |
from .ev3dev import Msensor, Motor
class TouchSensor(Msensor):
def __init__(self, port=-1):
Msensor.__init__(self, port, type_id=16, name='lego-ev3-touch')
@property
def is_pushed(self):
self.mode = 'TOUCH'
return bool(self.value0)
class ColorSensor(Msensor):
colors = (None... | {
"repo_name": "dan-ionut-fechete/ev3",
"path": "ev3/lego.py",
"copies": "1",
"size": "3026",
"license": "apache-2.0",
"hash": 3651784480147014000,
"line_mean": 20.9275362319,
"line_max": 71,
"alpha_frac": 0.5627891606,
"autogenerated": false,
"ratio": 3.2607758620689653,
"config_test": false,
... |
from ev3.ev3dev import Lcd
from PIL import Image, ImageDraw, ImageFont
import time
from ev3.ev3dev import Key
from ev3.ev3dev import Tone
import os
from modules import Robot
class TestLcd():
count = [1, 1, 0, 0, 0]
pos = 0
d = Lcd()
k = Key()
t = Tone()
r = Robot.Robot()
def test(self):
... | {
"repo_name": "KMPSUJ/lego_robot",
"path": "lcd.py",
"copies": "1",
"size": "1961",
"license": "mit",
"hash": 5432945206195336000,
"line_mean": 27.4202898551,
"line_max": 79,
"alpha_frac": 0.4915859255,
"autogenerated": false,
"ratio": 2.957767722473605,
"config_test": false,
"has_no_keywords... |
from ev3.ev3dev import Motor
from ev3.lego import MediumMotor
class m_over(Motor):
def set_rel_position(self, position_sp=720, speed_sp=500, **kwargs):
self.run_mode = 'position'
self.position_mode = 'relative'
self.regulation_mode = True
for k in kwargs:
v = kwargs[k]
... | {
"repo_name": "KMPSUJ/lego_robot",
"path": "modules/override.py",
"copies": "1",
"size": "1113",
"license": "mit",
"hash": -118874782327564820,
"line_mean": 29.9166666667,
"line_max": 72,
"alpha_frac": 0.5831087152,
"autogenerated": false,
"ratio": 3.467289719626168,
"config_test": false,
"ha... |
from ev3.ev3dev import Motor
class ev(Motor):
def start(self):
self.write_value('command', self.mode)
self.write_value('run', '1')
def stop(self):
self.write_value('command', 'stop')
self.write_value('run', '0')
def setup_position_limited(self, position_sp, speed_sp, absolute=True, **k... | {
"repo_name": "blaginin/asm_ev3",
"path": "ev.py",
"copies": "1",
"size": "1585",
"license": "apache-2.0",
"hash": -4710765721564720000,
"line_mean": 22.796875,
"line_max": 82,
"alpha_frac": 0.6201892744,
"autogenerated": false,
"ratio": 2.7661431064572426,
"config_test": false,
"has_no_keywo... |
from ev3.lego import InfraredSensor
from ev3.lego import ColorSensor
from ev3.lego import LargeMotor
from ev3.lego import MediumMotor
from ev3.ev3dev import Key
from ev3.ev3dev import LED
from ev3.ev3dev import Motor
import time
import subprocess
class Robot:
def __init__(self):
self.ir = InfraredSensor()
... | {
"repo_name": "BigMac/legolas1",
"path": "robot.py",
"copies": "1",
"size": "9778",
"license": "mit",
"hash": -940232545870998300,
"line_mean": 37.1953125,
"line_max": 96,
"alpha_frac": 0.5609531602,
"autogenerated": false,
"ratio": 3.7377675840978593,
"config_test": false,
"has_no_keywords":... |
from .evalf import evalf
from .symbolic import numerical, isket
import numpy as np
import scipy
def sparse_aware_dot(l,r): # XXX This should be in scipy!?
if scipy.sparse.issparse(l):
return l.dot(r)
elif scipy.sparse.issparse(r):
return type(r).dot(l,r)
return l.dot(r)
dot = sparse_aware_... | {
"repo_name": "Krastanov/cutiepy",
"path": "cutiepy/expect.py",
"copies": "1",
"size": "1330",
"license": "bsd-3-clause",
"hash": 912174699405066100,
"line_mean": 33.1025641026,
"line_max": 86,
"alpha_frac": 0.6240601504,
"autogenerated": false,
"ratio": 3.057471264367816,
"config_test": false,... |
from evalindexdata import EvalIndexDataSell
class EvalWinSellCall(EvalIndexDataSell):
def __init__(self, maxLoss):
self.maxLoss = maxLoss
self.lastClose = 0.0
def updateState(self, indexData, lastBuy):
self.lastClose = lastBuy.close
def evaluateMaxLoss(self, close)... | {
"repo_name": "selentd/pythontools",
"path": "pytools/src/oldsrc/evalwin.py",
"copies": "1",
"size": "1247",
"license": "apache-2.0",
"hash": -8050681024199406000,
"line_mean": 27.3636363636,
"line_max": 52,
"alpha_frac": 0.5829991981,
"autogenerated": false,
"ratio": 4.061889250814332,
"config... |
from eval.ner.sequences.log_domain import *
class SequenceClassificationDecoder():
''' Implements a sequence classification decoder.'''
def __init__(self):
pass
######
# Computes the forward trellis for a given sequence.
# Receives:
#
# Initial scores: (num_states) array
# Tr... | {
"repo_name": "rug-compling/hmm-reps",
"path": "eval/ner/sequences/sequence_classification_decoder.py",
"copies": "1",
"size": "4943",
"license": "mit",
"hash": 9180494989400743000,
"line_mean": 38.544,
"line_max": 118,
"alpha_frac": 0.6119765325,
"autogenerated": false,
"ratio": 3.77328244274809... |
from evalsupport import deco_alpha
from evalsupport import MetaAleph
print('<[1]> evaltime_meta module start')
@deco_alpha
class ClassThree():
print('<[2]> ClassThree body')
def method_y(self):
print('<[3]> ClassThree.method_y')
class ClassFour(ClassThree):
print('<[4]> ClassFour body')
d... | {
"repo_name": "dcbdmb/example-code",
"path": "21-class-metaprog/evaltime_meta.py",
"copies": "7",
"size": "1145",
"license": "mit",
"hash": 6172349227822020000,
"line_mean": 20.6037735849,
"line_max": 46,
"alpha_frac": 0.5834061135,
"autogenerated": false,
"ratio": 3.252840909090909,
"config_te... |
from evalsupport import deco_alpha
print('<[1]> evaltime module start')
class ClassOne():
print('<[2]> ClassOne body')
def __init__(self):
print('<[3]> ClassOne.__init__')
def __del__(self):
print('<[4]> ClassOne.__del__')
def method_x(self):
print('<[5]>... | {
"repo_name": "stephenl6705/fluentPy",
"path": "evaltime.py",
"copies": "1",
"size": "1055",
"license": "mit",
"hash": 8073843879354767000,
"line_mean": 22.4666666667,
"line_max": 46,
"alpha_frac": 0.5213270142,
"autogenerated": false,
"ratio": 3.6006825938566553,
"config_test": false,
"has_n... |
from evaluate import evaluate_model
from models import *
from train import train_model
from visualize import visualize_model_performance
num_epochs = 50
model0 = model_0()
model1 = model_1()
model2 = model_2()
model3 = model_3()
baseline_model_path = train_model(model0, str(model0.name) + "_p3_baseline_balanced_weig... | {
"repo_name": "williamdjones/cv_assignment_5",
"path": "part3.py",
"copies": "1",
"size": "1345",
"license": "mit",
"hash": 985083449639342100,
"line_mean": 45.3793103448,
"line_max": 120,
"alpha_frac": 0.6802973978,
"autogenerated": false,
"ratio": 3.002232142857143,
"config_test": false,
"h... |
from evaluate import parse_expression_into_parts, infix_parts_to_postfix, evaluate_infix, \
evaluate_infix_str
EXPR = "9 - ( 1 + 3 ) * 2"
INFIX_PARTS = [9, '-', '(', 1, '+', 3, ')', '*', 2]
POSTFIX_PARTS = [9, 1, 3, '+', 2, '*', '-']
def test_infix_parts_to_postfix():
assert infix_parts_to_postfix(INFIX_PAR... | {
"repo_name": "tylerprete/evaluate-math",
"path": "test_evaluate.py",
"copies": "1",
"size": "1077",
"license": "mit",
"hash": -2603165371799162000,
"line_mean": 33.7419354839,
"line_max": 91,
"alpha_frac": 0.5812441968,
"autogenerated": false,
"ratio": 2.8342105263157893,
"config_test": false,... |
from evaluate_user import evaluate_user
from Tkinter import *
from ScrolledText import ScrolledText
from ttk import Frame, Button, Label, Style
import re
class EvaluatorWindow(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.title("Twitte... | {
"repo_name": "ngrudzinski/sentiment_analysis_437",
"path": "main.py",
"copies": "1",
"size": "1882",
"license": "apache-2.0",
"hash": -1711670781525396200,
"line_mean": 29.3709677419,
"line_max": 108,
"alpha_frac": 0.6200850159,
"autogenerated": false,
"ratio": 3.5916030534351147,
"config_test... |
from evaluate.utils.executor import CommandExecutor
from utils.archives import get_file_name_list, extract_or_copy
from grader.settings import PROJECT_ROOT
import pickle, os, shutil, tempfile
# Class to manage custom testcases (student fed input files)
class CustomTestcase(object):
def __init__(self, inputFile, p... | {
"repo_name": "kartikshah1/Test",
"path": "evaluate/utils/checkOutput.py",
"copies": "1",
"size": "6055",
"license": "mit",
"hash": 7197486871215122000,
"line_mean": 44.1865671642,
"line_max": 146,
"alpha_frac": 0.6184971098,
"autogenerated": false,
"ratio": 4.279151943462898,
"config_test": tr... |
from evaluation import Evaluation
import matplotlib.pyplot as plt
import numpy as np
from evaluation import Evaluation
class GraphResults:
""" Graphical display of results from the `Evaluation` library. """
def __init__(self):
self.RE = Evaluation()
def graph_commonness(self, size):
"""
... | {
"repo_name": "jacobkrantz/ProbSyllabifier",
"path": "utils/evaluation/graphResults.py",
"copies": "1",
"size": "4867",
"license": "mit",
"hash": -8848348534361296000,
"line_mean": 32.1088435374,
"line_max": 88,
"alpha_frac": 0.5574275735,
"autogenerated": false,
"ratio": 3.6983282674772036,
"c... |
from evaluation import Evaluator, EvaluatorInput
from sklearn.metrics import confusion_matrix, classification_report, accuracy_score
import time
import numpy
import dill
from sklearn.metrics import confusion_matrix
def print_cm(cm, labels, hide_labels=True, file=None, hide_zeroes=False, hide_diagonal=False, hide_thre... | {
"repo_name": "pymir3/pymir3",
"path": "scripts/acf/ev_simple.py",
"copies": "1",
"size": "2525",
"license": "mit",
"hash": -5331999297839402000,
"line_mean": 29.0714285714,
"line_max": 115,
"alpha_frac": 0.5504950495,
"autogenerated": false,
"ratio": 3.86085626911315,
"config_test": false,
"... |
from evaluation.python_evaluator import Evaluator
from helpers.read_conll_files import ConllReader
from helpers.static import Static
class ValidationSetEvaluator:
inner = None
epochs_between_tests = None
max_epochs = None
early_stopping = None
def __init__(self, inner, evaluator):
self.... | {
"repo_name": "MichSchli/QuestionAnsweringGCN",
"path": "old_version/experiment_construction/learner_construction/validation_set_evaluator.py",
"copies": "1",
"size": "2211",
"license": "mit",
"hash": -8954887203382626000,
"line_mean": 37.1206896552,
"line_max": 209,
"alpha_frac": 0.6472184532,
"au... |
from evaluation.python_evaluator import Evaluator
from helpers.read_conll_files import ConllReader
import json
import numpy as np
class SivaJsonReader():
gold = None
def __init__(self, gold=False):
self.gold = gold
def parse_file(self, filename):
for line in open("data/webquestions/wq.b... | {
"repo_name": "MichSchli/QuestionAnsweringGCN",
"path": "old_version/tools/evaluate_siva_file.py",
"copies": "1",
"size": "1129",
"license": "mit",
"hash": 101724218073353340,
"line_mean": 28.7368421053,
"line_max": 98,
"alpha_frac": 0.6005314438,
"autogenerated": false,
"ratio": 4.04659498207885... |
from evaluation.python_evaluator import Evaluator
from helpers.read_conll_files import ConllReader
class DummyLearner:
preprocessor = None
candidate_generator = None
model = None
def __init__(self, validation_file_location, prefix):
self.validation_file_iterator = ConllReader(validation_fil... | {
"repo_name": "MichSchli/QuestionAnsweringGCN",
"path": "old_version/experiment_construction/learner_construction/dummy_learner.py",
"copies": "1",
"size": "1325",
"license": "mit",
"hash": 2735077903995816000,
"line_mean": 29.8372093023,
"line_max": 99,
"alpha_frac": 0.6996226415,
"autogenerated":... |
from evaluation.visualization import visualize_results, visualize_learning
from apply_model import myelin, pipeline
from learning.data_construction import build_data
from mrf import learn_mrf
from learn_model import learn_model
import os
def test_prediction():
build_data('/Users/viherm/Desktop/CARS','/Users/viher... | {
"repo_name": "vherman3/AxonSegmentation",
"path": "AxonDeepSeg/test.py",
"copies": "1",
"size": "2295",
"license": "mit",
"hash": 456379452004567500,
"line_mean": 38.5689655172,
"line_max": 108,
"alpha_frac": 0.748583878,
"autogenerated": false,
"ratio": 3.0397350993377485,
"config_test": fals... |
from evaluator.dptables import SUITS
from evaluator.hashtable import FLUSH
from evaluator.hashtable5 import NO_FLUSH_5
from evaluator.hash import hash_quinary
binaries_by_id = [
0x1, 0x1, 0x1, 0x1,
0x2, 0x2, 0x2, 0x2,
0x4, 0x4, 0x4, 0x4,
0x8, 0x8, 0x8, 0x8,
0x10, 0x10, 0x10, 0x10,
0x20, 0x2... | {
"repo_name": "HenryRLee/PokerHandEvaluator",
"path": "python/phevaluator/evaluator/evaluator5.py",
"copies": "1",
"size": "1350",
"license": "apache-2.0",
"hash": -7715066416024214000,
"line_mean": 25.4705882353,
"line_max": 49,
"alpha_frac": 0.6037037037,
"autogenerated": false,
"ratio": 1.9940... |
from evaluator.dptables import SUITS
from evaluator.hashtable import FLUSH
from evaluator.hashtable6 import NO_FLUSH_6
from evaluator.hash import hash_quinary
binaries_by_id = [
0x1, 0x1, 0x1, 0x1,
0x2, 0x2, 0x2, 0x2,
0x4, 0x4, 0x4, 0x4,
0x8, 0x8, 0x8, 0x8,
0x10, 0x10, 0x10, 0x10,
0x20, 0x2... | {
"repo_name": "HenryRLee/PokerHandEvaluator",
"path": "python/phevaluator/evaluator/evaluator6.py",
"copies": "1",
"size": "1454",
"license": "apache-2.0",
"hash": -1899650100597003500,
"line_mean": 25.9259259259,
"line_max": 49,
"alpha_frac": 0.6004126547,
"autogenerated": false,
"ratio": 2.0027... |
from evaluator.dptables import SUITS
from evaluator.hashtable import FLUSH
from evaluator.hashtable7 import NO_FLUSH_7
from evaluator.hash import hash_quinary
binaries_by_id = [
0x1, 0x1, 0x1, 0x1,
0x2, 0x2, 0x2, 0x2,
0x4, 0x4, 0x4, 0x4,
0x8, 0x8, 0x8, 0x8,
0x10, 0x10, 0x10, 0x10,
0x20, 0x2... | {
"repo_name": "HenryRLee/PokerHandEvaluator",
"path": "python/phevaluator/evaluator/evaluator7.py",
"copies": "1",
"size": "1558",
"license": "apache-2.0",
"hash": 8821629115461199000,
"line_mean": 26.3333333333,
"line_max": 49,
"alpha_frac": 0.5975609756,
"autogenerated": false,
"ratio": 2.01032... |
from evaluator.dptables import SUITS
from evaluator.hashtable import FLUSH
from evaluator.hashtable_omaha import NO_FLUSH_OMAHA
from evaluator.hashtable_omaha import FLUSH_OMAHA
from evaluator.hash import hash_quinary
from evaluator.hash import hash_binary
binaries_by_id = [
0x1, 0x1, 0x1, 0x1,
0x2, 0x2, 0x2,... | {
"repo_name": "HenryRLee/PokerHandEvaluator",
"path": "python/phevaluator/evaluator/evaluator_omaha.py",
"copies": "1",
"size": "3071",
"license": "apache-2.0",
"hash": -6168075618632944000,
"line_mean": 30.6597938144,
"line_max": 71,
"alpha_frac": 0.611201563,
"autogenerated": false,
"ratio": 2.... |
from evaluator.evaluator5 import evaluate_5cards
from evaluator.evaluator import evaluate_cards
import time
def evaluate_all_five_card_hands():
for a in range(48):
for b in range(a+1, 49):
for c in range(b+1, 50):
for d in range(c+1, 51):
for e in range(d+1, 52):
evaluate_car... | {
"repo_name": "HenryRLee/PokerHandEvaluator",
"path": "python/phevaluator/benchmark.py",
"copies": "1",
"size": "1528",
"license": "apache-2.0",
"hash": 797991788086255900,
"line_mean": 30.1836734694,
"line_max": 79,
"alpha_frac": 0.5268324607,
"autogenerated": false,
"ratio": 3.137577002053388,
... |
from evaluator.evaluator import evaluate_cards
def example1():
print('Example 1: A Texas Holdem example')
a = 7 * 4 + 0 # 9c
b = 2 * 4 + 0 # 4c
c = 2 * 4 + 3 # 4s
d = 7 * 4 + 1 # 9d
e = 2 * 4 + 2 # 4h
# Player 1
f = 10 * 4 + 0 # Qc
g = 4 * 4 + 0 # 6c
# Player 2
h = 0 * 4 + 0 # 2c
i = 7 * 4... | {
"repo_name": "HenryRLee/PokerHandEvaluator",
"path": "python/phevaluator/examples.py",
"copies": "1",
"size": "1558",
"license": "apache-2.0",
"hash": -7744759032763512000,
"line_mean": 27.3272727273,
"line_max": 79,
"alpha_frac": 0.5564826701,
"autogenerated": false,
"ratio": 2.6451612903225805... |
from evaluator import Evaluator
from card import Card
from deck import Deck
from itertools import combinations
evaluator = Evaluator()
class Util():
# In order of 2 - A, s-c-h-d
FULL_DECK = set()
# In order of 2:deck, 3: deck-2, 4: deck-2,3
# d-c-s-h
ALL_HOLE_CARDS = []
# Tuples
# key = pa... | {
"repo_name": "simonbw/poker-player",
"path": "util.py",
"copies": "1",
"size": "7079",
"license": "mit",
"hash": -2874629684948271000,
"line_mean": 43.5283018868,
"line_max": 108,
"alpha_frac": 0.5538917926,
"autogenerated": false,
"ratio": 3.710167714884696,
"config_test": false,
"has_no_ke... |
from evaluator import Evaluator
from card import Card
from util import Util
evaluator = Evaluator()
util = Util()
average_range= set()
for set_ in Util.PAIRS.values():
average_range |= set_
average_range |= (Util.UNSUITED['AK'] | Util.UNSUITED['K8'] |
Util.UNSUITED['AQ'] | Util.UNSUITED['QJ'] |
... | {
"repo_name": "simonbw/poker-player",
"path": "test.py",
"copies": "1",
"size": "1246",
"license": "mit",
"hash": -4184414659637328000,
"line_mean": 40.5666666667,
"line_max": 105,
"alpha_frac": 0.6099518459,
"autogenerated": false,
"ratio": 3.0242718446601944,
"config_test": false,
"has_no_k... |
from evdev import ecodes
import evdev
# http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
# See chapter 10 for keycodes.
EVDEV_TO_HID_MAP = {
ecodes.KEY_A: 0x04,
ecodes.KEY_B: 0x05,
ecodes.KEY_C: 0x06,
ecodes.KEY_D: 0x07,
ecodes.KEY_E: 0x08,
ecodes.KEY_F: 0x09,
ecodes.KEY_G: 0x0A,
ec... | {
"repo_name": "miikka-h/Projektikurssi17",
"path": "pi3/hid_report.py",
"copies": "1",
"size": "5714",
"license": "mit",
"hash": -1187887862379534800,
"line_mean": 25.7009345794,
"line_max": 91,
"alpha_frac": 0.5990549527,
"autogenerated": false,
"ratio": 2.6380424746075715,
"config_test": fals... |
from evdev import ecodes
import time
#user tablet settings
LEFT_HANDED = False #rotate pen and track 180 if true
TRACKPAD_ENABLED = True #since it's sort of in the way
# playing with these pressure curves types
PRESSURE_CURVE = False # LINEAR, SOFT, HARD
#soft = sqrt(z); hard = x^2
#false means no additional... | {
"repo_name": "dannytaylor/pinspiroy",
"path": "default.py",
"copies": "1",
"size": "4077",
"license": "mit",
"hash": 659428392712124500,
"line_mean": 29.2074074074,
"line_max": 116,
"alpha_frac": 0.7157223449,
"autogenerated": false,
"ratio": 2.1966594827586206,
"config_test": false,
"has_no... |
from evdev import InputDevice as HID, list_devices, ecodes
from time import sleep
from skeleton import InputSkeleton
def get_input_devices():
"""Returns list of all the available InputDevices"""
return [HID(fn) for fn in list_devices()]
def get_path_by_name(name):
"""Gets HID device path by name, returns... | {
"repo_name": "CRImier/WCS",
"path": "input/drivers/hid.py",
"copies": "2",
"size": "3138",
"license": "apache-2.0",
"hash": -3960503675221428700,
"line_mean": 33.4835164835,
"line_max": 105,
"alpha_frac": 0.5245379222,
"autogenerated": false,
"ratio": 4.3888111888111885,
"config_test": false,
... |
from evdev import InputDevice, categorize, ecodes
from phue import Bridge
import random
# general info Makey Makey: https://learn.sparkfun.com/tutorials/makey-makey-quickstart-guide & https://learn.sparkfun.com/tutorials/makey-makey-advanced-guide
# evdev library: https://python-evdev.readthedocs.io/en/latest/
# phue ... | {
"repo_name": "hku-maplab/HUElights",
"path": "python/makeyHue.py",
"copies": "1",
"size": "2196",
"license": "mit",
"hash": -3366260176967756300,
"line_mean": 35,
"line_max": 159,
"alpha_frac": 0.6234061931,
"autogenerated": false,
"ratio": 3.337386018237082,
"config_test": false,
"has_no_ke... |
from evdev import InputDevice, categorize, ecodes
from pyfirmata import Arduino, util
# Define an enumeration to represent the state of the MakeyMakey touch.
touchStateMap = {
1: "press",
2: "hold",
0: "release"
}
def behavior1(touchState):
print "behavior 1: " + touchState
def behavior2(touchState):
prin... | {
"repo_name": "merose/MakeyPiano",
"path": "test-programs/makeyBehavior.py",
"copies": "1",
"size": "1840",
"license": "apache-2.0",
"hash": -6898163599237597000,
"line_mean": 25.2857142857,
"line_max": 90,
"alpha_frac": 0.6331521739,
"autogenerated": false,
"ratio": 3.256637168141593,
"config_... |
from evdev import InputDevice, categorize, ecodes
from pyfirmata import Arduino, util
if __name__ == '__main__':
board = Arduino('/dev/ttyACM0')
dev = InputDevice('/dev/input/by-id/usb-JoyLabz_Makey_Makey_v1.20aa_50000000-event-kbd')
blink = False
for event in dev.read_loop():
if event.type == ecodes.E... | {
"repo_name": "merose/MakeyPiano",
"path": "test-programs/blinkArduinoOnTouch.py",
"copies": "1",
"size": "1355",
"license": "apache-2.0",
"hash": -222565151885276220,
"line_mean": 25.0576923077,
"line_max": 90,
"alpha_frac": 0.5594095941,
"autogenerated": false,
"ratio": 3.203309692671395,
"co... |
from evdev import InputDevice, categorize, ecodes
from threading import Thread
class JSConverter(Thread):
MLIMITLOW = 32
LLIMITLOW = 96
MLIMITHIGH = 255
LLIMITHIGH = 512
VALID_CODES = [0,1,3,4]
def __init__(self, device):
Thread.__init__(self)
self.gamepad = InputDevice(device)... | {
"repo_name": "csauer42/rover",
"path": "controller/archive/jsconverter.py",
"copies": "1",
"size": "1814",
"license": "mit",
"hash": 4976703377067384000,
"line_mean": 31.9818181818,
"line_max": 79,
"alpha_frac": 0.5418963616,
"autogenerated": false,
"ratio": 3.353049907578558,
"config_test": f... |
from evdev import InputDevice, categorize, ecodes
import os
import sys
if __name__ == '__main__':
if os.path.islink('/dev/input/by-id/usb-JoyLabz_Makey_Makey_v1.20aa_50000000-event-kbd'):
dev = InputDevice('/dev/input/by-id/usb-JoyLabz_Makey_Makey_v1.20aa_50000000-event-kbd')
elif os.path.islink('/dev/input/b... | {
"repo_name": "merose/MakeyPiano",
"path": "test-programs/decodeMakeyMakey.py",
"copies": "1",
"size": "1463",
"license": "apache-2.0",
"hash": -8818398061649605000,
"line_mean": 30.8043478261,
"line_max": 92,
"alpha_frac": 0.6021872864,
"autogenerated": false,
"ratio": 2.9555555555555557,
"con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.