text stringlengths 0 1.05M | meta dict |
|---|---|
from funcserver import Server
class CalcAPI(object):
def __init__(self, ignore_divbyzero=False):
self.ignore_divbyzero = ignore_divbyzero
def add(self, a, b):
'''Computes the sum of @a and @b'''
return a + b
def sub(self, a, b):
'''Computes the difference of @a and @b'''
... | {
"repo_name": "prashanthellina/funcserver",
"path": "examples/calc_server.py",
"copies": "1",
"size": "1025",
"license": "mit",
"hash": 2591755705099471000,
"line_mean": 25.9736842105,
"line_max": 64,
"alpha_frac": 0.5824390244,
"autogenerated": false,
"ratio": 3.5839160839160837,
"config_test"... |
from funcserver import Server
class CalcAPI(object):
def __init__(self, ignore_divbyzero=False):
self.ignore_divbyzero = ignore_divbyzero
def add(self, a, b):
"""Computes the sum of @a and @b"""
return a + b
def sub(self, a, b):
"""Computes the difference of @a and @b"""
... | {
"repo_name": "deep-compute/funcserver",
"path": "examples/calc_server.py",
"copies": "1",
"size": "1075",
"license": "mit",
"hash": -7748296446620226000,
"line_mean": 22.8888888889,
"line_max": 51,
"alpha_frac": 0.5553488372,
"autogenerated": false,
"ratio": 3.6815068493150687,
"config_test": ... |
from ..funcs import fmap
from ..abc import Monad, Container, Option, Full, Empty
from ..utils.compat import wraps
from ..utils.decorators import method_optional_kwargs
from ..utils.internal import _propagate_self
class Either(Monad, Option):
"""Enhanced version of Maybe. Represents a successful computation or
... | {
"repo_name": "justanr/pynads",
"path": "pynads/concrete/either.py",
"copies": "1",
"size": "5880",
"license": "mit",
"hash": -1962756779414803000,
"line_mean": 31.3076923077,
"line_max": 79,
"alpha_frac": 0.6154761905,
"autogenerated": false,
"ratio": 4.16135881104034,
"config_test": false,
... |
from funcs import *
from flask_socketio import send, emit
print("defining socks...")
# SOCKETIO DEFINITIONS
@sio.on('connect', namespace='/')
def io_connected():
ip = request.environ['REMOTE_ADDR']
if current_user.is_authenticated:
connected[current_user.gccid] = "{} {}".format(current_user.fname, c... | {
"repo_name": "theapricot/oppapp2",
"path": "sockdefs.py",
"copies": "1",
"size": "5272",
"license": "mit",
"hash": -6609655224581048000,
"line_mean": 31.7453416149,
"line_max": 138,
"alpha_frac": 0.595599393,
"autogenerated": false,
"ratio": 3.6534996534996536,
"config_test": false,
"has_no_... |
from FuncTable import FuncTable
from FuncDef import FuncDef
import re
def read_fd(fname):
func_pat = "([A-Za-z][_A-Za-z00-9]+)\((.*)\)\((.*)\)"
func_table = None
bias = 0
private = True
# parse file
f = open(fname, "r")
for line in f:
l = line.strip()
if len(l) > 1 and l[0] != '*':
# a co... | {
"repo_name": "alpine9000/amiga_examples",
"path": "tools/external/amitools/amitools/fd/FDFormat.py",
"copies": "1",
"size": "2676",
"license": "bsd-2-clause",
"hash": -3015278093927857000,
"line_mean": 27.4787234043,
"line_max": 67,
"alpha_frac": 0.456651719,
"autogenerated": false,
"ratio": 3.4... |
from functional.core import ExampleImage
def check_valid(source_image, reference_image):
data = source_image.create_image()
assert reference_image.valid_image(data)
def check_invalid(source_image, reference_image):
data = source_image.create_image()
assert not reference_image.valid_image(data)
def... | {
"repo_name": "atrosinenko/lecture-notes-compiler",
"path": "tests/functional/core_image_test.py",
"copies": "1",
"size": "4270",
"license": "mit",
"hash": 6374412110839996000,
"line_mean": 26.7272727273,
"line_max": 57,
"alpha_frac": 0.5901639344,
"autogenerated": false,
"ratio": 3.2795698924731... |
from functional.execution import ExecutionEngine
from functional.transformations import CACHE_T
class Lineage(object):
"""
Class for tracking the lineage of transformations, and applying them to a given sequence.
"""
def __init__(self, prior_lineage=None, engine=None):
"""
Construct a... | {
"repo_name": "EntilZha/PyFunctional",
"path": "functional/lineage.py",
"copies": "2",
"size": "2367",
"license": "mit",
"hash": -1214264504779127600,
"line_mean": 28.9620253165,
"line_max": 95,
"alpha_frac": 0.6020278834,
"autogenerated": false,
"ratio": 4.762575452716298,
"config_test": false... |
from functional import seq
from .deck import Deck
from .note import Note
from ..anki.adapters.anki_deck import AnkiDeck
from ..anki.adapters.note_model_file_provider import NoteModelFileProvider
def from_collection(collection, name, deck_metadata=None, is_child=False) -> Deck:
anki_dict = collection.decks.byName... | {
"repo_name": "Stvad/CrowdAnki",
"path": "crowd_anki/representation/deck_initializer.py",
"copies": "1",
"size": "1851",
"license": "mit",
"hash": 3882468793330620000,
"line_mean": 36.02,
"line_max": 103,
"alpha_frac": 0.6882766072,
"autogenerated": false,
"ratio": 3.2703180212014136,
"config_t... |
from functional_tests.base import FunctionalTest
from selenium.common.exceptions import NoSuchElementException
from django.contrib.auth.models import Group
from accounts.tests.test_models import create_new_user
class AdminTest(FunctionalTest):
fixtures = [
'groups_permissions',
]
def setUp(self... | {
"repo_name": "CDE-UNIBE/qcat",
"path": "functional_tests/test_administration.py",
"copies": "1",
"size": "3302",
"license": "apache-2.0",
"hash": 4416484708703444500,
"line_mean": 36.5227272727,
"line_max": 80,
"alpha_frac": 0.6302241066,
"autogenerated": false,
"ratio": 3.624588364434687,
"co... |
from functional_tests.context import *
class ResetPasswordTestCase(LiveServerTestCase):
def create_user(self):
user = User.objects.create_user('Lisa',
'daisychain_lisa@testingmail.org',
'hunter22')
EmailAddress.objects... | {
"repo_name": "daisychainme/daisychain",
"path": "daisychain/functional_tests/test_user_password_reset.py",
"copies": "1",
"size": "2506",
"license": "mit",
"hash": 3924837258693107000,
"line_mean": 40.7666666667,
"line_max": 78,
"alpha_frac": 0.5873902634,
"autogenerated": false,
"ratio": 4.1081... |
from functional_tests.context import *
class UseradminTestCase(LiveServerTestCase):
def create_user(self):
user = User.objects.create_user('Lisa',
'lisa@example.org',
'password',
is_acti... | {
"repo_name": "daisychainme/daisychain",
"path": "daisychain/functional_tests/test_user_admin.py",
"copies": "1",
"size": "4196",
"license": "mit",
"hash": -2477395260152530400,
"line_mean": 38.5849056604,
"line_max": 76,
"alpha_frac": 0.4930886559,
"autogenerated": false,
"ratio": 4.402938090241... |
from functional_tests.factory import ArticleFactory
from functional_tests.factory import CategoryFactory
from functional_tests.factory import PhotoAlbumSlideFactory
from functional_tests.factory import TalkingAlbumSlideFactory
class DataSetup():
def create_article(self, title, author, category, location, image, s... | {
"repo_name": "PARINetwork/pari",
"path": "functional_tests/data_setup.py",
"copies": "1",
"size": "1589",
"license": "bsd-3-clause",
"hash": -7386534778447801000,
"line_mean": 50.2580645161,
"line_max": 115,
"alpha_frac": 0.6324732536,
"autogenerated": false,
"ratio": 4.701183431952662,
"confi... |
from functional_tests import FunctionalTest, ROOT, USERS
import time
class TestLoginPage (FunctionalTest):
def setUp(self):
# John opens his browser and goes to the home-page of the tukker app
self.url = ROOT + '/default/user/login'
get_browser=self.browser.get(self.url)
... | {
"repo_name": "NewGlobalStrategy/NetDecisionMaking",
"path": "fts/test_login.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": 5371855891279311000,
"line_mean": 40.16,
"line_max": 94,
"alpha_frac": 0.6472303207,
"autogenerated": false,
"ratio": 3.7282608695652173,
"config_test": fal... |
from ..functionbase import SSAFunctionBase
from ..ssa_types import SSA_OBJECT
class BaseOp(SSAFunctionBase):
has_side_effects = False
def __init__(self, parent, arguments, makeException=False):
super(BaseOp, self).__init__(parent, arguments)
self.rval = None
self.outException = None
... | {
"repo_name": "orneryhippo/saturdays",
"path": "Krakatau-master/Krakatau/Krakatau/ssa/ssa_ops/base.py",
"copies": "4",
"size": "1087",
"license": "apache-2.0",
"hash": 8408803330075731000,
"line_mean": 35.2333333333,
"line_max": 94,
"alpha_frac": 0.6826126955,
"autogenerated": false,
"ratio": 4.0... |
from function_details import FunctionDetails
from quadruple import *
#
# Semantic anaĺysis and structures
#
#################
# Semantic Cube #
#################
# Operator values
# 1: +
# 2: -
# 3: *
# 4: /
# 5: %
# 6: =
# 7: ==
# 8: >
# 9: <
# 10: <=
# 11: >=
# 12: <>
# 13: &&
# 14: ||
# Cube declaration
# -1 as re... | {
"repo_name": "chelord21/zmeya",
"path": "semantics.py",
"copies": "1",
"size": "10738",
"license": "mit",
"hash": 4227730548324032000,
"line_mean": 30.1217391304,
"line_max": 95,
"alpha_frac": 0.5963490733,
"autogenerated": false,
"ratio": 3.0581031045286244,
"config_test": false,
"has_no_ke... |
from function.discrete_function import DiscreteFunction
class Permutation(DiscreteFunction):
"""
Permutation class. Defines permutation over objects given a well defined domain for the objects, and
and array of array of obbjects that specify the permutation itself.
Note: We use right-hand functional b... | {
"repo_name": "dpazel/music_rep",
"path": "function/permutation.py",
"copies": "1",
"size": "4090",
"license": "mit",
"hash": -1861439734318872300,
"line_mean": 31.9838709677,
"line_max": 110,
"alpha_frac": 0.5706601467,
"autogenerated": false,
"ratio": 4.148073022312373,
"config_test": false,
... |
from function.function_pitch_range import FunctionPitchRange
from function.piecewise_linear_function import PiecewiseLinearFunction
from tonalmodel.diatonic_pitch import DiatonicPitch
class PiecewiseLinearPitchFunction(PiecewiseLinearFunction, FunctionPitchRange):
def __init__(self, transition_points=list(), res... | {
"repo_name": "dpazel/music_rep",
"path": "function/piecewise_linear_pitch_function.py",
"copies": "1",
"size": "1087",
"license": "mit",
"hash": 7876933537157331000,
"line_mean": 34.064516129,
"line_max": 105,
"alpha_frac": 0.6752529899,
"autogenerated": false,
"ratio": 3.9816849816849818,
"co... |
from function import Function
from frame import Frame
import collections
import operator
import textwrap
import dis
import sys
class VirtualMachineError(Exception):
pass
Block = collections.namedtuple('Block', 'type, handler, stack_height')
class VirtualMachine(object):
def __init__(self):
self.fra... | {
"repo_name": "tylersco/Python2Python",
"path": "virtualmachine.py",
"copies": "1",
"size": "10538",
"license": "mit",
"hash": 570452782093542400,
"line_mean": 26.6587926509,
"line_max": 94,
"alpha_frac": 0.5357752894,
"autogenerated": false,
"ratio": 3.726308345120226,
"config_test": false,
... |
from .function import Function
from .numbers import nan
class Mod(Function):
"""Represents a modulo operation on symbolic expressions.
Receives two arguments, dividend p and divisor q.
The convention used is the same as Python's: the remainder always has the
same sign as the divisor.
Examples
... | {
"repo_name": "skirpichev/omg",
"path": "diofant/core/mod.py",
"copies": "1",
"size": "4357",
"license": "bsd-3-clause",
"hash": 1994197438779773000,
"line_mean": 27.477124183,
"line_max": 77,
"alpha_frac": 0.4353913243,
"autogenerated": false,
"ratio": 3.8219298245614035,
"config_test": false,... |
from function import Function
from sympy.core.numbers import Float
from sympy.core.function import expand_mul
class Mod(Function):
"""Represents a modulo operation on symbolic expressions.
Receives two arguments, dividend p and divisor q.
The convention used is the same as python's: the remainder always ... | {
"repo_name": "ichuang/sympy",
"path": "sympy/core/mod.py",
"copies": "3",
"size": "1089",
"license": "bsd-3-clause",
"hash": -1995028766297333800,
"line_mean": 26.9230769231,
"line_max": 77,
"alpha_frac": 0.5610651974,
"autogenerated": false,
"ratio": 3.794425087108014,
"config_test": false,
... |
from function import Function
from sympy.core.numbers import Float
from sympy.core.function import expand_mul
class Mod(Function):
"""Represents a modulo operation on symbolic expressions.
Receives two arguments, dividend p and divisor q.
The convention used is the same as python's: the remainder always... | {
"repo_name": "amitjamadagni/sympy",
"path": "sympy/core/mod.py",
"copies": "1",
"size": "1090",
"license": "bsd-3-clause",
"hash": -2918974266267994600,
"line_mean": 26.25,
"line_max": 77,
"alpha_frac": 0.5605504587,
"autogenerated": false,
"ratio": 3.797909407665505,
"config_test": false,
"... |
from function import *
#from function import restart_comm
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
FRONT_C = 1
LEFT_C = 2
RIGHT_C = 3
BACK_C = 4
#Switch Case that selects the commands
def command(x):
bytes = x.split()
#Motor Commands
if bytes[0] == 'w':
move_forward(bytes)
if bytes[0] == 'a':
move_le... | {
"repo_name": "STMU-IEEE/Robotics-16-17",
"path": "commWithArduino.py",
"copies": "1",
"size": "3556",
"license": "mit",
"hash": 4971638669412967000,
"line_mean": 23.3561643836,
"line_max": 109,
"alpha_frac": 0.6223284589,
"autogenerated": false,
"ratio": 2.4490358126721765,
"config_test": fals... |
from Function import *
from Math import *
from Area import *
import random
class distributionObject(mathObject):
def __init__(self):
self.type = "distribution"
self.e = 0
self.s = 0
def cal(self, val):
pass
def val(self):
pass
class PointDistribution(distributionO... | {
"repo_name": "Anon-LeoH/UncleDaLearn",
"path": "UD/Distribution/__init__.py",
"copies": "1",
"size": "3179",
"license": "mit",
"hash": -6411330354054800000,
"line_mean": 22.204379562,
"line_max": 142,
"alpha_frac": 0.4869455804,
"autogenerated": false,
"ratio": 3.5719101123595505,
"config_test... |
from function import *
#
# [0]A [1]B [2]C [3]D [4]E [5]F [6]G
# +-----+-----+-----+-----+-----+-----+-----+
#[6]| | | | | | | |
# 1 | | | | | | | |
# | | | | | | | |
# +-----------------------------------------+
#[5]| ... | {
"repo_name": "STMU-IEEE/Robotics-16-17",
"path": "Pathfinding.py",
"copies": "1",
"size": "5404",
"license": "mit",
"hash": -8849045695402046000,
"line_mean": 34.0909090909,
"line_max": 107,
"alpha_frac": 0.4287564767,
"autogenerated": false,
"ratio": 2.8427143608627037,
"config_test": false,
... |
from Function_Module import *
from BMaster_code import *
import sys
def main(cpath, Type, N=6):
overview = path(cpath,'Overview.txt')
pyomo_code = False
if Type in ('S', 'Test'):
GG = .02
pyomo_code = True
elif Type == 'M':
GG = .15
elif Type == 'L':
GG = .30
e... | {
"repo_name": "cdhagmann/WITP",
"path": "Master.py",
"copies": "1",
"size": "3006",
"license": "apache-2.0",
"hash": -7043722281118619000,
"line_mean": 32.032967033,
"line_max": 78,
"alpha_frac": 0.5532268796,
"autogenerated": false,
"ratio": 2.5154811715481173,
"config_test": false,
"has_no_... |
from Function_Module import *
from coopr.pyomo import *
from coopr import neos
from coopr.opt import SolverFactory
import coopr.environ
import os
import time
from PyomoCode.ReferenceTechModel import Pyomo_tech
def solve_tech_model(idx, solver='gurobi', time=None, gap=None, cutoff=None):
tech = 'Tech{}'.format(idx... | {
"repo_name": "cdhagmann/WITP",
"path": "Pyomo_code.py",
"copies": "1",
"size": "15472",
"license": "apache-2.0",
"hash": -3691504815902600000,
"line_mean": 37.2024691358,
"line_max": 102,
"alpha_frac": 0.5021975181,
"autogenerated": false,
"ratio": 3.398198989677136,
"config_test": false,
"h... |
from Function_Module import *
from Pyomo_code import *
from BigMModel import solve_big_m_model
import time
global_gap = .02
def tech_idx(tup):
i, j = tup
return (i - 1) * 6 + (j - 1)
BIG_M_TIMEOUT = 12 * 60 * 60
@Timer
def Bhanu_code():
command = "echo '' | mono WITP-TPH.exe"
output = bash_command(c... | {
"repo_name": "cdhagmann/WITP",
"path": "BMaster_code.py",
"copies": "1",
"size": "3590",
"license": "apache-2.0",
"hash": -1315937620766560000,
"line_mean": 25.204379562,
"line_max": 77,
"alpha_frac": 0.5498607242,
"autogenerated": false,
"ratio": 2.9718543046357615,
"config_test": false,
"h... |
from Function_Module import *
from Pyomo_code import *
import time
global_gap = .02
def tech_idx(tup):
i, j = tup
return (i - 1) * 6 + (j - 1)
@Timer
def Bhanu_code():
command = "echo '' | mono WITP-TPH.exe"
output = bash_command(command)
Last_line = output[-1]
assert 'minimum cost' in Last_... | {
"repo_name": "cdhagmann/WITP",
"path": "Master_code.py",
"copies": "1",
"size": "3573",
"license": "apache-2.0",
"hash": 1419714023379492900,
"line_mean": 25.8646616541,
"line_max": 77,
"alpha_frac": 0.545200112,
"autogenerated": false,
"ratio": 3.038265306122449,
"config_test": false,
"has_... |
from functionrefactor.commands import launch_case
from functionrefactor.formatter import Formatter
from functionrefactor.settings import *
from tests.common_functions import *
import json
class TestRuns():
def test_runs(self):
with open("tests/cases/test_cases.json", "r") as tcf:
test_launche... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_runs.py",
"copies": "1",
"size": "1134",
"license": "mit",
"hash": -1969767511287521000,
"line_mean": 35.5806451613,
"line_max": 79,
"alpha_frac": 0.6234567901,
"autogenerated": false,
"ratio": 3.78,
"config_test": true,
"has_no... |
from functionrefactor.header import HeaderDef
from functionrefactor.parser import Parser
from functionrefactor.formatter import Formatter
from functionrefactor.settings import *
import sys
import os
import json
__all__ = ['parse_header', 'parse_to_file', 'main']
#
def parse_header(filename):
parser = Parser()
... | {
"repo_name": "astrodroid/functionrefactor",
"path": "functionrefactor/commands.py",
"copies": "1",
"size": "4758",
"license": "mit",
"hash": 2868219211083006000,
"line_mean": 31.3673469388,
"line_max": 93,
"alpha_frac": 0.6008827238,
"autogenerated": false,
"ratio": 3.6018168054504165,
"config... |
from functionrefactor.header import *
from functionrefactor.formatter import Formatter
from functionrefactor.string_utilities import find_and_replace_all, is_invalid
import difflib
import sys
def is_strictly_equal(actual, expected):
assert actual == expected
if actual == expected:
print("OK! a: " + ac... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/common_functions.py",
"copies": "1",
"size": "3405",
"license": "mit",
"hash": 1037333626056094200,
"line_mean": 29.1327433628,
"line_max": 105,
"alpha_frac": 0.6002936858,
"autogenerated": false,
"ratio": 3.528497409326425,
"config_te... |
from functionrefactor.parser import Parser, CommentParser, Regex
from functionrefactor.header import *
from tests.common_functions import *
import pytest
def test_comments():
''' ignores_new lines '''
_in = [
"//comment is this", "/* comment is this as well */",
"auto p = get_value(); //some c... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_comments.py",
"copies": "1",
"size": "2164",
"license": "mit",
"hash": 2117821112919553300,
"line_mean": 30.8235294118,
"line_max": 92,
"alpha_frac": 0.5203327172,
"autogenerated": false,
"ratio": 3.507293354943274,
"config_test":... |
from functionrefactor.parser import Parser
from functionrefactor.header import *
from tests.common_functions import *
# yapf: disable
_in = [
"#define SMACRO = ()... ; /* */","#define OLDSTYLECONST = 42",
r"#define MULTILINE_MACRO = DOSOMETHING()\ ",
r" return -1;\ ",
"#ifdef SOM... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_preprocessor.py",
"copies": "1",
"size": "1687",
"license": "mit",
"hash": 4274007295528230000,
"line_mean": 28.0862068966,
"line_max": 141,
"alpha_frac": 0.5749851808,
"autogenerated": false,
"ratio": 3.367265469061876,
"config_t... |
from functionrefactor.parser import Parser
from tests.common_functions import *
def test_namespace():
''' ignores_new lines '''
_in = [
"namespace Nutella", "{", "}", "namespace PeanutButter{", "}",
"namespace Cereal{ //something", "}"
]
expected_result_hpp = [
"namespace Nute... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_namespace_class.py",
"copies": "1",
"size": "1367",
"license": "mit",
"hash": 4967958465855710000,
"line_mean": 30.0681818182,
"line_max": 79,
"alpha_frac": 0.5749817118,
"autogenerated": false,
"ratio": 3.4089775561097255,
"confi... |
from functionrefactor.parser import Parser, Regex, FunctionVariableParser
from tests.common_functions import *
def test_variable_capture():
rg = Regex()
parser = FunctionVariableParser(rg)
[keywords, name, rhs] = parser._extract_variable_components('int i;')
is_equal(''.join([f.format_hpp() for f in... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_var_function.py",
"copies": "1",
"size": "3169",
"license": "mit",
"hash": -8142715969349956000,
"line_mean": 32.3578947368,
"line_max": 79,
"alpha_frac": 0.5531713474,
"autogenerated": false,
"ratio": 3.1438492063492065,
"config_... |
from functionrefactor.parser import Parser, TemplateParser, Regex
from tests.common_functions import *
def test_templates():
''' ignores_new lines '''
_in = [
"template <typename T>", "template <class Name = std::ForwardIterator>",
"template", "<typename TT, typename U, int X_size = 10>", "tem... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_template_args.py",
"copies": "1",
"size": "1798",
"license": "mit",
"hash": 7369688482586793000,
"line_mean": 33.5769230769,
"line_max": 96,
"alpha_frac": 0.5795328142,
"autogenerated": false,
"ratio": 3.5393700787401574,
"config_... |
from functionrefactor.parser import Regex
from tests.common_functions import *
def test_comment_regex():
r = Regex()
assert r.comment_single_line.match("//comment")
assert r.comment_single_line.match(" //comment something")
assert r.comment_multiline.match(" /*comment something*/")
assert r.... | {
"repo_name": "astrodroid/functionrefactor",
"path": "tests/test_regex.py",
"copies": "1",
"size": "6642",
"license": "mit",
"hash": -514456622692939200,
"line_mean": 41.8516129032,
"line_max": 99,
"alpha_frac": 0.6052393857,
"autogenerated": false,
"ratio": 3.224271844660194,
"config_test": tr... |
from functionrefactor.settings import settings
from functionrefactor.string_utilities import append, append_list, is_invalid, first_word
from abc import ABC, abstractmethod
import re
__all__ = [
'Abstract', 'Comments', 'TemplateArgs', 'TemplateArg', 'Keywords',
'Variable', 'FunctionDef'
]
class Abstract(ABC)... | {
"repo_name": "astrodroid/functionrefactor",
"path": "functionrefactor/header_components.py",
"copies": "1",
"size": "11268",
"license": "mit",
"hash": -2037451159844147000,
"line_mean": 29.956043956,
"line_max": 121,
"alpha_frac": 0.5907880724,
"autogenerated": false,
"ratio": 4.085569253081943,... |
from functionrefactor.string_utilities import *
from functionrefactor.header_components import *
__all__ = ['PreprocessorStuff', 'ClassDef', 'NamespaceDef', 'HeaderDef']
class PreprocessorStuff(Abstract):
"""Preprocessor things like #includes, #ifdef and MACROS"""
def __init__(self, text):
self.text... | {
"repo_name": "astrodroid/functionrefactor",
"path": "functionrefactor/header.py",
"copies": "1",
"size": "7150",
"license": "mit",
"hash": -3039453959271494700,
"line_mean": 29.4255319149,
"line_max": 148,
"alpha_frac": 0.5745454545,
"autogenerated": false,
"ratio": 3.9502762430939224,
"config... |
from functions2 import rm_duplicate_arrays
import numpy as np
class Map(object):
def __init__(self, map=None):
self.map = map
def invert(self):
inverted_map = np.zeros(self.map.size)
for x in range(self.map.size):
inverted_map[self.map[x]] = x
self.map = inverted_ma... | {
"repo_name": "paulsbrookes/subcipher",
"path": "map.py",
"copies": "2",
"size": "1104",
"license": "apache-2.0",
"hash": 5664270165529510000,
"line_mean": 35.8,
"line_max": 69,
"alpha_frac": 0.6222826087,
"autogenerated": false,
"ratio": 3.54983922829582,
"config_test": false,
"has_no_keywor... |
from functions.FE import FE
from fitness import Classifier
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import pandas as pd
import ga
def testIris():
iris = pd.read_csv("data/iris.data", sep=",")
irisAtts = iris.drop("class", 1)
target = iris["class"]
#Scale to [0,1] before expan... | {
"repo_name": "andreabduque/GAFE",
"path": "main.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": 5517076589336832000,
"line_mean": 33.7878787879,
"line_max": 125,
"alpha_frac": 0.6324041812,
"autogenerated": false,
"ratio": 3.188888888888889,
"config_test": false,
"has_no_keywor... |
from FunctionsforCOL import calculate_score
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def komplikator():
if request.method == 'POST':
gender = request.form['gender']
age = request.form['age']
status = request.form['stat... | {
"repo_name": "CodeCatz/litterbox",
"path": "Natasa/ComplexLifeCalc/server.py",
"copies": "1",
"size": "1297",
"license": "mit",
"hash": 5784510773784876000,
"line_mean": 47.0740740741,
"line_max": 192,
"alpha_frac": 0.66692367,
"autogenerated": false,
"ratio": 3.6128133704735377,
"config_test"... |
from .function.signature import NoDefault
from transmute_core.http_parameters import ParamSet, Param
from .exceptions import APIException, NoSerializerFound
NoArgument = object()
class ParamExtractor(object):
"""
An abstract object to extend to handle
extracting parameters from a request.
"""
No... | {
"repo_name": "toumorokoshi/web-transmute",
"path": "transmute_core/param_extractor.py",
"copies": "2",
"size": "5495",
"license": "mit",
"hash": -4548414594602940000,
"line_mean": 35.8791946309,
"line_max": 105,
"alpha_frac": 0.5716105551,
"autogenerated": false,
"ratio": 4.602177554438861,
"c... |
from ...functions import adjoint, conjugate
from .matexpr import MatrixExpr
class Transpose(MatrixExpr):
"""
The transpose of a matrix expression.
This is a symbolic object that simply stores its argument without
evaluating it. To actually compute the transpose, use the ``transpose()``
function, ... | {
"repo_name": "diofant/diofant",
"path": "diofant/matrices/expressions/transpose.py",
"copies": "2",
"size": "1560",
"license": "bsd-3-clause",
"hash": 7447227735293431000,
"line_mean": 21.6086956522,
"line_max": 77,
"alpha_frac": 0.583974359,
"autogenerated": false,
"ratio": 3.705463182897862,
... |
from .functions import BaseAnalysisFunction
import wave
import subprocess
import textgrid
import os
import tempfile
def is_autovot_friendly_file(sound_file):
rate = subprocess.run(["soxi", "-r", sound_file], encoding="UTF-8", stdout=subprocess.PIPE).stdout
if int(rate) != 16000:
return False
cha... | {
"repo_name": "mmcauliffe/python-acoustic-similarity",
"path": "conch/analysis/autovot.py",
"copies": "1",
"size": "4312",
"license": "mit",
"hash": -178741565068646,
"line_mean": 48.5632183908,
"line_max": 343,
"alpha_frac": 0.6069109462,
"autogenerated": false,
"ratio": 3.3323029366306027,
"c... |
from functions import check_hadoop_services, check_local_path
from .exceptions import CustomRequestFailed
from rest_framework import permissions
actions= ['start', 'stop', 'restart', 'upload', 'run', 'check']
class HadoopPermission(permissions.BasePermission):
"""
Validity check for hadoop actions.
"""
... | {
"repo_name": "efikalti/Lambda",
"path": "backend/app/permissions.py",
"copies": "1",
"size": "1936",
"license": "apache-2.0",
"hash": -2031137135038328000,
"line_mean": 44.023255814,
"line_max": 115,
"alpha_frac": 0.6022727273,
"autogenerated": false,
"ratio": 4.733496332518337,
"config_test":... |
from functions import continuedFraction
import math
def fraction(pList):
'''from the list pList = [a0 a1 a2 ...]
returns the corresponding fraction P/Q '''
length = len(pList)
p,q = 1,0
lP, lQ = [pList[0]], [1]
p1 = pList[1] * lP[0] + p
q1 = pList[1] * lQ[0] + q
lP.append(p1)
lQ.append(q1)
for i in range(2... | {
"repo_name": "nguyenkims/projecteuler-python",
"path": "src/p66.py",
"copies": "1",
"size": "1082",
"license": "mit",
"hash": -120811543194817260,
"line_mean": 18.6909090909,
"line_max": 65,
"alpha_frac": 0.5804066543,
"autogenerated": false,
"ratio": 2.0847784200385355,
"config_test": false,
... |
from functions import defun, defun_wrapped, defun_static
@defun
def stieltjes(ctx, n, a=1):
n = ctx.convert(n)
a = ctx.convert(a)
if n < 0:
return ctx.bad_domain("Stieltjes constants defined for n >= 0")
if hasattr(ctx, "stieltjes_cache"):
stieltjes_cache = ctx.stieltjes_cache
else:... | {
"repo_name": "mattpap/sympy-polys",
"path": "sympy/mpmath/functions/zeta.py",
"copies": "3",
"size": "21328",
"license": "bsd-3-clause",
"hash": 3918138467259775000,
"line_mean": 29.7319884726,
"line_max": 88,
"alpha_frac": 0.4938109527,
"autogenerated": false,
"ratio": 2.9184455391351944,
"co... |
from functions import defun, defun_wrapped
def _check_need_perturb(ctx, terms, prec, discard_known_zeros):
perturb = recompute = False
extraprec = 0
discard = []
for term_index, term in enumerate(terms):
w_s, c_s, alpha_s, beta_s, a_s, b_s, z = term
have_singular_nongamma_weight = False... | {
"repo_name": "tovrstra/sympy",
"path": "sympy/mpmath/functions/hypergeometric.py",
"copies": "1",
"size": "69864",
"license": "bsd-3-clause",
"hash": -8061213987126200000,
"line_mean": 32.9145631068,
"line_max": 104,
"alpha_frac": 0.4586911714,
"autogenerated": false,
"ratio": 2.837692932575142,... |
from functions import defun, defun_wrapped
def _hermite_param(ctx, n, z, parabolic_cylinder):
"""
Combined calculation of the Hermite polynomial H_n(z) (and its
generalization to complex n) and the parabolic cylinder
function D.
"""
n, ntyp = ctx._convert_param(n)
z = ctx.convert(z)
q =... | {
"repo_name": "tarballs-are-good/sympy",
"path": "sympy/mpmath/functions/orthogonal.py",
"copies": "2",
"size": "16126",
"license": "bsd-3-clause",
"hash": 2767997674997057000,
"line_mean": 31.7099391481,
"line_max": 84,
"alpha_frac": 0.4752573484,
"autogenerated": false,
"ratio": 2.5447372573773... |
from .functions import defun, defun_wrapped
def _hermite_param(ctx, n, z, parabolic_cylinder):
"""
Combined calculation of the Hermite polynomial H_n(z) (and its
generalization to complex n) and the parabolic cylinder
function D.
"""
n, ntyp = ctx._convert_param(n)
z = ctx.convert(z)
q ... | {
"repo_name": "maryklayne/Funcao",
"path": "sympy/mpmath/functions/orthogonal.py",
"copies": "18",
"size": "16151",
"license": "bsd-3-clause",
"hash": 2199199174172050400,
"line_mean": 31.7606490872,
"line_max": 84,
"alpha_frac": 0.4757600149,
"autogenerated": false,
"ratio": 2.5450677592184054,
... |
from functions import defun, defun_wrapped
@defun
def gammaprod(ctx, a, b, _infsign=False):
a = [ctx.convert(x) for x in a]
b = [ctx.convert(x) for x in b]
poles_num = []
poles_den = []
regular_num = []
regular_den = []
for x in a: [regular_num, poles_num][ctx.isnpint(x)].append(x)
for ... | {
"repo_name": "tarballs-are-good/sympy",
"path": "sympy/mpmath/functions/factorials.py",
"copies": "3",
"size": "5368",
"license": "bsd-3-clause",
"hash": 6028471188974831000,
"line_mean": 26.387755102,
"line_max": 81,
"alpha_frac": 0.5134128167,
"autogenerated": false,
"ratio": 2.669318746892093... |
from .functions import defun, defun_wrapped
@defun
def j0(ctx, x):
"""Computes the Bessel function `J_0(x)`. See :func:`~mpmath.besselj`."""
return ctx.besselj(0, x)
@defun
def j1(ctx, x):
"""Computes the Bessel function `J_1(x)`. See :func:`~mpmath.besselj`."""
return ctx.besselj(1, x)
@defun
def b... | {
"repo_name": "klkuhlm/mpmath",
"path": "mpmath/functions/bessel.py",
"copies": "4",
"size": "37938",
"license": "bsd-3-clause",
"hash": -4004448526894187000,
"line_mean": 33.2400722022,
"line_max": 100,
"alpha_frac": 0.4871369076,
"autogenerated": false,
"ratio": 2.6792372881355933,
"config_te... |
from functions import defun, defun_wrapped
@defun
def j0(ctx, x):
"""Computes the Bessel function `J_0(x)`. See :func:`~mpmath.besselj`."""
return ctx.besselj(0, x)
@defun
def j1(ctx, x):
"""Computes the Bessel function `J_1(x)`. See :func:`~mpmath.besselj`."""
return ctx.besselj(1, x)
@defun
def be... | {
"repo_name": "pernici/sympy",
"path": "sympy/mpmath/functions/bessel.py",
"copies": "2",
"size": "37599",
"license": "bsd-3-clause",
"hash": 9191072003030575000,
"line_mean": 33.1188747731,
"line_max": 100,
"alpha_frac": 0.4861299503,
"autogenerated": false,
"ratio": 2.670004260758415,
"config... |
from .functions import defun, defun_wrapped
@defun
def j0(ctx, x):
"""Computes the Bessel function `J_0(x)`. See :func:`~mpmath.besselj`."""
return ctx.besselj(0, x)
@defun
def j1(ctx, x):
"""Computes the Bessel function `J_1(x)`. See :func:`~mpmath.besselj`."""
return ctx.besselj(1, x)
@defun
def b... | {
"repo_name": "Cuuuurzel/KiPyCalc",
"path": "sympy/mpmath/functions/bessel.py",
"copies": "18",
"size": "37942",
"license": "mit",
"hash": -6605970575510022000,
"line_mean": 33.2436823105,
"line_max": 100,
"alpha_frac": 0.4872700438,
"autogenerated": false,
"ratio": 2.679141364214094,
"config_t... |
from .functions import defun, defun_wrapped
@defun
def _jacobi_theta2(ctx, z, q):
extra1 = 10
extra2 = 20
# the loops below break when the fixed precision quantities
# a and b go to zero;
# right shifting small negative numbers by wp one obtains -1, not zero,
# so the condition a**2 + b**2 > MI... | {
"repo_name": "jamesblunt/sympy",
"path": "sympy/mpmath/functions/theta.py",
"copies": "51",
"size": "37320",
"license": "bsd-3-clause",
"hash": 1037802819899132500,
"line_mean": 34.5767397521,
"line_max": 76,
"alpha_frac": 0.3867631297,
"autogenerated": false,
"ratio": 2.7027809965237544,
"con... |
from functions import defun, defun_wrapped
@defun
def _jacobi_theta2(ctx, z, q):
extra1 = 10
extra2 = 20
# the loops below break when the fixed precision quantities
# a and b go to zero;
# right shifting small negative numbers by wp one obtains -1, not zero,
# so the condition a**2 + b**2 > MIN... | {
"repo_name": "tarballs-are-good/sympy",
"path": "sympy/mpmath/functions/theta.py",
"copies": "2",
"size": "37319",
"license": "bsd-3-clause",
"hash": -1568595109849629700,
"line_mean": 34.5757864633,
"line_max": 76,
"alpha_frac": 0.3867734934,
"autogenerated": false,
"ratio": 2.702904323893677,
... |
from .functions import defun, defun_wrapped
@defun
def qp(ctx, a, q=None, n=None, **kwargs):
r"""
Evaluates the q-Pochhammer symbol (or q-rising factorial)
.. math ::
(a; q)_n = \prod_{k=0}^{n-1} (1-a q^k)
where `n = \infty` is permitted if `|q| < 1`. Called with two arguments,
``qp(a,q)... | {
"repo_name": "tectronics/mpmath",
"path": "mpmath/functions/qfunctions.py",
"copies": "6",
"size": "7603",
"license": "bsd-3-clause",
"hash": -5684427589036143000,
"line_mean": 26.2508960573,
"line_max": 78,
"alpha_frac": 0.4803367092,
"autogenerated": false,
"ratio": 2.8284970238095237,
"conf... |
from functions import defun, defun_wrapped
@defun
def qp(ctx, a, q=None, n=None, **kwargs):
r"""
Evaluates the q-Pochhammer symbol (or q-rising factorial)
.. math ::
(a; q)_n = \prod_{k=0}^{n-1} (1-a q^k)
where `n = \infty` is permitted if `|q| < 1`. Called with two arguments,
``qp(a,q)`... | {
"repo_name": "pernici/sympy",
"path": "sympy/mpmath/functions/qfunctions.py",
"copies": "3",
"size": "7585",
"license": "bsd-3-clause",
"hash": 1031899442854489100,
"line_mean": 26.1863799283,
"line_max": 78,
"alpha_frac": 0.4805537245,
"autogenerated": false,
"ratio": 2.832337565347274,
"conf... |
from .functions import defun, defun_wrapped
@defun_wrapped
def _erf_complex(ctx, z):
z2 = ctx.square_exp_arg(z, -1)
#z2 = -z**2
v = (2/ctx.sqrt(ctx.pi))*z * ctx.hyp1f1((1,2),(3,2), z2)
if not ctx._re(z):
v = ctx._im(v)*ctx.j
return v
@defun_wrapped
def _erfc_complex(ctx, z):
if ctx.re(... | {
"repo_name": "shipci/sympy",
"path": "sympy/mpmath/functions/expintegrals.py",
"copies": "47",
"size": "11452",
"license": "bsd-3-clause",
"hash": 752051106462992500,
"line_mean": 26.2666666667,
"line_max": 79,
"alpha_frac": 0.5060251484,
"autogenerated": false,
"ratio": 2.814450724993856,
"co... |
from functions import defun, defun_wrapped
@defun_wrapped
def _erf_complex(ctx, z):
z2 = ctx.square_exp_arg(z, -1)
#z2 = -z**2
v = (2/ctx.sqrt(ctx.pi))*z * ctx.hyp1f1((1,2),(3,2), z2)
if not ctx._re(z):
v = ctx._im(v)*ctx.j
return v
@defun_wrapped
def _erfc_complex(ctx, z):
if ctx.re(z... | {
"repo_name": "tarballs-are-good/sympy",
"path": "sympy/mpmath/functions/expintegrals.py",
"copies": "2",
"size": "11451",
"license": "bsd-3-clause",
"hash": 4167985780781838300,
"line_mean": 26.2642857143,
"line_max": 79,
"alpha_frac": 0.5060693389,
"autogenerated": false,
"ratio": 2.81489675516... |
from functions import gcd, continuedFraction
import math
def properFraction(pNume,pDeno):
'''pNume: numerator, pDeno: Denominator
return [z,x,y] such that pNume/pDeno =z + x/y and gcd(x,y) = 1'''
t = gcd(pDeno,pNume)
z = pNume / pDeno
x,y = (pNume - z*pDeno)/t, pDeno/t
return [z,x,y]
print properFraction(20,15... | {
"repo_name": "nguyenkims/projecteuler-python",
"path": "src/p64.py",
"copies": "1",
"size": "1193",
"license": "mit",
"hash": 2668366855950331400,
"line_mean": 20.3035714286,
"line_max": 67,
"alpha_frac": 0.6202849958,
"autogenerated": false,
"ratio": 2.312015503875969,
"config_test": false,
... |
from functions import get_dist
from components import *
class Task(object):
def __init__(self):
self._children = []
def run(self):
pass
def add_child(self, c):
self._children.append(c)
class Selector(Task):
def __init__(self):
super().__init__()
def run(self):
... | {
"repo_name": "NiclasEriksen/rpg_procgen",
"path": "ai_components.py",
"copies": "1",
"size": "4591",
"license": "cc0-1.0",
"hash": 1916995935734421200,
"line_mean": 24.087431694,
"line_max": 72,
"alpha_frac": 0.5129601394,
"autogenerated": false,
"ratio": 3.947549441100602,
"config_test": fals... |
from .functions import get_models_from_string, quick_search, \
get_object_from_string
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.http import Http404, HttpResponse, HttpResponseServerError
from django.utils import simplejson, simplejson as json
from django.utils.d... | {
"repo_name": "SlashRoot/WHAT",
"path": "what_apps/utility/views.py",
"copies": "1",
"size": "8364",
"license": "mit",
"hash": -8299788858504212000,
"line_mean": 40.6169154229,
"line_max": 235,
"alpha_frac": 0.6409612626,
"autogenerated": false,
"ratio": 4.169491525423729,
"config_test": false,... |
from .functions import group_by, take, first
from .count_unanswered_tickets import count_unanswered_tickets
from .count_open_tickets import count_open_tickets
from .get_shifts import get_shifts
from .get_printers import group_printer_errors
def format_printer_errors(printers):
printer_count = 8
string = ''
... | {
"repo_name": "hawkrives/stolaf-ubersicht-widgets",
"path": "lib/collect_data.py",
"copies": "1",
"size": "2297",
"license": "mit",
"hash": 95951145313974350,
"line_mean": 36.6557377049,
"line_max": 99,
"alpha_frac": 0.6286460601,
"autogenerated": false,
"ratio": 3.120923913043478,
"config_test... |
from functions import inch_to_mm
from functions import sta_value
import os
import win32com.client
class CarmOmf(object):
def __init__(self, carm_part_number, instance_id, side, order_of_new_product, copy_from_product, cfp_name):
self.carm_part_number = carm_part_number
self.order_of_new... | {
"repo_name": "zy964c/ECS-tool",
"path": "carm3.py",
"copies": "1",
"size": "144566",
"license": "unlicense",
"hash": -7282257869168356000,
"line_mean": 46.6754208754,
"line_max": 397,
"alpha_frac": 0.6092303861,
"autogenerated": false,
"ratio": 3.205881048476516,
"config_test": false,
"has_n... |
from functions import isPrime
numberPrimes = 100
P = []
def fillP():
count, t = 0,2
while count < numberPrimes:
if isPrime(t):
P.append(t)
count +=1
t+=1
fillP()
def nb(n,a):
'''nb of different ways to write n as the sum of numbers
that are all greater or egal to P[a]'''
if P[a] == n or n==0 : return ... | {
"repo_name": "nguyenkims/projecteuler-python",
"path": "src/p77.py",
"copies": "1",
"size": "1281",
"license": "mit",
"hash": -4549441328692360700,
"line_mean": 20.0163934426,
"line_max": 83,
"alpha_frac": 0.5448868072,
"autogenerated": false,
"ratio": 2.1421404682274248,
"config_test": false,... |
from functions import *
from analysis_functions import *
from plot_functions import *
import numpy as np
import cPickle
import matplotlib.pyplot as plt
from store_functions import *
import os
from sklearn.linear_model import LinearRegression # Import the learning algorithm
number_of_cells = 21
for cell_number in x... | {
"repo_name": "h-mayorquin/M2_complexity_thesis",
"path": "Analysis/regresion_simulation_total.py",
"copies": "1",
"size": "6874",
"license": "bsd-2-clause",
"hash": 5599904462026160000,
"line_mean": 31.2723004695,
"line_max": 105,
"alpha_frac": 0.5768111725,
"autogenerated": false,
"ratio": 3.66... |
from functions import *
from grid import *
from mob import *
from tiles import *
import pyglet
RES_PATH = "resources/"
class Game():
"""Game session."""
def __init__(self, window):
self.debug = window.debug
self.window = window # Need to keep track of the game window
# Lists of g... | {
"repo_name": "NiclasEriksen/py-towerwars",
"path": "deploy/src/game.py",
"copies": "1",
"size": "13534",
"license": "cc0-1.0",
"hash": -6452789199649710000,
"line_mean": 32.7506234414,
"line_max": 84,
"alpha_frac": 0.4759125166,
"autogenerated": false,
"ratio": 3.8059617547806526,
"config_test... |
from functions import *
from plot_functions import plot_mutliplot_bilinear
from analysis_functions import *
import numpy as np
import cPickle
import matplotlib.pyplot as plt
import os
from time import localtime
import scipy.io
from sklearn.linear_model import LinearRegression # Import the learning algorithm
########... | {
"repo_name": "h-mayorquin/M2_complexity_thesis",
"path": "Analysis/regresion_experiment.py",
"copies": "1",
"size": "9063",
"license": "bsd-2-clause",
"hash": 1894446164800087600,
"line_mean": 28.9108910891,
"line_max": 103,
"alpha_frac": 0.6301445437,
"autogenerated": false,
"ratio": 3.38424197... |
from .functions import *
from pytaskflow.taskflow_engine import WorkFlow, Task
def get_error_task():
t_err = Task(task_name='Error Task')
t_err.register_function(function=ErrorMessageFunction(), success_task=None, err_task=None)
return t_err
def get_workflow():
t4 = Task(task_name='Task 3: Dump All ... | {
"repo_name": "nicc777/pytaskflow",
"path": "examples/example01/workflow_factory.py",
"copies": "1",
"size": "1043",
"license": "bsd-3-clause",
"hash": 901864258894970800,
"line_mean": 44.3913043478,
"line_max": 172,
"alpha_frac": 0.7344199425,
"autogenerated": false,
"ratio": 3.269592476489028,
... |
from functions import *
import argparse
def updateStart(db, gene_id, newStart, rev_comp):
cur = db.cursor()
if rev_comp == False:
cur.execute("UPDATE gene SET start = " + str(newStart) + ", adjusted = 1 WHERE id = " + str(gene_id))
else:
cur.execute("UPDATE gene SET end = " + str(newStart) ... | {
"repo_name": "pjtatlow/geneysis",
"path": "python/practiceCode.py",
"copies": "1",
"size": "15427",
"license": "mit",
"hash": 4554757448240779000,
"line_mean": 41.6160220994,
"line_max": 164,
"alpha_frac": 0.601737214,
"autogenerated": false,
"ratio": 3.8166749134092033,
"config_test": false,
... |
from functions import *
import sys, os
#This file contains all of the injection and retrieval algorithms used
def xthPixelInject(args = None): #args should be [pixList, newPixList, intFiList, [Relevant CLI Args as list]]
pixList = args[0]
newPixList = args[1]
intFiList = args[2]
xth = int(args[3][0]) #The only arg ... | {
"repo_name": "jjsullivan5196/steganosaurus",
"path": "algorithms.py",
"copies": "1",
"size": "3923",
"license": "mit",
"hash": 2191686948455019500,
"line_mean": 31.974789916,
"line_max": 113,
"alpha_frac": 0.6393066531,
"autogenerated": false,
"ratio": 2.7882018479033404,
"config_test": false,... |
from .functions import *
def locatePlate(img, file_path, plot=False):
scale, img_resized = resizeImage(img)
regions = getRegions(img_resized)
regions_filtered = filterRegions(img_resized, regions)
if len(regions_filtered) == 1:
points = refineBoundaries(img_resized, regions_filtered[0])
... | {
"repo_name": "allansp84/license-plate",
"path": "modules/localization/localization/main.py",
"copies": "1",
"size": "1316",
"license": "bsd-3-clause",
"hash": 7536828573562078000,
"line_mean": 37.7058823529,
"line_max": 86,
"alpha_frac": 0.6223404255,
"autogenerated": false,
"ratio": 3.556756756... |
from functions import *
g.startbuild = datetime.datetime.now()
logger = logging.getLogger('neuromodulation')
logger.debug("* * * Building layers")
build_model()
logger.debug("* * * Connecting layers in columns")
for column in range(column_number):
print "COLUMN {0}".format(column)
''' L2 '''
# for Glu
... | {
"repo_name": "research-team/robot-dream",
"path": "somatosensory_columns/main.py",
"copies": "1",
"size": "6462",
"license": "mit",
"hash": 8536796009368931000,
"line_mean": 62.9900990099,
"line_max": 130,
"alpha_frac": 0.6928195605,
"autogenerated": false,
"ratio": 2.3644346871569706,
"config... |
from functions import *
print "Attempting to read cached updates data."
try:
file = open("sample_times,samples,period,modes,updates.pickle", "rb")
sample_times, samples, period, modes, updates = UnpickleThis("sample_times,samples,period,modes,updates.pickle")
print "Read in cached updates data. There are {0} updat... | {
"repo_name": "vdods/heisenberg",
"path": "attic/fourier-analysis/main.py",
"copies": "1",
"size": "4299",
"license": "mit",
"hash": -21598899352828812,
"line_mean": 59.5492957746,
"line_max": 130,
"alpha_frac": 0.7506396836,
"autogenerated": false,
"ratio": 3.526661197703035,
"config_test": fa... |
from Functions import *
while True:
option = input('(L)ab 1, (T)aller 2: ')
if option == 'L':
num = input('Numeral: ')
if num == '1':
func = 'np.exp(x) - 3*x'
x0 = input('Ingrese límite inferior: ')
x1 = input('Ingrese límite superior: ')
par = input('¿Realizar 6 iteraciones? (S/N): ')
if par... | {
"repo_name": "queq/just-stuff",
"path": "python/lab-1/main.py",
"copies": "1",
"size": "1839",
"license": "mit",
"hash": -267747093116807360,
"line_mean": 31.0701754386,
"line_max": 77,
"alpha_frac": 0.5705689278,
"autogenerated": false,
"ratio": 2.3316326530612246,
"config_test": false,
"ha... |
from functions import prime_sieve, primefactors
import time
import math
times = []
times += [time.clock()]
limit = 1000000
primes = prime_sieve(int(math.sqrt(limit)))
maximum = 2
maxn = 2
# phi(2n) = {2phi(n) if n is even; phi(n) if odd}
# phi(nm) = phi(n) * phi(m) if n, m are coprime
# maxn will be even but eventual... | {
"repo_name": "esosn/euler",
"path": "69.py",
"copies": "1",
"size": "1111",
"license": "mit",
"hash": 8294753654031220000,
"line_mean": 21.693877551,
"line_max": 69,
"alpha_frac": 0.5661566157,
"autogenerated": false,
"ratio": 2.8055555555555554,
"config_test": false,
"has_no_keywords": fals... |
from functions import *
from time import sleep
def run_calculator():
"""
A Simple Calculator
"""
list_choices = ['Addition: 1',
'Subtraction: 2',
'Multiplication: 3',
'Division: 4',
'Exponent: 5',
... | {
"repo_name": "Apsis/Synthetic-Programming",
"path": "Simple Calculator/main.py",
"copies": "1",
"size": "1381",
"license": "mit",
"hash": -9109832418679094000,
"line_mean": 22.2280701754,
"line_max": 54,
"alpha_frac": 0.4098479363,
"autogenerated": false,
"ratio": 4.398089171974522,
"config_te... |
from ..functions import sqrt
from .rv import (cdf, density, dependent, expectation, given, independent,
probability, pspace, random_symbols, sample, sample_iter,
sampling_density, where)
__all__ = ('P', 'E', 'density', 'where', 'given', 'sample', 'cdf', 'pspace',
'sample_i... | {
"repo_name": "diofant/diofant",
"path": "diofant/stats/rv_interface.py",
"copies": "2",
"size": "4892",
"license": "bsd-3-clause",
"hash": -1353850904711446300,
"line_mean": 21.6481481481,
"line_max": 80,
"alpha_frac": 0.5515126738,
"autogenerated": false,
"ratio": 3.440225035161744,
"config_t... |
from .functions import Textile
class TextileFactory(object):
"""
Use TextileFactory to create a Textile object which can be re-used
to process multiple strings with the same settings.
>>> f = TextileFactory()
>>> f.process("some text here")
'\\t<p>some text here</p>'
>>> f = TextileFacto... | {
"repo_name": "timonwong/OmniMarkupPreviewer",
"path": "OmniMarkupLib/Renderers/libs/python3/textile/textilefactory.py",
"copies": "2",
"size": "2255",
"license": "mit",
"hash": -7274836619988116000,
"line_mean": 29.472972973,
"line_max": 77,
"alpha_frac": 0.5920177384,
"autogenerated": false,
"r... |
from functions import Textile
class TextileFactory(object):
"""
Use TextileFactory to create a Textile object which can be re-used
to process multiple strings with the same settings.
>>> f = TextileFactory()
>>> f.process("some text here")
'\\t<p>some text here</p>'
>>> f = TextileFactor... | {
"repo_name": "Lyleo/OmniMarkupPreviewer",
"path": "OmniMarkupLib/Renderers/libs/python2/textile/textilefactory.py",
"copies": "2",
"size": "2248",
"license": "mit",
"hash": -8898333770990043000,
"line_mean": 29.3783783784,
"line_max": 77,
"alpha_frac": 0.5920818505,
"autogenerated": false,
"rati... |
from .functions import vtos, stov
class ModelFile:
def __init__(self, filename, mode='r'):
self.__fp = open(filename, mode)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.__fp.close()
return False
def write(self, x):
... | {
"repo_name": "odashi/chainer_examples",
"path": "chainer-1.4/util/model_file.py",
"copies": "1",
"size": "1198",
"license": "mit",
"hash": 4992737684497897000,
"line_mean": 22.0384615385,
"line_max": 55,
"alpha_frac": 0.530884808,
"autogenerated": false,
"ratio": 3.3185595567867034,
"config_te... |
from ..functions.messages import SaveDraftRequest
from ..types import UpdateDraftMessage
class Draft:
"""
Custom class that encapsulates a draft on the Telegram servers, providing
an abstraction to change the message conveniently. The library will return
instances of this class when calling `client.ge... | {
"repo_name": "andr-04/Telethon",
"path": "telethon/tl/custom/draft.py",
"copies": "1",
"size": "2627",
"license": "mit",
"hash": -2115114454082083300,
"line_mean": 31.8375,
"line_max": 86,
"alpha_frac": 0.6003045299,
"autogenerated": false,
"ratio": 4.299509001636661,
"config_test": false,
"... |
from functions_text import *
from roulette_player import *
###### PLAYER TURN ######
def turn(active, bets, betsMoney, betsType, money, name, gender, simpleChances):
betMade = False
input("{0}, tapez Entrée pour faire vos jeux.".format(name[active]))
while not(betMade):
### PRINT MEN... | {
"repo_name": "cpvannier/western",
"path": "roulette_turn.py",
"copies": "1",
"size": "2139",
"license": "apache-2.0",
"hash": -1153894462859193300,
"line_mean": 44.4680851064,
"line_max": 128,
"alpha_frac": 0.6036499766,
"autogenerated": false,
"ratio": 3.133431085043988,
"config_test": false,... |
from functions_text import *
from western_player import *
###### PLAYER TURN ######
def turn(active, players, rooms, room, actions, bullets, defense, life, alive, killer, traitors, traitor, detective, gender, name, title, sniper, playerTNT, roomTNT, playerBlock, roomBlock, roomBlocked):
actionsTemp = actions[acti... | {
"repo_name": "cpvannier/western",
"path": "western_turn.py",
"copies": "1",
"size": "3872",
"license": "apache-2.0",
"hash": 4502938962606807000,
"line_mean": 46.0975609756,
"line_max": 203,
"alpha_frac": 0.5735370274,
"autogenerated": false,
"ratio": 3.369982547993019,
"config_test": false,
... |
from ...functions.xml.deff import *
def nextquantity(s,l,t):
return wrap("next", t[2])
def damage(s,l,t):
return wrap("damage", t[0])
def combatdamage(s,l,t):
combat = emptytag("combat")
return wrap("damage", [combat,t[1]])
def noncombatdamage(s,l,t):
noncombat = emptytag("noncombat")
return wrap("damage", [n... | {
"repo_name": "jrgdiz/cardwalker",
"path": "grammar/rules/oneshot/act.py",
"copies": "1",
"size": "2324",
"license": "mit",
"hash": -361483554068445300,
"line_mean": 17.75,
"line_max": 44,
"alpha_frac": 0.6256454389,
"autogenerated": false,
"ratio": 2.26953125,
"config_test": false,
"has_no_k... |
from .function_type import FunctionType, Invokable, IntrinsicCallable
from .containers import Temporary
class MacroType(FunctionType, Invokable):
def __init__(self, ret_type, params, body, typescope, compiletime):
super().__init__(ret_type, params, True, False)
self._typescope = typescope
... | {
"repo_name": "simon816/Command-Block-Assembly",
"path": "cbl/macro_type.py",
"copies": "1",
"size": "1647",
"license": "mit",
"hash": -3545487537936638000,
"line_mean": 40.175,
"line_max": 74,
"alpha_frac": 0.6114146934,
"autogenerated": false,
"ratio": 4.12781954887218,
"config_test": false,
... |
from functools import cached_property
from typing import Dict, Iterable, Optional, Protocol, Type, TypeVar, Union
import requests
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.contrib.auth.models import AnonymousUser
from dja... | {
"repo_name": "CenterForOpenScience/lookit-api",
"path": "exp/views/mixins.py",
"copies": "1",
"size": "6152",
"license": "apache-2.0",
"hash": 1407852026549908200,
"line_mean": 34.3563218391,
"line_max": 130,
"alpha_frac": 0.6776657997,
"autogenerated": false,
"ratio": 4.120562625586068,
"conf... |
from functools import cached_property, partial
from logging import getLogger, FileHandler
from multiprocessing import cpu_count
from pathlib import Path
from time import time
from typing import Dict, Optional, Union, Sequence
import albumentations as A
import pytorch_lightning as pl
from pytorch_lightning import seed_... | {
"repo_name": "akirasosa/mobile-semantic-segmentation",
"path": "src/run_train.py",
"copies": "1",
"size": "6544",
"license": "mit",
"hash": 5138638162982190000,
"line_mean": 29.5794392523,
"line_max": 89,
"alpha_frac": 0.551497555,
"autogenerated": false,
"ratio": 3.9162178336325555,
"config_t... |
from functools import cmp_to_key
from collections import namedtuple
from common.deco import cachedprop, singleton
from ..base import BinaryElementBase
from ..location import UndefinedLocation
class DataTypeBase(BinaryElementBase):
def __init__(self, elf, name, loc_id):
BinaryElementBase.__init__(self, elf... | {
"repo_name": "Samsung/ADBI",
"path": "idk/cachereader/datatype/datatype.py",
"copies": "1",
"size": "6567",
"license": "apache-2.0",
"hash": 4164865685191119400,
"line_mean": 29.123853211,
"line_max": 104,
"alpha_frac": 0.5954012487,
"autogenerated": false,
"ratio": 4.198849104859335,
"config_... |
from functools import cmp_to_key
import string
class Post:
def __init__(self, image_id, unixtime, rawtime, reddit_id, subreddit, username):
self.unixtime = unixtime
self.rawtime = rawtime
self.image_id = image_id
self.reddit_id = reddit_id
self.subreddit = subreddit
s... | {
"repo_name": "dfcf93/RPICS",
"path": "TheoryOfNetworkedSystems/Cascade-NETINF/Project Related/netinfredditprep.py",
"copies": "1",
"size": "6562",
"license": "mit",
"hash": -6486576776061138000,
"line_mean": 30.2476190476,
"line_max": 116,
"alpha_frac": 0.5169155745,
"autogenerated": false,
"rat... |
from functools import cmp_to_key
from oic.utils.http_util import extract_from_request
__author__ = 'rolandh'
UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"
INTERNETPROTOCOLPASSWORD = \
'urn:oasis:names:tc:SAML:2.0:ac:classes:InternetProtocolPassword'
MOBILETWOFACTORCONTRACT = \
'urn:oasis... | {
"repo_name": "ekivemark/BlueButtonDev",
"path": "oidc/pyoidc-master/src/oic/utils/authn/authn_context.py",
"copies": "1",
"size": "7079",
"license": "apache-2.0",
"hash": 8889058147749680000,
"line_mean": 31.3287671233,
"line_max": 120,
"alpha_frac": 0.5376465602,
"autogenerated": false,
"ratio"... |
from functools import cmp_to_key
from sublime import Region
from sublime_plugin import TextCommand
class MoveTextHorizCommand(TextCommand):
def move_text_horiz(self, edit, direction):
for region in self.view.sel():
if region.empty():
continue
orig_region = region
... | {
"repo_name": "ggamir/SublimeMoveText",
"path": "move_text.py",
"copies": "1",
"size": "4050",
"license": "bsd-2-clause",
"hash": -2310453472092009500,
"line_mean": 34.8407079646,
"line_max": 123,
"alpha_frac": 0.5995061728,
"autogenerated": false,
"ratio": 3.817153628652215,
"config_test": fal... |
from functools import cmp_to_key
import mufsim.utils as util
import mufsim.gamedb as db
import mufsim.stackitems as si
from mufsim.errors import MufRuntimeError
from mufsim.insts.base import Instruction, instr
@instr("addprop")
class InstAddProp(Instruction):
def execute(self, fr):
fr.check_underflow(3)
... | {
"repo_name": "revarbat/mufsim",
"path": "mufsim/insts/properties.py",
"copies": "1",
"size": "10436",
"license": "bsd-2-clause",
"hash": -7676189149316034000,
"line_mean": 25.9664082687,
"line_max": 60,
"alpha_frac": 0.5344001533,
"autogenerated": false,
"ratio": 3.336317135549872,
"config_tes... |
from functools import lru_cache as _lru_cache
import string as _string
import pearl as _pearl
from . import ast as _ast
g = _pearl.Grammar()
g = g.put('__start__', [{'statement_sequence'}, 'whitespace'])
# statement sequence
g = g.put('statement_sequence', [{'statements'}], _ast.StatementSequence)
g = g.put('sta... | {
"repo_name": "yuri-kilochek/pearl",
"path": "lang/core/_core_grammar.py",
"copies": "1",
"size": "13446",
"license": "mit",
"hash": 3533470019055960600,
"line_mean": 36.041322314,
"line_max": 192,
"alpha_frac": 0.5227576975,
"autogenerated": false,
"ratio": 3.7112889870273253,
"config_test": f... |
from functools import lru_cache as _lru_cache
from ._read import read as _read
from . import ast as _ast
@_lru_cache(maxsize=None)
class Module:
def __init__(self, path):
self.__path = path
self.__body = _read(path)
self.__exported_variables = {}
self.__exported_macro_definitions ... | {
"repo_name": "yuri-kilochek/pearl",
"path": "lang/core/_Module.py",
"copies": "1",
"size": "2020",
"license": "mit",
"hash": 8749961458645973000,
"line_mean": 27.8571428571,
"line_max": 93,
"alpha_frac": 0.553960396,
"autogenerated": false,
"ratio": 4.031936127744511,
"config_test": false,
"... |
from functools import lru_cache
class Solution:
def dieSimulator(self, n: int, rollMax: List[int]) -> int:
MOD = 10 ** 9 + 7
@lru_cache(None)
def dfs(prevSame, curr, left):
if left == 0:
return 1
total = 0
for i in range(6):
... | {
"repo_name": "jiadaizhao/LeetCode",
"path": "1201-1300/1223-Dice Roll Simulation/1223-Dice Roll Simulation.py",
"copies": "1",
"size": "1252",
"license": "mit",
"hash": 1295571516814218000,
"line_mean": 31.9473684211,
"line_max": 93,
"alpha_frac": 0.4065495208,
"autogenerated": false,
"ratio": 3... |
from functools import lru_cache
class Solution:
def findGoodStrings(self, n: int, s1: str, s2: str, evil: str) -> int:
m = len(evil)
lps = [0] * m
i = 1
l = 0
while i < m:
if evil[i] == evil[l]:
lps[i] = l + 1
i += 1
... | {
"repo_name": "jiadaizhao/LeetCode",
"path": "1301-1400/1397-Find All Good Strings/1397-Find All Good Strings.py",
"copies": "1",
"size": "1337",
"license": "mit",
"hash": 8436892174953766000,
"line_mean": 27.4468085106,
"line_max": 74,
"alpha_frac": 0.3500373972,
"autogenerated": false,
"ratio":... |
from functools import lru_cache
from bisect import bisect_left
from Levenshtein import distance
from .hashable_list_wrapper import HashableListWrapper
def _index(container, value):
"""
Locate the leftmost value exactly equal to x
"""
i = bisect_left(container, value)
if i != len(container) and cont... | {
"repo_name": "b09dan/universities_sentiment",
"path": "text_class/pynlc/corrector.py",
"copies": "1",
"size": "2644",
"license": "mit",
"hash": -8119757400422923000,
"line_mean": 28.3777777778,
"line_max": 73,
"alpha_frac": 0.628214826,
"autogenerated": false,
"ratio": 3.9345238095238093,
"con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.