text
stringlengths
0
1.05M
meta
dict
from functools import reduce # Sort in O(n log(n)) time and O(n) space def sort_high_to_low(integers): result = None for i in range(len(integers)): if result is None: result = [integers[i]] continue for j in range(len(result)): if integers[i] <= result[len(r...
{ "repo_name": "JDFagan/InterviewInPython", "path": "interviewcake/highest_product.py", "copies": "1", "size": "1719", "license": "mit", "hash": -4054943587126883000, "line_mean": 34.8125, "line_max": 89, "alpha_frac": 0.5445026178, "autogenerated": false, "ratio": 3.988399071925754, "config_tes...
from functools import reduce number = 11 data = [[ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8], [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0], [81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65], [52, 70, 95, 23, 4, ...
{ "repo_name": "rhinox/ProjectEuler", "path": "src/main/python/problem_11.py", "copies": "1", "size": "3173", "license": "mit", "hash": 4039884350456360400, "line_mean": 46.3582089552, "line_max": 97, "alpha_frac": 0.501103057, "autogenerated": false, "ratio": 2.2761836441893832, "config_test": ...
from functools import reduce try: from itertools import zip_longest from unittest.mock import patch as _patch, Mock as _Mock from unittest.mock import call as _call, ANY as _ANY except ImportError: from mock import patch as _patch, Mock as _Mock from mock import call as _call, ANY as _ANY from i...
{ "repo_name": "vmagamedov/hiku", "path": "tests/base.py", "copies": "1", "size": "1846", "license": "bsd-3-clause", "hash": 2399954279884178400, "line_mean": 28.7741935484, "line_max": 71, "alpha_frac": 0.6013001083, "autogenerated": false, "ratio": 3.563706563706564, "config_test": false, "h...
from functools import reduce # version code d345910f07ae coursera = 1 # Please fill out this stencil and submit using the provided submission script. ## 1: (Task 1) Movie Review ## Task 1 def movie_review(name): from random import randint """ Input: the name of a movie Output: a string (one of the revi...
{ "repo_name": "josiah14/linear-algebra", "path": "programming-the-matrix/0-week/inverse-index-lab/Python/inverse_index_lab.py", "copies": "1", "size": "2945", "license": "mit", "hash": -7016810641730002000, "line_mean": 38.7972972973, "line_max": 190, "alpha_frac": 0.6522920204, "autogenerated": fa...
from functools import reduce # V is sparse Vector with O(k)=o(n) elements # Time: O(1) def getitem(v,d): "Returns the value of entry d in v" assert d in v.D return 0 if d not in v.f else v.f[d]; # Time: O(1) def setitem(v,d,val): "Set the element of v with label d to be val" assert d in v.D v....
{ "repo_name": "mgall/coding-the-matrix", "path": "matrixlib/vec.py", "copies": "1", "size": "3228", "license": "mit", "hash": 3931624128291188700, "line_mean": 30.9603960396, "line_max": 198, "alpha_frac": 0.5477075589, "autogenerated": false, "ratio": 2.977859778597786, "config_test": false, ...
from functools import reduce voting_data = list(open("voting_record_dump109.txt")) ## Task 1 def create_voting_dict(): """ Input: None (use voting_data above) Output: A dictionary that maps the last name of a senator to a list of numbers representing the senator's voting record. ...
{ "repo_name": "mgall/coding-the-matrix", "path": "labs/03-lab-politics/politics_lab.py", "copies": "1", "size": "6273", "license": "mit", "hash": -480726516447352450, "line_mean": 37.4846625767, "line_max": 100, "alpha_frac": 0.6438705564, "autogenerated": false, "ratio": 2.8854645814167434, "c...
from functools import reduce, partial import inspect import operator from operator import attrgetter from textwrap import dedent from .compatibility import PY3, PY33, PY34, PYPY, import_module from .utils import no_default __all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose', 'pipe',...
{ "repo_name": "Microsoft/PTVS", "path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda/_vendor/toolz/functoolz.py", "copies": "1", "size": "32092", "license": "apache-2.0", "hash": 2093802457664481800, "line_mean": 28.8530232558, "line_max": 79, "alpha_frac": 0.5461174124, "autoge...
from functools import reduce, partial import inspect import operator from operator import attrgetter from textwrap import dedent from .compatibility import PY3, PY33, PY34, PYPY from .utils import no_default __all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose', 'pipe', 'complement', ...
{ "repo_name": "jeffery-do/Vizdoombot", "path": "doom/lib/python3.5/site-packages/toolz/functoolz.py", "copies": "1", "size": "30770", "license": "mit", "hash": -438882412883073600, "line_mean": 28.558117195, "line_max": 79, "alpha_frac": 0.5485537862, "autogenerated": false, "ratio": 3.9413346996...
from functools import reduce, partial import inspect import operator from toolz.utils import no_default def identity(x): return x def thread_first(val, *forms): """ Thread value through a sequence of functions/forms >>> def double(x): return 2*x >>> def inc(x): return x + 1 >>> thread_first(...
{ "repo_name": "whilo/toolz", "path": "toolz/functoolz/core.py", "copies": "1", "size": "9236", "license": "bsd-3-clause", "hash": 7884066073343873000, "line_mean": 23.3693931398, "line_max": 79, "alpha_frac": 0.5436336076, "autogenerated": false, "ratio": 3.7914614121510675, "config_test": fals...
from functools import reduce, partial import inspect import operator import sys __all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose', 'pipe', 'complement', 'juxt', 'do', 'curry', 'flip') def identity(x): """ Identity function. Return x >>> identity(3) 3 """ retu...
{ "repo_name": "jcrist/toolz", "path": "toolz/functoolz.py", "copies": "5", "size": "14985", "license": "bsd-3-clause", "hash": 6766746920942812000, "line_mean": 25.2894736842, "line_max": 79, "alpha_frac": 0.5468802135, "autogenerated": false, "ratio": 3.796554345072207, "config_test": false, ...
from functools import reduce, partial import inspect import operator __all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose', 'pipe', 'complement', 'juxt', 'do', 'curry') def identity(x): return x def thread_first(val, *forms): """ Thread value through a sequence of functions...
{ "repo_name": "larsmans/toolz", "path": "toolz/functoolz.py", "copies": "7", "size": "10471", "license": "bsd-3-clause", "hash": 4116973708904466000, "line_mean": 24.5390243902, "line_max": 79, "alpha_frac": 0.5474166746, "autogenerated": false, "ratio": 3.7897213174086137, "config_test": false...
from functools import reduce, partial import inspect import operator def identity(x): return x def thread_first(val, *forms): """ Thread value through a sequence of functions/forms >>> def double(x): return 2*x >>> def inc(x): return x + 1 >>> thread_first(1, inc, double) 4 If the f...
{ "repo_name": "joyrexus/toolz", "path": "toolz/functoolz/core.py", "copies": "1", "size": "9658", "license": "bsd-3-clause", "hash": 3199862913879604000, "line_mean": 23.7641025641, "line_max": 79, "alpha_frac": 0.5447297577, "autogenerated": false, "ratio": 3.787450980392157, "config_test": fa...
from functools import reduce, partial, wraps import inspect import operator from operator import attrgetter from textwrap import dedent import sys from .compatibility import PY3, PY34, PYPY __all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose', 'pipe', 'complement', 'juxt', 'do', 'curr...
{ "repo_name": "pombredanne/toolz", "path": "toolz/functoolz.py", "copies": "1", "size": "25136", "license": "bsd-3-clause", "hash": 4965721593215442000, "line_mean": 27.5636363636, "line_max": 79, "alpha_frac": 0.5526336728, "autogenerated": false, "ratio": 3.8964501627654626, "config_test": fa...
from functools import reduce, partial, wraps import inspect import operator from operator import attrgetter from textwrap import dedent import sys __all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose', 'pipe', 'complement', 'juxt', 'do', 'curry', 'flip', 'excepts') def identity(x): ...
{ "repo_name": "autorealm/MayoiNeko", "path": "develop/toolz/functoolz.py", "copies": "1", "size": "18001", "license": "apache-2.0", "hash": -515901521145279600, "line_mean": 25.3557833089, "line_max": 79, "alpha_frac": 0.540358869, "autogenerated": false, "ratio": 3.860390306669526, "config_tes...
from functools import reduce, partial, wraps def const(x): return lambda _: x def curry(f): return lambda x: lambda y: f(x,y) def compose(*f): return reduce(lambda g,f: lambda x: g(f(x)), f) def tco(func): @wraps(func) def func_run(*args, **kwargs): res = func(*args, **kwargs) while type(res...
{ "repo_name": "oisdk/PyParse", "path": "Utils.py", "copies": "1", "size": "1749", "license": "mit", "hash": -6186365178648242000, "line_mean": 24.347826087, "line_max": 72, "alpha_frac": 0.5557461407, "autogenerated": false, "ratio": 3.0738137082601056, "config_test": false, "has_no_keywords"...
from functools import reduce import itertools from tkinter import messagebox from googleTranslate.Translator import Translator import re __author__ = 'Girish' class Subtitle_translator(Translator): def __init__(self,to): Translator.__init__(self,to) def set_progress_bar(self,progress_ba...
{ "repo_name": "girishramnani/collegeProjects", "path": "googleTranslate/Subtitle_translator.py", "copies": "3", "size": "1174", "license": "mit", "hash": 3401482940347902000, "line_mean": 26.6341463415, "line_max": 108, "alpha_frac": 0.5161839864, "autogenerated": false, "ratio": 4.14840989399293...
from functools import reduce import itertools import warnings class Iterable: def __init__(self, iterable): iter(iterable) self.__iterable = list(iterable) def __iter__(self): return iter(self.__iterable) def __len__(self): return len(list(self.__iterable)...
{ "repo_name": "neverendingqs/pyiterable", "path": "pyiterable/iterable.py", "copies": "1", "size": "20514", "license": "mit", "hash": -745946282186158300, "line_mean": 35.9186691312, "line_max": 139, "alpha_frac": 0.5401189432, "autogenerated": false, "ratio": 4.011341415721549, "config_test": ...
from functools import reduce import operator from django.db import models from django.db.models import Prefetch, Q, Count from django.urls import reverse, reverse_lazy from django.conf import settings from django.utils.translation import gettext_lazy as _, gettext from django.contrib.humanize.templatetags.huma...
{ "repo_name": "flavoi/diventi", "path": "diventi/products/models.py", "copies": "1", "size": "14787", "license": "apache-2.0", "hash": -1274900968654638300, "line_mean": 32.388372093, "line_max": 135, "alpha_frac": 0.5890429489, "autogenerated": false, "ratio": 4.375554897898787, "config_test":...
from functools import reduce import operator from django.db import models from django.db.models import Q, Count, Sum from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ from django.conf import settings from django.contrib.auth.models import AbstractUser, UserManager fro...
{ "repo_name": "flavoi/diventi", "path": "diventi/accounts/models.py", "copies": "1", "size": "8546", "license": "apache-2.0", "hash": -7439312121132650000, "line_mean": 33.0163934426, "line_max": 154, "alpha_frac": 0.6008895131, "autogenerated": false, "ratio": 4.026390197926484, "config_test":...
from functools import reduce BASE_COST = 800 discount = [1.0, 1.0, 0.95, 0.9, 0.8, 0.75] def groupCost(g): return len(g) * discount[len(g)] class Grouping: def __init__(self, groups=None): self.groups = [set()] if groups is None else groups def total(self): return sum(ma...
{ "repo_name": "N-Parsons/exercism-python", "path": "exercises/book-store/example.py", "copies": "1", "size": "1293", "license": "mit", "hash": 3424081276115114500, "line_mean": 24.387755102, "line_max": 77, "alpha_frac": 0.5367362722, "autogenerated": false, "ratio": 3.552197802197802, "config_...
from functools import reduce BASE_COST = 800 discount = [1.0, 1.0, 0.95, 0.9, 0.8, 0.75] def group_cost(group): return len(group) * discount[len(group)] class Grouping: def __init__(self, groups=None): self.groups = [set()] if groups is None else groups def total(self): ...
{ "repo_name": "smalley/python", "path": "exercises/book-store/example.py", "copies": "2", "size": "1403", "license": "mit", "hash": 7596700005181253000, "line_mean": 25.5098039216, "line_max": 64, "alpha_frac": 0.5566642908, "autogenerated": false, "ratio": 3.8125, "config_test": false, "has_...
from functools import reduce def breakup(line): dimensions = [int(number) for number in line.split("x")] print (line + " broke in to " + str(dimensions)) return dimensions def double(x): return 2*x def calculatesides(dimensions): print ("Given dimensions " + str(dimensions)) areas...
{ "repo_name": "icbat/adventofcode2015", "path": "python/day2/wrapping_paper_dimensions.py", "copies": "1", "size": "1934", "license": "mit", "hash": 3235440595638385000, "line_mean": 28.6984126984, "line_max": 92, "alpha_frac": 0.6530506722, "autogenerated": false, "ratio": 3.574861367837338, "...
from functools import reduce def pick(obj, key): if type(obj) is dict: return obj[key] else: return getattr(obj, key) def match(part, template): if type(template) is dict: try: return all([match(pick(part,k),v) for k,v in template.items()]) except ...
{ "repo_name": "neerajvashistha/pa-dude", "path": "lib/python2.7/site-packages/telepot/filtering.py", "copies": "4", "size": "1195", "license": "mit", "hash": 1546235357802989000, "line_mean": 26.4523809524, "line_max": 87, "alpha_frac": 0.5112970711, "autogenerated": false, "ratio": 3.94389438943...
from functools import reduce from dynts.conf import settings from ...api import timeseries, is_timeseries class Expr: '''Base class for abstract syntax nodes ''' def count(self): '''Number of nodes''' return 1 def malformed(self): return False @property ...
{ "repo_name": "quantmind/dynts", "path": "dynts/dsl/ast/base.py", "copies": "1", "size": "9833", "license": "bsd-3-clause", "hash": 1358479623120942000, "line_mean": 25.9346590909, "line_max": 88, "alpha_frac": 0.5324926269, "autogenerated": false, "ratio": 4.301399825021872, "config_test": fal...
from functools import reduce from numpy import array, ndarray, dtype object_type = dtype(object) def crossoperator(func, *args): return [func(*vals) for vals in zip(*args)] def scalarasiter(x): if x is None: return () elif hasattr(x, '__iter__'): return x else: ...
{ "repo_name": "quantmind/dynts", "path": "dynts/utils/section.py", "copies": "1", "size": "2249", "license": "bsd-3-clause", "hash": 7510346334945448000, "line_mean": 21.9255319149, "line_max": 65, "alpha_frac": 0.4828812806, "autogenerated": false, "ratio": 3.904513888888889, "config_test": fa...
from functools import reduce import wx from gooey.gui import formatters, events from gooey.gui.util import wx_util from gooey.util.functional import getin, ifPresent from gooey.gui.validators import runValidator from gooey.gui.components.util.wrapped_static_text import AutoWrappedStaticText class BaseWid...
{ "repo_name": "partrita/Gooey", "path": "gooey/gui/components/widgets/bases.py", "copies": "1", "size": "5908", "license": "mit", "hash": 6502257795734131000, "line_mean": 31.0055865922, "line_max": 92, "alpha_frac": 0.6076506432, "autogenerated": false, "ratio": 3.9891964888588793, "config_tes...
from functools import reduce, update_wrapper def pipe_call(a, b): return b(a) def and_then(*f): def and_then_call(x): return reduce(pipe_call, f, x) return and_then_call class Pipe: def __init__(self, f, l_args, r_args, kwargs, f_continue: tuple = None): if not isinstance(f, str): ...
{ "repo_name": "manhong2112/CodeColle", "path": "Python/waifu/pipe_fn.py", "copies": "1", "size": "1563", "license": "mit", "hash": 7037716326892806000, "line_mean": 24.6229508197, "line_max": 77, "alpha_frac": 0.5822136916, "autogenerated": false, "ratio": 3.132264529058116, "config_test": fals...
from functools import reduce, wraps from itertools import chain, tee from random import choice from string import digits from django.utils.functional import curry def just(*x, **kw): return len(x) and x[0] or kw def call(fn): return fn() def swap(a, fn): return fn(a) def unpack_args(fn): return lam...
{ "repo_name": "doctorzeb8/django-era", "path": "era/utils/functools.py", "copies": "1", "size": "2291", "license": "mit", "hash": 5396153454546150000, "line_mean": 19.6396396396, "line_max": 75, "alpha_frac": 0.5722391969, "autogenerated": false, "ratio": 2.7939024390243903, "config_test": fals...
from functools import reduce, wraps def foo1(*args): for arg in args: print(arg) def foo2(**kwargs): for key, value in kwargs.items(): print('{key} == {value}'.format(**locals())) def fibon(n): i, a, b = 1, 1, 2 while i <= n: yield a a, b = b, a + b i += 1 ...
{ "repo_name": "amozie/amozie", "path": "studzie/interpy_pdf.py", "copies": "1", "size": "1238", "license": "apache-2.0", "hash": -1695817052362641700, "line_mean": 16.1944444444, "line_max": 53, "alpha_frac": 0.5105008078, "autogenerated": false, "ratio": 2.845977011494253, "config_test": false...
from functools import singledispatch from abc import ABC import cgen as c from devito.ir import (DummyEq, Call, Conditional, List, Prodder, ParallelIteration, ParallelBlock, PointerCast, EntryFunction, LocalExpression) from devito.mpi.distributed import MPICommObject from devito.passes.iet.engi...
{ "repo_name": "opesci/devito", "path": "devito/passes/iet/langbase.py", "copies": "1", "size": "8429", "license": "mit", "hash": -2506433137338446300, "line_mean": 28.9964412811, "line_max": 88, "alpha_frac": 0.5842923241, "autogenerated": false, "ratio": 4.335905349794238, "config_test": false...
from functools import singledispatch from llvmlite import ir from numba.core import types, cgutils from numba.core.imputils import Registry from numba.cuda import nvvmutils registry = Registry() lower = registry.lower voidptr = ir.PointerType(ir.IntType(8)) # NOTE: we don't use @lower here since print_item() doesn'...
{ "repo_name": "stonebig/numba", "path": "numba/cuda/printimpl.py", "copies": "5", "size": "2478", "license": "bsd-2-clause", "hash": -7359692120917400000, "line_mean": 30.7692307692, "line_max": 79, "alpha_frac": 0.691283293, "autogenerated": false, "ratio": 3.504950495049505, "config_test": fa...
from functools import singledispatch from llvmlite.llvmpy.core import Type from numba.core import types, cgutils from numba.core.imputils import Registry from numba.cuda import nvvmutils registry = Registry() lower = registry.lower voidptr = Type.pointer(Type.int(8)) # NOTE: we don't use @lower here since print_ite...
{ "repo_name": "seibert/numba", "path": "numba/cuda/printimpl.py", "copies": "1", "size": "2488", "license": "bsd-2-clause", "hash": 3040421818345085400, "line_mean": 30.8974358974, "line_max": 79, "alpha_frac": 0.6917202572, "autogenerated": false, "ratio": 3.49438202247191, "config_test": fals...
from functools import singledispatch from numbers import Integral import numpy as np from numba import njit from scipy import sparse @singledispatch def is_constant(a, axis=None) -> np.ndarray: """ Check whether values in array are constant. Params ------ a Array to check axis ...
{ "repo_name": "theislab/scanpy", "path": "scanpy/_utils/compute/is_constant.py", "copies": "1", "size": "2817", "license": "bsd-3-clause", "hash": 6770869195300949000, "line_mean": 24.3783783784, "line_max": 80, "alpha_frac": 0.5583954562, "autogenerated": false, "ratio": 3.3696172248803826, "c...
from functools import singledispatch from os import PathLike from pathlib import Path from typing import Optional, Union, Iterator import h5py from . import anndata from .sparse_dataset import SparseDataset from ..compat import Literal, ZarrArray class AnnDataFileManager: """Backing file manager for AnnData."""...
{ "repo_name": "theislab/anndata", "path": "anndata/_core/file_backing.py", "copies": "1", "size": "3074", "license": "bsd-3-clause", "hash": 3508439657661030000, "line_mean": 26.6936936937, "line_max": 88, "alpha_frac": 0.6060507482, "autogenerated": false, "ratio": 3.925925925925926, "config_t...
from functools import singledispatch from typing import Callable, List, Optional, Tuple import numpy as np import torch import torch.nn.functional as F from scipy.optimize import linear_sum_assignment @singledispatch def permutate(y1, y2, cost_func: Optional[Callable] = None, returns_cost: bool = False): """Find...
{ "repo_name": "pyannote/pyannote-audio", "path": "pyannote/audio/utils/permutation.py", "copies": "1", "size": "3909", "license": "mit", "hash": 1529482963346174000, "line_mean": 28.8396946565, "line_max": 97, "alpha_frac": 0.6001534919, "autogenerated": false, "ratio": 3.45929203539823, "confi...
from functools import singledispatch from typing import Dict from .expressions import ( Expression, Operation, Wildcard, AssociativeOperation, CommutativeOperation, SymbolWildcard, Pattern, OneIdentityOperation ) __all__ = [ 'is_constant', 'is_syntactic', 'get_head', 'match_head', 'preorder_iter', 'preorder_i...
{ "repo_name": "wheerd/patternmatcher", "path": "matchpy/expressions/functions.py", "copies": "2", "size": "6078", "license": "mit", "hash": -5422208405158384000, "line_mean": 34.3372093023, "line_max": 126, "alpha_frac": 0.7025337282, "autogenerated": false, "ratio": 4.31063829787234, "config_t...
from functools import singledispatch from typing import List, Optional import strawberry from django import forms from django.core.exceptions import ImproperlyConfigured from strawberry.types.datetime import Date, DateTime, Time @singledispatch def convert_form_field(field): raise ImproperlyConfigured( "...
{ "repo_name": "patrick91/pycon", "path": "backend/strawberry_forms/converter.py", "copies": "1", "size": "3512", "license": "mit", "hash": -1175322615337260800, "line_mean": 29.275862069, "line_max": 79, "alpha_frac": 0.7269362187, "autogenerated": false, "ratio": 3.38996138996139, "config_test...
from functools import singledispatch from typing import Optional, Union import warnings from anndata import AnnData from scanpy.get import _get_obs_rep import numba import numpy as np import pandas as pd from scipy import sparse @singledispatch def gearys_c( adata: AnnData, *, vals: Optional[Union[np.nd...
{ "repo_name": "theislab/scanpy", "path": "scanpy/metrics/_gearys_c.py", "copies": "1", "size": "9804", "license": "bsd-3-clause", "hash": 735643843749345300, "line_mean": 28.7090909091, "line_max": 98, "alpha_frac": 0.5784373725, "autogenerated": false, "ratio": 3.2778335005015045, "config_test...
from functools import singledispatch import numbers from typing import Tuple import math from .transferfunction import TransferFunction from .statespace import StateSpace from .exception import WrongSampleTime, UnknownDiscretizationMethod from .model_conversion import * import numpy as np __all__ = ['c2d'] def _zoh...
{ "repo_name": "DaivdZhang/tinyControl", "path": "tcontrol/discretization.py", "copies": "1", "size": "3604", "license": "bsd-3-clause", "hash": -6438048848176653000, "line_mean": 28.3008130081, "line_max": 90, "alpha_frac": 0.6040510544, "autogenerated": false, "ratio": 3.1042204995693368, "con...
from functools import singledispatch import typing from typing import Callable, Any, Dict, TypeVar, Type from amino.util.string import snake_case from amino.algebra import Algebra A = TypeVar('A') B = TypeVar('B') R = TypeVar('R') Alg = TypeVar('Alg', bound=Algebra) def dispatch(obj: B, tpes: typing.List[A], prefix...
{ "repo_name": "tek/amino", "path": "amino/dispatch.py", "copies": "1", "size": "1537", "license": "mit", "hash": -2206986871171945000, "line_mean": 30.3673469388, "line_max": 113, "alpha_frac": 0.589459987, "autogenerated": false, "ratio": 3.341304347826087, "config_test": false, "has_no_keyw...
from functools import singledispatch import warnings import traceback from werkzeug.exceptions import HTTPException from werkzeug.routing import Rule from werkzeug.wrappers import Response, BaseResponse from findig.content import ErrorHandler, Formatter, Parser from findig.context import ctx from findig.resource impo...
{ "repo_name": "geniphi/findig", "path": "findig/dispatcher.py", "copies": "1", "size": "10003", "license": "mit", "hash": 7133685226032348000, "line_mean": 34.725, "line_max": 79, "alpha_frac": 0.5956213136, "autogenerated": false, "ratio": 4.896231032794909, "config_test": false, "has_no_key...
from functools import singledispatch from llvmlite.llvmpy.core import Type, Constant from numba.core import types, typing, cgutils from numba.core.imputils import Registry from numba.cuda import nvvmutils registry = Registry() lower = registry.lower voidptr = Type.pointer(Type.int(8)) # NOTE: we don't use @lower ...
{ "repo_name": "sklam/numba", "path": "numba/cuda/printimpl.py", "copies": "1", "size": "2571", "license": "bsd-2-clause", "hash": 136926388538165970, "line_mean": 31.5443037975, "line_max": 79, "alpha_frac": 0.6938934267, "autogenerated": false, "ratio": 3.4884667571234735, "config_test": false...
from functools import singledispatch import sympy from devito.logger import warning from devito.finite_differences.differentiable import Add, Mul, EvalDerivative from devito.finite_differences.derivative import Derivative from devito.tools import as_tuple __all__ = ['solve', 'linsolve'] class SolveError(Exception)...
{ "repo_name": "opesci/devito", "path": "devito/operations/solve.py", "copies": "1", "size": "3353", "license": "mit", "hash": -2548138694532712000, "line_mean": 25.1953125, "line_max": 87, "alpha_frac": 0.6376379362, "autogenerated": false, "ratio": 3.69273127753304, "config_test": false, "ha...
from functools import singledispatch class BaseWriter: """Base class for recursive writers. Usage: - Create an instance of this class. - Use :meth:`register` in the same manner as Python's built-in :func:`functools.singledispatch` to decorate functions that certain types of :mod:`pandasd...
{ "repo_name": "dr-leo/pandaSDMX", "path": "pandasdmx/writer/base.py", "copies": "1", "size": "2221", "license": "apache-2.0", "hash": 6569591053051041000, "line_mean": 31.6617647059, "line_max": 79, "alpha_frac": 0.5938766321, "autogenerated": false, "ratio": 4.505070993914807, "config_test": f...
from functools import singledispatch class cached_property: def __init__(self, func): self.func = func def __get__(self, obj, cls): if obj is None: # pragma: no cover return self value = obj.__dict__[self.func.__name__] = self.func(obj) return value def prepare_...
{ "repo_name": "Stranger6667/pyoffers", "path": "src/pyoffers/utils.py", "copies": "1", "size": "3256", "license": "mit", "hash": -11806878575648148, "line_mean": 26.3613445378, "line_max": 86, "alpha_frac": 0.5399262899, "autogenerated": false, "ratio": 3.7168949771689497, "config_test": false,...
from functools import singledispatch, total_ordering @singledispatch def function(arg): return "Type of argument: {}".format(type(arg)) @function.register(list) def function_list(arg): return "Size of list: {}".format(len(arg)) @function.register(int) def function_int(arg): return "Value of int: {}".f...
{ "repo_name": "svisser/python-3-examples", "path": "examples/functools.py", "copies": "1", "size": "1591", "license": "mit", "hash": -5021913701355044000, "line_mean": 24.253968254, "line_max": 71, "alpha_frac": 0.6096794469, "autogenerated": false, "ratio": 3.5752808988764047, "config_test": f...
from functools import singledispatch, wraps import stl from optlang import Constraint, Variable from magnum.constraint_kinds import Kind as K eps = 1e-7 M = 1000 # TODO def counter(func): i = 0 @wraps(func) def _func(*args, **kwargs): nonlocal i i += 1 return func(*args, i=i, *...
{ "repo_name": "mvcisback/py-blustl", "path": "magnum/solvers/milp/boolean_encoding.py", "copies": "2", "size": "2238", "license": "bsd-3-clause", "hash": 4541561260336413000, "line_mean": 24.4318181818, "line_max": 73, "alpha_frac": 0.5786416443, "autogenerated": false, "ratio": 3.036635006784260...
from functools import total_ordering, lru_cache import logging import re import requests from eva_cttv_pipeline.trait_mapping.ols import get_ontology_label_from_ols, is_in_efo from eva_cttv_pipeline.trait_mapping.ols import is_current_and_in_efo from eva_cttv_pipeline.trait_mapping.utils import json_request logger =...
{ "repo_name": "EBIvariation/eva-cttv-pipeline", "path": "eva_cttv_pipeline/trait_mapping/oxo.py", "copies": "1", "size": "8085", "license": "apache-2.0", "hash": 3301269777967984600, "line_mean": 34.9333333333, "line_max": 120, "alpha_frac": 0.6180581323, "autogenerated": false, "ratio": 3.342290...
from functools import total_ordering class Room: def __init__(self, name, length, width): self.name = name self.length = length self.width = width self.square_feet = self.length * self.width @total_ordering class House: def __init__(self, name, style): self.name = name ...
{ "repo_name": "hyller/CodeLibrary", "path": "python-cookbook-master/src/8/making_classes_support_comparison_operations/example.py", "copies": "2", "size": "1884", "license": "unlicense", "hash": 6044864278287940000, "line_mean": 30.9322033898, "line_max": 81, "alpha_frac": 0.601910828, "autogenerat...
from functools import total_ordering from collections import Hashable @total_ordering class CaseClass(object): """ Implementation like Scala's case class """ def __init__(self, keys): """ :param keys: list of attribute names """ self.__keys = keys def __eq__(self,...
{ "repo_name": "mogproject/artifact-cli", "path": "src/artifactcli/util/caseclass.py", "copies": "1", "size": "1800", "license": "apache-2.0", "hash": -2029655216058803500, "line_mean": 29.5084745763, "line_max": 116, "alpha_frac": 0.475, "autogenerated": false, "ratio": 4.545454545454546, "conf...
from functools import total_ordering from datetime import datetime from CMi.utils import title_sort_key from django.db import models class Category(models.Model): name = models.CharField(max_length=255) def __unicode__(self): return '%s' % self.name @total_ordering class Show(models.Model): nam...
{ "repo_name": "boxed/CMi", "path": "web_frontend/CMi/tvshows/models.py", "copies": "1", "size": "2611", "license": "mit", "hash": -370314084388931800, "line_mean": 29.7294117647, "line_max": 85, "alpha_frac": 0.6491765607, "autogenerated": false, "ratio": 3.7895500725689404, "config_test": fals...
from functools import total_ordering from dateutil.parser import parse as parse_date from collections import defaultdict def parse_data(data): if type(data) == list: data = data[0] if "_datatype" in data: if data["_datatype"] == "dateTime": return parse_date(data["_value"]) els...
{ "repo_name": "russss/ukparliament", "path": "ukparliament/resource.py", "copies": "1", "size": "6194", "license": "mit", "hash": -1596084794488172300, "line_mean": 32.4810810811, "line_max": 87, "alpha_frac": 0.5561834033, "autogenerated": false, "ratio": 3.7178871548619448, "config_test": fal...
from functools import total_ordering from ipaddr import IPAddress from itertools import ifilter def is_rangestmt(x): return isinstance(x, RangeStmt) def join_p(xs, indent=1, prefix=''): if not xs: return '' lines = "".join(map(str, xs)).splitlines() prefix += ' ' * indent return "".jo...
{ "repo_name": "zeeman/cyder", "path": "cyder/management/commands/lib/dhcpd_compare2/dhcp_objects.py", "copies": "2", "size": "6248", "license": "bsd-3-clause", "hash": 9148551211715906000, "line_mean": 26.6460176991, "line_max": 76, "alpha_frac": 0.5523367478, "autogenerated": false, "ratio": 3.8...
from functools import total_ordering from iso4217 import Currency as ISO4217Currency _ALL_CURRENCIES = {} @total_ordering class Currency(object): """A currency identifier, as defined by ISO-4217. Parameters ---------- code : str ISO-4217 code for the currency. Attributes ---------- ...
{ "repo_name": "quantopian/zipline", "path": "zipline/currency.py", "copies": "1", "size": "1825", "license": "apache-2.0", "hash": 3223705074458690000, "line_mean": 22.7012987013, "line_max": 75, "alpha_frac": 0.4942465753, "autogenerated": false, "ratio": 4.366028708133971, "config_test": fals...
from functools import total_ordering from typing import Optional @total_ordering class Record: """Representation of the season record of a team. Ordering is provided by win percentage, with ties considered 0.5 win. Args: wins: Starting number of wins, default 0 losses: Starting number of...
{ "repo_name": "lbianch/nfl_elo", "path": "elo.py", "copies": "1", "size": "7426", "license": "mit", "hash": -3045999061073095700, "line_mean": 29.8132780083, "line_max": 113, "alpha_frac": 0.6019391328, "autogenerated": false, "ratio": 3.8636836628511966, "config_test": false, "has_no_keyword...
from functools import total_ordering from util.config import BaseConfig, IncorrectFieldType, IncorrectFieldFormat @total_ordering class SymVer(BaseConfig): def __init__(self, major=0, minor=0, patch=0, **kwargs): super().__init__(**kwargs) if isinstance(major, int) and isinstance(minor, int) and i...
{ "repo_name": "LuckyGeck/dedalus", "path": "util/symver.py", "copies": "1", "size": "1379", "license": "mit", "hash": 6322217794603593000, "line_mean": 39.5588235294, "line_max": 110, "alpha_frac": 0.5656272661, "autogenerated": false, "ratio": 4.079881656804734, "config_test": false, "has_no...
from functools import total_ordering import itertools as it EXONIC_IMPACTS = set(["stop_gained", "stop_lost", "frameshift_variant", "initiator_codon_variant", "inframe_deletion", "inframe_insertion", ...
{ "repo_name": "seandavi/effects", "path": "effects/effect.py", "copies": "1", "size": "13090", "license": "mit", "hash": 2113110052866051000, "line_mean": 29.8, "line_max": 287, "alpha_frac": 0.5950343774, "autogenerated": false, "ratio": 3.443830570902394, "config_test": false, "has_no_keywo...
from functools import total_ordering import json import warnings from ._util import cheap_repr, for_json @total_ordering class CardSet: def __init__(self, name, release_date=None, fetch=False, abbreviations=None, **data): self.name = name self.release_date = release_date ...
{ "repo_name": "jwodder/envec", "path": "envec/cardset.py", "copies": "1", "size": "2967", "license": "mit", "hash": -2096027354381589800, "line_mean": 31.9666666667, "line_max": 80, "alpha_frac": 0.5214020897, "autogenerated": false, "ratio": 4.086776859504132, "config_test": false, "has_no_k...
from functools import total_ordering import re from .color import Color from ._util import cheap_repr, split_mana, for_json @total_ordering class Content: def __init__(self, name, types, cost=None, supertypes=(), subtypes=(), text=None, power=None, toughness=None, loyalty=None, ...
{ "repo_name": "jwodder/envec", "path": "envec/content.py", "copies": "1", "size": "5306", "license": "mit", "hash": 4786414736169528000, "line_mean": 33.8947368421, "line_max": 77, "alpha_frac": 0.5288461538, "autogenerated": false, "ratio": 3.9760119940029983, "config_test": false, "has_no_k...
from functools import total_ordering import string import math symbols = string.ascii_uppercase + "[]\;',./" x_digits = 4 y_digits = 2 kb_height = 3 kb_width = 11 costless = " \t\n" + string.digits + "`~!@#$%^&*()_+-=" rule_3_penalty = 20 mod_factor = 2 def equivalent_keys(k1, k2): multi = "[];',./|" equiv = ...
{ "repo_name": "zsck/Evokey", "path": "src/util.py", "copies": "2", "size": "4231", "license": "mit", "hash": -6760279072195880000, "line_mean": 29.8832116788, "line_max": 80, "alpha_frac": 0.5554242496, "autogenerated": false, "ratio": 3.210166919575114, "config_test": false, "has_no_keywords...
from functools import total_ordering import sys from PyFBA import log_and_message COMMON_REACTION_LIMIT = 5 class Compound: """ A compound is the essential metabolic compound that is involved in a reaction. The compound by itself does not have a location. See PyFBA.metabolism.CompoundWithLocation for th...
{ "repo_name": "linsalrob/PyFBA", "path": "PyFBA/metabolism/compound.py", "copies": "1", "size": "10361", "license": "mit", "hash": -5854328644900477000, "line_mean": 29.3841642229, "line_max": 122, "alpha_frac": 0.5802528713, "autogenerated": false, "ratio": 4.2884933774834435, "config_test": f...
from functools import total_ordering from beautiful_date import BeautifulDate from tzlocal import get_localzone from datetime import datetime, date, timedelta from .attachment import Attachment from .attendee import Attendee from .reminders import PopupReminder, EmailReminder from .util.date_time_util import insure_l...
{ "repo_name": "kuzmoyev/Google-Calendar-Simple-API", "path": "gcsa/event.py", "copies": "1", "size": "9390", "license": "mit", "hash": 3154361507424304600, "line_mean": 41.6818181818, "line_max": 111, "alpha_frac": 0.6121405751, "autogenerated": false, "ratio": 4.153029632905794, "config_test":...
from functools import total_ordering from cffi import FFI ffi = FFI() ffi.cdef(""" void long_store(long *, long *); long long_add_and_fetch(long *, long); long long_sub_and_fetch(long *, long); long long_get_and_set(long *, long); long long_compare_and_set(long *, long *, long); """) atomic = ffi.verify(""" void l...
{ "repo_name": "cyberdelia/atomic", "path": "atomic/__init__.py", "copies": "1", "size": "4040", "license": "mit", "hash": 4070450434608986600, "line_mean": 26.1140939597, "line_max": 105, "alpha_frac": 0.5767326733, "autogenerated": false, "ratio": 3.467811158798283, "config_test": false, "ha...
from functools import total_ordering from dark.score import HigherIsBetterScore, LowerIsBetterScore @total_ordering class _Base(object): """ Holds information about a matching region from a read alignment. You should not use this class directly. Use one of its subclasses, either HSP or LSP, dependin...
{ "repo_name": "bamueh/dark-matter", "path": "dark/hsp.py", "copies": "1", "size": "5426", "license": "mit", "hash": -6430252448699756000, "line_mean": 43.1138211382, "line_max": 79, "alpha_frac": 0.6249539255, "autogenerated": false, "ratio": 4.411382113821138, "config_test": false, "has_no_k...
from functools import total_ordering from django.db import models from django.db.models.query import QuerySet from django.utils.formats import date_format from django.utils.timezone import now from django.utils.translation import ugettext_lazy as _ @total_ordering class AbstractBaseModel(models.Model): """Base c...
{ "repo_name": "SmartElect/SmartElect", "path": "libya_elections/abstract.py", "copies": "1", "size": "5388", "license": "apache-2.0", "hash": -1950568174897603800, "line_mean": 34.2156862745, "line_max": 99, "alpha_frac": 0.6690794358, "autogenerated": false, "ratio": 4.199532346063913, "config...
from functools import total_ordering from django.db.migrations.state import ProjectState from .exceptions import CircularDependencyError, NodeNotFoundError @total_ordering class Node: """ A single node in the migration graph. Contains direct links to adjacent nodes in either direction. """ def _...
{ "repo_name": "wkschwartz/django", "path": "django/db/migrations/graph.py", "copies": "69", "size": "12841", "license": "bsd-3-clause", "hash": 8419318291669255000, "line_mean": 39.2539184953, "line_max": 110, "alpha_frac": 0.5967603769, "autogenerated": false, "ratio": 4.440179806362379, "conf...
from functools import total_ordering from django.db.models import signals from django.db.models.fields import BLANK_CHOICE_DASH from django.conf import settings from django.forms import fields from django.db.models.options import Options from django.core.exceptions import ValidationError from neomodel import Required...
{ "repo_name": "robinedwards/django-neomodel", "path": "django_neomodel/__init__.py", "copies": "1", "size": "6988", "license": "mit", "hash": -4953945009222363000, "line_mean": 32.9223300971, "line_max": 93, "alpha_frac": 0.6074699485, "autogenerated": false, "ratio": 4.207104154124021, "config...
from functools import total_ordering from django.forms.utils import flatatt from django.template.loader import render_to_string from django.utils.functional import cached_property from django.utils.html import format_html from wagtail.core import hooks @total_ordering class Button: show = True def __init__...
{ "repo_name": "kaedroho/wagtail", "path": "wagtail/admin/widgets/button.py", "copies": "7", "size": "3069", "license": "bsd-3-clause", "hash": 1509065836035939800, "line_mean": 29.3861386139, "line_max": 95, "alpha_frac": 0.6217008798, "autogenerated": false, "ratio": 3.9498069498069497, "confi...
from functools import total_ordering from ._funcs import astuple from ._make import attrib, attrs @total_ordering @attrs(eq=False, order=False, slots=True, frozen=True) class VersionInfo: """ A version object that can be compared to tuple of length 1--4: >>> attr.VersionInfo(19, 1, 0, "final") <= (19, ...
{ "repo_name": "pegasus-isi/pegasus", "path": "packages/pegasus-common/src/Pegasus/vendor/attr/_version_info.py", "copies": "1", "size": "2066", "license": "apache-2.0", "hash": 165714767652856130, "line_mean": 24.5061728395, "line_max": 87, "alpha_frac": 0.5498547919, "autogenerated": false, "rat...
from functools import total_ordering from hashids import Hashids def _is_uint(number): """Returns whether a value is an unsigned integer.""" try: return number == int(number) and number >= 0 except ValueError: return False def _is_str(candidate): """Returns whether a value is a stri...
{ "repo_name": "nshafer/django-hashid-field", "path": "hashid_field/hashid.py", "copies": "1", "size": "4573", "license": "mit", "hash": 5599622811383390000, "line_mean": 32.1376811594, "line_max": 119, "alpha_frac": 0.560026241, "autogenerated": false, "ratio": 4.384467881112176, "config_test":...
from functools import total_ordering from swimlane.core.cursor import Cursor from swimlane.core.resolver import SwimlaneResolver from swimlane.core.resources.base import APIResource # pylint: disable=abstract-method @total_ordering class UserGroup(APIResource): """Base class for Users and Groups Notes: ...
{ "repo_name": "Swimlane/sw-python-client", "path": "swimlane/core/resources/usergroup.py", "copies": "1", "size": "4863", "license": "mit", "hash": -26246746674710340, "line_mean": 28.8343558282, "line_max": 118, "alpha_frac": 0.5909932141, "autogenerated": false, "ratio": 4.167095115681234, "c...
from functools import total_ordering import base from fito.specs.utils import is_iterable, general_iterator # it's a constant that is different from every other object _no_default = object() class MockIterable(object): def __len__(self): return def __getitem__(self, _): return def __setitem__(self, _,...
{ "repo_name": "elsonidoq/fito", "path": "fito/specs/fields.py", "copies": "1", "size": "5795", "license": "mit", "hash": -8404944358858981000, "line_mean": 26.0794392523, "line_max": 108, "alpha_frac": 0.6436583261, "autogenerated": false, "ratio": 3.969178082191781, "config_test": false, "ha...
from functools import total_ordering import phonenumbers from django.conf import settings from django.core import validators @total_ordering class PhoneNumber(phonenumbers.PhoneNumber): """ A extended version of phonenumbers.PhoneNumber that provides some neat and more pythonic, easy to access methods. T...
{ "repo_name": "stefanfoulis/django-phonenumber-field", "path": "phonenumber_field/phonenumber.py", "copies": "1", "size": "5491", "license": "mit", "hash": -767148670768474500, "line_mean": 33.0807453416, "line_max": 85, "alpha_frac": 0.6125387279, "autogenerated": false, "ratio": 4.0286343612334...
from functools import total_ordering import pytest from ..functional import keysorted, sliding_window def test_sliding_window(): assert list(sliding_window([], 2)) == [] assert list(sliding_window([1, 2, 3], 2)) == [(1, 2), (2, 3)] assert list(sliding_window([1, 2, 3, 4], 2)) == [(1, 2), (2, 3), (3, 4)]...
{ "repo_name": "ssanderson/interface", "path": "interface/tests/test_functional.py", "copies": "1", "size": "1032", "license": "apache-2.0", "hash": 690704683987189900, "line_mean": 25.4615384615, "line_max": 76, "alpha_frac": 0.5484496124, "autogenerated": false, "ratio": 3.0352941176470587, "c...
from functools import total_ordering import six from swimlane.exceptions import UnknownField from .base import APIResource @total_ordering class App(APIResource): """A single App record instance Used lookup field definitions and retrieve/create child Record instances Attributes: name (str): Ap...
{ "repo_name": "Swimlane/sw-python-client", "path": "swimlane/core/resources/app.py", "copies": "1", "size": "4736", "license": "mit", "hash": -4936046008415276000, "line_mean": 35.1526717557, "line_max": 120, "alpha_frac": 0.5821368243, "autogenerated": false, "ratio": 4.333028362305581, "confi...
from functools import total_ordering class InvalidPeriodError(Exception): pass def validate_year(year): if year < 1970 or year > 9999: raise InvalidPeriodError("Year must be between 1970 and 9999") def validate_month(month): if month < 1 or month > 12: raise InvalidPeriodError("Month m...
{ "repo_name": "davidmarquis/pyperiods", "path": "pyperiods/period.py", "copies": "1", "size": "2056", "license": "mit", "hash": 8126752476400411000, "line_mean": 23.4761904762, "line_max": 70, "alpha_frac": 0.5992217899, "autogenerated": false, "ratio": 4.3559322033898304, "config_test": false,...
from functools import total_ordering @total_ordering class HigherIsBetterScore(object): """ Provide comparison functions for scores where numerically higher values are considered better. @param score: The numeric score of this HSP. """ def __init__(self, score): self.score = score ...
{ "repo_name": "terrycojones/dark-matter", "path": "dark/score.py", "copies": "3", "size": "1367", "license": "mit", "hash": -840696383248295300, "line_mean": 23.8545454545, "line_max": 75, "alpha_frac": 0.6100950988, "autogenerated": false, "ratio": 4.1676829268292686, "config_test": false, "...
from functools import total_ordering @total_ordering class Match(object): """Object representing a match in a search index. Attributes: matched_object (object): the object that was matched matched_string (string): the string representation of the object score (float): the score of the...
{ "repo_name": "ntamas/python-selecta", "path": "selecta/matches.py", "copies": "1", "size": "2701", "license": "mit", "hash": 9098674901230635000, "line_mean": 32.7625, "line_max": 78, "alpha_frac": 0.6138467234, "autogenerated": false, "ratio": 4.435139573070607, "config_test": false, "has_n...
from functools import total_ordering @total_ordering class Node(object): data = None prev_node = None next_node = None def __init__(self, data = None): self.data = data def __lt__(self, other): if other: return self.data < other.data else: return False def __eq__(self, other): if other: retur...
{ "repo_name": "mehmetg/python_scraps", "path": "linked_lists.py", "copies": "1", "size": "6886", "license": "unlicense", "hash": -6984120095234640000, "line_mean": 18.6210826211, "line_max": 82, "alpha_frac": 0.6171943073, "autogenerated": false, "ratio": 2.513138686131387, "config_test": false...
from functools import total_ordering @total_ordering class OrderedType: creation_counter = 1 def __init__(self, _creation_counter=None): self.creation_counter = _creation_counter or self.gen_counter() @staticmethod def gen_counter(): counter = OrderedType.creation_counter Ord...
{ "repo_name": "graphql-python/graphene", "path": "graphene/utils/orderedtype.py", "copies": "1", "size": "1223", "license": "mit", "hash": 5428951344424451000, "line_mean": 30.358974359, "line_max": 76, "alpha_frac": 0.6516762061, "autogenerated": false, "ratio": 4.650190114068441, "config_test...
from functools import total_ordering @total_ordering class OrderedType(object): creation_counter = 1 def __init__(self, _creation_counter=None): self.creation_counter = _creation_counter or self.gen_counter() @staticmethod def gen_counter(): counter = OrderedType.creation_counter ...
{ "repo_name": "Globegitter/graphene", "path": "graphene/utils/orderedtype.py", "copies": "4", "size": "1231", "license": "mit", "hash": -3582236010326647000, "line_mean": 30.5641025641, "line_max": 76, "alpha_frac": 0.6523151909, "autogenerated": false, "ratio": 4.645283018867924, "config_test"...
# from functools import total_ordering # Sadly not present under py2.6 # @total_ordering class Node(object): NoMatch = 0 PartialMatch = 1 FullMatch = 2 def __init__(self, value, children=None, tag=None): from .tokens import Keyword, Variable, Literal assert type(value) in [Keyword, Var...
{ "repo_name": "macobo/sqlcomplete", "path": "sqlcomplete/language/graph.py", "copies": "1", "size": "5252", "license": "mit", "hash": 7899975330909258000, "line_mean": 32.0314465409, "line_max": 100, "alpha_frac": 0.6245239909, "autogenerated": false, "ratio": 3.9135618479880776, "config_test":...
from functools import total_ordering @total_ordering class Cliente: def __init__(self, numero, nome, sobrenome, endereco, telefone, saldo): self.numero = numero self.nome = nome self.sobrenome = sobrenome self.endereco = endereco self.telefone = telefone self.saldo = saldo def __str__(self): return "...
{ "repo_name": "possatti/kawaii", "path": "kawaii/cliente.py", "copies": "1", "size": "1203", "license": "mit", "hash": -8802569511192374000, "line_mean": 22.5882352941, "line_max": 72, "alpha_frac": 0.6034912718, "autogenerated": false, "ratio": 2.4753086419753085, "config_test": false, "has_...
from functools import total_ordering @total_ordering class Clock: def __init__(self, hour, block = 0, day = 0): self._hour = hour self._block = block self._day = day def hour(self): return self._hour def minute(self): return self._block * 5 def day(self): ...
{ "repo_name": "tomwadley/sexting-xkeyscore", "path": "sexting/lib/clock.py", "copies": "1", "size": "1374", "license": "isc", "hash": 7659673125851474000, "line_mean": 25.9411764706, "line_max": 107, "alpha_frac": 0.5334788937, "autogenerated": false, "ratio": 3.7035040431266846, "config_test":...
from functools import total_ordering @total_ordering class Version(): """Organization Class for comparable Version System Version integer uses decimal shift: 2 digits major version, 2 digits minor version, 2 digits micro version 170100 -> 17.1.0 """ def __init__(self, in...
{ "repo_name": "vlajos/FactorioManager", "path": "FactorioManager/version.py", "copies": "2", "size": "2041", "license": "mit", "hash": 2353183845774020600, "line_mean": 29.9242424242, "line_max": 86, "alpha_frac": 0.5365017148, "autogenerated": false, "ratio": 4.296842105263158, "config_test": ...
from functools import total_ordering __version__ = '1.5' @total_ordering class Infinity(object): def __init__(self, positive=True): self.positive = positive def __neg__(self): return Infinity(not self.positive) def __gt__(self, other): if self == other: return False ...
{ "repo_name": "kvesteri/infinity", "path": "infinity.py", "copies": "1", "size": "2701", "license": "bsd-3-clause", "hash": -7468508443544702000, "line_mean": 21.3223140496, "line_max": 74, "alpha_frac": 0.5135135135, "autogenerated": false, "ratio": 4.194099378881988, "config_test": false, "...
from functools import total_ordering from heapq import nlargest from math import fabs from itertools import dropwhile from operator import itemgetter, add, sub, mul, truediv, pow, xor from random import getrandbits, randint, randrange, sample from sys import maxsize def split_list(xs: list, n: int): whi...
{ "repo_name": "tannerb/genetic_math", "path": "genetic.py", "copies": "1", "size": "6472", "license": "mit", "hash": -2632555434296313000, "line_mean": 28.672985782, "line_max": 121, "alpha_frac": 0.5398640297, "autogenerated": false, "ratio": 3.648252536640361, "config_test": false, "has_no_...
from functools import total_ordering import time @total_ordering class graph_node(object): def __init__(self, name): self.name = name self.edge_list = [] self.visited = False def add_node_edge(self, *edges): for item in edges: if item not in self...
{ "repo_name": "caderache2014/data_structures", "path": "graph.py", "copies": "1", "size": "5590", "license": "mit", "hash": 5662068869718931000, "line_mean": 30.8941176471, "line_max": 71, "alpha_frac": 0.5288014311, "autogenerated": false, "ratio": 3.553719008264463, "config_test": false, "h...
from functools import total_ordering, wraps class Promise: """ Base class for the proxy class created in the closure of the lazy function. It's used to recognize promises in code. """ pass def lazy(func, *resultclasses): """ Turn any callable into a lazy evaluated callable. result classe...
{ "repo_name": "pyschool/story", "path": "story/utils.py", "copies": "1", "size": "4594", "license": "mit", "hash": 8995405101140741000, "line_mean": 34.0687022901, "line_max": 79, "alpha_frac": 0.5265563779, "autogenerated": false, "ratio": 4.678207739307536, "config_test": false, "has_no_key...
from functools import update_wrapper, lru_cache import numpy as np from . import _pocketfft from ._pocketfft import helper as _helper def next_fast_len(target, real=False): """Find the next fast size of input data to ``fft``, for zero-padding, etc. SciPy's FFT algorithms gain their speed by a recursive divi...
{ "repo_name": "jor-/scipy", "path": "scipy/fft/_helper.py", "copies": "2", "size": "3382", "license": "bsd-3-clause", "hash": -4513594013762344400, "line_mean": 32.4851485149, "line_max": 80, "alpha_frac": 0.6540508575, "autogenerated": false, "ratio": 3.9279907084785135, "config_test": false, ...
from functools import update_wrapper, lru_cache from ._pocketfft import helper as _helper def next_fast_len(target, real=False): """Find the next fast size of input data to ``fft``, for zero-padding, etc. SciPy's FFT algorithms gain their speed by a recursive divide and conquer strategy. This relies on ...
{ "repo_name": "mdhaber/scipy", "path": "scipy/fft/_helper.py", "copies": "12", "size": "3389", "license": "bsd-3-clause", "hash": -7103633953354199000, "line_mean": 32.89, "line_max": 79, "alpha_frac": 0.6500442608, "autogenerated": false, "ratio": 3.899884925201381, "config_test": false, "ha...
from functools import update_wrapper from collections import Mapping VictronServicePrefix = 'com.victronenergy' def safeadd(*values): """ Adds all parameters passed to this function. Parameters which are None are ignored. If all parameters are None, the function will return None as well. """ values = [v for v...
{ "repo_name": "victronenergy/dbus-systemcalc-py", "path": "sc_utils.py", "copies": "1", "size": "2630", "license": "mit", "hash": -8958475258141407000, "line_mean": 28.2222222222, "line_max": 110, "alpha_frac": 0.7136882129, "autogenerated": false, "ratio": 3.1610576923076925, "config_test": fa...
from functools import update_wrapper from datetime import timedelta from flask import Flask from flask import render_template app = Flask(__name__, static_url_path='/static') import similarity sim = similarity.Similarity() from flask import jsonify from flask.ext.cors import CORS, cross_origin app = Flask(__name__) ...
{ "repo_name": "pieteradejong/joie-de-code", "path": "strdistanceapp/app.py", "copies": "1", "size": "3302", "license": "mit", "hash": -7951466588446409000, "line_mean": 30.75, "line_max": 86, "alpha_frac": 0.643549364, "autogenerated": false, "ratio": 3.817341040462428, "config_test": false, ...
from functools import update_wrapper from datetime import timedelta from flask import Response, request, make_response, current_app import json def to_json(): def decorator(f): def wrapped_function(*args, **kwargs): r = json.dumps(f(*args, **kwargs)) res = Response(r, status=200, m...
{ "repo_name": "hbrls/weixin-api-mockup", "path": "appl/utils/decorators.py", "copies": "1", "size": "2775", "license": "mit", "hash": -1448543921657800400, "line_mean": 30.8965517241, "line_max": 112, "alpha_frac": 0.6104504505, "autogenerated": false, "ratio": 3.9642857142857144, "config_test"...
from functools import update_wrapper from decimal import Decimal, ROUND_UP from django.contrib import admin, messages from django.utils.encoding import smart_str from django import forms from django.conf.urls import url, patterns from django.contrib.admin.util import (unquote, flatten_fieldsets, get_deleted_objects, ...
{ "repo_name": "upptalk/uppsell", "path": "uppsell/admin.py", "copies": "1", "size": "15108", "license": "mit", "hash": -4994485170511872000, "line_mean": 40.8504155125, "line_max": 130, "alpha_frac": 0.5981599153, "autogenerated": false, "ratio": 3.950836820083682, "config_test": false, "has_...
from functools import update_wrapper from django.conf import settings from django.db import connection, DEFAULT_DB_ALIAS from django.test import TestCase, skipUnlessDBFeature from models import Reporter, Article # # The introspection module is optional, so methods tested here might raise # NotImplementedError. This i...
{ "repo_name": "jamespacileo/django-france", "path": "tests/regressiontests/introspection/tests.py", "copies": "2", "size": "4689", "license": "bsd-3-clause", "hash": 2835781599905321000, "line_mean": 41.2432432432, "line_max": 99, "alpha_frac": 0.6596289187, "autogenerated": false, "ratio": 4.056...
from functools import update_wrapper from django.conf.urls import patterns, url from django.contrib import admin from windberg_results import models from windberg_results.views import import_entries_from_csv class ResultEntryInlineAdmin(admin.TabularInline): model = models.ResultEntry extra = 0 class Result...
{ "repo_name": "janLo/Windberg-web", "path": "windberg_results/admin.py", "copies": "1", "size": "1282", "license": "bsd-3-clause", "hash": -307629717093687600, "line_mean": 32.7368421053, "line_max": 89, "alpha_frac": 0.635725429, "autogenerated": false, "ratio": 3.7705882352941176, "config_tes...
from functools import update_wrapper from django.conf.urls import url from django.http import HttpResponse from tastypie import http from tastypie.exceptions import ImmediateHttpResponse from tastypie.resources import ModelResource, convert_post_to_put from nested_resource import utils from tastypie.utils import traili...
{ "repo_name": "kgritesh/tastypie-nested-resource", "path": "nested_resource/resources.py", "copies": "1", "size": "2851", "license": "mit", "hash": -4684894958498608000, "line_mean": 36.5131578947, "line_max": 80, "alpha_frac": 0.629954402, "autogenerated": false, "ratio": 4.174231332357247, "c...
from functools import update_wrapper from django.contrib.admin import ModelAdmin from django.contrib.admin.util import unquote from django.forms.models import ModelForm from django_ace import AceWidget from django.contrib import admin from django.shortcuts import render from tildeslash.blog.models import Post class P...
{ "repo_name": "yshlin/tildeslash", "path": "tildeslash/blog/admin.py", "copies": "1", "size": "1451", "license": "bsd-3-clause", "hash": -750387957575822100, "line_mean": 28.6326530612, "line_max": 99, "alpha_frac": 0.6230186079, "autogenerated": false, "ratio": 4.00828729281768, "config_test":...
from functools import update_wrapper from django.contrib import admin from django.shortcuts import redirect, render from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from .forms import MessageForm from .models import get_device_model Device = get_device_model() class...
{ "repo_name": "bogdal/django-gcm", "path": "gcm/admin.py", "copies": "1", "size": "2436", "license": "bsd-2-clause", "hash": 7423432675928990000, "line_mean": 35.9090909091, "line_max": 72, "alpha_frac": 0.6194581281, "autogenerated": false, "ratio": 3.8544303797468356, "config_test": false, ...