text
stringlengths
0
1.05M
meta
dict
from functools import reduce import operator from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.db.models import Q from autorski.models import Joke def __add_pages(request, jokes): paginator = Paginator(jokes, 15) page = request.GET.get('page') try: jokes = pagi...
{ "repo_name": "jchmura/suchary-django", "path": "autorski/extras/prepare_view.py", "copies": "1", "size": "2075", "license": "mit", "hash": -6517948922761374000, "line_mean": 26.68, "line_max": 88, "alpha_frac": 0.6202409639, "autogenerated": false, "ratio": 3.685612788632327, "config_test": fa...
from functools import reduce import operator from django.db.models import CharField, Value as V from django.db.models.functions import Concat from pontoon.base.models import User, TranslatedResource from pontoon.machinery.utils import ( get_google_translate_data, get_translation_memory_data, ) def get_trans...
{ "repo_name": "mozilla/pontoon", "path": "pontoon/pretranslation/pretranslate.py", "copies": "3", "size": "2692", "license": "bsd-3-clause", "hash": -1319611961148128500, "line_mean": 32.2345679012, "line_max": 86, "alpha_frac": 0.6526745914, "autogenerated": false, "ratio": 4.017910447761194, ...
from functools import reduce import os import struct import numpy as np class LABEL: NONE = 0 VESSEL = 1 BACKGROUND = 2 PADDING = 3 class IMG: BACKGROUND = 0 VESSEL = 1 NONE = 255 is_eq = lambda a: lambda b: a == b is_neq = lambda a: lambda b: a != b def read_image(filename, dtype=n...
{ "repo_name": "molski/pmag", "path": "utils.py", "copies": "1", "size": "4995", "license": "mit", "hash": 3394424271241360400, "line_mean": 26.1467391304, "line_max": 80, "alpha_frac": 0.5627627628, "autogenerated": false, "ratio": 3.593525179856115, "config_test": false, "has_no_keywords": f...
from functools import reduce import os import time from collections import deque import pickle import warnings import gym import numpy as np import tensorflow as tf import tensorflow.contrib as tc from mpi4py import MPI from stable_baselines import logger from stable_baselines.common import tf_util, OffPolicyRLModel,...
{ "repo_name": "hill-a/stable-baselines", "path": "stable_baselines/ddpg/ddpg.py", "copies": "1", "size": "56965", "license": "mit", "hash": 8262858876242834000, "line_mean": 47.4791489362, "line_max": 120, "alpha_frac": 0.5513052332, "autogenerated": false, "ratio": 4.220419352448692, "config_t...
from functools import reduce import os.path as osp import collections import numpy as np import gc from rllab.envs.mujoco.mujoco_env import MujocoEnv from rllab import spaces from rllab.misc.overrides import overrides from rllab.misc import logger import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as pl...
{ "repo_name": "florensacc/snn4hrl", "path": "envs/mujoco/mujoco_env.py", "copies": "1", "size": "10179", "license": "mit", "hash": -2979853239775346700, "line_mean": 54.3206521739, "line_max": 123, "alpha_frac": 0.5491698595, "autogenerated": false, "ratio": 3.4123365739188736, "config_test": f...
from functools import reduce import pprint import time import shodan import requests import api_key from google_api import query_google_api from shodan_api import query_shodan_api from mxtoolbox_api import query_mxtoolbox_api from dnsbl import query_dnsbl_list from utils import assoc_default_score, combine_scores pp ...
{ "repo_name": "Dominionized/anonymoustre", "path": "anonymoustre/main.py", "copies": "1", "size": "1300", "license": "mit", "hash": 4594693178398562000, "line_mean": 25, "line_max": 84, "alpha_frac": 0.6746153846, "autogenerated": false, "ratio": 3.2338308457711444, "config_test": false, "has...
from functools import reduce import random from string import ascii_letters, digits import os import teca.filesystem as tecafs from six import next as _next import logging def _d(n, k): return reduce(lambda x, y: x*y, range(n-k+1, n+1), 1) def generateToken(list_of_tokens=None, lenght=7, alphabet=ascii_letters+di...
{ "repo_name": "alfateam123/Teca", "path": "teca/generation.py", "copies": "1", "size": "2138", "license": "mit", "hash": 4460659562477127000, "line_mean": 37.1785714286, "line_max": 126, "alpha_frac": 0.631898971, "autogenerated": false, "ratio": 3.5280528052805282, "config_test": false, "has...
from functools import reduce import random # Two groups of size 10 # Rest will be whatever left remains GROUP_SIZES = [10, 10] def to_groups(seq, group_sizes): groups = {} seq_index = 1 group_index = 1 total_sizes = reduce(lambda x, y: x + y, group_sizes) if total_sizes < len(seq): grou...
{ "repo_name": "Hackfmi/HackFMI-4", "path": "help-scripts/order.py", "copies": "1", "size": "1448", "license": "mit", "hash": 1874390520432823800, "line_mean": 23.5423728814, "line_max": 72, "alpha_frac": 0.6201657459, "autogenerated": false, "ratio": 3.383177570093458, "config_test": false, "...
from functools import reduce import sqlite3 def insertion(cursor, table, data): """Insert data into table with given cursor""" if cursor is None: raise ValueError("Cursor is None!") if len(data) == 0: raise ValueError("Data is empty!") expected_length = len(data[0]) if not all(map...
{ "repo_name": "imajunryou/RealPython2", "path": "sql/06_sql_homework.py", "copies": "1", "size": "1741", "license": "mit", "hash": -487593062018831550, "line_mean": 29.5438596491, "line_max": 67, "alpha_frac": 0.5491097071, "autogenerated": false, "ratio": 4.020785219399538, "config_test": fals...
from functools import reduce import string from django.db.models import Q from django.views import generic from gallery import models class BasePatientView(object): """Responsible for generating basic patient context data""" def get_context_data(self) -> dict: """ Get context data about pat...
{ "repo_name": "cdriehuys/chmvh-website", "path": "chmvh_website/gallery/views.py", "copies": "1", "size": "2902", "license": "mit", "hash": 4272160273594268000, "line_mean": 25.8703703704, "line_max": 76, "alpha_frac": 0.6033769814, "autogenerated": false, "ratio": 4.116312056737589, "config_te...
from functools import reduce import sys import os import git import glob from astropy.table import Table from tqdm import tqdm import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.colors as colors import matplotlib.ticker as ticker import subprocess im...
{ "repo_name": "dpshelio/busfactor", "path": "busfactor/counter.py", "copies": "1", "size": "5723", "license": "mit", "hash": 1482251426150112000, "line_mean": 36.1623376623, "line_max": 116, "alpha_frac": 0.5951424078, "autogenerated": false, "ratio": 3.4663840096910965, "config_test": false, ...
from functools import reduce import torch from torch._utils import _accumulate from ..function import Function, InplaceFunction class Index(Function): def __init__(self, index): super(Index, self).__init__() self.index = index def forward(self, i): self.input_size = i.size() ...
{ "repo_name": "RPGOne/Skynet", "path": "pytorch-master/torch/autograd/_functions/tensor.py", "copies": "1", "size": "18346", "license": "bsd-3-clause", "hash": 5408063517656617000, "line_mean": 28.9282218597, "line_max": 92, "alpha_frac": 0.589174752, "autogenerated": false, "ratio": 3.7463753318...
from functools import reduce import torch import torch._utils from ..function import Function class Type(Function): @staticmethod def forward(ctx, i, dest_type): ctx.input_type = type(i) ctx.input_device = -1 if not i.is_cuda else i.get_device() return i.type(dest_type) @staticme...
{ "repo_name": "ryfeus/lambda-packs", "path": "pytorch/source/torch/autograd/_functions/tensor.py", "copies": "1", "size": "1691", "license": "mit", "hash": 6015001933895220000, "line_mean": 34.2291666667, "line_max": 92, "alpha_frac": 0.5771732703, "autogenerated": false, "ratio": 4.0649038461538...
from functools import reduce import urllib import json import urllib.request import lxml.html from PIL import Image from django.core import serializers from django.core.files.base import ContentFile from django.db import transaction from django.http import HttpResponse from django.db.models import Q import operator fro...
{ "repo_name": "artbart/DistributedLibrary", "path": "library/pac_views/v_books.py", "copies": "1", "size": "12238", "license": "mit", "hash": 1597173270698162400, "line_mean": 30.3333333333, "line_max": 111, "alpha_frac": 0.6130932897, "autogenerated": false, "ratio": 3.5236447520184546, "confi...
from functools import reduce import urllib.request as urllib2 import json import time import os travis_entry = 'https://api.travis-ci.org' build_id = os.getenv("TRAVIS_BUILD_ID") polling_interval = int(os.getenv("POLLING_INTERVAL", '5')) gh_token = os.getenv("GITHUB_TOKEN") job_number = os.getenv("TRAVIS_JOB_NUMBER"...
{ "repo_name": "beavyHQ/beavy", "path": ".infrastructure/travis/scripts/travis_after_all.py", "copies": "1", "size": "2977", "license": "mpl-2.0", "hash": -1325974866063924700, "line_mean": 33.1954022989, "line_max": 114, "alpha_frac": 0.6531092437, "autogenerated": false, "ratio": 3.5, "config_...
from functools import reduce activation_func = { # 跃迁函数 'transition': lambda x: 1 if x > 0 else 0, # 线性函数 'linear': lambda x: x } class Perceptron(object): def __init__(self, input_num, activator): ''' 初始化感知器,设置输入参数的个数,以及激活函数。 激活函数的类型为double -> double ''' s...
{ "repo_name": "ycaxgjd/VIL", "path": "ANN/perceptron.py", "copies": "1", "size": "3810", "license": "mit", "hash": 15477771638392836, "line_mean": 26.7657657658, "line_max": 107, "alpha_frac": 0.5304996755, "autogenerated": false, "ratio": 2.032981530343008, "config_test": false, "has_no_keyw...
from functools import reduce class ActionChecker: @classmethod def correct_action(self, players, player_pos, sb_amount, action, amount=None): if self.is_allin(players[player_pos], action, amount): amount = players[player_pos].stack + players[player_pos].paid_sum() elif self.__is_illegal(players, pla...
{ "repo_name": "sberbank-ai/holdem-challenge", "path": "PyPokerEngine/pypokerengine/engine/action_checker.py", "copies": "1", "size": "3715", "license": "mit", "hash": -130873296404262190, "line_mean": 34.380952381, "line_max": 121, "alpha_frac": 0.6522207268, "autogenerated": false, "ratio": 3.39...
from functools import reduce class BaseNegotiator: # Constructor - Note that you can add other fields here; the only # required fields are self.preferences and self.offer def __init__(self): self.preferences = [] self.offer = [] self.iter_limit = 0 # initialize(self : BaseNego...
{ "repo_name": "A-Beck/AINegotiaor", "path": "negotiator_base.py", "copies": "1", "size": "1937", "license": "mit", "hash": -7350407524437980000, "line_mean": 46.2682926829, "line_max": 169, "alpha_frac": 0.6675271038, "autogenerated": false, "ratio": 4.183585313174946, "config_test": false, "...
from functools import reduce class BaseNegotiator: # Constructor - Note that you can add other fields here; the only # required fields are self.preferences and self.offer def __init__(self): self.preferences = [] self.offer = [] self.iter_limit = 0 # initialize(self : BaseNegot...
{ "repo_name": "nealp9084/hw3", "path": "negotiator_base.py", "copies": "1", "size": "1915", "license": "mit", "hash": -3475747217960891400, "line_mean": 46.875, "line_max": 169, "alpha_frac": 0.6710182768, "autogenerated": false, "ratio": 4.163043478260869, "config_test": false, "has_no_keywo...
from functools import reduce class BaseNegotiator: # Constructor - Note that you can add other fields here; the only # required fields are self.preferences and self.offer def __init__(self): self.preferences = [] self.offer = [] self.iter_limit = 0 # initialize(self : BaseNego...
{ "repo_name": "zws3mb/CS4710HW3", "path": "negotiator_base.py", "copies": "4", "size": "1917", "license": "mit", "hash": 4916590863553692000, "line_mean": 48.1538461538, "line_max": 169, "alpha_frac": 0.6703182055, "autogenerated": false, "ratio": 4.167391304347826, "config_test": false, "has...
from functools import reduce class Perceptron(object): def __init__(self, input_num, activator): ''' 初始化感知器,设置输入参数的个数,以及激活函数。 激活函数的类型为double -> double ''' self.activator = activator # 权重向量初始化为0 self.weights = [0.0 for _ in range(input_num)] # 偏置项初始化为0...
{ "repo_name": "thanple/ThinkingInPython", "path": "pythinking/ml/common.py", "copies": "1", "size": "2528", "license": "apache-2.0", "hash": 8004354193364071000, "line_mean": 32.5573770492, "line_max": 86, "alpha_frac": 0.5097751711, "autogenerated": false, "ratio": 2.207119741100324, "config_t...
from functools import reduce class ScopedString (object): def __init__ (self): self._stack = [] def push (self, frame): self._stack.append (frame) def pop (self): frame = self._stack.pop() return frame def __str__ (self...
{ "repo_name": "doffm/dbuf", "path": "src/dbuf/util.py", "copies": "1", "size": "3108", "license": "bsd-3-clause", "hash": 7000044123501045000, "line_mean": 28.046728972, "line_max": 72, "alpha_frac": 0.4057271557, "autogenerated": false, "ratio": 5.037277147487845, "config_test": false, "has_...
from functools import reduce # constants used in the multGF2 function mask1 = mask2 = polyred = None def setGF2(degree, irPoly): """Define parameters of binary finite field GF(2^m)/g(x) - degree: extension degree of binary field - irPoly: coefficients of irreducible polynomial g(x) """ def i...
{ "repo_name": "srijs/hwsl2-core", "path": "calc.py", "copies": "1", "size": "1141", "license": "mit", "hash": -1679128641056926200, "line_mean": 28.2820512821, "line_max": 101, "alpha_frac": 0.5609114812, "autogenerated": false, "ratio": 3.1174863387978142, "config_test": false, "has_no_keywo...
from functools import reduce def format_comment_title(product): """Produce a Markdown-formatted string based on a given "product"--a string containing a browser identifier optionally followed by a colon and a release channel. (For example: "firefox" or "chrome:dev".) The generated title string is used ...
{ "repo_name": "Acidburn0zzz/servo", "path": "tests/wpt/web-platform-tests/tools/wpt/markdown.py", "copies": "43", "size": "1622", "license": "mpl-2.0", "hash": 6199813624525708000, "line_mean": 37.619047619, "line_max": 89, "alpha_frac": 0.5351418002, "autogenerated": false, "ratio": 3.7116704805...
from functools import reduce def is_trivial(dependency): (x, y) = dependency return y <= x; def is_superkey(key, dependency): (x, y) = dependency return key <= x def is_bcnf(dependency, key): return is_superkey(key, dependency) or is_trivial(dependency) def str_dependency(dependency): (x, y)...
{ "repo_name": "matias-pierobon/informatica-unlp", "path": "db1/normalizer/normalizer.py", "copies": "1", "size": "8822", "license": "mit", "hash": -6561618493799354000, "line_mean": 33.9444444444, "line_max": 141, "alpha_frac": 0.5935725642, "autogenerated": false, "ratio": 3.398687765341567, "...
from functools import reduce def largest_product_sequence(grid, sequence_length): """ given a grid and sequence length returns the sequence with the maximum product args: grid: the 2d array to sequence over. sequence_length: the length of the sequence for calculating the...
{ "repo_name": "PurityControl/uchi-komi-python", "path": "problems/euler/0011-largest-product-in-grid/ichi/largest_product.py", "copies": "1", "size": "2058", "license": "mit", "hash": 2022208254553614000, "line_mean": 27.1917808219, "line_max": 72, "alpha_frac": 0.563654033, "autogenerated": false,...
from functools import reduce def p_empty_or_comment(line, comment='#'): """Predicate matching strings that are not empty and don't start with a comment character. For best results, the line should no longer contain whitespace at the start.""" return len(line) and not line.startswith(comment) def mrepl...
{ "repo_name": "MnM/tomcat-ear", "path": "lib/properties.py", "copies": "1", "size": "2746", "license": "bsd-3-clause", "hash": -3454626335900183000, "line_mean": 41.2461538462, "line_max": 80, "alpha_frac": 0.6613255645, "autogenerated": false, "ratio": 4.244204018547141, "config_test": false, ...
from functools import reduce def pf1(n, facts): i = 2 while i <= n: if n % i == 0: facts.append(i) pf1(n // i, facts) break else: i += 1 def pf2(n): facts = [] i = 2 while i <= n: if n % i == 0: #print(i) ...
{ "repo_name": "mitesh1112/smallpy", "path": "LCMHCF.py", "copies": "1", "size": "1510", "license": "unlicense", "hash": -4395737029726131000, "line_mean": 18.1139240506, "line_max": 60, "alpha_frac": 0.3894039735, "autogenerated": false, "ratio": 3.069105691056911, "config_test": false, "has_...
from functools import reduce from boto3.dynamodb.conditions import Attr IMAGE_TYPE = 'image' VIDEO_TYPE = 'video' class MediaDB(object): def list_media_files(self, label=None): pass def add_media_file(self, name, media_type, labels=None): pass def get_media_file(self, name): p...
{ "repo_name": "aws-samples/chalice-workshop", "path": "code/media-query/07-videos/chalicelib/db.py", "copies": "6", "size": "2117", "license": "apache-2.0", "hash": -1289366893132646400, "line_mean": 26.4935064935, "line_max": 77, "alpha_frac": 0.5507794048, "autogenerated": false, "ratio": 4.192...
from functools import reduce from ckeditor_uploader import views as cku_views from django.conf import settings from django.contrib.auth import views as auth_views from django.contrib.auth.decorators import login_required from django.urls import include, path from django.views.i18n import JavaScriptCatalog from drf_s...
{ "repo_name": "modoboa/modoboa", "path": "modoboa/urls.py", "copies": "1", "size": "3428", "license": "isc", "hash": -9107362390492353000, "line_mean": 36.2608695652, "line_max": 84, "alpha_frac": 0.6843640607, "autogenerated": false, "ratio": 3.3542074363992174, "config_test": false, "has_no...
from functools import reduce from ...combinators import Lazy from ...AST.expressions.arithmetic import IntAexp, VarAexp, BinopAexp def any_operator_in_list(ops): """ Returns the parser appropriate to the keyword list (ops). """ from ..common import keyword op_parsers = [keyword(op) for op in ops...
{ "repo_name": "PetukhovVictor/compiler", "path": "src/Parser/Parsers/expressions/arithmetic.py", "copies": "1", "size": "2601", "license": "mit", "hash": -291049085711451460, "line_mean": 26.670212766, "line_max": 111, "alpha_frac": 0.6289888504, "autogenerated": false, "ratio": 3.597510373443983...
from functools import reduce from ...combinators import Rep, Exp from ...AST.common import CompoundStatement def stmt(): """ Main statement parser. Try to first parse as 'assign' statement, if not possible - as 'if' statement, if not possible - as 'while' statement. """ from ..expressions...
{ "repo_name": "PetukhovVictor/compiler", "path": "src/Parser/Parsers/statements/base.py", "copies": "1", "size": "1345", "license": "mit", "hash": -4895065253277678000, "line_mean": 27.0208333333, "line_max": 88, "alpha_frac": 0.5977695167, "autogenerated": false, "ratio": 3.9098837209302326, "...
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.content_db_router import default_database_is_attached, get_active_content_database from kolibri.content.mod...
{ "repo_name": "rtibbles/kolibri", "path": "kolibri/plugins/coach/serializers.py", "copies": "1", "size": "12487", "license": "mit", "hash": -6937374488170230000, "line_mean": 49.1485943775, "line_max": 122, "alpha_frac": 0.6213662209, "autogenerated": false, "ratio": 4.260320709655407, "config_...
from functools import reduce from dateutil.parser import parse from django.db.models import Case from django.db.models import Count from django.db.models import F from django.db.models import IntegerField from django.db.models import Manager from django.db.models import Max from django.db.models import Sum from django...
{ "repo_name": "jonboiser/kolibri", "path": "kolibri/plugins/coach/serializers.py", "copies": "1", "size": "13991", "license": "mit", "hash": 8160696601574850000, "line_mean": 46.2668918919, "line_max": 122, "alpha_frac": 0.6213994711, "autogenerated": false, "ratio": 4.2371290127195635, "config...
from functools import reduce from dict_utils.public import DictUtils class BlueprintResolver(): """ takes care of resolving the dependencies of blueprints into one independent document """ class ResolvingException(Exception): """ is thrown, in case an error occurs, during resolving a ...
{ "repo_name": "jdepoix/goto_cloud", "path": "goto_cloud/migration_plan_parsing/blueprint_resolving.py", "copies": "1", "size": "3237", "license": "mit", "hash": -1883769820102194000, "line_mean": 34.1847826087, "line_max": 118, "alpha_frac": 0.6184738956, "autogenerated": false, "ratio": 4.860360...
from functools import reduce from django.apps.registry import apps from django.conf.urls import url as conf_url, include from django.contrib.auth import get_permission_codename from django.core.exceptions import ImproperlyConfigured import declarative_urlconf as urlconf from . import views from .registry import Regis...
{ "repo_name": "bpeschier/reek-admin", "path": "admin/admins.py", "copies": "1", "size": "7321", "license": "mit", "hash": -4863488015621554000, "line_mean": 30.0211864407, "line_max": 97, "alpha_frac": 0.6139871602, "autogenerated": false, "ratio": 4.049225663716814, "config_test": false, "ha...
from functools import reduce from django.contrib.auth.models import User from approver.models import Response, Question, Project, Choice from approver.constants import answer_submit_names, answer_response_names from approver.utils import get_current_user_gatorlink, after_approval def add_update_response(post_data, r...
{ "repo_name": "PFWhite/qipr_approver", "path": "qipr_approver/approver/workflows/approve_workflow.py", "copies": "1", "size": "4445", "license": "apache-2.0", "hash": 7523950253024121000, "line_mean": 39.7798165138, "line_max": 119, "alpha_frac": 0.694488189, "autogenerated": false, "ratio": 3.96...
from functools import reduce from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.db.models import F, Sum from . import exceptions class QuotaLimitField(models.IntegerField): """ Django virtual model field. Could be used to manage quotas transparently as model f...
{ "repo_name": "opennode/nodeconductor-assembly-waldur", "path": "src/waldur_core/quotas/fields.py", "copies": "1", "size": "12173", "license": "mit", "hash": -2991388658199226000, "line_mean": 34.6979472141, "line_max": 114, "alpha_frac": 0.6251540294, "autogenerated": false, "ratio": 4.284758887...
from functools import reduce from django.core.management.base import BaseCommand from chat.serializers import LessonSerializer from chat.models import Chat class Command(BaseCommand): """ Update all Chats progress. """ def handle(self, *args, **options): for chat in Chat.objects.all(): ...
{ "repo_name": "cjlee112/socraticqs2", "path": "mysite/chat/management/commands/update_progress.py", "copies": "1", "size": "1651", "license": "apache-2.0", "hash": 2815920373167082500, "line_mean": 36.5227272727, "line_max": 95, "alpha_frac": 0.5481526348, "autogenerated": false, "ratio": 4.41443...
from functools import reduce from django.db import models from django.core.validators import MinLengthValidator from .validators import ( IsDigitValidator, ControlNumberValidation ) class SNILS(str): RAZOR = '001-001-998' control_mask = range(9, 0, -1) @property def representation(self): ...
{ "repo_name": "wolfstein9119/django-russian-fields", "path": "russian_fields/snils.py", "copies": "1", "size": "2731", "license": "bsd-2-clause", "hash": -3323046112380606000, "line_mean": 27.1546391753, "line_max": 99, "alpha_frac": 0.5759794947, "autogenerated": false, "ratio": 3.73087431693989...
from functools import reduce from django.db import models from django.db.models import Min from django.db.models.signals import post_delete, post_save from django.dispatch.dispatcher import receiver from django.utils.translation import ugettext_lazy as _ from cms.models import CMSPlugin from filer.fields.image import...
{ "repo_name": "MagicSolutions/cmsplugin-media-center", "path": "cmsplugin_media_center/models.py", "copies": "1", "size": "6618", "license": "mit", "hash": 3373914652532916700, "line_mean": 37.0344827586, "line_max": 100, "alpha_frac": 0.6429434875, "autogenerated": false, "ratio": 4.055147058823...
from functools import reduce from django.db import models from django.db.models import Sum import six from . import exceptions class QuotaLimitField(models.IntegerField): """ Django virtual model field. Could be used to manage quotas transparently as model fields. """ concrete = False def ...
{ "repo_name": "opennode/nodeconductor", "path": "waldur_core/quotas/fields.py", "copies": "1", "size": "11711", "license": "mit", "hash": -1403234775563532500, "line_mean": 37.9069767442, "line_max": 114, "alpha_frac": 0.6481086158, "autogenerated": false, "ratio": 4.176533523537803, "config_te...
from functools import reduce from django.db import models from crm.models import Company from products.models import Product INVOICE_TYPES = ( ('ci', 'Client'), ('si', 'Supplier'), ) INVOICE_STATES = ( ('draft', 'Draft'), ('open', 'Open'), ('paid', 'Paid'), ) class Invoice(models.Model): ...
{ "repo_name": "drf-forms/ember_sample", "path": "back/accounting/models.py", "copies": "1", "size": "1466", "license": "mit", "hash": -6216469767982337000, "line_mean": 24.7192982456, "line_max": 99, "alpha_frac": 0.636425648, "autogenerated": false, "ratio": 3.720812182741117, "config_test": f...
from functools import reduce from django.db.models import Q from django.http import Http404 from django.shortcuts import render from django.db import models # Create your views here. from django.http import Http404 from dcal.models import DimCalendar from django.views.generic import TemplateView, ListView # Create yo...
{ "repo_name": "gregn610/dimcal", "path": "src/dimcal/buildsql/views.py", "copies": "1", "size": "5155", "license": "unlicense", "hash": -8593790262031897000, "line_mean": 31.4213836478, "line_max": 100, "alpha_frac": 0.6031037827, "autogenerated": false, "ratio": 3.8759398496240602, "config_tes...
from functools import reduce from django.db.models import Q __all__ = [ 'Condition', 'AndCondition', 'OrCondition', 'LookupCondition', ] class Condition: def __init__(self, query, *args, **kwargs): self.query = query def annotate(self, queryset): """ Hook for conditions...
{ "repo_name": "mkonline/django-json-queries", "path": "django_json_queries/conditions.py", "copies": "1", "size": "3973", "license": "mit", "hash": 270628688784390370, "line_mean": 27.1773049645, "line_max": 79, "alpha_frac": 0.59023408, "autogenerated": false, "ratio": 4.304442036836403, "conf...
from functools import reduce from django.utils.safestring import mark_safe from django.utils.translation import ugettext from pyston.exception import RESTException from pyston.utils import rfs, LOOKUP_SEP from pyston.utils.helpers import get_field_or_none, get_method_or_none from pyston.serializer import get_resource...
{ "repo_name": "druids/django-pyston", "path": "pyston/order/managers.py", "copies": "1", "size": "10096", "license": "bsd-3-clause", "hash": -3902591484074683000, "line_mean": 48.0097087379, "line_max": 118, "alpha_frac": 0.6677892235, "autogenerated": false, "ratio": 4.527354260089686, "config...
from functools import reduce from domain.gameboardrelativepositionstateneuron import GameBoardRelativePositionStateNeuron from domain.direction import Direction from domain.neuron import Neuron from domain.position import Position from domain.sigmoidneuron import SigmoidNeuron from domain.synapse import Synapse clas...
{ "repo_name": "hesslink111/neuralnetworknibbles", "path": "domain/snakeneuralnet.py", "copies": "1", "size": "2950", "license": "mit", "hash": -3494377340332166000, "line_mean": 39.9722222222, "line_max": 119, "alpha_frac": 0.6071186441, "autogenerated": false, "ratio": 3.975741239892183, "conf...
from functools import reduce from ..function import Function class _DimReduceFunction(Function): def __init__(self, dim=None): super(_DimReduceFunction, self).__init__() self.dim = dim def forward(self, input): self.input_size = input.size() fn = getattr(input, self.fn_name)...
{ "repo_name": "RPGOne/Skynet", "path": "pytorch-master/torch/autograd/_functions/reduce.py", "copies": "1", "size": "7116", "license": "bsd-3-clause", "hash": -1041379393362069600, "line_mean": 32.2523364486, "line_max": 101, "alpha_frac": 0.5505902192, "autogenerated": false, "ratio": 3.76308831...
from functools import reduce from git_orm import transaction, GitError from git_orm.models.query import Q class ObjCache: def __init__(self, model): self.model = model self.cache = {} pks = transaction.current().list_blobs([model._meta.storage_name]) self.pks = set(map(model._meta...
{ "repo_name": "natano/python-git-orm", "path": "git_orm/models/queryset.py", "copies": "1", "size": "4081", "license": "isc", "hash": -7960725986496986000, "line_mean": 29.9166666667, "line_max": 79, "alpha_frac": 0.550845381, "autogenerated": false, "ratio": 3.9315992292870905, "config_test": ...
from functools import reduce from helpers.spec_helper import * from interfaces.expr import Bool from interfaces.spec import Spec n = 2 rs_array, r_array = [], [] gs_array, g_array = [], [] rm_s, rm = sig_prop('rm') gm_s, gm = sig_prop('gm') for i in range(n): rs, r = sig_prop('r_'+str(i)) gs, g = sig_prop(...
{ "repo_name": "5nizza/party-elli", "path": "experiments-for-synt/prioritized_arbiter_2.py", "copies": "1", "size": "1275", "license": "mit", "hash": -2886802942676356600, "line_mean": 16.4657534247, "line_max": 85, "alpha_frac": 0.5458823529, "autogenerated": false, "ratio": 2.634297520661157, ...
from functools import reduce from helpers.spec_helper import * from interfaces.expr import Bool from interfaces.spec import Spec n = 3 # rs_array, r_array = [], [] gs_array, g_array = [], [] for i in range(n): rs, r = sig_prop('r_'+str(i)) gs, g = sig_prop('g_'+str(i)) rs_array.append(rs) r_array.a...
{ "repo_name": "5nizza/party-elli", "path": "experiments-for-synt/postponed_arbiter_3.py", "copies": "1", "size": "1119", "license": "mit", "hash": -2262745207517796900, "line_mean": 23.8666666667, "line_max": 99, "alpha_frac": 0.5549597855, "autogenerated": false, "ratio": 2.632941176470588, "c...
from functools import reduce from helpers.spec_helper import * from interfaces.expr import Bool from interfaces.spec import Spec n = 3 rs_array, r_array = [], [] gs_array, g_array = [], [] rm_s, rm = sig_prop('rm') gm_s, gm = sig_prop('gm') for i in range(n): rs, r = sig_prop('r_'+str(i)) gs, g = sig_prop(...
{ "repo_name": "5nizza/party-elli", "path": "experiments-for-synt/prioritized_arbiter_3.py", "copies": "1", "size": "1275", "license": "mit", "hash": -2582711146591164000, "line_mean": 16.4657534247, "line_max": 85, "alpha_frac": 0.5458823529, "autogenerated": false, "ratio": 2.634297520661157, ...
from functools import reduce from helpers.spec_helper import * from interfaces.expr import Bool from interfaces.spec import Spec n = 4 # rs_array, r_array = [], [] gs_array, g_array = [], [] for i in range(n): rs, r = sig_prop('r_'+str(i)) gs, g = sig_prop('g_'+str(i)) rs_array.append(rs) r_array.a...
{ "repo_name": "5nizza/party-elli", "path": "experiments-for-synt/postponed_arbiter_4.py", "copies": "1", "size": "1119", "license": "mit", "hash": 7659840922421147000, "line_mean": 23.8666666667, "line_max": 99, "alpha_frac": 0.5549597855, "autogenerated": false, "ratio": 2.632941176470588, "co...
from functools import reduce from .homogeneous import Translation, UniformScale, Rotation, Affine, Homogeneous def transform_about_centre(obj, transform): r""" Return a Transform that implements transforming an object about its centre. The given object must be transformable and must implement a metho...
{ "repo_name": "patricksnape/menpo", "path": "menpo/transform/compositions.py", "copies": "2", "size": "4180", "license": "bsd-3-clause", "hash": 4948414588822811000, "line_mean": 33.8333333333, "line_max": 86, "alpha_frac": 0.6669856459, "autogenerated": false, "ratio": 4.278403275332651, "conf...
from functools import reduce from .homogeneous import (Translation, UniformScale, Rotation, Affine, Homogeneous) def transform_about_centre(obj, transform): r""" Return a Transform that implements transforming an object about its centre. The given object must be transformable an...
{ "repo_name": "yuxiang-zhou/menpo", "path": "menpo/transform/compositions.py", "copies": "4", "size": "4233", "license": "bsd-3-clause", "hash": 699174643305522400, "line_mean": 33.9834710744, "line_max": 81, "alpha_frac": 0.6586345382, "autogenerated": false, "ratio": 4.323799795709908, "confi...
from functools import reduce from lisp.environment import default, Env NIL = [] def procedure(params, body, env): """ User defined procedure. Uses lexical scoping (lookup names in the place it was defined). """ return lambda *args: evaluate_expression(body, Env(params, args, env)) def evalua...
{ "repo_name": "begor/lisp", "path": "lisp/evaluator.py", "copies": "1", "size": "5360", "license": "mit", "hash": 3426213915181929000, "line_mean": 26.6288659794, "line_max": 96, "alpha_frac": 0.5893656716, "autogenerated": false, "ratio": 4.088482074752098, "config_test": false, "has_no_keyw...
from functools import reduce from lispy.parser import List, Quotation, Number, Symbol from lispy.evaluator import evaluate, macro, ismacro def test_number(): value = evaluate(Number(123), {}) assert value == Number(123) def test_number_list(): value = evaluate(Quotation(List([Number(11), Number(22), Nu...
{ "repo_name": "yhlam/lispy", "path": "tests/test_evaluator.py", "copies": "1", "size": "2147", "license": "mit", "hash": -4133747809516157000, "line_mean": 26.1772151899, "line_max": 79, "alpha_frac": 0.4792734048, "autogenerated": false, "ratio": 4.193359375, "config_test": true, "has_no_key...
from functools import reduce from mission.constants.config import buoys as constants from mission.framework.combinators import Sequential, Concurrent, MasterConcurrent, Conditional from mission.framework.helpers import call_if_function, ConsistencyCheck, get_sub_position from mission.framework.movement import Heading...
{ "repo_name": "cuauv/software", "path": "mission/missions/old/2017/buoys.py", "copies": "1", "size": "41842", "license": "bsd-3-clause", "hash": -9004799887464110000, "line_mean": 36.6276978417, "line_max": 192, "alpha_frac": 0.544452942, "autogenerated": false, "ratio": 4.022495673908864, "con...
from functools import reduce from netCDF4 import Dataset from numpy import ndarray from numpy.ma import masked_array, masked_where from numpy.ma.core import is_masked from rasterio.dtypes import is_ndarray from ncdjango.geoprocessing import params from ncdjango.geoprocessing.data import Raster from ncdjango.geoproces...
{ "repo_name": "consbio/ncdjango", "path": "ncdjango/geoprocessing/tasks/raster.py", "copies": "1", "size": "6556", "license": "bsd-3-clause", "hash": -8171174457640008000, "line_mean": 36.0395480226, "line_max": 118, "alpha_frac": 0.6526845638, "autogenerated": false, "ratio": 4.310322156476003, ...
from functools import reduce from plisp import types from plisp import environment # Special forms class LambdaForm(types.Callable): def apply(self, args, call_env): if len(args) != 2 or type(args[0]) is not types.List: raise SyntaxError("lambda must be of form: lambda args expression") ...
{ "repo_name": "s0lder/plisp", "path": "plisp/builtins.py", "copies": "1", "size": "7136", "license": "mit", "hash": -2324792269042718700, "line_mean": 31.2895927602, "line_max": 106, "alpha_frac": 0.6091647982, "autogenerated": false, "ratio": 3.791710945802338, "config_test": false, "has_no_...
from functools import reduce from pyglet_gui.constants import HALIGN_CENTER, HALIGN_LEFT, HALIGN_RIGHT, \ VALIGN_TOP, VALIGN_CENTER, ANCHOR_CENTER, GetRelativePoint from pyglet_gui.core import Viewer, Rectangle class Spacer(Viewer): def __init__(self, min_width=0, min_height=0): Viewer.__init__(self...
{ "repo_name": "jorgecarleitao/pyglet-gui", "path": "pyglet_gui/containers.py", "copies": "1", "size": "13627", "license": "bsd-3-clause", "hash": 8314039891102288000, "line_mean": 30.7645687646, "line_max": 112, "alpha_frac": 0.5621927057, "autogenerated": false, "ratio": 4.118162586884255, "co...
from functools import reduce from pypokerengine.engine.card import Card import random class Deck: def __init__(self, deck_ids=None, cheat=False, cheat_card_ids=[]): self.cheat = cheat self.cheat_card_ids = cheat_card_ids self.deck = [Card.from_id(cid) for cid in deck_ids] if deck_ids else self.__setup(...
{ "repo_name": "sberbank-ai/holdem-challenge", "path": "PyPokerEngine/pypokerengine/engine/deck.py", "copies": "2", "size": "1305", "license": "mit", "hash": -9160316534048159000, "line_mean": 26.7659574468, "line_max": 87, "alpha_frac": 0.6636015326, "autogenerated": false, "ratio": 2.98627002288...
from functools import reduce from pypokerengine.engine.table import Table from pypokerengine.engine.player import Player from pypokerengine.engine.pay_info import PayInfo from pypokerengine.engine.poker_constants import PokerConstants as Const from pypokerengine.engine.action_checker import ActionChecker from pypokere...
{ "repo_name": "sberbank-ai/holdem-challenge", "path": "PyPokerEngine/pypokerengine/engine/round_manager.py", "copies": "1", "size": "9824", "license": "mit", "hash": -9215129100342321000, "line_mean": 41.5281385281, "line_max": 118, "alpha_frac": 0.6836319218, "autogenerated": false, "ratio": 3.3...
from functools import reduce from pypokerengine.engine.table import Table from pypokerengine.engine.seats import Seats from pypokerengine.engine.card import Card from pypokerengine.engine.deck import Deck from pypokerengine.engine.player import Player from pypokerengine.engine.pay_info import PayInfo from pypokerengin...
{ "repo_name": "ishikota/PyPokerEngine", "path": "pypokerengine/utils/game_state_utils.py", "copies": "2", "size": "6742", "license": "mit", "hash": -6288793233862788000, "line_mean": 43.0653594771, "line_max": 113, "alpha_frac": 0.6929694453, "autogenerated": false, "ratio": 3.369315342328836, ...
from functools import reduce from rest_framework.decorators import api_view from django.conf import settings from django.db.models import Q from .helpers import (PrettyJsonResponse, _create_page_token, _get_paginated_bookings, _parse_datetime, _return_json_bookings, _serial...
{ "repo_name": "uclapi/uclapi", "path": "backend/uclapi/roombookings/views.py", "copies": "1", "size": "8695", "license": "mit", "hash": -1820212846184739800, "line_mean": 33.2322834646, "line_max": 78, "alpha_frac": 0.6354226567, "autogenerated": false, "ratio": 3.7237687366167025, "config_test...
from functools import reduce from scitbx import matrix from scitbx.array_family import flex from dials.algorithms.refinement.parameterisation.model_parameters import ( ModelParameterisation, Parameter, ) from dials.algorithms.refinement.refinement_helpers import ( PanelGroupCompose, dR_from_axis_and_a...
{ "repo_name": "dials/dials", "path": "algorithms/refinement/parameterisation/detector_parameters.py", "copies": "1", "size": "43681", "license": "bsd-3-clause", "hash": -6781433291710114000, "line_mean": 37.1160558464, "line_max": 95, "alpha_frac": 0.5652343124, "autogenerated": false, "ratio": 3...
from functools import reduce from skyline_path.core import SkylineStatus from skyline_path.core.dominate import dominate_check from skyline_path.core.edge_helper import aggregate class SkyPath: """ Implement SkyPath Algorithm. composite with MultiAttributeGraph """ def __init__(self, mag): ...
{ "repo_name": "shadow3x3x3/renew-skyline-path-query", "path": "skyline_path/algorithms/sky_path.py", "copies": "1", "size": "3131", "license": "mit", "hash": 4500573737302058500, "line_mean": 35.8352941176, "line_max": 72, "alpha_frac": 0.5934206324, "autogenerated": false, "ratio": 3.74074074074...
from functools import reduce from Slices import Slice from theReader import TheReader class Brain: def __init__(self, configFile): self.reader = TheReader(configFile) self.reader.readConfiguration() self.slices = [] def searchMinOccurencesOfIngredient(self): numResult = reduce...
{ "repo_name": "ziliquas/PizzaHashCode", "path": "Logic.py", "copies": "1", "size": "4492", "license": "apache-2.0", "hash": 3854685415951473700, "line_mean": 37.724137931, "line_max": 146, "alpha_frac": 0.5256010686, "autogenerated": false, "ratio": 3.8360375747224595, "config_test": false, "...
from functools import reduce from sqlalchemy import and_ def rowdict(row): if row is None: return None return dict(row.items()) def rowdicts(rows): if rows is None: return None return [dict(r) for r in rows] def exec_fetchall(expr): return expr.execute().fetchall() def exec_...
{ "repo_name": "davvid/skeletor", "path": "skeletor/db/sql.py", "copies": "1", "size": "2973", "license": "bsd-3-clause", "hash": -2865598310043325400, "line_mean": 29.3367346939, "line_max": 76, "alpha_frac": 0.6781029263, "autogenerated": false, "ratio": 3.7776365946632784, "config_test": fals...
from functools import reduce from syntax import * from collections import namedtuple class NoRuleApplies(RuntimeError): pass # ------------------------ EVALUATION ------------------------ def isnumericval(term): t_term = type(term) if t_term is TmZero: return True elif t_term is TmSucc: ...
{ "repo_name": "habibutsu/tapl-py", "path": "recon/core.py", "copies": "1", "size": "6891", "license": "mit", "hash": -2543317977205793300, "line_mean": 26.2371541502, "line_max": 67, "alpha_frac": 0.5735016688, "autogenerated": false, "ratio": 3.145139205842081, "config_test": false, "has_no_...
from functools import reduce from tetre.rule_applier import * from tree_utils import find_in_spacynode, merge_nodes class Growth(RuleApplier): def __init__(self): """Implements all growth rules. Growth rules are the ones that increases the number of children that are right below the node of the w...
{ "repo_name": "aoldoni/tetre", "path": "lib/tetre/graph_processing.py", "copies": "1", "size": "21385", "license": "mit", "hash": -8382806804492293, "line_mean": 39.9367816092, "line_max": 119, "alpha_frac": 0.5767232907, "autogenerated": false, "ratio": 4.269530469530469, "config_test": false,...
from functools import reduce from typing import Tuple, Callable, Any, TypeVar, overload # noqa A = TypeVar("A") B = TypeVar("B") C = TypeVar("C") D = TypeVar("D") E = TypeVar("E") F = TypeVar("F") G = TypeVar("G") @overload def compose() -> Callable[[A], A]: # pylint: disable=function-redefined ... # pylint:...
{ "repo_name": "dbrattli/OSlash", "path": "oslash/util/fn.py", "copies": "1", "size": "2405", "license": "apache-2.0", "hash": -4851590875184598000, "line_mean": 24.8602150538, "line_max": 116, "alpha_frac": 0.6191268191, "autogenerated": false, "ratio": 3.202396804260985, "config_test": false, ...
from functools import reduce from typing import TypeVar, Callable, List, Tuple, Any T = TypeVar('T') def curry(x, args_count=None): """ In mathematics and computer science, currying is the technique of translating the evaluation of a function. It that takes multiple arguments (or a tuple of arguments) ...
{ "repo_name": "przemyslawjanpietrzak/pyMonet", "path": "pymonet/utils.py", "copies": "1", "size": "4461", "license": "mit", "hash": -5447081044837870000, "line_mean": 26.0363636364, "line_max": 111, "alpha_frac": 0.6565792423, "autogenerated": false, "ratio": 4.062841530054645, "config_test": f...
from functools import reduce from videocore.vinstr import * from videocore.encoding import Register # helper functions def print_with_indent(instr): print (' {}'.format(instr)) def print_with_attension(instr): print ('>>> {}'.format(instr)) # TODO: print labels # labels are not stored in asm._instructions, ...
{ "repo_name": "nineties/py-videocore", "path": "videocore/checker.py", "copies": "1", "size": "8613", "license": "mit", "hash": 1364999910554287900, "line_mean": 28.4965753425, "line_max": 165, "alpha_frac": 0.6353187043, "autogenerated": false, "ratio": 3.32035466461064, "config_test": false, ...
from functools import reduce from werkzeug.exceptions import NotFound from werkzeug.utils import redirect from .application import Page from .utils import unicodecmp class ServerList(Page): url_rule = "/" def order_link(self, name, title): cls = "" link = f"?order_by={name}" desc = ...
{ "repo_name": "pallets/werkzeug", "path": "examples/cupoftee/pages.py", "copies": "1", "size": "2202", "license": "bsd-3-clause", "hash": -3179701102525839400, "line_mean": 28.36, "line_max": 88, "alpha_frac": 0.5613079019, "autogenerated": false, "ratio": 3.8229166666666665, "config_test": fal...
from functools import reduce import asyncio_mongo from asyncio_mongo import _pymongo from asyncio_mongo import exceptions from asyncio_mongo import filter as qf from wdim.orm import sort from wdim.orm import query from wdim.orm import exceptions from wdim.orm.database.base import DatabaseLayer from wdim.orm.database....
{ "repo_name": "chrisseto/Still", "path": "wdim/orm/database/mongo.py", "copies": "1", "size": "3132", "license": "mit", "hash": -5461633035654963000, "line_mean": 33.8, "line_max": 122, "alpha_frac": 0.6270753512, "autogenerated": false, "ratio": 4.051746442432083, "config_test": false, "has_...
from functools import reduce import django_filters from django.db.models import Q from . import models class BuildingFilter(django_filters.FilterSet): class Meta: model = models.Building fields = [ 'campusonline', ] class FloorFilter(django_filters.FilterSet): class M...
{ "repo_name": "medunigraz/outpost", "path": "src/outpost/django/geo/filters.py", "copies": "2", "size": "1883", "license": "bsd-2-clause", "hash": -387461130281135360, "line_mean": 19.6923076923, "line_max": 60, "alpha_frac": 0.5677110993, "autogenerated": false, "ratio": 4.175166297117516, "co...
from functools import reduce import ee import math class ImageOperation(object): def __init__(self, image): super(ImageOperation, self).__init__() self.image = image self.input_band_names = image.bandNames() def select(self, name): return self.image.select(name) def set(...
{ "repo_name": "openforis/sepal", "path": "modules/google-earth-engine/docker/src/sepalinternal/image_operation.py", "copies": "1", "size": "2259", "license": "mit", "hash": 4669413418577869000, "line_mean": 30.8169014085, "line_max": 93, "alpha_frac": 0.5945108455, "autogenerated": false, "ratio"...
from functools import reduce import hail as hl from hail.expr.functions import _ndarray from hail.expr.functions import array as aarray from hail.expr.types import HailType, tfloat64, ttuple, tndarray from hail.typecheck import typecheck, nullable, oneof, tupleof, sequenceof from hail.expr.expressions import ( exp...
{ "repo_name": "danking/hail", "path": "hail/python/hail/nd/nd.py", "copies": "1", "size": "17209", "license": "mit", "hash": -2458475302368590000, "line_mean": 28.8732638889, "line_max": 134, "alpha_frac": 0.5916196897, "autogenerated": false, "ratio": 3.4304226475279105, "config_test": false, ...
from functools import reduce import numpy as np import numpy.core.umath as umath import numpy.core.fromnumeric as fromnumeric from numpy.testing import ( assert_, assert_raises, assert_equal, ) from numpy.ma import ( MaskType, MaskedArray, absolute, add, all, allclose, allequal, alltrue, arange, arccos...
{ "repo_name": "rgommers/numpy", "path": "numpy/ma/tests/test_old_ma.py", "copies": "10", "size": "32265", "license": "bsd-3-clause", "hash": -820715414340764300, "line_mean": 36.6048951049, "line_max": 81, "alpha_frac": 0.4760576476, "autogenerated": false, "ratio": 2.9023117747593776, "config_...
from functools import reduce import numpy as np import random import numpy as np from common.utils import binary, index_bits _AND = lambda a, b: a & b _XOR = lambda a, b: a ^ b def _gamma(cipher_query, cipher_index, cipher_one): """ Calculates the value of the gamma function, as described in PDF (para...
{ "repo_name": "blindstore/blindstore-old-scarab", "path": "server/store.py", "copies": "1", "size": "3439", "license": "mit", "hash": 8082321268612189000, "line_mean": 32.3980582524, "line_max": 79, "alpha_frac": 0.5958127363, "autogenerated": false, "ratio": 3.916856492027335, "config_test": f...
from functools import reduce import numpy import gem from finat.finiteelementbase import FiniteElementBase class TensorFiniteElement(FiniteElementBase): def __init__(self, element, shape, transpose=False): # TODO: Update docstring for arbitrary rank! r"""A Finite element whose basis functions ...
{ "repo_name": "FInAT/FInAT", "path": "finat/tensorfiniteelement.py", "copies": "1", "size": "4689", "license": "mit", "hash": 6153960399085693000, "line_mean": 36.512, "line_max": 147, "alpha_frac": 0.6142034549, "autogenerated": false, "ratio": 3.84344262295082, "config_test": false, "has_no...
from functools import reduce import os import magic from django.core.exceptions import ImproperlyConfigured from .settings import ( IMAGE_SETS, QUAL, VERSATILEIMAGEFIELD_POST_PROCESSOR, VERSATILEIMAGEFIELD_SIZED_DIRNAME, VERSATILEIMAGEFIELD_FILTERED_DIRNAME ) # PIL-supported file formats as foun...
{ "repo_name": "respondcreate/django-versatileimagefield", "path": "versatileimagefield/utils.py", "copies": "2", "size": "7238", "license": "mit", "hash": 8795258097111337000, "line_mean": 28.7860082305, "line_max": 83, "alpha_frac": 0.6007184305, "autogenerated": false, "ratio": 3.49661835748792...
from functools import reduce import pytest import requests from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.wait import WebDriverWait from sqlalchemy import text import xml.etree.ElementTree as ET from tests.conftest import TEST_PROXY_URL, TES...
{ "repo_name": "ebu/radiodns-plugit", "path": "tests/tests/test_channel_deletion.py", "copies": "1", "size": "4596", "license": "bsd-3-clause", "hash": -3467562439157245400, "line_mean": 58.6883116883, "line_max": 217, "alpha_frac": 0.6703655352, "autogenerated": false, "ratio": 2.9575289575289574...
from functools import reduce import pytest import requests import xml.etree.ElementTree as ET from selenium.webdriver.support.select import Select from sqlalchemy import text from tests.conftest import TEST_PROXY_URL, TEST_RADIO_DNS_URL from tests.test_channel_creation import CHANNELS_MSQL_QUERY from tests.utilities...
{ "repo_name": "ebu/radiodns-plugit", "path": "tests/tests/test_channel_edition.py", "copies": "1", "size": "5928", "license": "bsd-3-clause", "hash": -3110348555499969000, "line_mean": 62.0638297872, "line_max": 217, "alpha_frac": 0.6643049933, "autogenerated": false, "ratio": 2.89453125, "conf...
from functools import reduce import pytest from robot_server.service.json_api.errors import ErrorResponse def errors_wrapper(d): return {'errors': [d]} valid_error_objects = [ {'id': 'abc123'}, {'status': '404'}, {'title': 'Something went wrong'}, {'detail': "oh wow, there's a few things we me...
{ "repo_name": "OpenTrons/opentrons-api", "path": "robot-server/tests/service/json_api/test_errors.py", "copies": "2", "size": "1298", "license": "apache-2.0", "hash": 4259104373867266000, "line_mean": 27.8444444444, "line_max": 66, "alpha_frac": 0.6825885978, "autogenerated": false, "ratio": 3.51...
from functools import reduce import tensorflow as tf from tensorflow.contrib.layers import batch_norm from enum import Enum class Phase(Enum): train = 1 validation = 2 predict = 3 class Layer(Enum): token = 1 tag = 2 deprel = 3 feature = 4 class ParseModel: def __init__( ...
{ "repo_name": "danieldk/dpar", "path": "dpar-utils/tensorflow/model.py", "copies": "1", "size": "5346", "license": "apache-2.0", "hash": -7279705318816222000, "line_mean": 29.375, "line_max": 95, "alpha_frac": 0.5658436214, "autogenerated": false, "ratio": 3.810406272273699, "config_test": true...
from functools import reduce import time from pebble import ProcessPool from multiprocessing import cpu_count from os.path import isdir, join, abspath from glob import glob import h5py from datatypes.objects import Molecule, RISM from operators.charges.ambercharges import AmberCharges from operators.converters.select_...
{ "repo_name": "sergsb/clever", "path": "processing/core.py", "copies": "1", "size": "4255", "license": "apache-2.0", "hash": -1789431450703733800, "line_mean": 35.0593220339, "line_max": 98, "alpha_frac": 0.644653349, "autogenerated": false, "ratio": 3.4791496320523305, "config_test": false, ...
from functools import reduce import wx from vistas.core.observers.camera import CameraObservable from vistas.core.preferences import Preferences from vistas.ui.controllers.project import ProjectChangedEvent from vistas.ui.controls.viewer_panel import ViewerPanel from vistas.ui.events import EVT_CAMERA_MODE_CHANGED, E...
{ "repo_name": "VISTAS-IVES/pyvistas", "path": "source/vistas/ui/controls/viewer_container_panel.py", "copies": "1", "size": "7749", "license": "bsd-3-clause", "hash": -8581602621986710000, "line_mean": 34.7096774194, "line_max": 112, "alpha_frac": 0.5972383533, "autogenerated": false, "ratio": 3....
from functools import reduce class ConfigurationGenerator: def __init__(self): pass def _check_circle(self, function_list, device): in_degrees = [] for func in function_list: in_degrees.append(len(getattr(device, func).dependencies)) if 0 in in_degrees: ...
{ "repo_name": "ttaanngg/petal", "path": "app/generator.py", "copies": "1", "size": "4208", "license": "bsd-3-clause", "hash": 3498471126078858000, "line_mean": 42.0430107527, "line_max": 120, "alpha_frac": 0.4340329835, "autogenerated": false, "ratio": 4.130030959752322, "config_test": false, ...
from functools import reduce class ConfigurationGenerator: def __init__(self): pass def _check_circle(self, functions_list, device): in_degrees = [] for func in functions_list: in_degrees.append(len(getattr(device, func).dependencies)) if 0 in in_degrees: ...
{ "repo_name": "wenkaiqiu/petal", "path": "app/generator.py", "copies": "1", "size": "5049", "license": "bsd-3-clause", "hash": 7921616959501786000, "line_mean": 42.25, "line_max": 122, "alpha_frac": 0.4216394797, "autogenerated": false, "ratio": 4.153516295025729, "config_test": false, "has_n...
from functools import reduce class Counter: def __init__(self): self.success_count = 0 self.skip_count = 0 self.fail_count = 0 self.first_fail = None self.first_skip = None def success(self): self.success_count += 1 def skip(self, message): self.sk...
{ "repo_name": "jtauber/greek-inflection", "path": "utils.py", "copies": "1", "size": "1055", "license": "mit", "hash": -521518600355458600, "line_mean": 27.5135135135, "line_max": 109, "alpha_frac": 0.5800947867, "autogenerated": false, "ratio": 3.7279151943462896, "config_test": false, "has_...
from functools import reduce class IPv4Address(object): def __init__(self, addr): if isinstance(addr, IPv4Address): self._raw = addr._raw elif isinstance(addr, str): self._raw = ip_to_int(addr) elif isinstance(addr, int): self._raw = addr else: ...
{ "repo_name": "sourcesimian/vpn-porthole", "path": "vpnporthole/ip.py", "copies": "1", "size": "2728", "license": "mit", "hash": 6528199585641708000, "line_mean": 26.5555555556, "line_max": 98, "alpha_frac": 0.5201612903, "autogenerated": false, "ratio": 3.627659574468085, "config_test": false,...
from functools import reduce class Solution: def nextGreaterElement(self, n: int) -> int: nums = [int(d) for d in str(n)] # find the rightmost digit smaller than the next “534976” -> 9 i = len(nums) - 1 while i > 1: if nums[i - 1] < nums[i]: break ...
{ "repo_name": "l33tdaima/l33tdaima", "path": "p556m/next_greater_element.py", "copies": "1", "size": "1272", "license": "mit", "hash": -3162866208163780600, "line_mean": 28.2093023256, "line_max": 71, "alpha_frac": 0.4912420382, "autogenerated": false, "ratio": 3.0411622276029058, "config_test"...
from functools import reduce def _list_errors(e): """ Returns a list of violated schema fragments and related error messages :param e: ``jsonschema.exceptions.ValidationError`` instance """ error_list = [] for value, error in zip(e.validator_value, e.context): error_list.append((value,...
{ "repo_name": "openwisp/netconfig-gen", "path": "netjsonconfig/exceptions.py", "copies": "2", "size": "1209", "license": "mit", "hash": -5680948303670708000, "line_mean": 23.6734693878, "line_max": 74, "alpha_frac": 0.6112489661, "autogenerated": false, "ratio": 4.1833910034602075, "config_test...
from functools import reduce def normalize(aL): def touppercase(L): return L[0].upper() + L[1:].lower() return map(touppercase, aL) L = ['adam', 'LISA', 'barT'] print(list(normalize(L))) def prod(L): def star(x, y): return x * y return reduce(star, L) print('3 * 5 * 7 * 9 =', prod([...
{ "repo_name": "zhayangtao/HelloPython", "path": "python01/PythonFunction.py", "copies": "1", "size": "2986", "license": "apache-2.0", "hash": 427637658049744450, "line_mean": 16.1616766467, "line_max": 98, "alpha_frac": 0.5132588974, "autogenerated": false, "ratio": 2.5796579657965797, "config_...
from functools import reduce from numpy import uint16 from numpy import bool_ from query_result_list import QueryResultList from data_record import DataRecord from has_actions import HasActions from session import Session from filterable import Filterable from has_documents import HasDocuments from action import Ac...
{ "repo_name": "fire-uta/iiix-data-parser", "path": "query.py", "copies": "1", "size": "8645", "license": "mit", "hash": 3045347485768151600, "line_mean": 43.1071428571, "line_max": 177, "alpha_frac": 0.7101214575, "autogenerated": false, "ratio": 3.3533747090768036, "config_test": false, "has...
from functools import reduce # func 将函数名作为变量传入 def my_add(ax, bx, func): return func(ax) + func(bx) a, b = 5, -6 print(a, b, my_add(a, b, abs)) l1 = [1, 2, 3, 4, 5] def add(ax, bx): return ax + bx def sq(iax): return iax**2 # map函数入参为函数和Iterable, 出参是 Iterator,其中入参函数的参数列表为一个 # 作用为对Iterable逐个进行入参的函数处...
{ "repo_name": "lucd1990/self-learn-python", "path": "middle/higher_order_function.py", "copies": "1", "size": "1938", "license": "unlicense", "hash": 1176498263243161900, "line_mean": 19.3855421687, "line_max": 117, "alpha_frac": 0.5360520095, "autogenerated": false, "ratio": 1.9789473684210526, ...
from functools import reduce """ Noções básicas de programação funcional em Python Leitura complementar: http://nasemanadaprova.blogspot.com.br/2015/01/programacao-funcional-python.html List Comprehension: http://www.python-course.eu/list_comprehension.php Expressão lambda: http://blog.alienretro.com/entendendo-pytho...
{ "repo_name": "dev-lord/estruturas-dados-com-python3", "path": "aula03/basico-programacao-funcional.py", "copies": "1", "size": "1944", "license": "mit", "hash": 2990369443586176000, "line_mean": 34.9811320755, "line_max": 215, "alpha_frac": 0.7425275302, "autogenerated": false, "ratio": 2.648611...
from functools import reduce # Ref: MapReduce: Simplified Data Processing on Large Clusters (by Google) # map()函数接收两个参数,一个是函数,一个是Iterable,map将传入的函数依次作用到序列的每个元素,并把结果作为新的Iterator返回 # map()函数作为高阶函数,体现的式对运算规则抽象的设计思想 def func(x): return x ** 2 print(list(map(func, [1, 2, 3, 4, 5, 6]))) # reduce()函数接收两个参数,一个是函数,一个是...
{ "repo_name": "biztudio/JustPython", "path": "syntaxlab/src/play_map_reduce.py", "copies": "1", "size": "2294", "license": "mit", "hash": -6748798976663107000, "line_mean": 26.203125, "line_max": 118, "alpha_frac": 0.6201149425, "autogenerated": false, "ratio": 1.8471337579617835, "config_test"...