id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
3,300
volume
""" Domain class definition. """ import logging import numpy as np from collections import OrderedDict from ..tools.array import prod from ..tools.cache import CachedMethod, CachedClass, CachedAttribute from ..tools.general import unify_attributes, unify, OrderedSet from .coords import Coordinate, CartesianCoordinate...
3,301
test ksize2x2 stride1x1 rate1x1 valid
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
3,302
test gmm wrong descriptor format 4
import pytest import numpy as np pytest.importorskip('sklearn') from skimage.feature._fisher_vector import ( # noqa: E402 learn_gmm, fisher_vector, FisherVectorException, DescriptorException ) def test_gmm_wrong_descriptor_format_1(): """Test that DescriptorException is raised when wrong type for des...
3,303
add regs
# See LICENSE for licensing information. # # Copyright (c) 2016-2023 Regents of the University of California and The Board # of Regents for the Oklahoma Agricultural and Mechanical College # (acting for and on behalf of Oklahoma State University) # All rights reserved. # import math from openram.tech import spice cla...
3,304
wrapper
#!/usr/bin/env python3 # copyright (c) 2020 Bowen Ding # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, m...
3,305
get form kwargs
# # This file is part of pretix (Community Edition). # # Copyright (C) 2014-2020 Raphael Michel and contributors # Copyright (C) 2020-2021 rami.io GmbH and contributors # # This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General # Public License as published by ...
3,306
test positive list installable updates
"""Test for Content Access (Golden Ticket) CLI :Requirement: Content Access :CaseLevel: Acceptance :CaseComponent: Hosts-Content :CaseAutomation: Automated :team: Phoenix-subscriptions :TestType: Functional :Upstream: No """ import time import pytest from nailgun import entities from robottelo.cli.host import ...
3,307
test custom routing prefix
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import time from mcrouter.test.MCProcess import Memcached from mcrouter.test.McrouterTestCase import McrouterTestCa...
3,308
set ttl state
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: dynamodb_ttl version_added: 1.0.0 short_description: Set TTL for a given DynamoDB table description: - Sets the TTL for a...
3,309
set pids
# Copyright (C) 2010-2015 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. import glob import logging import os import shutil from lib.api.process import Process from lib.common.exceptions import CuckooPackageError log = log...
3,310
should exit
import logging import os from typing import Optional from jina.importer import ImportExtensions from jina.serve.runtimes.servers import BaseServer from jina._docarray import docarray_v2 class WebSocketServer(BaseServer): """WebSocket Server implementation""" def __init__( self, ssl_...
3,311
test create relation
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 import unittest from unittest.mock import ANY from databuilder.models.dashboard.dashboard_query import DashboardQuery from databuilder.models.graph_serializable import ( NODE_KEY, NODE_LABEL, RELATION_END_KEY, RELATION_END_LAB...
3,312
decorator
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
3,313
test var collection contains
import pytest from pyaerocom import const from pyaerocom.data import resources from pyaerocom.exceptions import VariableDefinitionError from pyaerocom.varcollection import VarCollection from pyaerocom.variable import Variable def test_VARS_is_VarCollection(): assert isinstance(const.VARS, VarCollection) @pytes...
3,314
update unindexed threads
""" 4Chan board scraper - indexes threads and queues them for scraping """ import json from backend.lib.scraper import BasicJSONScraper from common.lib.exceptions import JobAlreadyExistsException class BoardScraper4chan(BasicJSONScraper): """ Scrape 4chan boards The threads found aren't saved themselves, but ne...
3,315
data to dict
""" Parse the Audio SNIPS corpus Authors: * Heng-Jui Chang 2022 """ import logging from collections import OrderedDict from pathlib import Path from typing import Any, Dict, List from tqdm import trange from .base import Corpus __all__ = [ "SNIPS", ] class SNIPS(Corpus): def __init__( self, ...
3,316
flatten
from urllib.parse import parse_qs, unquote, urlparse from braceexpand import braceexpand import requests # https://github.com/mozilla/bedrock/blob/master/tests/redirects/base.py def get_abs_url(url, base_url): if url.startswith("/"): # urljoin messes with query strings too much return "".join([b...
3,317
test get all form definitions grouped by
import uuid from django.test import TestCase from corehq.apps.app_manager.tests.app_factory import AppFactory from corehq.apps.reports.analytics.couchaccessors import ( SimpleFormInfo, get_all_form_definitions_grouped_by_app_and_xmlns, get_all_form_details, get_form_details_for_app, get_form_detai...
3,318
mock time
"""retry tests.""" import asyncio import dataclasses import datetime import sys from typing import Iterator from unittest import mock import pytest from wandb.sdk.lib import retry if sys.version_info >= (3, 10): asyncio_run = asyncio.run else: def asyncio_run(coro): return asyncio.new_event_loop().r...
3,319
set service properties
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
3,320
test flag overrides env var
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
3,321
url set anchor
# ContentDB # Copyright (C) 2018-21 rubenwardy # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program...
3,322
add dict
import os import shutil from django.core.files import File from django.utils import timezone from django.utils.crypto import get_random_string from ...core.utils import slugify FILENAME_MAX_LEN = 50 class DataArchive: def __init__(self, user, working_dir_path): self.user = user self.working_dir...
3,323
setup
# monet_theming_group.py # # Change the look of Adwaita, with ease # Copyright (C) 2023, Gradience Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (a...
3,324
assert sigmoid classification
#!/usr/bin/env python3 import unittest import torch from captum._utils.typing import BaselineType, Tensor from captum.attr._core.integrated_gradients import IntegratedGradients from captum.attr._core.noise_tunnel import NoiseTunnel from tests.helpers.basic import assertTensorAlmostEqual, BaseTest from tests.helpers.c...
3,325
add minecraft service servicer to server
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 import minecraft_pb2 as minecraft__pb2 class MinecraftServiceStub(object): """*...
3,326
test elementwise merge do not erase
# coding=utf-8 import json from bzt.engine import Configuration from bzt.utils import BetterDict, dehumanize_time, temp_file from tests.unit import BZTestCase, RESOURCES_DIR, BASE_CONFIG, ROOT_LOGGER, EngineEmul class TestConfiguration(BZTestCase): def test_load(self): obj = Configuration() confi...
3,327
poplast
from _typeshed import SupportsKeysAndGetItem from binascii import Incomplete from collections.abc import Generator, ItemsView, Iterable, KeysView, ValuesView from typing import NoReturn, TypeVar from typing_extensions import Self, TypeAlias _KT = TypeVar("_KT") _VT = TypeVar("_VT") _T = TypeVar("_T") class OrderedMul...
3,328
log
import abc import colorlog import contextlib import inspect import io import logging import sys import traceback from magma.backend.util import make_relative from magma.common import Stack from magma.config import config, EnvConfig config._register( log_stream=EnvConfig("MAGMA_LOG_STREAM", "stderr"), log_lev...
3,329
get mapping data
""" Reference-physical domain mappings. """ import numpy as nm from sfepy.base.base import Struct from sfepy.discrete.common.extmods.cmapping import CMapping class PyCMapping(Struct): """ Class for storing mapping data. Primary data in numpy arrays. Data for C functions translated to FMFields and embedde...
3,330
set active severity
"""Contains the NotifyPanel class.""" __all__ = ['NotifyPanel'] class NotifyPanel: """NotifyPanel class: this class contains methods for creating a panel to control direct/panda notify categories.""" def __init__(self, directNotify, tl = None): """ NotifyPanel class pops up a control pan...
3,331
enabled
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
3,332
test property decorator baseclass doc
# Test case for property # more tests are in test_descr import sys import unittest from test.test_support import run_unittest class PropertyBase(Exception): pass class PropertyGet(PropertyBase): pass class PropertySet(PropertyBase): pass class PropertyDel(PropertyBase): pass class BaseClass(object...
3,333
extract formats
# coding: utf-8 from __future__ import unicode_literals import json import re from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, merge_dicts, parse_codecs, urljoin, ) class StreamCZIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:stream|televizeseznam)...
3,334
cwd
import enum from _typeshed import Incomplete from typing import Any, NamedTuple from psutil._common import ( NIC_DUPLEX_FULL as NIC_DUPLEX_FULL, NIC_DUPLEX_HALF as NIC_DUPLEX_HALF, NIC_DUPLEX_UNKNOWN as NIC_DUPLEX_UNKNOWN, AccessDenied as AccessDenied, NoSuchProcess as NoSuchProcess, ZombieProc...
3,335
toggle
# Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from __future__ import annotations import json from typing import Callable import aqt from anki.cards import Card, CardId from anki.lang import without_unicode_isolation from aqt.qt import *...
3,336
job retry data
import json import os import re from datetime import datetime from pathlib import Path from time import sleep from typing import Any import gitlab import psycopg2 import yaml from kubernetes import client, config from kubernetes.client.exceptions import ApiException from kubernetes.client.models.v1_pod import V1Pod fr...
3,337
main
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: elasticache_subnet_group version_added: 1.0.0 short_description: manage ElastiCache subnet groups description: - Create...
3,338
actions
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
3,339
test can launch
# pylint: disable=protected-access, unused-argument, no-value-for-parameter import os from unittest import mock, TestCase from .test_common import setUp from radical.pilot.agent.launch_method.aprun import APRun # ------------------------------------------------------------------------------ # class TestAPRun(TestC...
3,340
detector id
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
3,341
solve mat
# This file is part of PyOP2 # # PyOP2 is Copyright (c) 2012-2014, Imperial College London and # others. Please see the AUTHORS file in the main source directory for # a full list of copyright holders. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permi...
3,342
test content hash differs
from collections.abc import ( Callable, Mapping, ) from reconcile.saas_auto_promotions_manager.subscriber import ( CONTENT_HASH_LENGTH, ConfigHash, Subscriber, ) from .data_keys import ( DESIRED_REF, DESIRED_TARGET_HASHES, NAMESPACE_REF, TARGET_FILE_PATH, ) def test_can_compute_c...
3,343
is client error
from enum import IntEnum class codes(IntEnum): """HTTP status codes and reason phrases Status codes from the following RFCs are all observed: * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 * RFC 6585: Additional HTTP Status Codes * RFC 3229: Delta encoding in HTTP...
3,344
init models
# SPDX-License-Identifier: LGPL-3.0-or-later import json import os import unittest import numpy as np from common import ( j_loader, run_dp, tests_path, ) from deepmd.env import ( GLOBAL_NP_FLOAT_PRECISION, tf, ) from deepmd.train.run_options import ( RunOptions, ) from deepmd.train.trainer im...
3,345
main
import os import argparse import json import pandas as pd from autogluon.multimodal import MultiModalPredictor from ray import tune from dataset import ( AdultTabularDataset, AloiTabularDataset, CaliforniaHousingTabularDataset, CovtypeTabularDataset, EpsilonTabularDataset, HelenaTabularDataset,...
3,346
get object name
import functools import inspect import re from typing import Callable, Iterable, List, Optional, Any, Union, TYPE_CHECKING import interactions.api.events as events from interactions.client.const import T from interactions.models.discord.enums import ComponentType if TYPE_CHECKING: from interactions.models.discord...
3,347
show search
# -*- coding: utf-8 -*- # vStream https://github.com/Kodi-vStream/venom-xbmc-addons import re from resources.lib.gui.hoster import cHosterGui from resources.lib.gui.gui import cGui from resources.lib.handler.inputParameterHandler import cInputParameterHandler from resources.lib.handler.outputParameterHandler import c...
3,348
flatten errors
import json from typing import TYPE_CHECKING, Any, Dict, Generator, List, Optional, Sequence, Tuple, Type, Union from .json import pydantic_encoder from .utils import Representation if TYPE_CHECKING: from typing_extensions import TypedDict from .config import BaseConfig from .types import ModelOrDc f...
3,349
test static
import unittest from unittest.mock import patch import numpy as np import xarray as xr from data.calculated import CalculatedArray, CalculatedData from data.variable import Variable from data.variable_list import VariableList class TestCalculatedData(unittest.TestCase): @patch("data.sqlite_database.SQLiteDataba...
3,350
parse account
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
3,351
test subrequests are logged as subrequest summary
import json import logging import unittest from unittest import mock from pyramid import testing from kinto.core import DEFAULT_SETTINGS, JsonLogFormatter, initialization from .support import BaseWebTest class RequestSummaryTest(BaseWebTest, unittest.TestCase): def setUp(self): super().setUp() ...
3,352
test condition decision
# ---------------------------------------------------------------------------- # Copyright (C) 2021-2023 Deepchecks (https://www.deepchecks.com) # # This file is part of Deepchecks. # Deepchecks is distributed under the terms of the GNU Affero General # Public License (version 3 or later). # You should have received a ...
3,353
test xpathbuilder with eval
""" Tests of the XPathBuilder class. """ import pytest from lxml import etree TEST_INPXML_PATH = 'fleur/Max-R5/FePt_film_SSFT_LO/files/inp2.xml' def test_xpathbuilder(): """ Test the basic behaviour of the XPathBuilder class. """ from masci_tools.util.xml.xpathbuilder import XPathBuilder simple_...
3,354
implements bool
# flake8: noqa # This whole file is full of lint errors import codecs import sys import operator import functools import warnings try: import builtins except ImportError: import __builtin__ as builtins PY2 = sys.version_info[0] == 2 WIN = sys.platform.startswith('win') _identity = lambda x: x if PY2: u...
3,355
test parse timestamp with timezone invalid timezone
from __future__ import annotations import string import hypothesis as h import hypothesis.strategies as st import parsy import pytest import ibis.expr.datatypes as dt import ibis.tests.strategies as its from ibis.common.annotations import ValidationError @pytest.mark.parametrize( ("spec", "expected"), [ ...
3,356
teardown
# -*- coding: utf-8 -*- """ jinja2.testsuite ~~~~~~~~~~~~~~~~ All the unittests of Jinja2. These tests can be executed by either running run-tests.py using multiple Python versions at the same time. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ i...
3,357
run
from __future__ import annotations import logging import typing as t from types import ModuleType import cloudpickle import bentoml from ...exceptions import MissingDependencyException from ...exceptions import NotFound from ..models.model import Model from ..models.model import ModelContext from ..models.model imp...
3,358
test service names import and v0
import pytest @pytest.mark.subprocess(env=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0")) def test_service_names_import_default(): from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME from ddtrace.internal.schema import schematize_cache_operation from ddtrace.internal.schema import schematize_cloud_ap...
3,359
reset
""" Create aircraft trails on the radar display.""" from math import * import numpy as np import bluesky as bs from bluesky import settings from bluesky.core import TrafficArrays class Trails(TrafficArrays): """ Traffic trails class definition : Data for trails Methods: Trails() : ...
3,360
delete
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
3,361
get unicode value
""" @package dbmgr.vinfo @brief Support classes for Database Manager List of classes: - vinfo::VectorDBInfo (C) 2007-2013 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. @author Martin Landa <landa.ma...
3,362
test decimated offset 105
""" Name: decimation_test Purpose: v.in.lidar decimation test Author: Vaclav Petras Copyright: (C) 2015 by Vaclav Petras and the GRASS Development Team Licence: This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for d...
3,363
test prediction labels confidence
# -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function import os import sys import unittest # noinspection PyProtectedMember from numpy.testing import assert_equal from numpy.testing import assert_raises from sklearn.base import clone from sklearn.metrics import roc_auc_score #...
3,364
test periodic value repr
# Copyright 2018 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
3,365
wrap
from types import CodeType from types import FunctionType from typing import Any from typing import Callable from typing import Dict from typing import List from typing import Optional from typing import Set from typing import cast from ddtrace.debugging._function.discovery import FullyNamed from ddtrace.internal.inje...
3,366
private link service connection state
# coding=utf-8 # *** WARNING: this file was generated by pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from . imp...
3,367
output handler
import logging import os from redash.query_runner import ( TYPE_DATETIME, TYPE_FLOAT, TYPE_INTEGER, TYPE_STRING, BaseSQLQueryRunner, JobTimeoutException, register, ) from redash.utils import json_dumps, json_loads try: import oracledb TYPES_MAP = { oracledb.DATETIME: TYPE_...
3,368
process query params
import json from typing import Dict, List, Tuple from django import forms from django.conf import settings __all__ = ( 'APISelect', 'APISelectMultiple', ) class APISelect(forms.Select): """ A select widget populated via an API call :param api_url: API endpoint URL. Required if not set automatic...
3,369
ensure context
""" Expose each GPU devices directly. This module implements a API that is like the "CUDA runtime" context manager for managing CUDA context stack and clean up. It relies on thread-local globals to separate the context stack management of each thread. Contexts are also shareable among threads. Only the main thread c...
3,370
quat2 yaw
import rospy import threading from math import asin, atan2, pi from nav_msgs.msg import Odometry def METHOD_NAME(qw, qx, qy, qz): ''' Translates from Quaternion to Yaw. @param qw,qx,qy,qz: Quaternion values @type qw,qx,qy,qz: float @return Yaw value translated from Quaternion ''' rotat...
3,371
translate bin path
"""Rules for running `mro format`, either to reformat files or to check them.""" load( "//tools:providers.bzl", "MroInfo", ) load("//tools:util.bzl", "merge_runfiles") load("@bazel_skylib//lib:shell.bzl", "shell") def METHOD_NAME(p): if p.startswith(".."): return "external/" + p[len("../"):] r...
3,372
test sinh
# Owner(s): ["module: dynamo"] # this file is autogenerated via gen_ufuncs.py # do not edit manually! import numpy as np from torch._numpy._ufuncs import * # noqa: F403 from torch._numpy.testing import assert_allclose def test_absolute(): assert_allclose(np.absolute(0.5), absolute(0.5), atol=1e-14, check_dtyp...
3,373
streamlines to segments
# -*- coding: utf-8 -*- import logging import numpy as np from numpy.linalg import norm from scipy.spatial import cKDTree from scipy.sparse import bsr_matrix def _subdivide_streamline(streamline, n_steps): if n_steps < 2: return streamline dirs = streamline[1:] - streamline[:-1] subdivided = np....
3,374
test software trigger simtel process
import json import numpy as np import pytest from numpy.testing import assert_equal from ctapipe.containers import ArrayEventContainer from ctapipe.io import EventSource def assert_all_tel_keys(event, expected, ignore=None): if ignore is None: ignore = set() expected = tuple(expected) for name,...
3,375
should colorize
# Stubs for logbook.more (Python 3) # # NOTE: This dynamically typed stub was automatically generated by stubgen. from logbook.base import RecordDispatcher from logbook.handlers import ( FingersCrossedHandler as FingersCrossedHandlerBase, Handler, StderrHandler, StringFormatter, StringFormatterHand...
3,376
resolve login settings per product
import asyncio import json import logging import asyncpg from aiohttp import web from pydantic import ValidationError from servicelib.aiohttp.application_setup import ModuleCategory, app_module_setup from settings_library.email import SMTPSettings from settings_library.postgres import PostgresSettings from .._constan...
3,377
test write bed graph worker smoothing
import os import pytest import deeptools.writeBedGraph as wr from deeptools.writeBedGraph import scaleCoverage @pytest.mark.parametrize("bc", ["bam", 'cram']) class TestWriteBedGraph(): def ifiles(self, ext='bam'): root = os.path.dirname(os.path.abspath(__file__)) + "/test_data/" bamFile1 = root +...
3,378
raw slices
"""Defines commonly used segment predicates for rule writers. For consistency, all the predicates in this module are implemented as functions returning functions. This avoids rule writers having to remember the distinction between normal functions and functions returning functions. This is not necessarily a complete ...
3,379
construct
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
3,380
get segmentation target
import cv2 import numpy as np import torch from PIL import Image from torch.utils.data import Dataset from torch.utils.data.dataset import Subset from torchvision.datasets.sbd import SBDataset from torchvision.datasets.voc import VOCSegmentation import ignite.distributed as idist from ignite.utils import convert_tenso...
3,381
bbox overlaps
import numpy as np def clip_boxes(boxes, im_shape): """ Clip boxes to image boundaries. :param boxes: [N, 4* num_classes] :param im_shape: tuple of 2 :return: [N, 4* num_classes] """ # x1 >= 0 boxes[:, 0::4] = np.maximum(np.minimum(boxes[:, 0::4], im_shape[1] - 1), 0) # y1 >= 0 ...
3,382
setup
"""A directive to generate a gallery of images from structured data. Generating a gallery of images that are all the same size is a common pattern in documentation, and this can be cumbersome if the gallery is generated programmatically. This directive wraps this particular use-case in a helper-directive to generate i...
3,383
parse
import torch import torch.nn as nn import torch.nn.functional as F from .genotypes import PRIMITIVES, Genotype from .operations import OPS, FactorizedReduce, ReLUConvBN class MixedOp(nn.Module): def __init__(self, C, stride): super(MixedOp, self).__init__() self._ops = nn.ModuleList() for...
3,384
clean new pw
# # This file is part of pretix (Community Edition). # # Copyright (C) 2014-2020 Raphael Michel and contributors # Copyright (C) 2020-2021 rami.io GmbH and contributors # # This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General # Public License as published by ...
3,385
signal change
# # Copyright 2019-2022 GoPro Inc. # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version...
3,386
test instance
from ctypes import * from ctypes.test import need_symbol import unittest # IMPORTANT INFO: # # Consider this call: # func.restype = c_char_p # func(c_char_p("123")) # It returns # "123" # # WHY IS THIS SO? # # argument tuple (c_char_p("123"), ) is destroyed after the function # func is called, but NOT before ...
3,387
set up
# License: BSD 3-Clause import unittest from typing import List from random import randint, shuffle from openml.exceptions import OpenMLServerException from openml.testing import TestBase from openml.datasets import ( get_dataset, list_datasets, ) from openml.tasks import TaskType, create_task, get_task cla...
3,388
traverse
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
3,389
test works with python38
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from textwrap import dedent import pytest from pants.backend.python.dependency_inference import parse_python_dependencies from pants.backend.python.de...
3,390
output json
import argparse import errno import json import logging import os from collections import defaultdict from copy import deepcopy try: from typing import Any except ImportError: # Only used for type annotations pass from find_apps import find_apps from find_build_apps import BUILD_SYSTEM_CMAKE, BUILD_SYSTEMS...
3,391
get translation
# Copyright 2017 Google Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
3,392
test migrate instance
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in complia...
3,393
prepare request
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
3,394
main
import logging import optparse import os import sys import textwrap import time import transaction from pyramid.paster import bootstrap from pyramid.paster import setup_logging from rdflib import RDF from rdflib import SKOS from rdflib.term import URIRef from skosprovider_rdf import utils from atramhasis.data.dataman...
3,395
connect
import logging from typing import Callable, Optional, List, Tuple, Dict from feeluown.utils.dispatch import Signal logger = logging.getLogger(__name__) class SignalConnector: def __init__(self, symbol: str): self._signal: Optional[Signal] = None self.symbol = symbol self._slot_list: Li...
3,396
std string
''' $Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $ ''' from datetime import datetime from struct import unpack, calcsize from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo from pytz.tzinfo import memorized_datetime, memorized_timedelta def _byte_string(s): """Cast a string or byte string t...
3,397
method
import json from six.moves import urllib, xmlrpc_client from .util import read_body import logging log = logging.getLogger(__name__) def METHOD_NAME(r1, r2): assert r1.METHOD_NAME == r2.METHOD_NAME, "{} != {}".format(r1.METHOD_NAME, r2.METHOD_NAME) def uri(r1, r2): assert r1.uri == r2.uri, "{} != {}".form...
3,398
parent geoid
import logging from django.db import models from django.conf import settings from django.utils.text import slugify import requests log = logging.getLogger(__name__) CATEGORIES = { 'A': 'metro', 'B': 'local', 'C': 'district', } class LocationNotFound(Exception): pass class GeographyUpdate(models.M...
3,399
warnings
""" The standard stream parser interface for VASP. ---------------------------------------------- Contains the parsing interfaces to ``parsevasp`` used to parse standard streams for VASP related notification, warnings and errors. """ # pylint: disable=abstract-method import re from parsevasp.stream import Stream fro...