text stringlengths 0 1.05M | meta dict |
|---|---|
from functools import partial
# version code ef5291f09f60+
coursera = 1
# Please fill out this stencil and submit using the provided submission script.
def calc_minutes_in_week():
minutes_in_hour = 60
hours_in_day = 24
days_in_week = 7
return minutes_in_hour * hours_in_day * days_in_week
## 1: (Task... | {
"repo_name": "josiah14/linear-algebra",
"path": "programming-the-matrix/0-week/python-lab/Python/matrix/python_lab.py",
"copies": "1",
"size": "7462",
"license": "mit",
"hash": -5676672538974620000,
"line_mean": 41.3977272727,
"line_max": 127,
"alpha_frac": 0.6699276333,
"autogenerated": false,
... |
from functools import partial
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from soundcloud.resource import wrapped_resource
from soundcloud.request import make_request
class Client(object):
"""A client for interacting with Soundcloud resources."""
use_ssl ... | {
"repo_name": "soundcloud/soundcloud-python",
"path": "soundcloud/client.py",
"copies": "3",
"size": "6716",
"license": "bsd-2-clause",
"hash": -4092157070235273700,
"line_mean": 37.8208092486,
"line_max": 78,
"alpha_frac": 0.5860631328,
"autogenerated": false,
"ratio": 4.038484666265784,
"conf... |
from functools import partial, reduce
from inspect import isfunction
from typing import Callable, Iterator, Dict, List, Tuple, Any, Optional
__all__ = ["MiddlewareManager"]
GraphQLFieldResolver = Callable[..., Any]
class MiddlewareManager:
"""Manager for the middleware chain.
This class helps to wrap reso... | {
"repo_name": "graphql-python/graphql-core",
"path": "src/graphql/execution/middleware.py",
"copies": "1",
"size": "2467",
"license": "mit",
"hash": -1713970478231479000,
"line_mean": 38.1587301587,
"line_max": 88,
"alpha_frac": 0.6769355493,
"autogenerated": false,
"ratio": 4.645951035781544,
... |
from functools import partial, reduce
from mr_streams.exceptions import IllegalStreamOperationException
class EOL():
pass
class Streamer:
def __init__(self, _iter):
self.structure = iter(_iter)
self.eol = EOL()
def _build(self, expression):
self.structure = expression
sel... | {
"repo_name": "caffeine-potent/Streamer-Datastructure",
"path": "mr_streams/streamer.py",
"copies": "1",
"size": "2716",
"license": "mit",
"hash": -1501024574657173500,
"line_mean": 29.5168539326,
"line_max": 101,
"alpha_frac": 0.5850515464,
"autogenerated": false,
"ratio": 4,
"config_test": fa... |
from functools import partial, reduce
from multiprocess import Pool
from operator import add
import numpy as np
import pandas
import pandas
import h5py
from scipy.sparse import linalg
from cooler.tools import split, partition
import cooler
def bnewt(matvec, mask, tol=1e-6, x0=None, delta=0.1, Delta=3, fl=0):
""... | {
"repo_name": "open2c/cooltools",
"path": "cooltools/balance.py",
"copies": "1",
"size": "3695",
"license": "mit",
"hash": -4687656974056799000,
"line_mean": 23.7852348993,
"line_max": 76,
"alpha_frac": 0.4955320877,
"autogenerated": false,
"ratio": 3.5272206303724927,
"config_test": false,
"... |
from functools import partial, reduce
from typing import Dict
class Node(object):
def __init__(self):
self.dependencies = []
self._value = None
def value(self):
return self._value
class Bot(Node):
def value(self):
if self._value is None:
a, b = (d() for d in ... | {
"repo_name": "adriano-arce/Interview-Problems",
"path": "Advent-Of-Code-2016/10-Balance-Bots/10-Balance-Bots.py",
"copies": "1",
"size": "2573",
"license": "mit",
"hash": -8275759572521178000,
"line_mean": 28.2386363636,
"line_max": 80,
"alpha_frac": 0.5565487757,
"autogenerated": false,
"ratio"... |
from functools import partial, reduce
import collections
import sys
import botocore
import click
import time
class Action(collections.namedtuple('Action', [ "resource", "method", "arguments", "saveas" ])):
def __new__(cls, resource, method, arguments, saveas=""):
return super(Action, cls).__new__(cls, resource... | {
"repo_name": "cncf/demo",
"path": "cncfdemo-cli/cncfdemo/bootstrap/aws/utils.py",
"copies": "1",
"size": "2248",
"license": "apache-2.0",
"hash": -3596472936941628400,
"line_mean": 29.3783783784,
"line_max": 140,
"alpha_frac": 0.6601423488,
"autogenerated": false,
"ratio": 3.8101694915254236,
... |
from functools import partial, reduce
import operator
from django.contrib import messages
from django.contrib.admin import (register, TabularInline, StackedInline,
ModelAdmin, HORIZONTAL)
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.views.main impo... | {
"repo_name": "dezede/dezede",
"path": "libretto/admin.py",
"copies": "1",
"size": "39854",
"license": "bsd-3-clause",
"hash": -2499095942059710000,
"line_mean": 33.7900262467,
"line_max": 83,
"alpha_frac": 0.5680623664,
"autogenerated": false,
"ratio": 3.6535281146637266,
"config_test": false,... |
from functools import partial, reduce
from flask import Blueprint, jsonify, render_template
from cachetools import cached, hashkey
from viewserver.funcs import pretty_bytes
from viewserver.ext.caching import TTL_CACHE
from viewserver.ext.periodic import relay_state
blu = Blueprint('core', __name__)
@cached(TTL_CA... | {
"repo_name": "blakev/syncthing-relaysrv-status",
"path": "viewserver/views.py",
"copies": "1",
"size": "1609",
"license": "mit",
"hash": 3869246328695985000,
"line_mean": 28.7962962963,
"line_max": 107,
"alpha_frac": 0.6016159105,
"autogenerated": false,
"ratio": 3.715935334872979,
"config_tes... |
from functools import partial
from gooey.gui.util.filedrop import FileDrop
__author__ = 'Chris'
from abc import ABCMeta, abstractmethod
import wx
from gooey.gui.widgets.calender_dialog import CalendarDlg
class WidgetPack(object):
"""
Interface specifying the contract to which
all `WidgetPack`... | {
"repo_name": "jonathanlurie/timelapseComposer",
"path": "lib/python/gooey/gui/widgets/widget_pack.py",
"copies": "2",
"size": "5287",
"license": "mit",
"hash": 2080243156459443500,
"line_mean": 25.8263157895,
"line_max": 139,
"alpha_frac": 0.6451673917,
"autogenerated": false,
"ratio": 3.6411845... |
from functools import partial
from math import cos, sin, sqrt, pi, ceil
import numpy as np
from numpy.linalg import norm
import scipy.optimize as so
Z_AXIS = np.array([0.0, 0.0, 1.0])
EARTH_A = 1.00000261
EARTH_E = 0.01671123
EARTH_I = 0.0
EARTH_W = np.radians(114.20783)
EARTH_OM = np.radians(348.7393... | {
"repo_name": "nomad-vagabond/asterion",
"path": "calculate_orbits.py",
"copies": "1",
"size": "4401",
"license": "mit",
"hash": -5227596828964264000,
"line_mean": 32.3828125,
"line_max": 98,
"alpha_frac": 0.5339695524,
"autogenerated": false,
"ratio": 2.5148571428571427,
"config_test": false,
... |
from functools import partial
from random import random, randint, choice
import pygame
import init as _
from baseclass import BaseClass
from options import Options
try:
from cython_ import collide
except ImportError:
from python_ import collide
from miscellaneous import further_than, scale
from t... | {
"repo_name": "thdb-theo/Zombie-Survival",
"path": "src/pickup.py",
"copies": "1",
"size": "3543",
"license": "mit",
"hash": 2143183487084644600,
"line_mean": 34.5257731959,
"line_max": 86,
"alpha_frac": 0.578041208,
"autogenerated": false,
"ratio": 3.5608040201005027,
"config_test": false,
"... |
from functools import partial
from virtman.openstack.common import log as logging
LOG = logging.getLogger(__name__)
CHAIN_TRIES = 3
class Chain(object):
"""
build chain, roll over if failed
"""
def __init__(self):
self._chain = []
def add_step(self, do, undo):
asse... | {
"repo_name": "vmthunder/packages",
"path": "virtman/virtman/utils/chain.py",
"copies": "2",
"size": "2480",
"license": "apache-2.0",
"hash": 3146332019025019000,
"line_mean": 27.9036144578,
"line_max": 80,
"alpha_frac": 0.4681451613,
"autogenerated": false,
"ratio": 3.8689547581903274,
"config... |
from functools import partial
import climenu
def print_var(variable):
'''print the variable'''
print(str(variable))
def build_items(count):
# In this example, we're generating menu items based on some
# thing that's determined at runtime (e.g. files in a directory).
# For this case... | {
"repo_name": "mtik00/pyclimenu",
"path": "examples/dynamic-group.py",
"copies": "1",
"size": "1259",
"license": "mit",
"hash": 9176717925029500000,
"line_mean": 25.3695652174,
"line_max": 74,
"alpha_frac": 0.597299444,
"autogenerated": false,
"ratio": 3.9841772151898733,
"config_test": false,
... |
from functools import partial
import itertools
import os
from _pydev_bundle._pydev_imports_tipper import TYPE_IMPORT, TYPE_CLASS, TYPE_FUNCTION, TYPE_ATTR, \
TYPE_BUILTIN, TYPE_PARAM
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
from _pydev_bundle.pydev_override import overrides
from _pyd... | {
"repo_name": "glenngillen/dotfiles",
"path": ".vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py",
"copies": "1",
"size": "20446",
"license": "mit",
"hash": 8683358603630664000,
"line_mean": 44.0495495495... |
from functools import partial
import re
from gooey.gui.lang import i18n
from gooey.gui.util.filedrop import FileDrop
from gooey.gui.util.quoting import maybe_quote
__author__ = 'Chris'
from abc import ABCMeta, abstractmethod
import os
import wx
import wx.lib.agw.multidirdialog as MDD
from gooey.gui.wi... | {
"repo_name": "intfrr/Gooey",
"path": "gooey/gui/widgets/widget_pack.py",
"copies": "5",
"size": "6317",
"license": "mit",
"hash": 3012179099680043000,
"line_mean": 27.3813953488,
"line_max": 199,
"alpha_frac": 0.6509419028,
"autogenerated": false,
"ratio": 3.542905215928211,
"config_test": fal... |
from functools import partial
import xml.etree.ElementTree as ET
# from copy import deepcopy
# BUG: Nested <anchor> tags are disallowed, which can break headings
# e.g. footnotes in heading.
# Possible fix: wrap anchor heading in §-span element instead of heading.
def _class_iter(it, class_):
for child i... | {
"repo_name": "fourpoints/addup",
"path": "treemodifier.py",
"copies": "1",
"size": "11337",
"license": "mit",
"hash": -5218612293273455000,
"line_mean": 25.3816425121,
"line_max": 82,
"alpha_frac": 0.532639379,
"autogenerated": false,
"ratio": 3.632169176545979,
"config_test": false,
"has_no... |
from functools import partial
from bunch import Bunch
from flask import request
from flask_login import current_user
from flask_menu import MenuEntryMixin
from flask_menu import current_menu
from flask_menu import register_menu
def visible_when(roles):
"""
:param list[str] roles:
:return:... | {
"repo_name": "by46/flask-kits",
"path": "flask_kits/ui/menu.py",
"copies": "1",
"size": "1938",
"license": "mit",
"hash": -7486205298721335000,
"line_mean": 22.5316455696,
"line_max": 74,
"alpha_frac": 0.5954592363,
"autogenerated": false,
"ratio": 3.860557768924303,
"config_test": false,
"h... |
from functools import partial
from django.contrib.gis.db.models import aggregates
class BaseSpatialFeatures(object):
gis_enabled = True
# Does the database contain a SpatialRefSys model to store SRID information?
has_spatialrefsys_table = True
# Does the backend support the django.contri... | {
"repo_name": "diego-d5000/MisValesMd",
"path": "env/lib/python2.7/site-packages/django/contrib/gis/db/backends/base/features.py",
"copies": "1",
"size": "3630",
"license": "mit",
"hash": -1075135016076699000,
"line_mean": 39.25,
"line_max": 94,
"alpha_frac": 0.6818181818,
"autogenerated": false,
... |
from functools import partial
from stdnet.utils import encoders
from stdnet import QuerySetError, ManyToManyError
from .globals import Event
from .session import Manager, LazyProxy
__all__ = ['LazyForeignKey', 'ModelFieldPickler']
RECURSIVE_RELATIONSHIP_CONSTANT = 'self'
pending_lookups = {}
class... | {
"repo_name": "lsbardel/python-stdnet",
"path": "stdnet/odm/related.py",
"copies": "1",
"size": "10661",
"license": "bsd-3-clause",
"hash": -4821908459840020000,
"line_mean": 36.9087591241,
"line_max": 79,
"alpha_frac": 0.6184222868,
"autogenerated": false,
"ratio": 4.290140845070423,
"config_t... |
from functools import partial
import wx
from gooey.gui.util import wx_util
from gooey.gui.widgets import widget_pack
class BaseGuiComponent(object):
widget_class = None
def __init__(self, parent, title, msg, choices=None):
'''
:param data: field info (title, help, etc..)
:param widg... | {
"repo_name": "jschultz/Gooey",
"path": "gooey/gui/widgets/components.py",
"copies": "1",
"size": "7280",
"license": "mit",
"hash": 8316712383884380000,
"line_mean": 28.7172995781,
"line_max": 104,
"alpha_frac": 0.6557692308,
"autogenerated": false,
"ratio": 3.440453686200378,
"config_test": fa... |
from functools import partial, singledispatch
import warnings
import numbers
from typing import Union, Tuple
from .transferfunction import TransferFunction, _tf_to_symbol
from .statespace import StateSpace
from .plot_utility import _plot_response_curve
from .discretization import c2d
from .model_conversion import tf2s... | {
"repo_name": "DaivdZhang/tinyControl",
"path": "tcontrol/time_response.py",
"copies": "1",
"size": "7780",
"license": "bsd-3-clause",
"hash": -590452373392842200,
"line_mean": 26.0138888889,
"line_max": 89,
"alpha_frac": 0.5951156812,
"autogenerated": false,
"ratio": 3.267534649307014,
"config... |
from functools import partial, singledispatch, wraps
import stl
import funcy as fn
import numpy as np
from optlang import Variable, Constraint
from magnum.constraint_kinds import Kind as K, Kind
M = 1000 # TODO
def counter(func):
i = 0
@wraps(func)
def _func(*args, **kwargs):
nonlocal i
... | {
"repo_name": "mvcisback/py-blustl",
"path": "magnum/solvers/milp/robustness_encoding.py",
"copies": "2",
"size": "3770",
"license": "bsd-3-clause",
"hash": -4245749179118528500,
"line_mean": 25,
"line_max": 78,
"alpha_frac": 0.5713527851,
"autogenerated": false,
"ratio": 2.8071481757259864,
"c... |
from functools import partial, total_ordering
from django.db import connections, models, router
from django.db.models.deletion import Collector
from django.utils.encoding import python_2_unicode_compatible
import bleach
import six
import olympia.core.logger
from olympia.amo.fields import PositiveAutoField
from olym... | {
"repo_name": "wagnerand/olympia",
"path": "src/olympia/translations/models.py",
"copies": "1",
"size": "9233",
"license": "bsd-3-clause",
"hash": 967747549479309300,
"line_mean": 33.7105263158,
"line_max": 79,
"alpha_frac": 0.6122603704,
"autogenerated": false,
"ratio": 4.278498609823911,
"con... |
from functools import partial, total_ordering
from django.db import connections, models, router
from django.db.models.deletion import Collector
import bleach
from bleach.linkifier import URL_RE # build_url_re() with good defaults.
import olympia.core.logger
from olympia.amo.fields import PositiveAutoField
from oly... | {
"repo_name": "mozilla/addons-server",
"path": "src/olympia/translations/models.py",
"copies": "1",
"size": "9497",
"license": "bsd-3-clause",
"hash": 7924239109088616000,
"line_mean": 33.285198556,
"line_max": 83,
"alpha_frac": 0.6057702432,
"autogenerated": false,
"ratio": 4.29923042100498,
"... |
from functools import partial, total_ordering
from django.db import connections, models, router
from django.db.models.deletion import Collector
import bleach
import olympia.core.logger
from olympia.amo.fields import PositiveAutoField
from olympia.amo.models import ManagerBase, ModelBase
from olympia.amo.urlresolver... | {
"repo_name": "wagnerand/addons-server",
"path": "src/olympia/translations/models.py",
"copies": "2",
"size": "9239",
"license": "bsd-3-clause",
"hash": -3960415077766215000,
"line_mean": 32.7189781022,
"line_max": 82,
"alpha_frac": 0.6033120468,
"autogenerated": false,
"ratio": 4.297209302325581... |
from functools import partial, total_ordering
import attr
import funcy as fn
from lazytree import LazyTree
from monotone_bipartition import hausdorff as mbph
from monotone_bipartition import rectangles # unit_rec
from monotone_bipartition import refine as mbpr # bounding_box
from monotone_bipartition import search ... | {
"repo_name": "mvcisback/multidim-threshold",
"path": "monotone_bipartition/bipartition.py",
"copies": "1",
"size": "3594",
"license": "mit",
"hash": -5136908712207879000,
"line_mean": 32.9056603774,
"line_max": 76,
"alpha_frac": 0.6199220924,
"autogenerated": false,
"ratio": 3.8980477223427332,
... |
from functools import partial, update_wrapper
from getpass import getpass
import logging
import os
import sys
from types import MethodType
from proboscis import TestProgram
from gmusicapi.clients import Webclient, Musicmanager
from gmusicapi.protocol.musicmanager import credentials_from_refresh_token
from gmusicapi.t... | {
"repo_name": "jimyx17/gmusic",
"path": "gmusicapi/test/run_tests.py",
"copies": "1",
"size": "4107",
"license": "bsd-3-clause",
"hash": -6006899996860778000,
"line_mean": 30.3511450382,
"line_max": 85,
"alpha_frac": 0.6359873387,
"autogenerated": false,
"ratio": 4.0146627565982405,
"config_tes... |
from functools import partial, update_wrapper
import inspect
import logging
from django.conf.urls import url, include
from django.core.urlresolvers import resolve
from django.http.response import HttpResponseNotAllowed, HttpResponse,\
HttpResponseBase
from django.template.response import TemplateResponse
from djan... | {
"repo_name": "lig/django-actionviews",
"path": "actionviews/base.py",
"copies": "1",
"size": "9751",
"license": "bsd-3-clause",
"hash": 7132266799330091000,
"line_mean": 30.6590909091,
"line_max": 79,
"alpha_frac": 0.5578914983,
"autogenerated": false,
"ratio": 4.67673860911271,
"config_test":... |
from functools import partial, update_wrapper
class SelfWrapper:
"""Wraps class attributes that could be overruled by instance attributes"""
_ATTRIBUTES = "Attributes"
def __init__(self, wrapped, attributelist):
self._attributelist = attributelist
self._wrapped = wrapped
self._cls =... | {
"repo_name": "sjdv1982/seamless",
"path": "seamless/highlevel/SelfWrapper.py",
"copies": "1",
"size": "1185",
"license": "mit",
"hash": 9142669370276401000,
"line_mean": 27.9268292683,
"line_max": 79,
"alpha_frac": 0.5991561181,
"autogenerated": false,
"ratio": 4.247311827956989,
"config_test"... |
from functools import partial, update_wrapper
from django.contrib.auth.decorators import user_passes_test
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponse
from django.views.generic import RedirectView
def empty_view(request, *args, **kwargs):
return HttpResponse('')
def ab... | {
"repo_name": "alilotfi/django",
"path": "tests/urlpatterns_reverse/views.py",
"copies": "67",
"size": "1466",
"license": "bsd-3-clause",
"hash": -5572186497445394000,
"line_mean": 22.6451612903,
"line_max": 92,
"alpha_frac": 0.727148704,
"autogenerated": false,
"ratio": 3.665,
"config_test": f... |
from functools import partial, update_wrapper
from django.contrib.auth.decorators import user_passes_test
from django.http import HttpResponse
from django.urls import reverse_lazy
from django.views.generic import RedirectView
def empty_view(request, *args, **kwargs):
return HttpResponse()
def absolute_kwargs_v... | {
"repo_name": "kaedroho/django",
"path": "tests/urlpatterns_reverse/views.py",
"copies": "57",
"size": "1528",
"license": "bsd-3-clause",
"hash": 3223045688764645400,
"line_mean": 23.253968254,
"line_max": 92,
"alpha_frac": 0.7342931937,
"autogenerated": false,
"ratio": 3.6208530805687205,
"con... |
from functools import partial, update_wrapper
from django.http import HttpResponse
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.decorators import user_passes_test
def empty_view(request, *args, **kwargs):
return HttpResponse('')
def kwa... | {
"repo_name": "kalahbrown/HueBigSQL",
"path": "desktop/core/ext-py/Django-1.6.10/tests/urlpatterns_reverse/views.py",
"copies": "64",
"size": "1511",
"license": "apache-2.0",
"hash": 1384393102973570800,
"line_mean": 25.5087719298,
"line_max": 92,
"alpha_frac": 0.7279947055,
"autogenerated": false,... |
from functools import partial, update_wrapper
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from django.core.exceptions import ObjectDoesNotExist
from .models import (URLRedirect, URLVisible, SimpleAccessRestriction,
GroupAccessRestriction, UserAccess... | {
"repo_name": "kezabelle/django-churlish",
"path": "churlish/admin_inlines.py",
"copies": "1",
"size": "3958",
"license": "bsd-2-clause",
"hash": 1893558926794643700,
"line_mean": 31.8290598291,
"line_max": 79,
"alpha_frac": 0.66195048,
"autogenerated": false,
"ratio": 4.224119530416222,
"confi... |
from functools import partial, update_wrapper
from django.contrib.auth.decorators import user_passes_test
from django.http import HttpResponse
from django.urls import reverse_lazy
from django.views.generic import RedirectView
def empty_view(request, *args, **kwargs):
return HttpResponse('')
def abs... | {
"repo_name": "yephper/django",
"path": "tests/urlpatterns_reverse/views.py",
"copies": "1",
"size": "1605",
"license": "bsd-3-clause",
"hash": -2409359147976676000,
"line_mean": 24.3114754098,
"line_max": 92,
"alpha_frac": 0.7028037383,
"autogenerated": false,
"ratio": 3.7238979118329465,
"con... |
from functools import partial, update_wrapper, wraps
import os
import signal
import subprocess
import pygmi
__all__ = 'call', 'message', 'program_list', 'curry', 'find_script', '_', 'prop'
def _():
pass
def call(*args, **kwargs):
background = kwargs.pop('background', False)
stdin = subprocess.PIPE if no... | {
"repo_name": "darkfeline/wmii",
"path": "alternative_wmiircs/python/pygmi/util.py",
"copies": "9",
"size": "2163",
"license": "mit",
"hash": 3066492827874414600,
"line_mean": 29.9,
"line_max": 90,
"alpha_frac": 0.5506241331,
"autogenerated": false,
"ratio": 3.444267515923567,
"config_test": fa... |
from functools import partial, WRAPPER_ASSIGNMENTS, WRAPPER_UPDATES
from toolz.compatibility import *
from toolz.compatibility import __all__ as compat_all
__all__ = compat_all + ('update_wrapper', 'wraps')
# pending removal based on acceptance of toolz pull request 230
# see: https://github.com/pytoolz/toolz/pull/23... | {
"repo_name": "justanr/toolshed",
"path": "toolshed/compatibility.py",
"copies": "1",
"size": "2497",
"license": "bsd-3-clause",
"hash": 4888874798913415000,
"line_mean": 33.2054794521,
"line_max": 78,
"alpha_frac": 0.6403684421,
"autogenerated": false,
"ratio": 4.290378006872852,
"config_test"... |
from functools import partial, wraps
from .base import DuplicateLabel
from .pyll.base import Apply, Literal
from .pyll import scope
from .pyll import as_apply
def validate_label(f):
@wraps(f)
def wrapper(label, *args, **kwargs):
is_real_string = isinstance(label, basestring)
is_literal_string ... | {
"repo_name": "dudalev/hyperopt",
"path": "hyperopt/pyll_utils.py",
"copies": "1",
"size": "6637",
"license": "bsd-3-clause",
"hash": 637492806938818600,
"line_mean": 28.1096491228,
"line_max": 88,
"alpha_frac": 0.5592888353,
"autogenerated": false,
"ratio": 3.8408564814814814,
"config_test": t... |
from functools import partial, wraps
from collections import namedtuple
from .predicate import match_instance
from .predicate import PredicateRegistry
from .arginfo import arginfo
from .error import RegistrationError
class dispatch:
"""Decorator to make a function dispatch based on its arguments.
This takes ... | {
"repo_name": "morepath/reg",
"path": "reg/dispatch.py",
"copies": "1",
"size": "9645",
"license": "bsd-3-clause",
"hash": -7276508442917660000,
"line_mean": 35.1235955056,
"line_max": 87,
"alpha_frac": 0.6414722654,
"autogenerated": false,
"ratio": 4.296213808463252,
"config_test": false,
"h... |
from functools import partial, wraps
from flask import Flask, request, send_file, make_response, Response
from flask.ext.restful import abort, Api, Resource
#from flask.ext.restful.utils import cors
import cors # until twilio/flask-restful/pull/276 is merged, see the package
from landmarkerio import Server, Endpoints,... | {
"repo_name": "jabooth/landmarkerio-server",
"path": "landmarkerio/server.py",
"copies": "1",
"size": "9111",
"license": "bsd-3-clause",
"hash": -3115408170092723000,
"line_mean": 29.8847457627,
"line_max": 80,
"alpha_frac": 0.6252881133,
"autogenerated": false,
"ratio": 3.9492847854356308,
"co... |
from functools import partial, wraps
from inspect import getargspec
from .op import identity, flip
class F(object):
"""Provide simple syntax for functions composition
(through << and >> operators) and partial function
application (through simple tuple syntax).
Usage example:
>>> func = F() << ... | {
"repo_name": "FunctionalX/FunctionalX.py",
"path": "FunctionalX/src/fn/func.py",
"copies": "2",
"size": "2272",
"license": "mit",
"hash": 3806584769022456300,
"line_mean": 26.0476190476,
"line_max": 74,
"alpha_frac": 0.5404929577,
"autogenerated": false,
"ratio": 3.7491749174917492,
"config_te... |
from functools import partial, wraps
from itertools import chain
import os
import threading
import sublime
from sublime_plugin import WindowCommand, TextCommand
from ..git_mixins.status import FileStatus
from ..commands import GsNavigate
from ...common import ui
from ..git_command import GitCommand
from ...common imp... | {
"repo_name": "divmain/GitSavvy",
"path": "core/interfaces/status.py",
"copies": "1",
"size": "27966",
"license": "mit",
"hash": 2542343746415027700,
"line_mean": 29.8335170893,
"line_max": 98,
"alpha_frac": 0.5770936137,
"autogenerated": false,
"ratio": 3.913518052057095,
"config_test": false,... |
from functools import partial, wraps
from itertools import ifilter, imap
from operator import not_
def list_subtract(a, b):
"""Return a list ``a`` without the elements of ``b``.
If a particular value is in ``a`` twice and ``b`` once then the returned
list then that value will appear once in the returned ... | {
"repo_name": "jml/perfidy",
"path": "perfidy/_func.py",
"copies": "1",
"size": "1969",
"license": "mit",
"hash": 8530123999908043000,
"line_mean": 21.1235955056,
"line_max": 76,
"alpha_frac": 0.5855764347,
"autogenerated": false,
"ratio": 3.165594855305466,
"config_test": false,
"has_no_keyw... |
from functools import partial, wraps
from mimetypes import guess_type
from os import path
from re import sub
from time import gmtime, strftime
from urllib.parse import unquote
from sanic.compat import stat_async
from sanic.exceptions import (
ContentRangeError,
FileNotFound,
HeaderNotFound,
InvalidUsag... | {
"repo_name": "channelcat/sanic",
"path": "sanic/static.py",
"copies": "1",
"size": "5976",
"license": "mit",
"hash": -8968757582895643000,
"line_mean": 34.7844311377,
"line_max": 77,
"alpha_frac": 0.5881860776,
"autogenerated": false,
"ratio": 4.368421052631579,
"config_test": false,
"has_no... |
from functools import partial, wraps
from urllib.parse import quote
from django.conf import settings
from django.contrib import messages
from django.urls import reverse
from django.shortcuts import redirect
from apostello.models import Keyword
def keyword_access_check(method):
"""Check a user can access a speci... | {
"repo_name": "monty5811/apostello",
"path": "apostello/decorators.py",
"copies": "1",
"size": "2175",
"license": "mit",
"hash": 8079062136100856000,
"line_mean": 32.4615384615,
"line_max": 93,
"alpha_frac": 0.6068965517,
"autogenerated": false,
"ratio": 4.429735234215886,
"config_test": false,... |
from functools import partial, wraps
import json
from xml.etree.ElementTree import ParseError
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.forms.formsets import formset_factory
from vecnet.openmalaria.scenario import Scenario
from ts_om.models import Sce... | {
"repo_name": "vecnet/vnetsource",
"path": "ts_om/views/ScenarioDeploymentsView.py",
"copies": "2",
"size": "3931",
"license": "mpl-2.0",
"hash": 7497070295754225000,
"line_mean": 39.5257731959,
"line_max": 112,
"alpha_frac": 0.6387687611,
"autogenerated": false,
"ratio": 4.565621370499419,
"co... |
from functools import partial, wraps
import json
import attr
from minion.http import Headers, MediaRange
from minion.request import Response
class JSON(object):
"""
An 'intelligent' JSON renderer that pretty-prints JSON for humans.
"""
def __init__(self, **kwargs):
self._dumps = partial(js... | {
"repo_name": "Julian/Minion",
"path": "minion/renderers.py",
"copies": "1",
"size": "2123",
"license": "mit",
"hash": -7673801123038807000,
"line_mean": 23.9764705882,
"line_max": 79,
"alpha_frac": 0.5967969854,
"autogenerated": false,
"ratio": 4.212301587301587,
"config_test": false,
"has_n... |
from functools import partial, wraps
import queue
import threading
class OP:
"""
A client operation.
:param client: The client this operation is executed from.
:type client: :class:`leaf.client.Client`
:param func: The operation function that is going to be executed.
:type func: function
... | {
"repo_name": "simonklb/matrix-leaf",
"path": "leaf/client/op.py",
"copies": "1",
"size": "3050",
"license": "mit",
"hash": -8977653101772317000,
"line_mean": 30.4432989691,
"line_max": 78,
"alpha_frac": 0.6049180328,
"autogenerated": false,
"ratio": 4.5051698670605616,
"config_test": false,
... |
from functools import partial, wraps
from crispy_forms.layout import Layout, HTML
from django.contrib import messages
from django.forms import BaseFormSet
from django.forms.models import formset_factory
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from hs_app_... | {
"repo_name": "hydroshare/hydroshare",
"path": "hs_app_netCDF/page_processors.py",
"copies": "1",
"size": "6814",
"license": "bsd-3-clause",
"hash": -6399414974906306000,
"line_mean": 47.3262411348,
"line_max": 99,
"alpha_frac": 0.6099207514,
"autogenerated": false,
"ratio": 3.9801401869158877,
... |
from functools import partial, wraps
from crispy_forms.layout import Layout, HTML
from django.forms import formset_factory
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from hs_core import page_processors
from hs_core.forms import BaseFormSet, MetaDataElementDe... | {
"repo_name": "hydroshare/hydroshare",
"path": "hs_modflow_modelinstance/page_processors.py",
"copies": "1",
"size": "11364",
"license": "bsd-3-clause",
"hash": 8947570394892241000,
"line_mean": 53.8985507246,
"line_max": 98,
"alpha_frac": 0.5341429074,
"autogenerated": false,
"ratio": 4.83368779... |
from functools import partial, wraps
from crispy_forms.layout import Layout, HTML
from django.forms.models import formset_factory
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from .forms import CellInfoForm, BandInfoForm, BaseBandInfoFormSet, OriginalCoverageS... | {
"repo_name": "hydroshare/hydroshare",
"path": "hs_geo_raster_resource/page_processors.py",
"copies": "1",
"size": "6675",
"license": "bsd-3-clause",
"hash": 5325800640805224000,
"line_mean": 52.4,
"line_max": 100,
"alpha_frac": 0.57917603,
"autogenerated": false,
"ratio": 4.444074567243675,
"c... |
from functools import partial, wraps
from django.core.exceptions import PermissionDenied
from django.forms.models import formset_factory
from mezzanine.pages.page_processors import processor_for
from hs_core.models import AbstractResource, GenericResource, Relation
from hs_core import languages_iso
from forms import... | {
"repo_name": "FescueFungiShare/hydroshare",
"path": "hs_core/page_processors.py",
"copies": "1",
"size": "25522",
"license": "bsd-3-clause",
"hash": -8755338842669869000,
"line_mean": 51.9502074689,
"line_max": 100,
"alpha_frac": 0.5926259698,
"autogenerated": false,
"ratio": 4.460328556448794,
... |
from functools import partial, wraps
from django import http
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.utils.decorators import available_attrs
from hilbert.middleware import _redirect
__all__ = (
'ajax_login_requi... | {
"repo_name": "mlavin/django-hilbert",
"path": "hilbert/decorators.py",
"copies": "1",
"size": "2442",
"license": "bsd-2-clause",
"hash": -5705691431875865000,
"line_mean": 28.7804878049,
"line_max": 78,
"alpha_frac": 0.6171171171,
"autogenerated": false,
"ratio": 4.090452261306533,
"config_tes... |
from functools import partial, wraps
from psycopg2 import connect as _connect
from psycopg2.extensions import register_adapter
from spans import *
from ._utils import adapt_range, register_range_caster, query_range_oids, floatrange_preprocess
__all__ = [
"connect",
"register_range_type"
]
@wraps(_connect)
d... | {
"repo_name": "runfalk/psycospans",
"path": "psycospans/__init__.py",
"copies": "1",
"size": "2248",
"license": "mit",
"hash": -3028472899252626000,
"line_mean": 36.4666666667,
"line_max": 98,
"alpha_frac": 0.7153024911,
"autogenerated": false,
"ratio": 3.608346709470305,
"config_test": false,
... |
from functools import partial, wraps
from toolz import merge
import pandas as pd
from ..base import tokenize
def rolling_chunk(func, part1, part2, window, *args):
if part1.shape[0] < window:
raise NotImplementedError("Window larger than partition size")
if window > 1:
extra = window - 1
... | {
"repo_name": "wiso/dask",
"path": "dask/dataframe/rolling.py",
"copies": "4",
"size": "2175",
"license": "bsd-3-clause",
"hash": -2217907968090794800,
"line_mean": 37.1578947368,
"line_max": 79,
"alpha_frac": 0.6340229885,
"autogenerated": false,
"ratio": 3.6189683860232944,
"config_test": fal... |
from functools import partial, wraps
from toolz import merge
import pandas as pd
from .core import tokenize
def rolling_chunk(func, part1, part2, window, *args):
if part1.shape[0] < window:
raise NotImplementedError("Window larger than partition size")
if window > 1:
extra = window - 1
... | {
"repo_name": "jayhetee/dask",
"path": "dask/dataframe/rolling.py",
"copies": "1",
"size": "2192",
"license": "bsd-3-clause",
"hash": 5056795725002110000,
"line_mean": 37.4561403509,
"line_max": 79,
"alpha_frac": 0.6341240876,
"autogenerated": false,
"ratio": 3.6231404958677684,
"config_test": ... |
from functools import partial, wraps
import numpy as np
from matplotlib import pyplot as plt
from core.config import Config, ALGORITHMS
from utils import generate_static_nodes
from experiments import evaluation
LABELS = dict(zip(ALGORITHMS, ['Classical MDS', 'Anchored MDS', 'MDS-RFID']))
def runexperiment(func):
... | {
"repo_name": "mkoledoye/mds_experiments",
"path": "experiments/comparisons.py",
"copies": "2",
"size": "1735",
"license": "mit",
"hash": 7086825199432404000,
"line_mean": 33.7,
"line_max": 106,
"alpha_frac": 0.7291066282,
"autogenerated": false,
"ratio": 3.0817051509769096,
"config_test": true... |
from functools import partial, wraps
class Assert:
def __init__(self):
self.messages_error = []
self.messages_warning = []
def __call__(self, expression, error_message):
if not expression:
self.messages_error.append(error_message)
def warn(self, expression, warning_m... | {
"repo_name": "edublancas/python-ds-tools",
"path": "src/dstools/pipeline/validators/validators.py",
"copies": "2",
"size": "3348",
"license": "mit",
"hash": -175116121769602000,
"line_mean": 28.1130434783,
"line_max": 79,
"alpha_frac": 0.557646356,
"autogenerated": false,
"ratio": 4.133333333333... |
from functools import partial, wraps
# This wrapper takes a class, and wraps all methods within the class with the
# specified decorator.
# This only supports instance methods, not classmethods and static methods???
def printer():
def handler(_func):
@wraps(_func)
def wrapper(*args, **kargs):
... | {
"repo_name": "mr-uuid/snippets",
"path": "python/wrappers/class_wrappers_continued.py",
"copies": "1",
"size": "1177",
"license": "mit",
"hash": -4357111427546172000,
"line_mean": 20.7962962963,
"line_max": 77,
"alpha_frac": 0.6108751062,
"autogenerated": false,
"ratio": 3.784565916398714,
"co... |
from functools import partial, wraps
from django.forms import formset_factory
from crispy_forms.layout import Layout, HTML
from hs_core import page_processors
from hs_core.views import add_generic_context
from hs_core.forms import BaseFormSet, MetaDataElementDeleteForm
from hs_modflow_modelinstance.models imp... | {
"repo_name": "ResearchSoftwareInstitute/MyHPOM",
"path": "hs_modflow_modelinstance/page_processors.py",
"copies": "1",
"size": "11404",
"license": "bsd-3-clause",
"hash": 4346826761021114400,
"line_mean": 54.1773399015,
"line_max": 109,
"alpha_frac": 0.5222728867,
"autogenerated": false,
"ratio"... |
from functools import reduce as ft_reduce
from .errors import CraftAiError
from .formatters import format_decision_rules
from .operators import OPERATORS
def _is_is_reducer(rule_1, rule_2):
if rule_1["operand"] and (rule_1["operand"] != rule_2["operand"]):
raise CraftAiError(
"Operator '{}' c... | {
"repo_name": "craft-ai/craft-ai-client-python",
"path": "craft_ai/reducer.py",
"copies": "1",
"size": "8085",
"license": "bsd-3-clause",
"hash": -3451230810799561700,
"line_mean": 30.2162162162,
"line_max": 92,
"alpha_frac": 0.4979591837,
"autogenerated": false,
"ratio": 3.161908486507626,
"co... |
from functools import reduce, lru_cache
import numpy as np
from typing import List, Any, Callable
import scipy.integrate as integrate
from mule_local.rexi.pcirexi.gauss_cache import GaussCache
from mule_local.rexi.pcirexi.section import section
def _complex_quad(func, a, b):
real = integrate.quad((lambda a: func... | {
"repo_name": "schreiberx/sweet",
"path": "mule_local/python/mule_local/rexi/pcirexi/cauchy_integrator.py",
"copies": "1",
"size": "8699",
"license": "mit",
"hash": 3628331937517759000,
"line_mean": 45.2712765957,
"line_max": 118,
"alpha_frac": 0.5763880906,
"autogenerated": false,
"ratio": 3.764... |
from functools import reduce
class AST:
def __init__(self, result, op=None, children=[]):
self._res = result
self._opr = op
self._chd = children
self._chr = str(result) if type(result) == int else str(result)[0]
def __repr__(self):
return ''.join(buchheim(self)._svg())
... | {
"repo_name": "oisdk/PyParse",
"path": "AST.py",
"copies": "1",
"size": "5730",
"license": "mit",
"hash": -264436776750541920,
"line_mean": 30.6574585635,
"line_max": 97,
"alpha_frac": 0.4856893543,
"autogenerated": false,
"ratio": 3.0592632140950347,
"config_test": false,
"has_no_keywords": ... |
from functools import reduce
class Solution:
def maxProduct(self, A):
B = A[::-1]
for i in range(1, len(A)):
A[i] *= A[i - 1] or 1
print(A)
B[i] *= B[i - 1] or 1
print(A, B)
return max(A + B)
# def maxProduct(self, nums):
# # print(nums... | {
"repo_name": "zuun77/givemegoogletshirts",
"path": "leetcode/python/152_maximum-product-subarray.py",
"copies": "1",
"size": "1326",
"license": "apache-2.0",
"hash": 8819540323817469000,
"line_mean": 33.8947368421,
"line_max": 66,
"alpha_frac": 0.4607843137,
"autogenerated": false,
"ratio": 2.83... |
from functools import reduce
def factorial(n):
if n==1 or n==0:
return 1
else:
return n * factorial(n-1)
def jc(n):
return reduce(operator.mul, range(1,10))
print(factorial(0))
print(factorial(5))
def is_palindromes(s):
return s==s[::-1]
print(is_palindromes('abba'))
print(is_pal... | {
"repo_name": "coodoing/udacity-searchengine",
"path": "course6_Recursive.py",
"copies": "1",
"size": "1352",
"license": "apache-2.0",
"hash": -6544932827625335000,
"line_mean": 21.5333333333,
"line_max": 72,
"alpha_frac": 0.5813609467,
"autogenerated": false,
"ratio": 2.6509803921568627,
"conf... |
from functools import reduce
from botlang.ast.ast_visitor import ASTVisitor
from botlang.evaluation.values import *
class ExecutionStack(list):
def print_trace(self):
from botlang.macros.default_macros import DefaultMacros
return reduce(
lambda a, n: a + n + '\n',
[
... | {
"repo_name": "PostCenter/botlang",
"path": "botlang/evaluation/evaluator.py",
"copies": "1",
"size": "8096",
"license": "mit",
"hash": -9071233875668719000,
"line_mean": 29.4360902256,
"line_max": 77,
"alpha_frac": 0.5805335968,
"autogenerated": false,
"ratio": 4.074484146955209,
"config_test"... |
from functools import reduce
from collections import defaultdict
class Ref(tuple):
def __new__(cls, name, id):
return super().__new__(cls, (name,id))
@property
def name(self):
return self[0]
@property
def id(self):
return self[1]
def __str__(self):
return
cla... | {
"repo_name": "wabu/zeroflo",
"path": "zeroflo/top/container.py",
"copies": "1",
"size": "5718",
"license": "mit",
"hash": 9039788506574943000,
"line_mean": 23.4358974359,
"line_max": 79,
"alpha_frac": 0.5050717034,
"autogenerated": false,
"ratio": 3.771767810026385,
"config_test": false,
"ha... |
from functools import reduce
from collections import defaultdict
from ..utils.common import getCurieFromVal, dict_set2list
from .bioentity import BioEntity
class BioThingsAPI:
MAX_BATCH_SIZE = 1000
def __init__(self, metadata):
self._process_metadata(metadata)
def _process_metadata(self, metada... | {
"repo_name": "biothings/biothings_explorer",
"path": "biothings_explorer/resolve_ids/api.py",
"copies": "1",
"size": "1882",
"license": "apache-2.0",
"hash": 2542285772423409000,
"line_mean": 35.1923076923,
"line_max": 88,
"alpha_frac": 0.5632306057,
"autogenerated": false,
"ratio": 3.8329938900... |
from functools import reduce
from collections import deque
from operator import getitem, setitem
def nested_enumerate(lst):
"""An analogue of enumerate for nested lists.
Returns an iterator over the (index, element) pairs of `lst` where
`index` is a list of integers [x0, x1,.., xn] such that
... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578376_analogue_enumerate_nested/recipe-578376.py",
"copies": "1",
"size": "2423",
"license": "mit",
"hash": -2062685325794573800,
"line_mean": 29.2875,
"line_max": 92,
"alpha_frac": 0.5984316962,
"autogenerated": false,
"ratio": 3.2567204... |
from functools import reduce
from collections import KeysView
class Node:
def __init__(self, value):
self.value = value
def get_child(self, key):
return NoneNode()
def keys(self):
return KeysView([])
def __str__(self):
return "<{}>".format(self.value)
def __eq__... | {
"repo_name": "hiroara/tree-python",
"path": "tree/structs.py",
"copies": "1",
"size": "1857",
"license": "mit",
"hash": -3524719577075760000,
"line_mean": 24.4383561644,
"line_max": 100,
"alpha_frac": 0.577813678,
"autogenerated": false,
"ratio": 3.8288659793814435,
"config_test": false,
"ha... |
from functools import reduce
from collections import namedtuple
from itertools import chain
from graphics import save_svg
Point = namedtuple("Point", ["x", "y"])
class Map():
"""
Representing a map which contains walls, a starting point and a target.
"""
def __init__(self, max_acceleration, filename=... | {
"repo_name": "Faerbit/evol-racer",
"path": "map.py",
"copies": "1",
"size": "2164",
"license": "mit",
"hash": 2312067548752440000,
"line_mean": 31.7878787879,
"line_max": 90,
"alpha_frac": 0.5231053604,
"autogenerated": false,
"ratio": 3.770034843205575,
"config_test": false,
"has_no_keyword... |
from functools import reduce
from datetime import datetime
from operator import and_
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from celery import states
from pytz import utc
from v... | {
"repo_name": "erigones/esdc-ce",
"path": "api/task/serializers.py",
"copies": "1",
"size": "5023",
"license": "apache-2.0",
"hash": -6604186334997036000,
"line_mean": 38.2421875,
"line_max": 118,
"alpha_frac": 0.6336850488,
"autogenerated": false,
"ratio": 3.8285060975609757,
"config_test": fa... |
from functools import reduce
from datetime import datetime
import operator
import re
from django_select2.views import AutoResponseView
from django.contrib.auth.models import Group
from django.conf.urls import url
from django.db.models import Q, Count
from fiscal.models import MembershipPersonRole
from workshops impor... | {
"repo_name": "swcarpentry/amy",
"path": "amy/workshops/lookups.py",
"copies": "1",
"size": "9342",
"license": "mit",
"hash": -7664379429956278000,
"line_mean": 31.4375,
"line_max": 86,
"alpha_frac": 0.6125026761,
"autogenerated": false,
"ratio": 4.070588235294117,
"config_test": false,
"has_... |
from functools import reduce
from datetime import datetime
import re
from flask import Blueprint, render_template, request, redirect, url_for
from flask.ext.login import login_required, current_user
from bnd.forms import CheckpointEvaluationForm
from bnd.models import Checkpoint, Team, Goal, Evaluation, \
Checkpo... | {
"repo_name": "suminb/bnd",
"path": "bnd/checkpoint.py",
"copies": "1",
"size": "3521",
"license": "mit",
"hash": -1881775025371914500,
"line_mean": 31.6018518519,
"line_max": 75,
"alpha_frac": 0.6197103096,
"autogenerated": false,
"ratio": 3.9253065774804905,
"config_test": false,
"has_no_ke... |
from functools import reduce
from dateutil.parser import parse
from django.db.models import Case, Count, F, IntegerField, Manager, Max, Sum, When
from kolibri.auth.models import FacilityUser
from kolibri.content.models import ContentNode
from kolibri.logger.models import ContentSummaryLog
from kolibri.core.lessons.mode... | {
"repo_name": "christianmemije/kolibri",
"path": "kolibri/plugins/coach/serializers.py",
"copies": "1",
"size": "13613",
"license": "mit",
"hash": -7244049393111873000,
"line_mean": 46.5979020979,
"line_max": 122,
"alpha_frac": 0.6157349592,
"autogenerated": false,
"ratio": 4.246101060511541,
"... |
from functools import reduce
from .definition import (
GraphQLInputObjectType,
GraphQLInterfaceType,
GraphQLList,
GraphQLNonNull,
GraphQLObjectType,
GraphQLUnionType,
)
from .directives import GraphQLIncludeDirective, GraphQLSkipDirective
from .introspection import IntrospectionSchema
class Gr... | {
"repo_name": "dittos/graphqllib",
"path": "graphql/core/type/schema.py",
"copies": "2",
"size": "3152",
"license": "mit",
"hash": 1365237225388880600,
"line_mean": 28.1851851852,
"line_max": 109,
"alpha_frac": 0.6116751269,
"autogenerated": false,
"ratio": 4.141918528252299,
"config_test": fal... |
from functools import reduce
from .definition import (
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLList,
GraphQLNonNull,
)
from .introspection import IntrospectionSchema
from .directives import GraphQLIncludeDirective, GraphQLSkipDirective
class GraphQLSchema(object):
"""... | {
"repo_name": "elastic-coders/graphqllib",
"path": "graphql/core/type/schema.py",
"copies": "2",
"size": "2826",
"license": "mit",
"hash": -5746812159142902000,
"line_mean": 27.8367346939,
"line_max": 109,
"alpha_frac": 0.618895966,
"autogenerated": false,
"ratio": 4.083815028901734,
"config_te... |
from functools import reduce
from django import forms
from django.contrib.auth import login
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ValidationError
from django.shortcuts import render, redirect
from django.utils.translation import gettext as _
from django.views impo... | {
"repo_name": "PLUS-POSTECH/study.plus.or.kr",
"path": "src/website/views.py",
"copies": "1",
"size": "3550",
"license": "apache-2.0",
"hash": -6612703814118607000,
"line_mean": 36.3684210526,
"line_max": 118,
"alpha_frac": 0.6529577465,
"autogenerated": false,
"ratio": 4.006772009029345,
"conf... |
from functools import reduce
from ...exceptions import SmtlibError
import uuid
import re
import copy
from typing import Union, Type, Optional, Dict, Any
class ExpressionException(SmtlibError):
"""
Expression exception
"""
pass
class Expression:
""" Abstract taintable Expression. """
def _... | {
"repo_name": "montyly/manticore",
"path": "manticore/core/smtlib/expression.py",
"copies": "1",
"size": "36789",
"license": "apache-2.0",
"hash": 5668414571755638000,
"line_mean": 29.5556478405,
"line_max": 133,
"alpha_frac": 0.5786512273,
"autogenerated": false,
"ratio": 3.8425945268435346,
"... |
from functools import reduce
from GF2 import *
# version code 75eb0ae74c69
coursera = 1
# Please fill out this stencil and submit using the provided submission script.
## 1: (Problem 1) Python Comprehensions: Filtering
def myFilter(L, num):
'''
Input:
-L: a list of numbers
-num: a positive integer... | {
"repo_name": "josiah14/linear-algebra",
"path": "programming-the-matrix/0-week/the-field-problems/Python/The_Field_problems.py",
"copies": "1",
"size": "4322",
"license": "mit",
"hash": -1249987680513122000,
"line_mean": 25.0361445783,
"line_max": 80,
"alpha_frac": 0.5645534475,
"autogenerated": f... |
from functools import reduce
from hearthbreaker.agents.trade.util import memoized
class FakeCard:
def __init__(self, card):
self.health = card.health
self.attack = card.base_attack
self.base_attack = card.base_attack
if hasattr(card, "taunt"):
self.taunt = card.taunt
... | {
"repo_name": "anuragpapineni/Hearthbreaker-evolved-agent",
"path": "hearthbreaker/agents/trade/trade.py",
"copies": "2",
"size": "7732",
"license": "mit",
"hash": -6952166985474704000,
"line_mean": 28.7384615385,
"line_max": 78,
"alpha_frac": 0.5531557165,
"autogenerated": false,
"ratio": 3.4970... |
from functools import reduce
from . import Parameter
from re import compile, MULTILINE
import re
class Configuration:
def __init__(self, file_path):
self.file_path = file_path
def load_parameters(self, names):
configs = self._get_parameters_from_config()
return {name: self._get_pa... | {
"repo_name": "fholiveira/tlpconfig",
"path": "tlp/models/configuration.py",
"copies": "1",
"size": "1672",
"license": "bsd-3-clause",
"hash": -6344298432929767000,
"line_mean": 35.347826087,
"line_max": 81,
"alpha_frac": 0.5592105263,
"autogenerated": false,
"ratio": 3.9341176470588235,
"confi... |
from functools import reduce
from itertools import chain, groupby, islice
from operator import itemgetter
from typing import Any, Callable, Iterable, Sequence
__all__ = [
'all_equal',
'butlast',
'concat',
'cons',
'dedupe',
'first',
'flatten',
'head',
'init',
'last',
'nth',
... | {
"repo_name": "Jackevansevo/basic-utils",
"path": "basic_utils/seq_helpers.py",
"copies": "1",
"size": "4548",
"license": "mit",
"hash": 1156020217288231400,
"line_mean": 19.7671232877,
"line_max": 77,
"alpha_frac": 0.5672823219,
"autogenerated": false,
"ratio": 3.404191616766467,
"config_test"... |
from functools import reduce
from itertools import chain
from django.conf import settings
from django.apps import apps
from django.utils.text import capfirst
from ..utils.functools import factual, first, pick, omit
from ..utils.translation import get_string, get_model_names
from ..utils.urls import exists_import
from ... | {
"repo_name": "doctorzeb8/django-era",
"path": "era/templatetags/menu.py",
"copies": "1",
"size": "6168",
"license": "mit",
"hash": -5668869941151844000,
"line_mean": 33.2666666667,
"line_max": 81,
"alpha_frac": 0.5230220493,
"autogenerated": false,
"ratio": 4.1202404809619235,
"config_test": f... |
from functools import reduce
from itertools import chain
from math import sqrt
from operator import mul
def even(n):
# n ~ 2*k
return n % 2 == 0
def odd(n):
# n ~ 2*k + 1
return n % 2 != 0
def gcd(a, b):
"""
Greatest common divisor (greatest common factor)
Notes
---------
Euc... | {
"repo_name": "vadimadr/python-algorithms",
"path": "algorithms/number_theory.py",
"copies": "1",
"size": "5909",
"license": "mit",
"hash": -5165591191912861000,
"line_mean": 17.1815384615,
"line_max": 71,
"alpha_frac": 0.4313758673,
"autogenerated": false,
"ratio": 2.779397930385701,
"config_t... |
from functools import reduce
from itertools import chain
from operator import attrgetter
from os import name, system
from typing import Any, List, Sequence, Tuple
__all__ = [
'clear',
'getattrs',
'map_getattr',
'rgetattr',
'rsetattr',
'slurp',
'to_string',
]
def slurp(fname: str) -> str:
... | {
"repo_name": "Jackevansevo/basic-utils",
"path": "basic_utils/core.py",
"copies": "1",
"size": "1624",
"license": "mit",
"hash": 8777713359020928000,
"line_mean": 24.375,
"line_max": 76,
"alpha_frac": 0.6256157635,
"autogenerated": false,
"ratio": 3.5929203539823007,
"config_test": false,
"h... |
from functools import reduce
from itertools import chain
from urllib.parse import unquote
from django.contrib.contenttypes.forms import BaseGenericInlineFormSet
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist, FieldDoesNotExist
from django.db.models import OneToOneFie... | {
"repo_name": "doctorzeb8/django-era",
"path": "era/views/forms.py",
"copies": "1",
"size": "12534",
"license": "mit",
"hash": -8050496049777788000,
"line_mean": 35.5422740525,
"line_max": 94,
"alpha_frac": 0.5829743099,
"autogenerated": false,
"ratio": 3.9377945334590008,
"config_test": false,... |
from functools import reduce
from itertools import chain
import networkx as nx
from lib.nodes import build_mac_table
def import_vis_data(graph, nodes, vis_data):
macs = build_mac_table(nodes)
nodes_a = map(lambda d: 2 * [d['primary']],
filter(lambda d: 'primary' in d, vis_data))
nodes_... | {
"repo_name": "FreifunkBremen/ffmap-backend",
"path": "lib/graph.py",
"copies": "1",
"size": "3515",
"license": "bsd-3-clause",
"hash": -1128570185275322600,
"line_mean": 35.2371134021,
"line_max": 207,
"alpha_frac": 0.5974395448,
"autogenerated": false,
"ratio": 3.160971223021583,
"config_test... |
from functools import reduce
from itertools import chain, product
from operator import methodcaller
import numpy
import FIAT
from FIAT.polynomial_set import mis
from FIAT.reference_element import TensorProductCell
import gem
from gem.utils import cached_property
from finat.finiteelementbase import FiniteElementBase... | {
"repo_name": "FInAT/FInAT",
"path": "finat/tensor_product.py",
"copies": "1",
"size": "8822",
"license": "mit",
"hash": -817051972970562700,
"line_mean": 36.3813559322,
"line_max": 106,
"alpha_frac": 0.6115393335,
"autogenerated": false,
"ratio": 4.120504437178888,
"config_test": false,
"has... |
from functools import reduce
from itertools import combinations
from pybbn.graph.edge import Edge, EdgeType
from pybbn.graph.graph import Ug
from pybbn.graph.node import Clique
class Triangulator(object):
"""
Triangulator. Triangulates an undirected moralized graph and produces cliques in the process.
""... | {
"repo_name": "vangj/py-bbn",
"path": "pybbn/pptc/triangulator.py",
"copies": "1",
"size": "4535",
"license": "apache-2.0",
"hash": -2164917198056017200,
"line_mean": 27.7025316456,
"line_max": 111,
"alpha_frac": 0.5691289967,
"autogenerated": false,
"ratio": 3.699021207177814,
"config_test": f... |
from functools import reduce
from itertools import compress
from operator import and_
from typing import List, Tuple, Dict, Optional
from hwt.doc_markers import internal
from hwt.hdl.operatorUtils import replace_input_in_expr
from hwt.hdl.sensitivityCtx import SensitivityCtx
from hwt.hdl.statements.statement import Hd... | {
"repo_name": "Nic30/HWToolkit",
"path": "hwt/hdl/statements/switchContainer.py",
"copies": "1",
"size": "14839",
"license": "mit",
"hash": 7286600100256340000,
"line_mean": 34.8429951691,
"line_max": 100,
"alpha_frac": 0.5796886583,
"autogenerated": false,
"ratio": 4.027958740499457,
"config_t... |
from functools import reduce
from itertools import count
import GF2
def add(*vectors):
return [ reduce(lambda x0, x1: x0 + x1, xs) for xs in zip(*vectors) ]
def minus(*vectors):
return [ reduce(lambda x0, x1: x0 - x1, xs) for xs in zip(*vectors) ]
def scalar_mult(constant, vector):
return list(map(lambda... | {
"repo_name": "josiah14/linear-algebra",
"path": "programming-the-matrix/1-week/the-vector-problems/Python/vector.py",
"copies": "1",
"size": "1918",
"license": "mit",
"hash": 6473707238706701000,
"line_mean": 34.5185185185,
"line_max": 128,
"alpha_frac": 0.6272158498,
"autogenerated": false,
"ra... |
from functools import reduce
from itertools import groupby
import numpy as np
import itertools
def combination(d):
c = d.copy()
temp = 0
for j in range(5):
for i in range(j + 1, 5):
if c[i] == c[j]: temp += 1
if temp == 10: return -1
for j in range(5):
for i in range(4):
if c[i + 1] <... | {
"repo_name": "sberbank-ai/holdem-challenge",
"path": "PyPokerEngine/pypokerengine/engine/hand_evaluator.py",
"copies": "1",
"size": "9969",
"license": "mit",
"hash": 8302575163280334000,
"line_mean": 28.149122807,
"line_max": 99,
"alpha_frac": 0.5695656535,
"autogenerated": false,
"ratio": 2.850... |
from functools import reduce
from itertools import groupby
class HandEvaluator:
HIGHCARD = 0
ONEPAIR = 1 << 8
TWOPAIR = 1 << 9
THREECARD = 1 << 10
STRAIGHT = 1 << 11
FLASH = 1 << 12
FULLHOUSE = 1 << 13
FOURCARD = 1 << 14
STRAIGHTFLASH = 1 << 15
HAND_STRE... | {
"repo_name": "ishikota/PyPokerEngine",
"path": "pypokerengine/engine/hand_evaluator.py",
"copies": "1",
"size": "7794",
"license": "mit",
"hash": -232086526779720540,
"line_mean": 28.9769230769,
"line_max": 99,
"alpha_frac": 0.6050808314,
"autogenerated": false,
"ratio": 3.1288639100762747,
"c... |
from functools import reduce
from itertools import groupby
from .functions import Compose
def mamdani(rules_output, defuzzy, functions, step=0.1):
"""
Mamdani model
:param rules_output: List of tuples (w, outputVar, linguisticVal) representing the output of each rule's evaluation
:param defuzzy: Defu... | {
"repo_name": "ealmuina/fuzzy-logic-evaluator",
"path": "fuzzy/models.py",
"copies": "1",
"size": "3081",
"license": "mit",
"hash": -3608028277340996000,
"line_mean": 37.5125,
"line_max": 119,
"alpha_frac": 0.6757546251,
"autogenerated": false,
"ratio": 3.9449423815621,
"config_test": false,
... |
from functools import reduce
from itertools import groupby
from pypokerengine.engine.hand_evaluator import HandEvaluator
from pypokerengine.engine.pay_info import PayInfo
class GameEvaluator:
@classmethod
def judge(self, table):
winners = self.__find_winners_from(table.get_community_card(), table.seats.playe... | {
"repo_name": "sberbank-ai/holdem-challenge",
"path": "PyPokerEngine/pypokerengine/engine/game_evaluator.py",
"copies": "1",
"size": "4390",
"license": "mit",
"hash": -376532597012173060,
"line_mean": 39.6481481481,
"line_max": 130,
"alpha_frac": 0.6958997722,
"autogenerated": false,
"ratio": 3.2... |
from functools import reduce
from itertools import permutations
from ..combinatorics import Permutation
from ..core import (Add, Basic, Dummy, Expr, Function, Integer, Mul, Pow,
Tuple, diff, symbols, sympify)
from ..core.numbers import Zero
from ..functions import factorial
from ..matrices import M... | {
"repo_name": "skirpichev/omg",
"path": "diofant/diffgeom/diffgeom.py",
"copies": "1",
"size": "54312",
"license": "bsd-3-clause",
"hash": -8605965319946006000,
"line_mean": 32.3611793612,
"line_max": 122,
"alpha_frac": 0.5766681396,
"autogenerated": false,
"ratio": 3.628298483532634,
"config_t... |
from functools import reduce
from itertools import permutations
from ..core import Add, Basic, Dummy, E, Eq, Integer, Mul, Wild, pi, sympify
from ..core.compatibility import ordered
from ..functions import (Ei, LambertW, Piecewise, acosh, asin, asinh, atan,
binomial, cos, cosh, cot, coth, erf,... | {
"repo_name": "skirpichev/omg",
"path": "diofant/integrals/heurisch.py",
"copies": "1",
"size": "18281",
"license": "bsd-3-clause",
"hash": -7827721510920935000,
"line_mean": 32.7911275416,
"line_max": 156,
"alpha_frac": 0.527542257,
"autogenerated": false,
"ratio": 3.773168214654283,
"config_t... |
from functools import reduce
from itertools import product
from operator import mul
import numpy as np
from .core import Array
from .utils import meta_from_array
from ..base import tokenize
from ..core import flatten
from ..highlevelgraph import HighLevelGraph
from ..utils import M
def reshape_rechunk(inshape, outs... | {
"repo_name": "ContinuumIO/dask",
"path": "dask/array/reshape.py",
"copies": "2",
"size": "6447",
"license": "bsd-3-clause",
"hash": -4772955976431810000,
"line_mean": 30.4487804878,
"line_max": 86,
"alpha_frac": 0.5521948193,
"autogenerated": false,
"ratio": 3.4329073482428116,
"config_test": ... |
from functools import reduce
from math import ceil
from typing import Union
from hwt.doc_markers import internal
from hwt.hdl.types.bits import Bits
from hwt.hdl.types.hdlType import HdlType
from hwt.hdl.types.utils import walkFlattenFields
from hwt.hdl.value import HValue
from hwt.synthesizer.rtlLevel.mainBases impor... | {
"repo_name": "Nic30/HWToolkit",
"path": "hwt/synthesizer/vectorUtils.py",
"copies": "1",
"size": "6524",
"license": "mit",
"hash": 8261053081077151000,
"line_mean": 30.2153110048,
"line_max": 82,
"alpha_frac": 0.5893623544,
"autogenerated": false,
"ratio": 4.230869001297017,
"config_test": fal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.