text
stringlengths
0
1.05M
meta
dict
from functools import reduce from math import factorial import click __doc__ = """See https://jtara1.github.io/bernoulli.html for an updated Bernoulli Trials Calc""" @click.command() @click.argument('trials', type=click.INT) @click.argument('prob_of_success', type=click.FLOAT) def bernoulli_trials(trials, prob_of_su...
{ "repo_name": "jtara1/MiscScripts", "path": "misc_scripts/bernoulli_trials.py", "copies": "1", "size": "1406", "license": "apache-2.0", "hash": -4447280046224225300, "line_mean": 32.4761904762, "line_max": 80, "alpha_frac": 0.5889046942, "autogenerated": false, "ratio": 3.6330749354005167, "con...
from functools import reduce from math import fmod from .. import Provider as SsnProvider def zfix(d): if d < 10: return "0" + str(d) else: return d class Provider(SsnProvider): def ssn(self, dob=None, gender=None): """ Generates Hungarian SSN equivalent (személyazonosít...
{ "repo_name": "joke2k/faker", "path": "faker/providers/ssn/hu_HU/__init__.py", "copies": "1", "size": "4300", "license": "mit", "hash": 5943084309570857000, "line_mean": 29.7769784173, "line_max": 112, "alpha_frac": 0.4513791491, "autogenerated": false, "ratio": 3.6879310344827587, "config_test...
from functools import reduce from math import frexp import psutil import time import os byte_names = 'KMGTPEZY' def bytes_for_humans(byte_count: int): # Get power of two directly from floating point exponent bits (mantissa) power_of_2 = frexp(byte_count)[1] - 1 binary_multiple = power_of_2 // 10 # If...
{ "repo_name": "JohnStarich/python-pool-performance", "path": "utils.py", "copies": "1", "size": "3481", "license": "mit", "hash": -805992299645185500, "line_mean": 29.2695652174, "line_max": 79, "alpha_frac": 0.6176386096, "autogenerated": false, "ratio": 3.6260416666666666, "config_test": fals...
from functools import reduce from math import sqrt, log from random import randint, getrandbits # from matplotlib import pyplot as plt from time import time __author__ = 'Roland' def product(l): rez = 1 for a in l: rez *= a return rez def lcm(l): return product(l) // reduce(gcd, l, max(l)) ...
{ "repo_name": "rolisz/hw3", "path": "Crypto/labs/l4/factorization.py", "copies": "1", "size": "2500", "license": "bsd-3-clause", "hash": 4584868555468568000, "line_mean": 21.9357798165, "line_max": 113, "alpha_frac": 0.4676, "autogenerated": false, "ratio": 3.1446540880503147, "config_test": fa...
from functools import reduce from .models import PublicationStatus from django_orghierarchy.models import Organization class UserModelPermissionMixin: """Permission mixin for user models A mixin class that provides permission check methods for user models. """ def is_admin(self, publisher): ...
{ "repo_name": "City-of-Helsinki/linkedevents", "path": "events/permissions.py", "copies": "1", "size": "2993", "license": "mit", "hash": 6197366422804372000, "line_mean": 44.3484848485, "line_max": 113, "alpha_frac": 0.6819244905, "autogenerated": false, "ratio": 4.493993993993994, "config_test...
from functools import reduce from mpi4py import MPI from itertools import islice from datetime import datetime as time import logging from collections import defaultdict from decomposer import Decomposer class MapReduce(object): def __init__(self, mapper, reducer, communicator=None, subsample=1, shuffler=None, p...
{ "repo_name": "UCL-dataspring/cluster-code", "path": "bluclobber/harness/mapreduce.py", "copies": "1", "size": "3829", "license": "mit", "hash": -6612310923042427000, "line_mean": 36.5392156863, "line_max": 111, "alpha_frac": 0.5917994254, "autogenerated": false, "ratio": 4.16195652173913, "con...
from functools import reduce from operator import add from fca.context import Context from fuzzy.fca.fuzzy_context import FuzzyContext ## Search result -> context def getContextFromSR(documents, terms, relation, maxKeywords): keywords = [x['keywords'][:maxKeywords] for x in documents] keywords = [[y[0] for y in x] ...
{ "repo_name": "havrlant/fca-search", "path": "src/fca_extension/utilities.py", "copies": "1", "size": "2154", "license": "bsd-2-clause", "hash": -9062217105849639000, "line_mean": 24.6547619048, "line_max": 88, "alpha_frac": 0.7028783658, "autogenerated": false, "ratio": 3.2537764350453173, "co...
from functools import reduce from operator import add from pygame.math import Vector2 as V2 import pygame as pg, os from src.display.tkinter_windows import create_menu from src.core import constants def init_display(): pg.init() info = pg.display.Info() dims = (int(info.current_w * 0.6), int(info.current...
{ "repo_name": "rschwa6308/Physics-2.0", "path": "Physics 2.0.py", "copies": "1", "size": "8393", "license": "mit", "hash": -6545692374609549000, "line_mean": 43.4074074074, "line_max": 126, "alpha_frac": 0.5721434529, "autogenerated": false, "ratio": 3.6270527225583407, "config_test": false, ...
from functools import reduce from operator import add import numpy as np import sym # Real-life example (ion speciation problem in water chemistry) _ref = np.array([37.252574322668998, 22.321937961124899, 10.9011158998744, 20.190422234652999, 27.8679190043357, 33.933606208922598, 33....
{ "repo_name": "bjodah/sym", "path": "benchmarks/benchmarks/Lambdify.py", "copies": "1", "size": "5088", "license": "bsd-2-clause", "hash": -104008510235055380, "line_mean": 36.6888888889, "line_max": 125, "alpha_frac": 0.5123820755, "autogenerated": false, "ratio": 2.4723032069970845, "config_t...
from functools import reduce from operator import add import re from typing import Any, List, Dict, Set, Tuple, Optional from werkzeug.datastructures import ImmutableOrderedMultiDict EMAIL_REGEX = r'^[^@^\s]+@[^@^\.^\s]+(\.[^@^\.^\s]+)+$' def get_validator(framework, content, answers): """ Retrieves a valid...
{ "repo_name": "alphagov/digitalmarketplace-supplier-frontend", "path": "app/main/helpers/validation.py", "copies": "1", "size": "14230", "license": "mit", "hash": 1957619954695075300, "line_mean": 40.2463768116, "line_max": 119, "alpha_frac": 0.628531272, "autogenerated": false, "ratio": 3.751647...
from functools import reduce from operator import add from strategies import condition, do_one, exhaust from ...core import Add, Expr, sympify from ...core.logic import _fuzzy_group from ...core.strategies import flatten, glom, rm_id, sort, unpack from ...functions import adjoint from ...utilities import default_sort...
{ "repo_name": "skirpichev/omg", "path": "diofant/matrices/expressions/matadd.py", "copies": "1", "size": "3262", "license": "bsd-3-clause", "hash": 5121473153398543000, "line_mean": 25.096, "line_max": 71, "alpha_frac": 0.5717351318, "autogenerated": false, "ratio": 3.4591728525980914, "config_...
from functools import reduce from operator import and_ from operator import or_ from django.db import models from django.db.models import Q __all__ = [ 'LookupManager', 'LookupManagerMixin', 'OrderedSearchManager', 'OrderedSearchManagerMixin', 'SearchManager', 'SearchManagerMixin', ] class ...
{ "repo_name": "jleeothon/inquisition", "path": "inquisition/managers.py", "copies": "1", "size": "2489", "license": "mit", "hash": 8629245437145161000, "line_mean": 28.9879518072, "line_max": 78, "alpha_frac": 0.6508638007, "autogenerated": false, "ratio": 4.1072607260726075, "config_test": fal...
from functools import reduce from operator import and_, or_ from common.funcfun import lmap from retrieval.boolean_parser import Node import shelve from other.constants import INDEX_FOLDER_NAME, DOCUMENT_INFO_NAME, INFO_FOLDER_NAME, STEMSDICT_NAME,\ KEYWORDSINDOCUMENTS_NAME, SCORES_TABLE from retrieval.stem import Ste...
{ "repo_name": "havrlant/fca-search", "path": "src/retrieval/index.py", "copies": "1", "size": "3978", "license": "bsd-2-clause", "hash": -1280858361503991600, "line_mean": 27.4214285714, "line_max": 101, "alpha_frac": 0.7099044746, "autogenerated": false, "ratio": 3.0647149460708785, "config_te...
from functools import reduce from operator import getitem from inspect import getdoc from werkzeug.exceptions import NotFound from yggdrasil.record import Record from . import Page class Root(Page): def __init__(self, urlmap): self.urlmap = urlmap def render_rule(self, request, rule): resul...
{ "repo_name": "Evgenus/yggdrasil", "path": "yggdrasil/app/pages/root.py", "copies": "1", "size": "1356", "license": "mit", "hash": -106253939665195860, "line_mean": 24.6037735849, "line_max": 78, "alpha_frac": 0.6091445428, "autogenerated": false, "ratio": 4.490066225165563, "config_test": fals...
from functools import reduce from operator import getitem from typing import Any, Callable, Sequence, Tuple from basic_utils.seq_helpers import butlast, last __all__ = [ 'get_in_dict', 'get_keys', 'prune_dict', 'set_in_dict', ] def get_keys(d: dict, keys: Sequence[Any], default: Callable=None) -> Tu...
{ "repo_name": "Jackevansevo/basic-utils", "path": "basic_utils/dict_helpers.py", "copies": "1", "size": "1903", "license": "mit", "hash": 4739013772402712000, "line_mean": 23.0886075949, "line_max": 76, "alpha_frac": 0.5496584341, "autogenerated": false, "ratio": 3.0792880258899675, "config_tes...
from functools import reduce from operator import getitem from werkzeug.exceptions import HTTPException, NotFound from werkzeug.wrappers import Request from werkzeug import routing from yggdrasil.record import Record class WebApp: def __init__(self, urlmap, namespace): self.urlmap = urlmap self.n...
{ "repo_name": "Evgenus/yggdrasil", "path": "yggdrasil/app/__init__.py", "copies": "1", "size": "1753", "license": "mit", "hash": -3152881796342467000, "line_mean": 28.7118644068, "line_max": 62, "alpha_frac": 0.6240730177, "autogenerated": false, "ratio": 4.3606965174129355, "config_test": fals...
from functools import reduce from operator import iand, ior from string import punctuation import django from django.apps import apps from django.contrib.sites.managers import CurrentSiteManager as DjangoCSM from django.core.exceptions import ImproperlyConfigured from django.db.models import CharField, Manager, Q, Tex...
{ "repo_name": "stephenmcd/mezzanine", "path": "mezzanine/core/managers.py", "copies": "2", "size": "17672", "license": "bsd-2-clause", "hash": -1636184606120646400, "line_mean": 38.7123595506, "line_max": 88, "alpha_frac": 0.5766183794, "autogenerated": false, "ratio": 4.552292632663575, "confi...
from functools import reduce from operator import ior from dal import autocomplete from django.contrib.auth.decorators import user_passes_test from django.http.response import JsonResponse from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.views.generic import ListVi...
{ "repo_name": "bwhicks/PlinyProject", "path": "backend/prosopography/views.py", "copies": "1", "size": "5725", "license": "mit", "hash": 8519941288550193000, "line_mean": 34.5590062112, "line_max": 81, "alpha_frac": 0.5322270742, "autogenerated": false, "ratio": 4.310993975903615, "config_test"...
from functools import reduce from operator import itemgetter from pprint import pformat from six import viewkeys, iteritems from six.moves import map, zip from toolz import curry, flip from .sentinel import sentinel @curry def apply(f, *args, **kwargs): """Apply a function to arguments. Parameters ----...
{ "repo_name": "quantopian/zipline", "path": "zipline/utils/functional.py", "copies": "1", "size": "10260", "license": "apache-2.0", "hash": -5660203899356712000, "line_mean": 23.4285714286, "line_max": 79, "alpha_frac": 0.5478557505, "autogenerated": false, "ratio": 3.9085714285714284, "config_...
from functools import reduce from operator import mul from itertools import combinations_with_replacement def lcg(): """Linear Congruential Generator.""" TWO_POW_20 = reduce(mul, (2 for _ in range(20))) t = 0 while True: t = 615949*t + 797807 t %= TWO_POW_20 yield t - TWO_POW_20...
{ "repo_name": "peterstace/project-euler", "path": "OLD_PY_CODE/project_euler_old_old/150/150.py", "copies": "1", "size": "1967", "license": "unlicense", "hash": 7294832828322204000, "line_mean": 22.987804878, "line_max": 80, "alpha_frac": 0.5566853076, "autogenerated": false, "ratio": 3.112341772...
from functools import reduce from operator import mul from quantecon import cartesian import numpy as np from numpy import zeros from typing import TypeVar, Generic, Dict T = TypeVar("T") S = TypeVar("S") def prod(l): return reduce(mul, l, 1.0) from dolo.numeric.misc import mlinspace class Grid: def __m...
{ "repo_name": "EconForge/dolo", "path": "dolo/numeric/grids.py", "copies": "1", "size": "5197", "license": "bsd-2-clause", "hash": 7666026254038726000, "line_mean": 21.3004291845, "line_max": 84, "alpha_frac": 0.577752117, "autogenerated": false, "ratio": 3.1936078672403196, "config_test": fals...
from functools import reduce from operator import mul import time start_time = time.time() n = 100000 def factorization(n): """ Generate the prime factorization of n in the form of pairs (p, k) where the prime p appears k times in the factorization. """ p = 1 while p * p < n: p += 1 ...
{ "repo_name": "GodMode-On/Tasks-from-different-sites", "path": "Hackerrank/Project Euler #95: Amicable chains.py", "copies": "1", "size": "1969", "license": "unlicense", "hash": 4910177555205934000, "line_mean": 24.5714285714, "line_max": 76, "alpha_frac": 0.4520060945, "autogenerated": false, "r...
from functools import reduce from operator import mul __author__ = 'anuvrat' ''' Exceeds time limit ''' class Memoize(object): def __init__(self, f): self.f = f self.cache = {} def __call__(self, *args): if args not in self.cache: self.cache[args] = self.f(*args) ...
{ "repo_name": "anuvrat/spoj", "path": "problems/tutorial/000074_divsum.py", "copies": "1", "size": "1779", "license": "mit", "hash": -6486141029699924000, "line_mean": 24.0563380282, "line_max": 126, "alpha_frac": 0.5182686903, "autogenerated": false, "ratio": 2.906862745098039, "config_test": ...
from functools import reduce from operator import mul from lasagne.layers import Layer from lasagne.layers import Conv2DLayer from lasagne.layers import MaxPool2DLayer import numpy as np from tabulate import tabulate convlayers = [Conv2DLayer] maxpoollayers = [MaxPool2DLayer] try: from lasagne.layers.cuda_convnet...
{ "repo_name": "scottlittle/nolearn", "path": "nolearn/lasagne/util.py", "copies": "5", "size": "5836", "license": "mit", "hash": -1914668629933426400, "line_mean": 32.1590909091, "line_max": 98, "alpha_frac": 0.6038382454, "autogenerated": false, "ratio": 3.4168618266978923, "config_test": fals...
from functools import reduce from operator import mul, rshift from ..concrete.list import List from ..utils.decorators import annotate from .monoid import mappend from .pure import identity __all__ = ('fmap', 'unit', 'lift', 'multiapply', 'multibind', 'cons', 'mcons', 'sequence', 'mapM') @annotate(type="...
{ "repo_name": "justanr/pynads", "path": "pynads/funcs/lifted.py", "copies": "1", "size": "3140", "license": "mit", "hash": 2326675607620457500, "line_mean": 28.0740740741, "line_max": 77, "alpha_frac": 0.5961783439, "autogenerated": false, "ratio": 3.250517598343685, "config_test": false, "ha...
from functools import reduce from operator import not_ from typing import Any, Callable, Iterator __all__ = [ 'comp', 'complement', 'compose', 'dec', 'even', 'identity', 'inc', 'natural_nums', 'odd', ] sentinel = object() def natural_nums(start: int=0, end: int=None) -> Iterator[...
{ "repo_name": "Jackevansevo/basic-utils", "path": "basic_utils/primitives.py", "copies": "1", "size": "1743", "license": "mit", "hash": -521563974577361400, "line_mean": 15.1388888889, "line_max": 76, "alpha_frac": 0.53643144, "autogenerated": false, "ratio": 3.486, "config_test": false, "has...
from functools import reduce from operator import or_, add from typing import List, Union, Iterable, TypeVar from django.contrib.postgres.search import TrigramSimilarity from django.db import models from django.db.models import Q, F, When, Case, Value, BooleanField from django.shortcuts import _get_queryset # generic...
{ "repo_name": "fidals/refarm-site", "path": "search/search.py", "copies": "1", "size": "4742", "license": "mit", "hash": -8247908616544271000, "line_mean": 31.2585034014, "line_max": 91, "alpha_frac": 0.6140868832, "autogenerated": false, "ratio": 3.941812136325852, "config_test": false, "has...
from functools import reduce from operator import or_ import random import sc2 from sc2 import Race, Difficulty from sc2.constants import * from sc2.player import Bot, Computer from sc2.data import race_townhalls import enum class BroodlordBot(sc2.BotAI): def select_target(self): if self.known_enemy_stru...
{ "repo_name": "Dentosal/python-sc2", "path": "examples/zerg/onebase_broodlord.py", "copies": "1", "size": "4717", "license": "mit", "hash": 2135451834562277600, "line_mean": 38.9745762712, "line_max": 98, "alpha_frac": 0.6039855841, "autogenerated": false, "ratio": 3.420594633792603, "config_te...
from functools import reduce from operator import or_ from chamber.shortcuts import get_object_or_none from django.utils.translation import ugettext from django.db.models.query import QuerySet from django.db.models import Q from django.db.models.expressions import OrderBy from django.utils.translation import ugettext...
{ "repo_name": "druids/django-pyston", "path": "pyston/paginator.py", "copies": "1", "size": "8554", "license": "bsd-3-clause", "hash": 3477494264881346000, "line_mean": 33.6356275304, "line_max": 115, "alpha_frac": 0.5713116671, "autogenerated": false, "ratio": 4.063657957244655, "config_test":...
from functools import reduce from operator import or_ from django.db.models import Q from django.conf import settings from django.contrib.auth.models import User from django.http import JsonResponse from cities_light.models import City, Country, Region from dal import autocomplete from pytz import country_timezones ...
{ "repo_name": "mozilla/mozillians", "path": "mozillians/users/views.py", "copies": "2", "size": "9979", "license": "bsd-3-clause", "hash": -1560303883583743200, "line_mean": 32.7128378378, "line_max": 98, "alpha_frac": 0.5949493937, "autogenerated": false, "ratio": 4.0614570614570615, "config_t...
from functools import reduce from operator import or_ from django.db.models import Q from django.http import JsonResponse from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils.html import escape from django.views import View from tagging.models import Tag from account.models...
{ "repo_name": "ultmaster/eoj3", "path": "home/search_api.py", "copies": "1", "size": "4625", "license": "mit", "hash": 1188256850368374500, "line_mean": 32.5144927536, "line_max": 111, "alpha_frac": 0.6534054054, "autogenerated": false, "ratio": 3.370991253644315, "config_test": true, "has_no...
from functools import reduce from operator import xor from docutils import nodes from semantic_version import Version as StrictVersion, Spec import six class Version(StrictVersion): """ Version subclass toggling ``partial=True`` by default. """ def __init__(self, version_string, partial=True): ...
{ "repo_name": "bitprophet/releases", "path": "releases/models.py", "copies": "1", "size": "7419", "license": "bsd-2-clause", "hash": -5430787993442334000, "line_mean": 35.7277227723, "line_max": 79, "alpha_frac": 0.5888933819, "autogenerated": false, "ratio": 4.30586186883343, "config_test": fa...
from functools import reduce from optparse import make_option from dateutil.relativedelta import relativedelta from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError from django.db.models import Q from django.utils import timezone from timepiece import utils fro...
{ "repo_name": "caktus/django-timepiece", "path": "timepiece/management/commands/check_entries.py", "copies": "1", "size": "8286", "license": "mit", "hash": -1305716946856635000, "line_mean": 38.4571428571, "line_max": 82, "alpha_frac": 0.5300506879, "autogenerated": false, "ratio": 4.361052631578...
from functools import reduce from optparse import OptionParser, make_option from dateutil.relativedelta import relativedelta from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError from django.db.models import Q from django.utils import timezone from timepiece im...
{ "repo_name": "BocuStudio/django-timepiece", "path": "timepiece/management/commands/check_entries.py", "copies": "2", "size": "9169", "license": "mit", "hash": 8698935303657345000, "line_mean": 38.3519313305, "line_max": 82, "alpha_frac": 0.5172865089, "autogenerated": false, "ratio": 4.457462323...
from functools import reduce from os import path from collections import Mapping, MutableSequence import keyword import logging import yaml import numpy as np from pkg_resources import resource_filename from .. import geometry as geom from .validator import Validator class FrozenJSON(object): """A facade for na...
{ "repo_name": "jinhyunglee/yass", "path": "src/yass/config/config.py", "copies": "1", "size": "7292", "license": "apache-2.0", "hash": -760875185414757900, "line_mean": 34.3980582524, "line_max": 108, "alpha_frac": 0.5555403182, "autogenerated": false, "ratio": 4.264327485380117, "config_test":...
from functools import reduce from os import system from os.path import exists import requests from xlrd import open_workbook from django.conf import settings from django.db.models import Q from django.db.utils import IntegrityError from django.core.management.base import BaseCommand, CommandError from hospitals.model...
{ "repo_name": "syndbg/django-bulstrad", "path": "hospitals/management/commands/ingest.py", "copies": "1", "size": "9093", "license": "mit", "hash": -4684034911744370000, "line_mean": 41.7783018868, "line_max": 104, "alpha_frac": 0.576469291, "autogenerated": false, "ratio": 3.5803395183576785, ...
from functools import reduce from pprint import pformat from six import viewkeys from six.moves import map, zip from toolz import curry, flip from .sentinel import sentinel @curry def apply(f, *args, **kwargs): """Apply a function to arguments. Parameters ---------- f : callable The functio...
{ "repo_name": "florentchandelier/zipline", "path": "zipline/utils/functional.py", "copies": "2", "size": "9650", "license": "apache-2.0", "hash": -8733192931981522000, "line_mean": 23.6173469388, "line_max": 79, "alpha_frac": 0.552746114, "autogenerated": false, "ratio": 3.958162428219852, "con...
from functools import reduce from pprint import pformat from six import viewkeys from six.moves import map, zip from toolz import curry, flip @curry def apply(f, *args, **kwargs): """Apply a function to arguments. Parameters ---------- f : callable The function to call. *args, **kwargs ...
{ "repo_name": "magne-max/zipline-ja", "path": "zipline/utils/functional.py", "copies": "1", "size": "9663", "license": "apache-2.0", "hash": 4142193595594846000, "line_mean": 23.6505102041, "line_max": 79, "alpha_frac": 0.5532443341, "autogenerated": false, "ratio": 3.957002457002457, "config_t...
from functools import reduce from pymongo import MongoClient import osm_address __author__ = 'tmshv' """ Populate documents with OSM_ID by matching document address & osm_features.tsv """ mongo = MongoClient() db = mongo['k2'] osm_dict = osm_address.get_streets_dict() def find_osm_id(doc): street, n = doc['a...
{ "repo_name": "tmshv/k2", "path": "Tools/db_populate_with_osm_id.py", "copies": "1", "size": "1210", "license": "mit", "hash": -999569642497826600, "line_mean": 18.7049180328, "line_max": 78, "alpha_frac": 0.5765391015, "autogenerated": false, "ratio": 2.9826302729528535, "config_test": false, ...
from functools import reduce from pymongo import MongoClient import re __author__ = 'tmshv' """ Correct 'address' field """ mongo = MongoClient() db = mongo['k2'] rules = [ [{'function': {'$exists': False}}, {'function': 'unknown'}], [{'function': 'unknown', 'name': re.compile('[Дд]етский сад')}, {'functi...
{ "repo_name": "tmshv/k2", "path": "Tools/db_set_functions_by_name.py", "copies": "1", "size": "2997", "license": "mit", "hash": -7833306507029489000, "line_mean": 44.8928571429, "line_max": 111, "alpha_frac": 0.5887159533, "autogenerated": false, "ratio": 2.4735322425409048, "config_test": fals...
from functools import reduce from pymongo import MongoClient __author__ = 'tmshv' """ Correct 'address' field """ mongo = MongoClient() db = mongo['k2'] BSON_ARRAY = 4 fix_rules_street = [ ['Обводного набережная канала', 'Набережная Обводного канала'], ['проспект Большой ПС', 'Большой проспект П.С.'], ...
{ "repo_name": "tmshv/k2", "path": "Tools/db_fix_address.py", "copies": "1", "size": "1769", "license": "mit", "hash": -86851717822465780, "line_mean": 24.8181818182, "line_max": 108, "alpha_frac": 0.5757575758, "autogenerated": false, "ratio": 1.780426599749059, "config_test": false, "has_no_...
from functools import reduce from pymongo import MongoClient __author__ = 'tmshv' """ Correct 'years' field. Transform '1911-1951, 1953' -> [[1911, 1951], [1953]] """ def periods(raw): """ Transform '1911-1951, 1953' -> [[1911, 1951], [1953]] :param raw: string like '1911-1951, 1953' :return: list ...
{ "repo_name": "tmshv/k2", "path": "Tools/db_fix_years.py", "copies": "1", "size": "1123", "license": "mit", "hash": -9209754699105101000, "line_mean": 20.1886792453, "line_max": 74, "alpha_frac": 0.589492431, "autogenerated": false, "ratio": 3.110803324099723, "config_test": false, "has_no_ke...
from functools import reduce from pyquantum.qgate import QGate, X, I, P0, P1 import numpy as np # Used by QuantumCircuit to handle gates controlled by gates on a position # lower than index class ControlledQGate(QGate): # Creates a new quantum gate on a given index of some column of a # quantum circuit de...
{ "repo_name": "miguelfrde/pyquantum", "path": "pyquantum/qcircuit.py", "copies": "1", "size": "4393", "license": "mit", "hash": 7779948624816765000, "line_mean": 36.8706896552, "line_max": 95, "alpha_frac": 0.5920783064, "autogenerated": false, "ratio": 3.6008196721311476, "config_test": false,...
from functools import reduce from ..Qt import QtGui, QtCore, isQObjectAlive from ..GraphicsScene import GraphicsScene from ..Point import Point from .. import functions as fn import weakref import operator from ..util.lru_cache import LRUCache class GraphicsItem(object): """ **Bases:** :class:`object` Ab...
{ "repo_name": "campagnola/acq4", "path": "acq4/pyqtgraph/graphicsItems/GraphicsItem.py", "copies": "3", "size": "23411", "license": "mit", "hash": -1551532586221088000, "line_mean": 39.1560891938, "line_max": 851, "alpha_frac": 0.5837426851, "autogenerated": false, "ratio": 4.32415958625785, "c...
from functools import reduce from random import random, shuffle class cwr2gb_Negotiator: # 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...
{ "repo_name": "cwr2gb/HW3-A.I.", "path": "cwr2gb.py", "copies": "1", "size": "3819", "license": "mit", "hash": -2964479585382716000, "line_mean": 41.4333333333, "line_max": 169, "alpha_frac": 0.609321812, "autogenerated": false, "ratio": 4.252783964365256, "config_test": false, "has_no_keywor...
from functools import reduce from random import random, shuffle class first_Negotiator: # 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 ...
{ "repo_name": "cwr2gb/HW3-A.I.", "path": "firstnegotiator.py", "copies": "1", "size": "2292", "license": "mit", "hash": 4841623173041521000, "line_mean": 43.9607843137, "line_max": 169, "alpha_frac": 0.6518324607, "autogenerated": false, "ratio": 4.182481751824818, "config_test": false, "has_...
from functools import reduce from random import sample from django.core.cache import cache from django.db.models import Q from django.db.models.aggregates import Count from kolibri.content import models, serializers from kolibri.content.content_db_router import get_active_content_database from kolibri.logger.models im...
{ "repo_name": "jayoshih/kolibri", "path": "kolibri/content/api.py", "copies": "1", "size": "8360", "license": "mit", "hash": 2838202764874714600, "line_mean": 41.8717948718, "line_max": 140, "alpha_frac": 0.6557416268, "autogenerated": false, "ratio": 4.17373939091363, "config_test": false, "...
from functools import reduce from random import sample from django.db.models import Q from kolibri.content import models, serializers from rest_framework import filters, pagination, viewsets from .utils.search import fuzz class ChannelMetadataCacheViewSet(viewsets.ModelViewSet): serializer_class = serializers.Ch...
{ "repo_name": "66eli77/kolibri", "path": "kolibri/content/api.py", "copies": "2", "size": "3267", "license": "mit", "hash": -3450518716482969600, "line_mean": 40.3544303797, "line_max": 140, "alpha_frac": 0.7101316192, "autogenerated": false, "ratio": 4.063432835820896, "config_test": false, ...
from functools import reduce from rlib.unroll import unrolling_iterable from som.interp_type import is_ast_interpreter, is_bytecode_interpreter """Captures the known primitives at load time of this module, i.e., at compile time with RPython. """ EXPECTED_NUMBER_OF_PRIMITIVE_FILES = 13 class PrimitivesNotFound(E...
{ "repo_name": "SOM-st/PySOM", "path": "src/som/primitives/known.py", "copies": "2", "size": "2509", "license": "mit", "hash": 6195368320483205000, "line_mean": 26.8777777778, "line_max": 84, "alpha_frac": 0.6301315265, "autogenerated": false, "ratio": 3.695139911634757, "config_test": false, ...
from functools import reduce from SDWLE.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 class Tr...
{ "repo_name": "jomyhuang/sdwle", "path": "SDWLE/agents/trade/trade.py", "copies": "1", "size": "7723", "license": "mit", "hash": -4452775827157405000, "line_mean": 28.7038461538, "line_max": 78, "alpha_frac": 0.5527644698, "autogenerated": false, "ratio": 3.4945701357466064, "config_test": fals...
from functools import reduce from stango.views import file_from_tar, static_file import collections import os import tarfile FilespecBase = collections.namedtuple('Filespec', 'path view kwargs') class Filespec(FilespecBase): def __new__(cls, path, view, kwargs={}): if not isinstance(path, str): ...
{ "repo_name": "akheron/stango", "path": "stango/files.py", "copies": "1", "size": "3894", "license": "mit", "hash": 7348075467001293000, "line_mean": 27.4233576642, "line_max": 86, "alpha_frac": 0.5469953775, "autogenerated": false, "ratio": 4.146964856230032, "config_test": false, "has_no_ke...
from functools import reduce from sys import intern __author__ = 'Aaron Hosford' __all__ = [ 'Property', 'Category', ] class Property: def __init__(self, name): if isinstance(name, Property): self._name = name._name self._hash = name._hash else: self....
{ "repo_name": "hosford42/pyramids", "path": "pyramids/categorization.py", "copies": "1", "size": "8391", "license": "mit", "hash": 6518556732465800000, "line_mean": 32.0354330709, "line_max": 74, "alpha_frac": 0.555714456, "autogenerated": false, "ratio": 4.729988726042841, "config_test": false...
from functools import reduce from sys import intern __author__ = 'Aaron Hosford' __all__ = [ 'Tokenizer', 'StandardTokenizer', 'tokenize', 'TokenSequence', ] class Tokenizer: def tokenize(self, text): raise NotImplementedError() class StandardTokenizer(Tokenizer): def __init__(se...
{ "repo_name": "hosford42/pyramids", "path": "pyramids/tokenization.py", "copies": "1", "size": "5603", "license": "mit", "hash": 4946316912973830000, "line_mean": 30.4775280899, "line_max": 75, "alpha_frac": 0.4709976798, "autogenerated": false, "ratio": 4.453895071542131, "config_test": false,...
# from functools import reduce from time import time def get_dict_squares(n): ''' Función para obtener diccionario con la suma de los cuadrados de los dígitos de cada número en el rango especificado. ''' # Lo más rápido res = {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 6...
{ "repo_name": "floppp/programming_challenges", "path": "project_euler/051-100/92.py", "copies": "1", "size": "2442", "license": "mit", "hash": -3752411034492624400, "line_mean": 25.6373626374, "line_max": 66, "alpha_frac": 0.5688943894, "autogenerated": false, "ratio": 2.8023121387283236, "conf...
from functools import reduce from typing import Iterable import dask import dask.array from dask.delayed import Delayed from rechunker.types import ( MultiStagePipeline, ParallelPipelines, PipelineExecutor, Stage, ) class DaskPipelineExecutor(PipelineExecutor[Delayed]): """An execution engine ba...
{ "repo_name": "pangeo-data/rechunker", "path": "rechunker/executors/dask.py", "copies": "1", "size": "3001", "license": "mit", "hash": 3786606171733185500, "line_mean": 28.1359223301, "line_max": 90, "alpha_frac": 0.6437854049, "autogenerated": false, "ratio": 3.2619565217391306, "config_test":...
from functools import reduce from typing import TYPE_CHECKING, Dict, List, Sequence, Tuple, Union from django.db.models import CharField, Q, Value from django.db.models.functions import Concat if TYPE_CHECKING: from django.db.models import QuerySet class SearchQuerySetMixin: """Mixin to add a searches metho...
{ "repo_name": "marcosgabarda/django-belt", "path": "belt/managers.py", "copies": "1", "size": "1700", "license": "mit", "hash": -4878625203462672000, "line_mean": 36.7777777778, "line_max": 100, "alpha_frac": 0.5782352941, "autogenerated": false, "ratio": 4.485488126649076, "config_test": false...
from functools import reduce from urllib.parse import urlparse import time def timeit(method): def timed(*args, **kw): ts = time.time() result = method(*args, **kw) te = time.time() print('Time: %2.2f sec, function: %r, args: (%r, %r).' % (te - ts, method.__name__, args, kw)) ...
{ "repo_name": "max-andr/deepanswer", "path": "src/utils.py", "copies": "1", "size": "1204", "license": "apache-2.0", "hash": -8963181303209944000, "line_mean": 24.6170212766, "line_max": 102, "alpha_frac": 0.5938538206, "autogenerated": false, "ratio": 3.2717391304347827, "config_test": false, ...
from functools import reduce from utils import convert_kwarg, format_expression, random_expression import random from sympy import * def addition(digits=2, values=2): digits = convert_kwarg(digits, int) values = convert_kwarg(values, int) sym_vars = [''.join(['_', str(i)]) for i in range(0, values)] s...
{ "repo_name": "tutorgen/problem_generator", "path": "problems/algebra_1/arithmetic.py", "copies": "1", "size": "3519", "license": "bsd-3-clause", "hash": -1254942571230841300, "line_mean": 29.6, "line_max": 82, "alpha_frac": 0.6362603012, "autogenerated": false, "ratio": 3.439882697947214, "con...
from functools import reduce from utils import convert_kwarg, format_expression, random_expression, random_tens_int import random from sympy import * # def solving_equations_with_the_distributive_property_and_by_combining_like_terms(): # pass # def solving_two_step_equations_simple_values(): # pass # def w...
{ "repo_name": "tutorgen/problem_generator", "path": "problems/algebra_1/solving_multi_step_equations.py", "copies": "1", "size": "2931", "license": "bsd-3-clause", "hash": -64056196011978580, "line_mean": 20.0863309353, "line_max": 86, "alpha_frac": 0.6680313886, "autogenerated": false, "ratio": ...
from functools import reduce from utils import convert_kwarg import random from sympy import * # def dividing_polynomials_iii(): # pass def polynomials_in_standard_form(): terms = [str(random.randint(0, 10)) for x in range(0, 4)] terms[0] = ''.join([terms[0], 'x^3']) terms[1] = ''.join([terms[1], 'x...
{ "repo_name": "tutorgen/problem_generator", "path": "problems/algebra_1/polynomials.py", "copies": "1", "size": "1447", "license": "bsd-3-clause", "hash": -8884343033216442000, "line_mean": 15.8255813953, "line_max": 76, "alpha_frac": 0.6447823082, "autogenerated": false, "ratio": 3.0918803418803...
from functools import reduce from xpath import dsl as x import capybara from capybara.compat import str_ from capybara.helpers import desc from capybara.selector.filter_set import add_filter_set, remove_filter_set, filter_sets from capybara.selector.selector import add_selector, remove_selector, selectors from capybar...
{ "repo_name": "elliterate/capybara.py", "path": "capybara/selector/__init__.py", "copies": "1", "size": "12150", "license": "mit", "hash": 8793891696528201000, "line_mean": 29.604534005, "line_max": 99, "alpha_frac": 0.5741563786, "autogenerated": false, "ratio": 3.8473717542748576, "config_tes...
from functools import reduce import abc class Matchable: @abc.abstractmethod def decompose(self): raise UnimplementedException('decompose unimplemented in class %s' % self.__class__) @classmethod @abc.abstractmethod def pattern(cls, *args): raise UnimplementedException('pattern unim...
{ "repo_name": "mvitousek/pypat", "path": "pypat.py", "copies": "1", "size": "5003", "license": "mit", "hash": 771442406940316500, "line_mean": 32.1324503311, "line_max": 103, "alpha_frac": 0.5712572457, "autogenerated": false, "ratio": 3.996006389776358, "config_test": false, "has_no_keywords...
from functools import reduce import base64 from six import BytesIO import matplotlib class EvaluatorHTMLSerializer: """ Wraps ClassifierEvaluator so attributes and methods return an HTML serializable version of them """ def __init__(self, evaluator): self.evaluator = evaluator def __g...
{ "repo_name": "edublancas/sklearn-model-evaluation", "path": "src/sklearn_evaluation/report/serialize.py", "copies": "2", "size": "1882", "license": "mit", "hash": -3969593066717116000, "line_mean": 24.7808219178, "line_max": 71, "alpha_frac": 0.6073326249, "autogenerated": false, "ratio": 3.5711...
from functools import reduce import collections class Solution: def longestWord(self, words: 'List[str]') -> 'str': Trie = lambda: collections.defaultdict(Trie) trie = Trie() END = True for i, word in enumerate(words): reduce(dict.__getitem__, word, trie)[END] = i ...
{ "repo_name": "jiadaizhao/LeetCode", "path": "0701-0800/0720-Longest Word in Dictionary/0720-Longest Word in Dictionary.py", "copies": "1", "size": "1468", "license": "mit", "hash": -2497369014260709400, "line_mean": 30.2340425532, "line_max": 89, "alpha_frac": 0.4993188011, "autogenerated": false,...
from functools import reduce import gc import io import locale # system locale module, not tornado.locale import logging import operator import textwrap import sys import unittest import warnings from tornado.httpclient import AsyncHTTPClient from tornado.httpserver import HTTPServer from tornado.netutil import Resol...
{ "repo_name": "dongpinglai/my_tornado", "path": "tornado/test/runtests.py", "copies": "5", "size": "8348", "license": "apache-2.0", "hash": -8835842092684174000, "line_mean": 33.6390041494, "line_max": 100, "alpha_frac": 0.6436272161, "autogenerated": false, "ratio": 4.060311284046692, "config_...
from functools import reduce import glob import os import numpy as np from bird import utils from bird import signal_processing as sp from bird import preprocessing as pp # def gaussian_probability_density(x, mu, sigma): # p = 1/(2*np.pi*(sigma**2))**(1/2) * np.exp(-((x-mu)**2)/(2*sigma**2)) # return p def ...
{ "repo_name": "johnmartinsson/bird-species-classification", "path": "bird/analysis.py", "copies": "1", "size": "1353", "license": "mit", "hash": -4627692277314064000, "line_mean": 32, "line_max": 78, "alpha_frac": 0.6977087953, "autogenerated": false, "ratio": 3.206161137440758, "config_test": ...
from functools import reduce import io import os import tempfile import binascii import numpy as np import networkx as nx from . import db from .svgoverlay import get_overlay, _make_layer, _find_layer, parser from lxml import etree from .dataset import Vertex from .polyutils import Surface, boundary_edges from .utils...
{ "repo_name": "gallantlab/pycortex", "path": "cortex/rois.py", "copies": "1", "size": "8871", "license": "bsd-2-clause", "hash": -3164041819651560000, "line_mean": 39.8801843318, "line_max": 144, "alpha_frac": 0.5583361515, "autogenerated": false, "ratio": 3.727310924369748, "config_test": fals...
from functools import reduce import itertools import math import random from mongoframes.factory.makers import Maker from mongoframes import ASC __all__ = [ 'Cycle', 'OneOf', 'RandomReference', 'SomeOf' ] class Cycle(Maker): """ Pick the next item from a list of makers and/or values cycl...
{ "repo_name": "GetmeUK/MongoFrames", "path": "mongoframes/factory/makers/selections.py", "copies": "1", "size": "9581", "license": "mit", "hash": -1074303563776917100, "line_mean": 29.6102236422, "line_max": 86, "alpha_frac": 0.5734265734, "autogenerated": false, "ratio": 4.597408829174664, "co...
from functools import reduce import itertools import numbers import operator from . import util def pylast_tracks_to_play_links(lastfm_tracks, network=None): if network is None: network = lastfm_tracks[0].network return (l for l in itertools.chain( *(network.get_track_play_links(track_group) ...
{ "repo_name": "IvanMalison/mopidy-lastfm", "path": "mopidy_lastfm/score.py", "copies": "1", "size": "4906", "license": "apache-2.0", "hash": -292148224437172860, "line_mean": 28.5542168675, "line_max": 106, "alpha_frac": 0.6324908276, "autogenerated": false, "ratio": 3.7336377473363775, "config...
from functools import reduce import itertools def identity(x): return x def thread_first(val, *forms): """ Thread value through a sequence of functions/forms >>> def double(x): return 2*x >>> def inc(x): return x + 1 >>> thread_first(1, inc, double) 4 If the function expects more tha...
{ "repo_name": "mrocklin/functoolz", "path": "functoolz/core.py", "copies": "1", "size": "5113", "license": "bsd-3-clause", "hash": -5979853251364691000, "line_mean": 23.0046948357, "line_max": 79, "alpha_frac": 0.5345198514, "autogenerated": false, "ratio": 3.52864044168392, "config_test": fals...
from functools import reduce import itertools def identity(x): return x def thread_first(val, *forms): """ Thread value through a sequence of functions/forms >>> def double(x): return 2*x >>> def inc(x): return x + 1 >>> thread_first(1, inc, double) 4 If the function expects more th...
{ "repo_name": "JNRowe/toolz", "path": "toolz/functoolz/core.py", "copies": "2", "size": "4877", "license": "bsd-3-clause", "hash": 1474672204108983000, "line_mean": 22.9068627451, "line_max": 79, "alpha_frac": 0.5273733853, "autogenerated": false, "ratio": 3.6422703510082153, "config_test": fal...
from functools import reduce import json from typing import Dict, List, NamedTuple, Optional from django.contrib.auth import get_user_model from django.utils import timezone from problem.models import ProblemInstance, ProblemAuthLog User = get_user_model() def calculate_problem_score(problem_instance, effective_so...
{ "repo_name": "PLUS-POSTECH/study.plus.or.kr", "path": "src/problem/helpers/score.py", "copies": "1", "size": "9240", "license": "apache-2.0", "hash": -5413071642158421000, "line_mean": 39.704845815, "line_max": 119, "alpha_frac": 0.6180735931, "autogenerated": false, "ratio": 3.938618925831202, ...
from functools import reduce import json import os from lib.alerttask import AlertTask from mozdef_util.query_models import SearchQuery, TermMatch, QueryStringMatch _CONFIG_FILE = os.path.join( os.path.dirname(__file__), 'aws_privilege_share.json') _AGGREGATE_KEY = 'details.requestparameters.username' _IAM...
{ "repo_name": "jeffbryner/MozDef", "path": "alerts/aws_privilege_share.py", "copies": "1", "size": "1986", "license": "mpl-2.0", "hash": -1515901782248190700, "line_mean": 30.5238095238, "line_max": 78, "alpha_frac": 0.639979859, "autogenerated": false, "ratio": 3.833976833976834, "config_test"...
from functools import reduce import logging from sys import stdout from django.db.models import Model from django.db.models.query import QuerySet from .utils import ( get_rendition_key_set, get_url_from_image_key, validate_versatileimagefield_sizekey_list ) logger = logging.getLogger(__name__) def cli_...
{ "repo_name": "respondcreate/django-versatileimagefield", "path": "versatileimagefield/image_warmer.py", "copies": "1", "size": "5664", "license": "mit", "hash": 1137002021412042200, "line_mean": 35.7792207792, "line_max": 79, "alpha_frac": 0.5667372881, "autogenerated": false, "ratio": 4.1677704...
from functools import reduce import logging import os from random import sample from pickle import load from copy import deepcopy import numpy as np import scipy.sparse as sp import pandas as pd import six from composes.composition.lexical_function import LexicalFunction from discoutils.tokens import DocumentFeature...
{ "repo_name": "mbatchkarov/vector_builder", "path": "builder/composers/vectorstore.py", "copies": "1", "size": "21805", "license": "bsd-3-clause", "hash": -743606114635063800, "line_mean": 40.4543726236, "line_max": 119, "alpha_frac": 0.6345333639, "autogenerated": false, "ratio": 3.7032948369565...
from functools import reduce import logging import platform import re import unittest logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__file__) from common import get_check from monasca_agent.collector.checks.system.unix import Cpu from monasca_agent.collector.checks.system.unix import Disk from m...
{ "repo_name": "sapcc/monasca-agent", "path": "tests_to_fix/test_system.py", "copies": "1", "size": "11608", "license": "bsd-3-clause", "hash": -5444452183412632000, "line_mean": 48.3957446809, "line_max": 129, "alpha_frac": 0.5537560303, "autogenerated": false, "ratio": 2.9424588086185044, "con...
from functools import reduce import logging from django.conf import settings as django_settings from rest_framework import exceptions from waldur_core.core.permissions import SAFE_METHODS, IsAdminOrReadOnly from waldur_core.structure import models logger = logging.getLogger(__name__) # TODO: this is a temporary pe...
{ "repo_name": "opennode/nodeconductor", "path": "waldur_core/structure/permissions.py", "copies": "1", "size": "2681", "license": "mit", "hash": 104132609789461010, "line_mean": 27.8279569892, "line_max": 106, "alpha_frac": 0.6926519955, "autogenerated": false, "ratio": 3.7132963988919667, "con...
from functools import reduce import math from collections import Counter def build_structure(f): d = { 'male': [], 'female': [], 'lastname_1': [], 'lastname_2': [], } keys = list(d.keys()) k = keys.pop(0) for line in open(f).readlines(): line = line.strip()...
{ "repo_name": "matslindh/codingchallenges", "path": "knowit2019/18.py", "copies": "1", "size": "1487", "license": "mit", "hash": -5055254277627946000, "line_mean": 25.0877192982, "line_max": 119, "alpha_frac": 0.5615332885, "autogenerated": false, "ratio": 3.130526315789474, "config_test": fals...
from functools import reduce import mmap from multiprocessing.managers import DictProxy, SyncManager, Server import os import random import struct import sys try: from posixshmem import _PosixSharedMemory, Error, ExistentialError, O_CREX except ImportError as ie: if os.name != "nt": # On Windows, posixs...
{ "repo_name": "applio/proto_shmem", "path": "shared_memory.py", "copies": "1", "size": "18492", "license": "mit", "hash": -1180574135648953000, "line_mean": 33.6941838649, "line_max": 86, "alpha_frac": 0.5693272767, "autogenerated": false, "ratio": 4.0588235294117645, "config_test": false, "h...
from functools import reduce import nltk.cluster import numpy distances = [] def get_clusters_k_means(vectors, k, distance_func, num_of_repeats): feature_vectors = [numpy.array(f) for f in vectors] clusterer = nltk.cluster.KMeansClusterer( num_means=k, distance=lambda x, y: distance_func(x, ...
{ "repo_name": "miromir2217/style_breach", "path": "style_breach/cluster/clustering.py", "copies": "1", "size": "1786", "license": "apache-2.0", "hash": 1508933437238472400, "line_mean": 37, "line_max": 116, "alpha_frac": 0.640537514, "autogenerated": false, "ratio": 3.9513274336283186, "config_...
from functools import reduce import numpy as np from menpo.transform import Homogeneous, Translation, Scale, NonUniformScale def dims_3to2(): r""" Returns ------ :map`Homogeneous` :map`Homogeneous` that strips off the 3D axis of a 3D shape leaving just the first two axes. """ ...
{ "repo_name": "grigorisg9gr/menpo3d", "path": "menpo3d/rasterize/transform.py", "copies": "3", "size": "4300", "license": "bsd-3-clause", "hash": -6152028573756367000, "line_mean": 32.59375, "line_max": 79, "alpha_frac": 0.5818604651, "autogenerated": false, "ratio": 3.6502546689303905, "config...
from functools import reduce import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection from skimage.draw import polygon LEFT_CLICK = 1 RIGHT_CLICK = 3 # Borrowed from skimage.future def _mask_from_vertices(vertices...
{ "repo_name": "pskeshu/doodle", "path": "doodle/manual_segment.py", "copies": "1", "size": "3240", "license": "mit", "hash": 7061240301488484000, "line_mean": 29, "line_max": 78, "alpha_frac": 0.6361111111, "autogenerated": false, "ratio": 3.737024221453287, "config_test": false, "has_no_keyw...
from functools import reduce import numpy as np import tensorflow as tf # TODO: check the methods of _TensorLike class TensorTrainBase(object): """An abstract class that represents a collection of Tensor Train cores. """ def __init__(self, tt_cores): """Creates a `TensorTrainBase`.""" pass def get_r...
{ "repo_name": "Bihaqo/t3f", "path": "t3f/tensor_train_base.py", "copies": "1", "size": "5565", "license": "mit", "hash": -892522016806643000, "line_mean": 30.0893854749, "line_max": 87, "alpha_frac": 0.6603773585, "autogenerated": false, "ratio": 3.7986348122866893, "config_test": false, "has...
from functools import reduce import numpy as np import time from scarab import EncryptedArray, EncryptedBit, \ PrivateKey, PublicKey, generate_pair _ADD = lambda a, b: a + b _MUL = lambda a, b: a * b _AND = lambda a, b: a & b _XOR = lambda a, b: a ^ b pk, sk = None, None def binary(num, size=32): """Binary...
{ "repo_name": "blindstore/blindstore-old-scarab", "path": "pir.py", "copies": "1", "size": "3021", "license": "mit", "hash": 6609702121587240000, "line_mean": 28.3300970874, "line_max": 109, "alpha_frac": 0.6338960609, "autogenerated": false, "ratio": 3.2310160427807486, "config_test": false, ...
from functools import reduce import numpy as np from tools.utils import flatten import acpc_python_client as acpc def get_utility(hole_cards, board_cards, players_folded, pot_commitment): num_players = len(players_folded) flattened_board_cards = flatten(board_cards) complete_hands = [ flatten(hol...
{ "repo_name": "JakubPetriska/poker-cfr", "path": "tools/hand_evaluation.py", "copies": "1", "size": "2731", "license": "mit", "hash": 5624747605925258000, "line_mean": 36.4109589041, "line_max": 115, "alpha_frac": 0.6195532772, "autogenerated": false, "ratio": 3.396766169154229, "config_test": ...
from functools import reduce import numpy as np # Qubit representation on a Ket or Bra state. Allows to create only # basis qubits |0> or |1>. By performing operations defined operations # it's possible to get other qubits or qubit registers. class Qubit: KET = True BRA = False # Creates a new qubit |...
{ "repo_name": "miguelfrde/pyquantum", "path": "pyquantum/qubit.py", "copies": "1", "size": "3624", "license": "mit", "hash": -201153547473917200, "line_mean": 35.9795918367, "line_max": 81, "alpha_frac": 0.6261037528, "autogenerated": false, "ratio": 3.7093142272262027, "config_test": false, ...
from functools import reduce import numpy from pyscf import gto, scf, mcscf ''' Compare two CASSCF active space. It's important to compare multi-reference calculations based on the comparable reference states. Here we compute the SVD eig and the determinant value of the CAS space overlap to measure how close two CAS...
{ "repo_name": "sunqm/pyscf", "path": "examples/mcscf/42-compare_cas_space.py", "copies": "1", "size": "1288", "license": "apache-2.0", "hash": -1202593119262572000, "line_mean": 33.8108108108, "line_max": 78, "alpha_frac": 0.6886645963, "autogenerated": false, "ratio": 2.430188679245283, "confi...
from functools import reduce import operator as op import numpy as np def interp1(x, xp, fp): """ Interpolate the 1d piecewise linear interpolant to a function with given values at discrete data points :param x: The x-coordinates of the interpolated values :param xp: The x-coordinates of the ...
{ "repo_name": "hoogamaphone/chromathicity", "path": "chromathicity/math.py", "copies": "1", "size": "1762", "license": "bsd-3-clause", "hash": 2118405404469277400, "line_mean": 29.9122807018, "line_max": 78, "alpha_frac": 0.6424517594, "autogenerated": false, "ratio": 3.5885947046843176, "confi...
from functools import reduce import operator from django.contrib.auth.models import Group, Permission from django.db.models import Q from django.test import TestCase, override_settings from django.urls import reverse from django.utils.crypto import get_random_string from accounts.models import User from zentral.contrib...
{ "repo_name": "zentralopensource/zentral", "path": "tests/jamf/test_jamf_setup_views.py", "copies": "1", "size": "12926", "license": "apache-2.0", "hash": 6094893842579865000, "line_mean": 45.6642599278, "line_max": 110, "alpha_frac": 0.6045180257, "autogenerated": false, "ratio": 3.8619659396474...
from functools import reduce import operator from django.contrib.auth.models import Group, Permission from django.db.models import Q from django.urls import reverse from django.utils.crypto import get_random_string from django.test import TestCase from accounts.models import User from zentral.contrib.inventory.models i...
{ "repo_name": "zentralopensource/zentral", "path": "tests/monolith/test_setup_views.py", "copies": "1", "size": "7005", "license": "apache-2.0", "hash": 2761206418430039000, "line_mean": 37.489010989, "line_max": 100, "alpha_frac": 0.6663811563, "autogenerated": false, "ratio": 3.825778263244129,...
from functools import reduce import operator from urllib.parse import urljoin from django.apps import apps from django.conf import settings from django.core import checks from django.core.cache import cache from django.db import models from django.db.models.aggregates import Sum from django.db.models.functions import ...
{ "repo_name": "awesto/django-shop", "path": "shop/models/product.py", "copies": "1", "size": "16044", "license": "bsd-3-clause", "hash": -2669159924297466000, "line_mean": 39.5151515152, "line_max": 112, "alpha_frac": 0.6588755921, "autogenerated": false, "ratio": 4.638334778837814, "config_tes...
from functools import reduce import operator import datetime import time from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.db.models import Q from django.utils.timezone import make_aware, get_current_timezone from obcy.models import Joke SITE_URL = { 'wykop': 'http://wykop.pl'...
{ "repo_name": "jchmura/suchary-django", "path": "obcy/extras/prepare_view.py", "copies": "1", "size": "4222", "license": "mit", "hash": 6270075118385788000, "line_mean": 28.7394366197, "line_max": 119, "alpha_frac": 0.6229275225, "autogenerated": false, "ratio": 3.3938906752411575, "config_test...
from functools import reduce import operator import math from llvmlite import ir import llvmlite.binding as ll from numba.core.imputils import Registry from numba.core.typing.npydecl import parse_dtype, signature from numba.core import types, cgutils from .cudadrv import nvvm from numba import cuda from numba.cuda im...
{ "repo_name": "gmarkall/numba", "path": "numba/cuda/cudaimpl.py", "copies": "1", "size": "33252", "license": "bsd-2-clause", "hash": -7004433995104263000, "line_mean": 35.3409836066, "line_max": 114, "alpha_frac": 0.6378864429, "autogenerated": false, "ratio": 3.2587220697765584, "config_test":...
from functools import reduce import operator import math from llvmlite.llvmpy.core import Type, InlineAsm import llvmlite.llvmpy.core as lc import llvmlite.binding as ll from numba.core.imputils import Registry from numba.core.typing.npydecl import parse_dtype from numba.core import types, cgutils from .cudadrv impor...
{ "repo_name": "sklam/numba", "path": "numba/cuda/cudaimpl.py", "copies": "1", "size": "27366", "license": "bsd-2-clause", "hash": 7769188903916740000, "line_mean": 35.5367156208, "line_max": 80, "alpha_frac": 0.6429145655, "autogenerated": false, "ratio": 3.219529411764706, "config_test": false...
from functools import reduce import operator import pprint import uuid from celery import states from django.db import models from django.contrib import admin from django.utils.html import format_html from project import celery_app from share.admin.util import FuzzyPaginator class TaskNameFilter(admin.SimpleListF...
{ "repo_name": "aaxelb/SHARE", "path": "share/admin/celery.py", "copies": "1", "size": "3689", "license": "apache-2.0", "hash": 4370947550267204000, "line_mean": 29.7416666667, "line_max": 115, "alpha_frac": 0.6072106262, "autogenerated": false, "ratio": 3.949678800856531, "config_test": false, ...
from functools import reduce import operator import pytz from django.contrib import messages from django.utils import timezone def get_report_date(request): user_tz = pytz.timezone(request.user.profile.timezone) date_string = request.GET.get('report_date') if date_string: try: report_...
{ "repo_name": "peap/djarzeit", "path": "reports/utils.py", "copies": "1", "size": "2683", "license": "mit", "hash": 7110657426809058000, "line_mean": 31.7195121951, "line_max": 78, "alpha_frac": 0.6276556094, "autogenerated": false, "ratio": 3.5630810092961487, "config_test": false, "has_no_k...
from functools import reduce import operator import re from dal import autocomplete from django.contrib.auth.models import Group from django.conf.urls import url from django.db.models import Q, Count from workshops import models from workshops.util import OnlyForAdminsNoRedirectMixin class EventLookupView(OnlyForAd...
{ "repo_name": "vahtras/amy", "path": "workshops/lookups.py", "copies": "1", "size": "4742", "license": "mit", "hash": 3227650137332039700, "line_mean": 30.6133333333, "line_max": 91, "alpha_frac": 0.6012231126, "autogenerated": false, "ratio": 4.127067014795474, "config_test": false, "has_no_...
from functools import reduce import operator import textwrap from plugins import BasePlugin __author__ = 'peter' class XORPlugin(BasePlugin): short_description = 'XOR all hexstring input(s) with eachother' header = 'XOR of the hex inputs' default = False description = textwrap.dedent('''\ This ...
{ "repo_name": "Sakartu/stringinfo", "path": "plugins/xor_plugin.py", "copies": "1", "size": "1107", "license": "mit", "hash": 1606363866072719000, "line_mean": 28.1315789474, "line_max": 81, "alpha_frac": 0.5889792231, "autogenerated": false, "ratio": 3.6058631921824102, "config_test": false, ...
from functools import reduce import operator arabic_to_roman = { 1: "I", 5: "V", 10: "X", 50: "L", 100: "C", 500: "D", 1000: "M"} roman_to_arabic = {roman: arabic for (arabic, roman) in arabic_to_roman.items()} MAX = 4999 def unfold(f, initial_state): next_item, state = f(initial_st...
{ "repo_name": "takemyoxygen/playground", "path": "py/numerals/numerals.py", "copies": "1", "size": "1964", "license": "mit", "hash": -8238291038610440000, "line_mean": 28.3134328358, "line_max": 97, "alpha_frac": 0.6206720978, "autogenerated": false, "ratio": 3.323181049069374, "config_test": f...
from functools import reduce import operator from django.core.exceptions import ImproperlyConfigured from django.db.models import Q from rest_framework.filters import BaseFilterBackend class CMSPagesFilterBackend(BaseFilterBackend): """ Use this backend to only show products assigned to the current page. ...
{ "repo_name": "awesto/django-shop", "path": "shop/rest/filters.py", "copies": "1", "size": "1687", "license": "bsd-3-clause", "hash": -3719191531598573000, "line_mean": 42.2564102564, "line_max": 102, "alpha_frac": 0.7065797273, "autogenerated": false, "ratio": 3.9881796690307327, "config_test"...