text
stringlengths
0
1.05M
meta
dict
from functools import lru_cache from collections import deque from dataclasses import dataclass, field import heapq @dataclass(frozen=True) class Point: x: int y: int def dist(self, other): return abs(self.x - other.x) + abs(self.y - other.y) class PriorityQueue: @dataclass(frozen=True, ord...
{ "repo_name": "suprzer0/aoc2016", "path": "day13/solve.py", "copies": "1", "size": "3000", "license": "mit", "hash": -926780763725494900, "line_mean": 20.7391304348, "line_max": 80, "alpha_frac": 0.5243333333, "autogenerated": false, "ratio": 3.239740820734341, "config_test": false, "has_no_k...
from functools import lru_cache from contextlib import contextmanager import os import glob from hashlib import sha1 from scipy import sparse import numpy as np from scipy.integrate import simps from scipy.ndimage import spline_filter from astropy.table import Table from astropy.coordinates import ICRS import astropy....
{ "repo_name": "drgmk/sdf", "path": "sdf/utils.py", "copies": "1", "size": "13582", "license": "mit", "hash": -3233368995377309000, "line_mean": 28.1459227468, "line_max": 133, "alpha_frac": 0.5853335297, "autogenerated": false, "ratio": 3.4263370332996974, "config_test": false, "has_no_keywor...
from functools import lru_cache from faker import Faker from jinja2 import Template class StringGenerator: """Sometimes in templates you want a reference to a variable to call a function. For example: >>> x = template_utils.StringGenerator(datetime.today().isoformat) >>> print(f"{x}") 2019-...
{ "repo_name": "SalesforceFoundation/CumulusCI", "path": "cumulusci/core/template_utils.py", "copies": "1", "size": "1409", "license": "bsd-3-clause", "hash": 521737387662944300, "line_mean": 22.8813559322, "line_max": 76, "alpha_frac": 0.6352022711, "autogenerated": false, "ratio": 3.622107969151...
from functools import lru_cache from hashlib import md5 from itertools import product salt = b'qzyelonm' lookahead_distance = 1000 def get_hex_digest(b): return md5(b).hexdigest() def first_repeat_char(hash_str, l=3): matches = sorted((hash_str.find(c*l), c) for c in set(hash_str) if c*l in hash_str) r...
{ "repo_name": "sclarke/adventofcode2016", "path": "d14.py", "copies": "1", "size": "1100", "license": "bsd-3-clause", "hash": -853456757248792700, "line_mean": 25.1904761905, "line_max": 114, "alpha_frac": 0.6554545455, "autogenerated": false, "ratio": 2.9177718832891246, "config_test": false, ...
from functools import lru_cache from hashlib import md5 from time import time from django.core.cache import cache from django.utils.cache import _i18n_cache_key_suffix from mezzanine.conf import settings from mezzanine.utils.conf import middlewares_or_subclasses_installed from mezzanine.utils.sites import current_sit...
{ "repo_name": "stephenmcd/mezzanine", "path": "mezzanine/utils/cache.py", "copies": "2", "size": "3906", "license": "bsd-2-clause", "hash": 6980224498068520000, "line_mean": 32.1016949153, "line_max": 74, "alpha_frac": 0.6592421915, "autogenerated": false, "ratio": 3.917753259779338, "config_te...
from functools import lru_cache from io import BytesIO from urllib.parse import urljoin from PIL import Image from urllib.request import Request, urlopen import asyncio from boards.database import engine from bs4 import BeautifulSoup import aiohttp user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 ...
{ "repo_name": "mstojcevich/Boards", "path": "boards/thumbnail.py", "copies": "1", "size": "4332", "license": "mit", "hash": -1695060703479431400, "line_mean": 31.0888888889, "line_max": 95, "alpha_frac": 0.6350415512, "autogenerated": false, "ratio": 3.7025641025641027, "config_test": false, ...
from functools import lru_cache from io import BytesIO import pygame import requests class ChatImage: def __init__(self, client_id, height=16): self.session = requests.Session() self.session.headers["Client-ID"] = client_id self.session.headers["Accept"] = "application/vnd.twitchtv.v5+jso...
{ "repo_name": "shughes-uk/twitchchat_display", "path": "twitchchat_display/images.py", "copies": "1", "size": "2426", "license": "mit", "hash": -507086209099794400, "line_mean": 35.2089552239, "line_max": 88, "alpha_frac": 0.604286892, "autogenerated": false, "ratio": 3.4025245441795233, "confi...
from functools import lru_cache from io import TextIOWrapper from typing import Dict import pytz @lru_cache(maxsize=None) def get_canonical_timezone_map() -> Dict[str, str]: canonical = {} with TextIOWrapper( pytz.open_resource("tzdata.zi") # type: ignore[attr-defined] # Unclear if this is part of t...
{ "repo_name": "zulip/zulip", "path": "zerver/lib/timezone.py", "copies": "6", "size": "1757", "license": "apache-2.0", "hash": -4953415391975245000, "line_mean": 21.2405063291, "line_max": 118, "alpha_frac": 0.5350028458, "autogenerated": false, "ratio": 2.6865443425076454, "config_test": false...
from functools import lru_cache from itertools import chain import logging import os import sublime from . import events, persist, util logger = logging.getLogger(__name__) COLORIZE = True WHITE_SCOPE = 'region.whitish' # hopefully a white color DEFAULT_STYLES = None # holds the styles we ship as the default sett...
{ "repo_name": "SublimeLinter/SublimeLinter3", "path": "lint/style.py", "copies": "1", "size": "4137", "license": "mit", "hash": 7030456014647995000, "line_mean": 28.9782608696, "line_max": 92, "alpha_frac": 0.6183224559, "autogenerated": false, "ratio": 3.7303877366997296, "config_test": false,...
from functools import lru_cache from json import JSONDecodeError from urllib.parse import urljoin, urlparse import requests from django.conf import settings from django.db.models import Q from workshops.models import ( Person, Role, Organization, Sponsorship, Task, ) from workshops.util import cre...
{ "repo_name": "vahtras/amy", "path": "pydata/api.py", "copies": "1", "size": "4704", "license": "mit", "hash": 2670075810124097000, "line_mean": 31.6666666667, "line_max": 89, "alpha_frac": 0.5612244898, "autogenerated": false, "ratio": 4.363636363636363, "config_test": false, "has_no_keyword...
from functools import lru_cache from langcodes import Language, best_match # Text in scripts written without spaces has to be handled specially in our # tokenization regex (see TOKEN_RE in tokens.py). Also, when one of these is # the script of the language we're analyzing, then we need to either have # a specific tok...
{ "repo_name": "LuminosoInsight/wordfreq", "path": "wordfreq/language_info.py", "copies": "1", "size": "6793", "license": "mit", "hash": 1412795037747228000, "line_mean": 38.3895348837, "line_max": 80, "alpha_frac": 0.6748339483, "autogenerated": false, "ratio": 3.7266226622662266, "config_test"...
from functools import lru_cache from logging import getLogger from os.path import join from typing import Any, Callable, Dict, Optional, List, Sequence, Set, Tuple import requests import json import csv from ..const import PROPER_STOP_NAMES, ACTIVE_RAIL_STATIONS, HEADERS, \ GIST_MISSING_STOPS, GIST_RAIL_PLATFORMS ...
{ "repo_name": "MKuranowski/WarsawGTFS", "path": "static/converter/stophandler.py", "copies": "1", "size": "14868", "license": "mit", "hash": 3687844764460532700, "line_mean": 35.515970516, "line_max": 97, "alpha_frac": 0.5389584174, "autogenerated": false, "ratio": 3.7606275303643724, "config_t...
from functools import lru_cache from math import ceil, floor, log2 from .utils import argmin, greatest_pow2 @lru_cache(maxsize=None) def C(p, q): if p == 0: return 1 if p > q: return 0 return C(p, q - 1) + C(p - 1, q) class RMQ: def __init__(self, array): self.array = array ...
{ "repo_name": "mhozza/string_algorithms", "path": "string_algorithms/rmq.py", "copies": "1", "size": "4323", "license": "mit", "hash": 5300163592047080000, "line_mean": 30.3260869565, "line_max": 106, "alpha_frac": 0.5149201943, "autogenerated": false, "ratio": 3.2774829416224414, "config_test"...
from functools import lru_cache from math import floor, log from typing import Dict d = { # generate_d 0: 1, 1: 2, 2: 3, 4: 4, 8: 6, 16: 9, 32: 14, 64: 22, 128: 35, 256: 56, 512: 90, 1024: 145, 2048: 234, 4096: 378, 8192: 611, 16384: 988, 32768: 1...
{ "repo_name": "MartinThoma/algorithms", "path": "Python/leetcode_600.py", "copies": "1", "size": "4681", "license": "mit", "hash": -1931442726737507000, "line_mean": 22.405, "line_max": 81, "alpha_frac": 0.5176244392, "autogenerated": false, "ratio": 2.6902298850574713, "config_test": false, ...
from functools import lru_cache from math import ( ceil, sqrt, ) from sequence import Sequence class Prime(Sequence): _NUMS = [2, 3] @classmethod def _append(cls): cls._append_many() @classmethod def _append_one(cls): (candidate, flag) = (cls._NUMS[-1], False) whil...
{ "repo_name": "mackorone/euler", "path": "src/prime.py", "copies": "1", "size": "1519", "license": "mit", "hash": 6836271841193496000, "line_mean": 26.125, "line_max": 68, "alpha_frac": 0.5075707702, "autogenerated": false, "ratio": 3.9454545454545453, "config_test": false, "has_no_keywords":...
from functools import lru_cache from menpo.shape import PointCloud from menpo.transform import Scale, Translation from menpo3d.rasterize import ( rasterize_barycentric_coordinate_images, rasterize_mesh_from_barycentric_coordinate_images, rasterize_shape_image_from_barycentric_coordinate_images) from menpode...
{ "repo_name": "menpo/lsfm", "path": "lsfm/landmark.py", "copies": "1", "size": "3169", "license": "bsd-3-clause", "hash": -2888775015307180000, "line_mean": 36.2823529412, "line_max": 78, "alpha_frac": 0.6667718523, "autogenerated": false, "ratio": 3.3252885624344177, "config_test": false, "h...
from functools import lru_cache from metrics import ratio_of_classes from numpy import log2 from typing import Callable, Mapping, Sequence, List from warnings import warn import pandas as pd class Gene: """Stores gene's identifier and description (multiton). At a time there can be only one gene with given i...
{ "repo_name": "sienkie/pathways-analysis", "path": "models.py", "copies": "1", "size": "15802", "license": "mit", "hash": -1136555631575083800, "line_mean": 32.9827956989, "line_max": 109, "alpha_frac": 0.5651183395, "autogenerated": false, "ratio": 4.457545839210155, "config_test": false, "h...
from functools import lru_cache from operator import attrgetter from os.path import sep, splitext, isdir, exists, join from os import listdir from urllib.parse import quote_plus import ipgetter from logging import getLogger from discord import ChannelType from roboto import config, disc log = getLogger(__name__) # ...
{ "repo_name": "leighmacdonald/roboto", "path": "roboto/media.py", "copies": "1", "size": "5168", "license": "mit", "hash": 6970096636813686000, "line_mean": 26.2, "line_max": 99, "alpha_frac": 0.6170665635, "autogenerated": false, "ratio": 3.5715272978576365, "config_test": false, "has_no_key...
from functools import lru_cache from pkg_resources import iter_entry_points from typing import ( Any, List, Mapping, Type, ) from marshmallow.fields import Field from microcosm_flask.swagger.parameters.base import ParameterBuilder from microcosm_flask.swagger.parameters.default import DefaultParameter...
{ "repo_name": "globality-corp/microcosm-flask", "path": "microcosm_flask/swagger/parameters/__init__.py", "copies": "1", "size": "1917", "license": "apache-2.0", "hash": -5411442114039876000, "line_mean": 24.56, "line_max": 89, "alpha_frac": 0.6155451226, "autogenerated": false, "ratio": 4.406896...
from functools import lru_cache from pyramid.security import ( ALL_PERMISSIONS, Allow, Authenticated, Deny, DENY_ALL, Everyone, ) from pyramid.threadlocal import get_current_request from pyramid.traversal import ( find_root, traverse, ) import contentbase from ..schema_formats import is_...
{ "repo_name": "philiptzou/clincoded", "path": "src/clincoded/types/base.py", "copies": "1", "size": "7287", "license": "mit", "hash": 2508191901959448000, "line_mean": 31.53125, "line_max": 101, "alpha_frac": 0.6013448607, "autogenerated": false, "ratio": 3.8072100313479624, "config_test": fals...
from functools import lru_cache from pyramid.security import ( ALL_PERMISSIONS, Allow, Authenticated, Deny, DENY_ALL, Everyone, ) from pyramid.traversal import ( find_root, traverse, ) import contentbase from ..schema_formats import is_accession @lru_cache() def _award_viewing_group(aw...
{ "repo_name": "kidaa/encoded", "path": "src/encoded/types/base.py", "copies": "1", "size": "7279", "license": "mit", "hash": 6828672249256526000, "line_mean": 31.7882882883, "line_max": 101, "alpha_frac": 0.5992581399, "autogenerated": false, "ratio": 3.8169900367068696, "config_test": false, ...
from functools import lru_cache from statistics import mean from string import punctuation import warnings from nltk.corpus import cmudict from nltk.tokenize import word_tokenize, sent_tokenize import numpy as np from sklearn.feature_extraction.text import CountVectorizer from otdet.util import lazyproperty class R...
{ "repo_name": "kemskems/otdet", "path": "otdet/feature_extraction.py", "copies": "1", "size": "7325", "license": "mit", "hash": 7621188799809032000, "line_mean": 33.880952381, "line_max": 78, "alpha_frac": 0.606552901, "autogenerated": false, "ratio": 3.839098532494759, "config_test": false, ...
from functools import lru_cache from typing import Any, Container, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union from urllib.parse import urlparse import orjson import requests from django.conf import settings from requests.adapters import ConnectionError, HTTPAdapter from requests.models import Prep...
{ "repo_name": "hackerkid/zulip", "path": "zerver/tornado/django_api.py", "copies": "2", "size": "5727", "license": "apache-2.0", "hash": 5565695577941948000, "line_mean": 35.7115384615, "line_max": 100, "alpha_frac": 0.6476340143, "autogenerated": false, "ratio": 3.723667100130039, "config_test...
from functools import lru_cache from typing import Any, Container, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union import orjson import requests from django.conf import settings from requests.adapters import ConnectionError, HTTPAdapter from requests.models import PreparedRequest, Response from request...
{ "repo_name": "brainwane/zulip", "path": "zerver/tornado/django_api.py", "copies": "1", "size": "4896", "license": "apache-2.0", "hash": 7708094520352694000, "line_mean": 39.131147541, "line_max": 122, "alpha_frac": 0.6266339869, "autogenerated": false, "ratio": 3.7865429234338746, "config_test...
from functools import lru_cache from typing import Callable, Dict, List, Optional, Any, cast from xml.etree.ElementTree import Element from xml.etree.ElementTree import tostring as et_str import html5lib import requests import activesoup _namespaces = ["http://www.w3.org/1999/xhtml"] def _strip_namespace(etree: E...
{ "repo_name": "jelford/activesoup", "path": "src/activesoup/html.py", "copies": "1", "size": "11008", "license": "mit", "hash": -2311447842219989000, "line_mean": 34.7402597403, "line_max": 168, "alpha_frac": 0.5795784884, "autogenerated": false, "ratio": 4.157099697885196, "config_test": false...
from functools import lru_cache from typing import Callable, Mapping, Sequence, List from warnings import warn import pandas as pd class Gene: """Stores gene's identifier and description (multiton). At a time there can be only one gene with given identifier, i.e. after the first initialization, all subs...
{ "repo_name": "kn-bibs/pathways-analysis", "path": "models.py", "copies": "1", "size": "15022", "license": "mit", "hash": -7627275604343066000, "line_mean": 32.9864253394, "line_max": 121, "alpha_frac": 0.5673012914, "autogenerated": false, "ratio": 4.435193386477708, "config_test": false, "h...
from functools import lru_cache from typing import Dict, List from ._cell_widths import CELL_WIDTHS from ._lru_cache import LRUCache def cell_len(text: str, _cache: Dict[str, int] = LRUCache(1024 * 4)) -> int: """Get the number of cells required to display text. Args: text (str): Text to display. ...
{ "repo_name": "willmcgugan/rich", "path": "rich/cells.py", "copies": "1", "size": "3685", "license": "mit", "hash": -2591204797837050400, "line_mean": 27.464, "line_max": 81, "alpha_frac": 0.5947161327, "autogenerated": false, "ratio": 3.331460674157303, "config_test": false, "has_no_keywords...
from functools import lru_cache from typing import Dict, List, Optional from debug_toolbar.panels.templates import TemplatesPanel as BaseTemplatesPanel from django.conf import settings from django.contrib import messages from django.contrib.humanize.templatetags.humanize import naturaltime from django.utils.html impor...
{ "repo_name": "karolyi/forum-django", "path": "backend/forum/jinja2.py", "copies": "1", "size": "5219", "license": "mit", "hash": 1198952770549557800, "line_mean": 29.8816568047, "line_max": 79, "alpha_frac": 0.6516574056, "autogenerated": false, "ratio": 3.9093632958801496, "config_test": fals...
from functools import lru_cache from typing import Iterable, Dict, Set, Tuple from helpers.hashable_dict import HashableDict from interfaces.expr import Signal class Label(HashableDict): # TODO: use Expr instead (cube) """ _hashable_ dict: signal -> True/False Label({}) means 'True' And there is no ...
{ "repo_name": "5nizza/party-elli", "path": "interfaces/automaton.py", "copies": "1", "size": "3598", "license": "mit", "hash": -1244348676524788000, "line_mean": 30.5614035088, "line_max": 100, "alpha_frac": 0.5275152863, "autogenerated": false, "ratio": 3.7169421487603307, "config_test": false...
from functools import lru_cache from typing import List import librosa import numpy as np from mugen import paths from mugen.events import EventList, Event class AudioEvent(Event): """ An event in some audio """ pass class End(AudioEvent): """ The end of some audio """ pass class...
{ "repo_name": "scherroman/mugen", "path": "mugen/audio/Audio.py", "copies": "1", "size": "4727", "license": "mit", "hash": -3696941281759082000, "line_mean": 25.1160220994, "line_max": 120, "alpha_frac": 0.5553204993, "autogenerated": false, "ratio": 4.114012184508268, "config_test": false, "...
from functools import lru_cache from typing import List, Tuple, Iterable, Dict, Optional import numpy as np from opensfm import bow from opensfm import feature_loader from opensfm.dataset import DataSetBase def unnormalized_vlad(features: np.ndarray, centers: np.ndarray) -> np.ndarray: """Compute unnormalized VL...
{ "repo_name": "mapillary/OpenSfM", "path": "opensfm/vlad.py", "copies": "1", "size": "2311", "license": "bsd-2-clause", "hash": 7029261816028634000, "line_mean": 29.012987013, "line_max": 87, "alpha_frac": 0.649935093, "autogenerated": false, "ratio": 3.5228658536585367, "config_test": false, ...
from functools import lru_cache from typing import Optional from django.core.exceptions import FieldDoesNotExist from django.db import models from django.db.models import QuerySet from rest_framework.compat import coreapi, coreschema from rest_framework.filters import BaseFilterBackend from rest_framework.request impo...
{ "repo_name": "rsinger86/drf-flex-fields", "path": "rest_flex_fields/filter_backends.py", "copies": "1", "size": "5946", "license": "mit", "hash": -4576592348556671500, "line_mean": 32.593220339, "line_max": 83, "alpha_frac": 0.5082408342, "autogenerated": false, "ratio": 4.967418546365915, "co...
from functools import lru_cache from typing import Optional from indy_crypto.bls import ProofOfPossession, VerKey from common.serializers.serialization import pool_state_serializer from crypto.bls.indy_crypto.bls_crypto_indy_crypto import IndyCryptoBlsUtils from plenum.common.constants import POOL_LEDGER_ID, NODE, DA...
{ "repo_name": "evernym/zeno", "path": "plenum/server/request_handlers/node_handler.py", "copies": "1", "size": "10182", "license": "apache-2.0", "hash": -5821467442304997000, "line_mean": 47.2559241706, "line_max": 113, "alpha_frac": 0.6166764879, "autogenerated": false, "ratio": 3.68779427743571...
from functools import lru_cache from typing import Optional from ursa.bls import ProofOfPossession, VerKey from common.serializers.serialization import pool_state_serializer from crypto.bls.indy_crypto.bls_crypto_indy_crypto import IndyCryptoBlsUtils from plenum.common.constants import POOL_LEDGER_ID, NODE, DATA, BLS...
{ "repo_name": "evernym/plenum", "path": "plenum/server/request_handlers/node_handler.py", "copies": "1", "size": "10175", "license": "apache-2.0", "hash": 2232331412928904400, "line_mean": 47.2227488152, "line_max": 113, "alpha_frac": 0.6165110565, "autogenerated": false, "ratio": 3.6879304095686...
from functools import lru_cache from typing import Sequence, Dict, Union, Tuple, List, Optional, cast, Iterable import numpy as np import quimb import quimb.tensor as qtn import cirq @lru_cache() def _qpos_tag(qubits: Union[cirq.LineQubit, Tuple[cirq.LineQubit]]): """Given a qubit or qubits, return a "position ...
{ "repo_name": "quantumlib/Cirq", "path": "cirq-core/cirq/contrib/quimb/density_matrix.py", "copies": "1", "size": "8487", "license": "apache-2.0", "hash": -2706866796492286000, "line_mean": 38.4744186047, "line_max": 98, "alpha_frac": 0.5805349358, "autogenerated": false, "ratio": 3.3139398672393...
from functools import lru_cache from wrapt import synchronized from time import time from collections import namedtuple from util import iprint TimeSignature = namedtuple("TimeSignature", ["top", "bottom"]) TimeReport = namedtuple("TimeReport", ["delta", "measure", "signature", "tick", "bpm", "prog", "playing"]) """...
{ "repo_name": "echolox/smartbcr2k", "path": "smci/clock.py", "copies": "1", "size": "3365", "license": "mit", "hash": -2677691082079889000, "line_mean": 26.5819672131, "line_max": 121, "alpha_frac": 0.6005943536, "autogenerated": false, "ratio": 3.6299892125134843, "config_test": false, "has_...
from functools import lru_cache import json import re import typing import warnings from django import template from django.conf import settings from django.utils.encoding import force_str from django.utils.html import format_html from django.utils.safestring import mark_safe import pubcode from ..models import UITex...
{ "repo_name": "jlaunonen/kirppu", "path": "kirppu/templatetags/kirppu_tags.py", "copies": "1", "size": "6029", "license": "mit", "hash": -2683243165230529500, "line_mean": 30.0773195876, "line_max": 96, "alpha_frac": 0.6261403218, "autogenerated": false, "ratio": 3.656155245603396, "config_test...
from functools import lru_cache import logging import lxml.html from cssselect import HTMLTranslator class SelectorException(RuntimeError): def __init__(self, selector, document): self.selector = selector self.doc = document translator = HTMLTranslator() @lru_cache() def xpath(pattern): re...
{ "repo_name": "orf/cyborg", "path": "cyborg/selector.py", "copies": "1", "size": "1630", "license": "apache-2.0", "hash": 3957104478310924300, "line_mean": 24.0769230769, "line_max": 82, "alpha_frac": 0.6404907975, "autogenerated": false, "ratio": 4.201030927835052, "config_test": false, "has...
from functools import lru_cache import logging import pandas as pd from discoutils.thesaurus_loader import Vectors from eval.pipeline.bov import ThesaurusVectorizer class MultiVectors(Vectors): def __init__(self, vectors): self.vectors = vectors def init_sims(self, *args, **kwargs): for v in ...
{ "repo_name": "mbatchkarov/dc_evaluation", "path": "eval/pipeline/multivectors.py", "copies": "1", "size": "3155", "license": "bsd-3-clause", "hash": -2026673979519361500, "line_mean": 42.2328767123, "line_max": 115, "alpha_frac": 0.5635499208, "autogenerated": false, "ratio": 4.162269129287599, ...
from functools import lru_cache import logging import requests import urllib from eva_cttv_pipeline.trait_mapping.utils import json_request OLS_EFO_SERVER = 'https://www.ebi.ac.uk/ols' # The setting for local OLS installation should be uncommented if necessary. Note that the link # for the local deployment is differ...
{ "repo_name": "EBIvariation/eva-cttv-pipeline", "path": "eva_cttv_pipeline/trait_mapping/ols.py", "copies": "1", "size": "3709", "license": "apache-2.0", "hash": 5185457994106447000, "line_mean": 36.8469387755, "line_max": 118, "alpha_frac": 0.6872472365, "autogenerated": false, "ratio": 3.535748...
from functools import lru_cache import logging import warnings import civis from civis.resources import generate_classes_maybe_cached from civis._utils import get_api_key from civis._deprecation import deprecate_param log = logging.getLogger(__name__) RETRY_CODES = [429, 502, 503, 504] RETRY_VERBS = ['HEAD', 'TRACE...
{ "repo_name": "civisanalytics/civis-python", "path": "civis/civis.py", "copies": "1", "size": "14803", "license": "bsd-3-clause", "hash": -5328278124501232000, "line_mean": 34.3293556086, "line_max": 79, "alpha_frac": 0.5673174357, "autogenerated": false, "ratio": 4.5241442542787285, "config_te...
from functools import lru_cache import math class Solution: def mergeStones(self, stones, K: int) -> int: if (len(stones) - 1) % (K - 1): return -1 presum = [0] * (1 + len(stones)) for i in range(len(stones)): presum[i + 1] = presum[i] + stones[i] @lru_cache(...
{ "repo_name": "jiadaizhao/LeetCode", "path": "0901-1000/1000-Minimum Cost to Merge Stones/1000-Minimum Cost to Merge Stones.py", "copies": "1", "size": "1455", "license": "mit", "hash": -7542997399918738000, "line_mean": 33.6428571429, "line_max": 105, "alpha_frac": 0.4652920962, "autogenerated": f...
from functools import lru_cache import math from skimage.transform import resize from rectpack import newPacker, SORT_AREA from rectpack.guillotine import GuillotineBafSlas import numpy as np import pandas as pd from ifcb.data.adc import SCHEMA_VERSION_1 from ifcb.data.stitching import InfilledImages class Mosaic(...
{ "repo_name": "joefutrelle/pyifcb", "path": "ifcb/viz/mosaic.py", "copies": "1", "size": "2322", "license": "mit", "hash": 4971968666164284000, "line_mean": 35.873015873, "line_max": 98, "alpha_frac": 0.5684754522, "autogenerated": false, "ratio": 3.3997071742313323, "config_test": false, "ha...
from functools import lru_cache import numpy as np from menpo3d.correspond import non_rigid_icp from .data import load_template def smootherstep(x, x_min, x_max): y = np.clip((x - x_min) / (x_max - x_min), 0, 1) return 6 * (y ** 5) - 15 * (y ** 4) + 10 * (y ** 3) def generate_data_weights(template, nosetip,...
{ "repo_name": "menpo/lsfm", "path": "lsfm/correspond.py", "copies": "1", "size": "2864", "license": "bsd-3-clause", "hash": 3206032790369035000, "line_mean": 38.7777777778, "line_max": 79, "alpha_frac": 0.5101256983, "autogenerated": false, "ratio": 3.269406392694064, "config_test": false, "h...
from functools import lru_cache import os from subprocess import call, DEVNULL from time import sleep # Only available on MacOS # Install with `pip install pyobj` from AppKit import NSScreen from . import BaseSystem class System(BaseSystem): @property def browser_path(self): return os.path.join('/'...
{ "repo_name": "foxxyz/multibrowse", "path": "systems/mac.py", "copies": "1", "size": "1161", "license": "mit", "hash": -2261566442469482000, "line_mean": 29.5526315789, "line_max": 107, "alpha_frac": 0.5831180017, "autogenerated": false, "ratio": 4.088028169014085, "config_test": false, "has_...
from functools import lru_cache import os from subprocess import check_output, CalledProcessError, STDOUT def _check(path): if type(path) is not str: raise ValueError( "path must be specified as str (actual: {})".format(type(path))) if not os.path.exists(path): raise FileNotFoundEr...
{ "repo_name": "chantera/teras", "path": "teras/utils/git.py", "copies": "1", "size": "1945", "license": "mit", "hash": 299325095899491800, "line_mean": 27.1884057971, "line_max": 76, "alpha_frac": 0.6107969152, "autogenerated": false, "ratio": 3.5108303249097474, "config_test": false, "has_no...
from functools import lru_cache import os import glob import copy from itertools import product import numpy as np from scipy.ndimage import map_coordinates from scipy.interpolate import interp1d,RegularGridInterpolator,\ UnivariateSpline import astropy.units as u from astropy.io import...
{ "repo_name": "drgmk/sdf", "path": "sdf/model.py", "copies": "1", "size": "47700", "license": "mit", "hash": 5627041390633751000, "line_mean": 35.3290175171, "line_max": 90, "alpha_frac": 0.5379035639, "autogenerated": false, "ratio": 3.9581777445855115, "config_test": false, "has_no_keywords...
from functools import lru_cache import os import glob import binarytree as bt import numpy as np import emcee # in case we don't have this module try: import classifier.photometry import classifier.spectra classifier_module = True except ImportError: classifier_module = False from . import model from...
{ "repo_name": "drgmk/sdf", "path": "sdf/fitting.py", "copies": "1", "size": "21568", "license": "mit", "hash": -6115587222771727000, "line_mean": 30.7176470588, "line_max": 104, "alpha_frac": 0.5699183976, "autogenerated": false, "ratio": 3.447019338341058, "config_test": false, "has_no_keywo...
from functools import lru_cache import os import rethinkdb as r from sondra.document.schema_parser import ValueHandler try: from werkzeug.utils import secure_filename except ImportError: import re def secure_filename(name): name = re.sub(r'\s+', '-', name) # Replace white space with dash ...
{ "repo_name": "JeffHeard/sondra", "path": "sondra/files.py", "copies": "1", "size": "7919", "license": "apache-2.0", "hash": 7843037000418739000, "line_mean": 33.5807860262, "line_max": 119, "alpha_frac": 0.6036115671, "autogenerated": false, "ratio": 3.9555444555444557, "config_test": false, ...
from functools import lru_cache import os.path import pickle import glob import time import json import numpy as np from scipy.stats import truncnorm from scipy.optimize import minimize import matplotlib.pyplot as plt import corner import astropy.units as u from . import photometry from . import spectrum from . impor...
{ "repo_name": "drgmk/sdf", "path": "sdf/result.py", "copies": "1", "size": "39493", "license": "mit", "hash": 1001727455177722800, "line_mean": 37.1574879227, "line_max": 109, "alpha_frac": 0.5347276733, "autogenerated": false, "ratio": 3.6936962214739992, "config_test": false, "has_no_keywor...
from functools import lru_cache import pandas as pd import numpy as np from collections import namedtuple from pathlib import Path import artistools def parse_adata(fadata, phixsdict, ionlist): """Generate ions and their level lists from adata.txt.""" firstlevelnumber = 1 for line in fadata: if n...
{ "repo_name": "lukeshingles/artistools", "path": "artistools/atomic/__init__.py", "copies": "1", "size": "6708", "license": "mit", "hash": -3191612066305810400, "line_mean": 35.6612021858, "line_max": 118, "alpha_frac": 0.6042039356, "autogenerated": false, "ratio": 3.5586206896551724, "config_...
from functools import lru_cache import random import re from sqlalchemy import Column, String from seabird.plugin import Plugin, CommandMixin from .db import Base, DatabaseMixin class Bleep(Base): __tablename__ = "bleep" bad_word = Column(String, primary_key=True) replacement = Column(String) class ...
{ "repo_name": "belak/pyseabird", "path": "seabird/modules/bleep.py", "copies": "2", "size": "2600", "license": "mit", "hash": 9129577346569968000, "line_mean": 27.5714285714, "line_max": 80, "alpha_frac": 0.5753846154, "autogenerated": false, "ratio": 3.903903903903904, "config_test": false, ...
from functools import lru_cache import re from subprocess import call, check_output, DEVNULL, CalledProcessError from . import BaseSystem BINARIES = [ 'chromium-browser', # ubuntu/debian 'chromium', # arch 'google-chrome-stable', # arch ] class System(BaseSystem): @property @lru_...
{ "repo_name": "foxxyz/multibrowse", "path": "systems/linux.py", "copies": "1", "size": "1121", "license": "mit", "hash": -8443970751044435000, "line_mean": 31.0285714286, "line_max": 114, "alpha_frac": 0.5637823372, "autogenerated": false, "ratio": 3.9059233449477353, "config_test": false, "h...
from functools import lru_cache import re from discord.ext import commands from ..data import fighters as _fighters from .errors import SmashError WORD = re.compile(r'\W+') def find_ngrams(text: str, number: int = 3) -> set: """https://stackoverflow.com/a/52389482 returns a set of ngrams for the given stri...
{ "repo_name": "mikevb1/discordbot", "path": "cogs/smash/models/fighter.py", "copies": "1", "size": "3267", "license": "mit", "hash": -4853336788604306000, "line_mean": 28.1696428571, "line_max": 102, "alpha_frac": 0.6192225283, "autogenerated": false, "ratio": 3.594059405940594, "config_test": ...
from functools import lru_cache import requests from urllib.parse import quote_plus import config _headers = {"user-agent": "/u/gracefulcharity card bot", "X-Mashape-Authorization": config.MASHAPE_API_KEY} BASE_URI = 'https://yugiohprices.p.mashape.com' @lru_cache(maxsize=128) def get_card_data(card_n...
{ "repo_name": "burkean/gracefulcharitybot", "path": "gracefulcharity/yugiohprices.py", "copies": "1", "size": "1027", "license": "mit", "hash": -4387691744370818600, "line_mean": 26.0263157895, "line_max": 77, "alpha_frac": 0.5959104187, "autogenerated": false, "ratio": 3.694244604316547, "conf...
from functools import lru_cache import requests, re, isodate from cache import TimedObjCache import config # YouTube utilities _yt_sigs = ["youtube.com", "youtu.be"] _yt_headers = {"User-Agent": config.useragent} _yt_api_base = "https://www.googleapis.com/youtube/v3/" _yt_video_url = _yt_api_base+"videos?part={type}&...
{ "repo_name": "TheEnigmaBlade/SpamShark", "path": "media_util.py", "copies": "1", "size": "5284", "license": "mit", "hash": 5188566427218651000, "line_mean": 28.1933701657, "line_max": 155, "alpha_frac": 0.6905753217, "autogenerated": false, "ratio": 2.8937568455640745, "config_test": false, ...
from functools import lru_cache import time from sauna.plugins.base import PsutilPlugin from sauna.plugins import human_to_bytes, bytes_to_human, PluginRegister my_plugin = PluginRegister('Network') @my_plugin.plugin() class Network(PsutilPlugin): def __init__(self, config): super().__init__(config) ...
{ "repo_name": "NicolasLM/sauna", "path": "sauna/plugins/ext/network.py", "copies": "1", "size": "3029", "license": "bsd-2-clause", "hash": -3209681635300051500, "line_mean": 28.9900990099, "line_max": 73, "alpha_frac": 0.5546384946, "autogenerated": false, "ratio": 3.5803782505910164, "config_t...
from functools import lru_cache from aiohttp_session import get_session from wtforms import Form, PasswordField from wtforms.fields.html5 import EmailField from wtforms.validators import Required, EqualTo, Length, Email from wtforms.csrf.session import SessionCSRF from .cfg import cfg from .utils import is_confirmati...
{ "repo_name": "imbolc/aiohttp-login", "path": "aiohttp_login/forms.py", "copies": "1", "size": "4297", "license": "isc", "hash": 2105188118332951000, "line_mean": 29.9136690647, "line_max": 70, "alpha_frac": 0.5466604608, "autogenerated": false, "ratio": 4.706462212486309, "config_test": false,...
from functools import lru_cache from aiohttp.web_exceptions import HTTPNotFound from .models import Departamentos import chilero.web @lru_cache() def departamentos(): return Departamentos.load() @lru_cache() def search(keywords): def _do_search(): for m in departamentos().as_complete_choices(): ...
{ "repo_name": "guate/division-politica", "path": "guate/division_politica/resources.py", "copies": "1", "size": "2335", "license": "mit", "hash": 2446156780124314000, "line_mean": 27.4756097561, "line_max": 99, "alpha_frac": 0.5498929336, "autogenerated": false, "ratio": 4.025862068965517, "con...
from functools import lru_cache from .concurrency import ConcurrentShelf class AddressDictionary(): def __init__(self, file_name): self._file_name = file_name self._closed = False self._shelf = None self._shelf = ConcurrentShelf(file_name) self._shelf.lock() if '__...
{ "repo_name": "probprog/pyprob", "path": "pyprob/address_dictionary.py", "copies": "1", "size": "1116", "license": "bsd-2-clause", "hash": -6442568795722627000, "line_mean": 30, "line_max": 49, "alpha_frac": 0.5304659498, "autogenerated": false, "ratio": 3.509433962264151, "config_test": false,...
from functools import lru_cache from conditional import ldap def _ldap_get_group_members(group): return ldap.get_group(group).get_members() def _ldap_is_member_of_group(member, group): group_list = member.get("memberOf") for group_dn in group_list: if group == group_dn.split(",")[0][3:]: ...
{ "repo_name": "RamZallan/conditional", "path": "conditional/util/ldap.py", "copies": "1", "size": "3553", "license": "mit", "hash": -5255855859427642000, "line_mean": 24.3785714286, "line_max": 66, "alpha_frac": 0.7016605685, "autogenerated": false, "ratio": 3.163846838824577, "config_test": fa...
from functools import lru_cache from custom import rewards from stats.models import Award, Reward _awards_tour = Award.objects.filter(type='tour') _awards_mission = Award.objects.filter(type='mission') _awards_sortie = Award.objects.filter(type='sortie') @lru_cache(maxsize=32) def get_reward_func(func_name): r...
{ "repo_name": "Flyingfox646/flyingfox", "path": "src/stats/rewards.py", "copies": "1", "size": "1117", "license": "mit", "hash": 1857266294850504700, "line_mean": 27.641025641, "line_max": 79, "alpha_frac": 0.7072515667, "autogenerated": false, "ratio": 3.01078167115903, "config_test": false, ...
from functools import lru_cache from deuce import conf import deuce import importlib from deuce.drivers.metadatadriver import MetadataStorageDriver,\ OverlapError, GapError, ConstraintError # SQL schemas. Note: the schema is versions # in such a way that new instances always start # with user version 1, then pr...
{ "repo_name": "rackerlabs/deuce", "path": "deuce/drivers/sqlite/sqlitemetadatadriver.py", "copies": "1", "size": "24162", "license": "apache-2.0", "hash": -5310298507624648000, "line_mean": 25.9064587973, "line_max": 79, "alpha_frac": 0.5645641917, "autogenerated": false, "ratio": 3.7547785547785...
from functools import lru_cache from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.db.models import ManyToOneRel from django.utils import timezone from django.utils.crypto import get_random_string from django.utils.translation import ugettext_la...
{ "repo_name": "City-of-Helsinki/kerrokantasi", "path": "democracy/models/base.py", "copies": "1", "size": "7831", "license": "mit", "hash": -1523579263042091500, "line_mean": 39.5751295337, "line_max": 119, "alpha_frac": 0.6368279913, "autogenerated": false, "ratio": 4.360244988864142, "config_...
from functools import lru_cache from django.contrib.auth import get_permission_codename from django.db.models import Q from froide.team.models import Team AUTH_MAPPING = { 'read': 'view', 'write': 'change', } def check_permission(obj, request, verb): user = request.user if not user.is_staff: ...
{ "repo_name": "stefanw/froide", "path": "froide/helper/auth.py", "copies": "1", "size": "4514", "license": "mit", "hash": -6740018870848722000, "line_mean": 23.6666666667, "line_max": 77, "alpha_frac": 0.6240584847, "autogenerated": false, "ratio": 3.6848979591836737, "config_test": false, "h...
from functools import lru_cache from django.core.exceptions import PermissionDenied from django.http import Http404 from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse from django.utils.text import capfirst from django.utils.translation import gettext as _ fr...
{ "repo_name": "zerolab/wagtail", "path": "wagtail/contrib/settings/views.py", "copies": "10", "size": "3579", "license": "bsd-3-clause", "hash": 4990418021477917000, "line_mean": 34.0882352941, "line_max": 104, "alpha_frac": 0.666387259, "autogenerated": false, "ratio": 3.8986928104575163, "con...
from functools import lru_cache from django.core.exceptions import PermissionDenied from django.http import Http404 from django.shortcuts import get_object_or_404, redirect, render from django.utils.text import capfirst from django.utils.translation import ugettext as _ from wagtail.admin import messages from wagtail...
{ "repo_name": "mixxorz/wagtail", "path": "wagtail/contrib/settings/views.py", "copies": "3", "size": "3474", "license": "bsd-3-clause", "hash": 3138329064386283500, "line_mean": 33.74, "line_max": 104, "alpha_frac": 0.6614853195, "autogenerated": false, "ratio": 3.877232142857143, "config_test"...
from functools import lru_cache from django.core.management.base import BaseCommand, CommandError from django.db import transaction from events.models import Event, Keyword, KeywordSet, DataSource HELSINKI_KEYWORD_SET_DATA = { 'id': 'helsinki:audiences', 'name_en': 'Helsinki audiences', 'name_fi': 'Helsi...
{ "repo_name": "City-of-Helsinki/linkedevents", "path": "events/management/commands/add_helsinki_audience.py", "copies": "1", "size": "5368", "license": "mit", "hash": -7952355949957708000, "line_mean": 41.1653543307, "line_max": 117, "alpha_frac": 0.6162464986, "autogenerated": false, "ratio": 3....
from functools import lru_cache from django.core.management.base import BaseCommand, CommandError from django.db import transaction from events.models import Event, Keyword, KeywordSet HELSINKI_KEYWORD_SET_DATA = { 'id': 'helsinki:audiences', 'name_en': 'Helsinki audiences', 'name_fi': 'Helsinki kohderyh...
{ "repo_name": "tuomas777/linkedevents", "path": "events/management/commands/add_helsinki_audience.py", "copies": "2", "size": "4899", "license": "bsd-3-clause", "hash": -4053264242396634000, "line_mean": 39.0655737705, "line_max": 117, "alpha_frac": 0.6123158756, "autogenerated": false, "ratio": ...
from functools import lru_cache from django.core.management.base import BaseCommand, CommandError from django.db import transaction from events.models import Keyword, KeywordSet, DataSource HELFI_KEYWORD_SET_DATA = { 'id': 'helfi:topics', 'name_en': 'www.hel.fi themes', 'name_fi': 'www.hel.fi-aihepiirit'...
{ "repo_name": "City-of-Helsinki/linkedevents", "path": "events/management/commands/add_helfi_topics.py", "copies": "1", "size": "4146", "license": "mit", "hash": 2507051638608980500, "line_mean": 33.475, "line_max": 116, "alpha_frac": 0.5678027556, "autogenerated": false, "ratio": 3.3606823720552...
from functools import lru_cache from django.core.management.base import BaseCommand, CommandError from django.db import transaction from events.models import Keyword, KeywordSet, DataSource HELSINKI_KEYWORD_SET_DATA = { 'id': 'helsinki:topics', 'name_en': 'Helsinki topics', 'name_fi': 'Helsinki-aihepiiri...
{ "repo_name": "City-of-Helsinki/linkedevents", "path": "events/management/commands/add_helsinki_topics.py", "copies": "1", "size": "3012", "license": "mit", "hash": 6162979680510005000, "line_mean": 35.265060241, "line_max": 114, "alpha_frac": 0.6255813953, "autogenerated": false, "ratio": 3.1321...
from functools import lru_cache from django import http from django.conf import settings from catalog import typing from catalog.context.base import Products, Tags from images.models import ImageQuerySet from refarm_pagination.context import PaginationContext class ProductBrands(Products): def __init__(self, p...
{ "repo_name": "fidals/refarm-site", "path": "catalog/context/products.py", "copies": "1", "size": "2173", "license": "mit", "hash": 2764574087406159400, "line_mean": 25.5, "line_max": 82, "alpha_frac": 0.5996318454, "autogenerated": false, "ratio": 4.294466403162056, "config_test": false, "ha...
from functools import lru_cache from django import template from django.conf import settings from django.forms.formsets import BaseFormSet from django.template.loader import get_template from crispy_forms.helper import FormHelper from crispy_forms.utils import TEMPLATE_PACK, get_template_pack register = template.Lib...
{ "repo_name": "django-crispy-forms/django-crispy-forms", "path": "crispy_forms/templatetags/crispy_forms_tags.py", "copies": "2", "size": "10384", "license": "mit", "hash": -7153359252313214000, "line_mean": 37.1764705882, "line_max": 116, "alpha_frac": 0.6126733436, "autogenerated": false, "rati...
from functools import lru_cache from django import template from django.conf import settings from django.forms import boundfield from django.forms.formsets import BaseFormSet from django.template import Context from django.template.loader import get_template from django.utils.safestring import mark_safe from crispy_f...
{ "repo_name": "maraujop/django-crispy-forms", "path": "crispy_forms/templatetags/crispy_forms_filters.py", "copies": "2", "size": "4743", "license": "mit", "hash": -2199933348697774000, "line_mean": 29.0189873418, "line_max": 88, "alpha_frac": 0.6209150327, "autogenerated": false, "ratio": 3.7672...
from functools import lru_cache from django.utils.crypto import salted_hmac, constant_time_compare from django.urls import reverse from django.conf import settings from crossdomainmedia import CrossDomainMediaAuth from froide.helper.auth import ( can_read_object, can_write_object, can_manage_object, has_auth...
{ "repo_name": "stefanw/froide", "path": "froide/foirequest/auth.py", "copies": "1", "size": "5149", "license": "mit", "hash": 2059938595774656000, "line_mean": 27.9269662921, "line_max": 78, "alpha_frac": 0.6791610021, "autogenerated": false, "ratio": 3.7474526928675402, "config_test": false, ...
from functools import lru_cache from fastapi import Depends from opentrons.api import MainRouter from opentrons.hardware_control import ThreadManager, ThreadedAsyncLock from robot_server.service.session.manager import SessionManager from robot_server.service.legacy.rpc import RPCServer from . import HARDWARE_APP_KEY ...
{ "repo_name": "OpenTrons/opentrons_sdk", "path": "robot-server/robot_server/service/dependencies.py", "copies": "1", "size": "1535", "license": "apache-2.0", "hash": -2461046836795708000, "line_mean": 27.9622641509, "line_max": 77, "alpha_frac": 0.7185667752, "autogenerated": false, "ratio": 3.83...
from functools import lru_cache from gfxutils import Color, V2 from . import core from .image import Image, Sprite class Font: def __init__(self, renderer, filename, size=24): self.renderer = renderer self.font = core.open_font(filename.encode('utf-8'), size) @lru_cache() def render(se...
{ "repo_name": "Steven-Wilson/pyxlgame", "path": "font.py", "copies": "1", "size": "1075", "license": "mit", "hash": -9098668530189352000, "line_mean": 32.59375, "line_max": 74, "alpha_frac": 0.6046511628, "autogenerated": false, "ratio": 3.7587412587412588, "config_test": false, "has_no_keywo...
from functools import lru_cache from gfxutils import V2, Color, Rect from . import core DRAW_BORDERS = False class Image: 'Stores image data -- Cannot be drawn directly' def __init__(self, renderer, texture, size, frames): self.renderer = renderer self.texture = texture self.size ...
{ "repo_name": "Steven-Wilson/pyxlgame", "path": "image.py", "copies": "1", "size": "4574", "license": "mit", "hash": 7121355629803069000, "line_mean": 31.2112676056, "line_max": 93, "alpha_frac": 0.5172715348, "autogenerated": false, "ratio": 3.859915611814346, "config_test": false, "has_no_k...
from functools import lru_cache from hwt.hdl.operatorDefs import AllOps from hwtHls.allocator.allocator import HlsAllocator from math import log2 from hwtHls.platform.opRealizationMeta import OpRealizationMeta from hwtHls.scheduler.force_directed import ForceDirectedScheduler from hwtHls.scheduler.list_schedueling imp...
{ "repo_name": "Nic30/hwtHls", "path": "hwtHls/platform/virtual.py", "copies": "1", "size": "2845", "license": "mit", "hash": -3404496479752239000, "line_mean": 25.3425925926, "line_max": 78, "alpha_frac": 0.5901581722, "autogenerated": false, "ratio": 3.17877094972067, "config_test": false, "...
from functools import lru_cache from hwtHls.platform.interpolations import interpolate_area_2d, downscale_width class AbstractXilinxPlatform(): def __init__(self): # {inputCnt: (lut6_coef, mux7f_coef, mux8f_coef)} self.mux_coefs = self._initMuxCoefs() self.mux_coefs_inputs = list(self.mux...
{ "repo_name": "Nic30/hwtHls", "path": "hwtHls/platform/xilinx/abstract.py", "copies": "1", "size": "3632", "license": "mit", "hash": 9179609975619353000, "line_mean": 31.7207207207, "line_max": 79, "alpha_frac": 0.5547907489, "autogenerated": false, "ratio": 3.588932806324111, "config_test": fa...
from functools import lru_cache from . import app, configure, request from . import get_or_create, commit from . import BaseIngestResource, QueryResource from ..models.cinder import ( Snapshot, AvailabilityZone, Volume, VolumeSnapshot, VolumeStatus, VolumeState, VolumeAttachment) class SnapshotResource(Quer...
{ "repo_name": "eResearchSA/reporting-unified", "path": "unified/apis/cinder.py", "copies": "1", "size": "3285", "license": "apache-2.0", "hash": -2861473051433048600, "line_mean": 28.0707964602, "line_max": 82, "alpha_frac": 0.5482496195, "autogenerated": false, "ratio": 5.239234449760765, "con...
from functools import lru_cache from . import app, configure, request from . import get_or_create, commit from . import QueryResource, BaseIngestResource from nectar import get_domain from ..models.keystone import ( Snapshot, Account, Tenant, Domain, Membership, AccountReference, AccountReferenceMapping) cl...
{ "repo_name": "eResearchSA/reporting-unified", "path": "unified/apis/keystone.py", "copies": "1", "size": "3389", "license": "apache-2.0", "hash": -2952160291906767000, "line_mean": 26.7786885246, "line_max": 79, "alpha_frac": 0.5768663323, "autogenerated": false, "ratio": 4.961932650073207, "c...
from functools import lru_cache from notifications_utils.columns import Columns from notifications_utils.sanitise_text import SanitiseASCII from .data import ( ADDITIONAL_SYNONYMS, COUNTRIES_AND_TERRITORIES, EUROPEAN_ISLANDS, ROYAL_MAIL_EUROPEAN, UK, UK_ISLANDS, WELSH_NAMES, Postage, )...
{ "repo_name": "alphagov/notifications-utils", "path": "notifications_utils/countries/__init__.py", "copies": "1", "size": "2164", "license": "mit", "hash": 8113664969215347000, "line_mean": 24.6666666667, "line_max": 72, "alpha_frac": 0.6108534323, "autogenerated": false, "ratio": 3.6981132075471...
from functools import lru_cache from numpy import ( asarray, atleast_2d, concatenate, empty, eye, kron, log, sqrt, tensordot, zeros_like, ) from numpy.linalg import eigh from optimix import Function from ._free import FreeFormCov from ._lrfree import LRFreeFormCov from .._util...
{ "repo_name": "glimix/limix-inference", "path": "glimix_core/cov/_kron2sum.py", "copies": "1", "size": "11640", "license": "mit", "hash": -3970539704452696000, "line_mean": 25.0092592593, "line_max": 88, "alpha_frac": 0.4744571022, "autogenerated": false, "ratio": 2.8125156445556945, "config_te...
from functools import lru_cache from scipy.special import binom from vectortween.Animation import Animation from vectortween.ParallelAnimation import ParallelAnimation from vectortween.ParametricAnimation import ParametricAnimation class BezierCurveAnimation(Animation): """ animation of a 2d position (conve...
{ "repo_name": "shimpe/pyvectortween", "path": "vectortween/BezierCurveAnimation.py", "copies": "1", "size": "2705", "license": "mit", "hash": -6104968054944312000, "line_mean": 43.3442622951, "line_max": 115, "alpha_frac": 0.6277264325, "autogenerated": false, "ratio": 3.665311653116531, "confi...
from functools import lru_cache from sqlparse import parse, tokens from sqlparse.sql import Comment, IdentifierList, Parenthesis, Token @lru_cache(maxsize=500) def sql_fingerprint(query, hide_columns=True): """ Simplify a query, taking away exact values and fields selected. Imperfect but better than sup...
{ "repo_name": "YPlan/django-perf-rec", "path": "src/django_perf_rec/sql.py", "copies": "1", "size": "4796", "license": "mit", "hash": -4027937071381561000, "line_mean": 28.975, "line_max": 84, "alpha_frac": 0.5806922435, "autogenerated": false, "ratio": 3.7645211930926217, "config_test": false,...
from functools import lru_cache from starlette import status from fastapi import Depends, HTTPException from opentrons.api import MainRouter from opentrons.hardware_control import ThreadManager, ThreadedAsyncLock from robot_server.hardware_wrapper import HardwareWrapper from robot_server.service.session.manager impor...
{ "repo_name": "OpenTrons/opentrons-api", "path": "robot-server/robot_server/service/dependencies.py", "copies": "2", "size": "2299", "license": "apache-2.0", "hash": 2336353709215379000, "line_mean": 29.25, "line_max": 77, "alpha_frac": 0.708568943, "autogenerated": false, "ratio": 4.090747330960...
from functools import lru_cache from sympy import Symbol from sympy.parsing.sympy_parser import parse_expr from vectortween.Animation import Animation from vectortween.Tween import Tween class ParametricAnimation(Animation): """ class to animate the value of a number between startframe and stopframe twe...
{ "repo_name": "shimpe/pyvectortween", "path": "vectortween/ParametricAnimation.py", "copies": "1", "size": "4846", "license": "mit", "hash": 6925188636088629000, "line_mean": 36.2769230769, "line_max": 121, "alpha_frac": 0.5980189847, "autogenerated": false, "ratio": 3.988477366255144, "config_...
from functools import lru_cache from sympy import Symbol, pi, sin, cos from sympy.parsing.sympy_parser import parse_expr from vectortween.Animation import Animation from vectortween.ParallelAnimation import ParallelAnimation from vectortween.ParametricAnimation import ParametricAnimation class PolarAnimation(Animat...
{ "repo_name": "shimpe/pyvectortween", "path": "vectortween/PolarAnimation.py", "copies": "1", "size": "7189", "license": "mit", "hash": -696790920484641500, "line_mean": 43.93125, "line_max": 116, "alpha_frac": 0.5868688274, "autogenerated": false, "ratio": 3.5695134061569016, "config_test": fa...
from functools import lru_cache from vectortween.Animation import Animation from vectortween.Mapping import Mapping from vectortween.Tween import Tween class NumberAnimation(Animation): """ class to animate the value of a number between startframe and stopframe tweening optionally can be applied (default...
{ "repo_name": "shimpe/pyvectortween", "path": "vectortween/NumberAnimation.py", "copies": "1", "size": "2356", "license": "mit", "hash": -6466285005523409000, "line_mean": 33.6470588235, "line_max": 107, "alpha_frac": 0.6056876061, "autogenerated": false, "ratio": 4.184724689165186, "config_tes...
from functools import lru_cache from vectortween.Animation import Animation from vectortween.NumberAnimation import NumberAnimation from vectortween.Tween import Tween class PointAnimation(Animation): """ animation of a 2d position (convenience class composing two number animations) """ def __init__...
{ "repo_name": "shimpe/pyvectortween", "path": "vectortween/PointAnimation.py", "copies": "1", "size": "2417", "license": "mit", "hash": -9050388031006177000, "line_mean": 45.4807692308, "line_max": 107, "alpha_frac": 0.6578402979, "autogenerated": false, "ratio": 3.7472868217054263, "config_tes...
from functools import lru_cache from vectortween.Animation import Animation from vectortween.NumberAnimation import NumberAnimation class ColorAnimation(Animation): """ class to animate a color colors are specified as tuples (r,g,b) where for each color component c 0<=c<=1 """ def __init__(...
{ "repo_name": "shimpe/pyvectortween", "path": "vectortween/ColorAnimation.py", "copies": "1", "size": "3700", "license": "mit", "hash": 1762736590989704000, "line_mean": 45.835443038, "line_max": 132, "alpha_frac": 0.6364864865, "autogenerated": false, "ratio": 3.9278131634819533, "config_test"...
from functools import lru_cache import hashlib salt = 'yjdafjpo' #salt = 'abc' hashes = {} @lru_cache(None) def first_with_three(s): cnt = 0 prev_x = None for x in s: if prev_x != x: cnt = 0 cnt += 1 if cnt == 3: return x prev_x = x return...
{ "repo_name": "matslindh/codingchallenges", "path": "adventofcode2016/14.py", "copies": "1", "size": "1448", "license": "mit", "hash": -9010889376516700000, "line_mean": 15.6551724138, "line_max": 73, "alpha_frac": 0.4613259669, "autogenerated": false, "ratio": 3.196467991169978, "config_test":...
from functools import lru_cache import jsonref from ocdsmerge.util import get_release_schema_url, get_tags def get_merge_rules(schema=None): """ Returns merge rules as key-value pairs, in which the key is a JSON path as a tuple, and the value is a list of merge properties whose values are `true`. ""...
{ "repo_name": "open-contracting/ocds-merge", "path": "ocdsmerge/rules.py", "copies": "1", "size": "3045", "license": "bsd-3-clause", "hash": -657399837298094800, "line_mean": 38.5454545455, "line_max": 119, "alpha_frac": 0.6357963875, "autogenerated": false, "ratio": 3.6078199052132702, "config...
from functools import lru_cache import logging from typing import Dict import spot from config import LTL3BA_PATH from helpers.python_ext import is_empty_str from helpers.shell import execute_shell from interfaces.LTL_to_automaton import LTLToAutomaton from interfaces.automaton import Automaton from interfaces.expr ...
{ "repo_name": "5nizza/party-elli", "path": "LTL_to_atm/translator_via_ltl3ba.py", "copies": "1", "size": "2069", "license": "mit", "hash": -1540349401247320000, "line_mean": 39.568627451, "line_max": 112, "alpha_frac": 0.6457225713, "autogenerated": false, "ratio": 3.4085667215815487, "config_t...
from functools import lru_cache import math from scipy import optimize, stats, integrate import numpy as np import quaternion # adds to numpy # noqa # pylint: disable=unused-import import cv2 from scipy.optimize import leastsq from visnav.settings import * class ImageProc: latest_opt = None show_fit = No...
{ "repo_name": "oknuutti/visnav-py", "path": "visnav/algo/image.py", "copies": "1", "size": "16219", "license": "mit", "hash": -6727986656705697000, "line_mean": 36.6310904872, "line_max": 159, "alpha_frac": 0.5298107158, "autogenerated": false, "ratio": 3.226377561169684, "config_test": false, ...
from functools import lru_cache import numpy as np from opensfm import bow from opensfm import feature_loader from opensfm.dataset import DataSetBase def unnormalized_vlad(features, centers): """Compute unnormalized VLAD histograms from a set of features in relation to centers. Returns the unnormalized ...
{ "repo_name": "oscarlorentzon/OpenSfM", "path": "opensfm/vlad.py", "copies": "1", "size": "2003", "license": "bsd-2-clause", "hash": 6615733892999443000, "line_mean": 26.0675675676, "line_max": 69, "alpha_frac": 0.6350474289, "autogenerated": false, "ratio": 3.4956369982547995, "config_test": f...
from functools import lru_cache import numpy as np import lie_learn.spaces.S2 as S2 def change_coordinates(coords, p_from='C', p_to='S'): """ Change Spherical to Cartesian coordinates and vice versa, for points x in S^3. We use the following coordinate system: https://en.wikipedia.org/wiki/N-sphere#...
{ "repo_name": "AMLab-Amsterdam/lie_learn", "path": "lie_learn/spaces/S3.py", "copies": "1", "size": "6760", "license": "mit", "hash": 1355352404733448000, "line_mean": 32.631840796, "line_max": 119, "alpha_frac": 0.5434235834, "autogenerated": false, "ratio": 3.287451361867704, "config_test": f...
from functools import lru_cache import numpy as np from ...core.utils import as_id_array from ...utils.decorators import read_only_array from ..voronoi.voronoi import DelaunayGraph class RadialGraphLayout: @staticmethod def number_of_nodes(shape): return np.sum(np.arange(1, shape[0] + 1)) * shape[1]...
{ "repo_name": "cmshobe/landlab", "path": "landlab/graph/radial/radial.py", "copies": "3", "size": "7137", "license": "mit", "hash": -384920638785078850, "line_mean": 26.2404580153, "line_max": 87, "alpha_frac": 0.5376208491, "autogenerated": false, "ratio": 3.421380632790029, "config_test": fal...
from functools import lru_cache import requests @lru_cache(maxsize=100000) def get_label_from_rxcui(rxcui): url = "https://rxnav.nlm.nih.gov/REST/rxcui/{}/properties.json".format(rxcui) d = requests.get(url).json() if d: return d['properties']['name'] @lru_cache(maxsize=100000) def get_rxcui_br...
{ "repo_name": "SuLab/scheduled-bots", "path": "scheduled_bots/drugs/pharma/rxnorm.py", "copies": "1", "size": "2134", "license": "mit", "hash": -8218233992204811000, "line_mean": 31.3333333333, "line_max": 105, "alpha_frac": 0.6640112465, "autogenerated": false, "ratio": 2.8190224570673714, "co...