id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
500 | communicate | """
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
salt.utils.nb_popen
~~~~~~~~~~~~~~~~~~~
Non blocking subprocess Popen.
This functionality has been adapted to work on windows following the recipe
found on:
http://code.activestate.com/recipes/440554/
"""
import errno
import loggi... |
501 | connect | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
502 | copy tensor | # Copyright (c) Alibaba, Inc. and its affiliates.
from typing import List
import numpy as np
import torch
def collate_fn(samples, pad_idx, eos_idx):
r"""
convert the sample to batch tensor.
"""
if len(samples) == 0:
return {}
def merge(key):
return collate_tokens([s[key] for s i... |
503 | find equivalent identifier of type | import re
class DeviceIdentifierType:
FIT = "fit"
TCX = "tcx"
GC = "gc"
class DeviceIdentifier:
def Match(self, query):
compareDict = dict(self.__dict__)
compareDict.update(query)
return compareDict == self.__dict__ # At the time it felt like a better idea than iterating through keys?
class FITDeviceIdenti... |
504 | test mutator sequence | import json
from pathlib import Path
import pytest
from nni.common.framework import get_default_framework, set_default_framework
from nni.nas.space import StationaryMutator, Mutator, MutationSampler, GraphModelSpace, ModelStatus, MutatorSequence
from nni.nas.space.mutator import _RandomSampler
from nni.nas.space.graph... |
505 | run | #!/usr/bin/env python3
"""A standalone tool for executing compiled Xilinx XRT bitstreams.
This tool can be invoked as a subprocess to run a compiled `.xclbin`, which may
be compiled either for RTL simulation or for actual on-FPGA execution. It
consumes and produces fud-style JSON input/output data files but is otherwi... |
506 | test output raw halfs | # SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
import logging
import unittest
logger = logging.getLogger(__name__)
try:
import numpy as np
except ImportError:
logger.warning(
"NumPy could not be imported. "
"Test case will lack significant coverag... |
507 | test context job metadata with unicode | # -*- coding: utf-8 -*-
from copy import deepcopy
import datetime
import pytest
# from awx.main.models import NotificationTemplates, Notifications, JobNotificationMixin
from awx.main.models import AdHocCommand, InventoryUpdate, Job, JobNotificationMixin, ProjectUpdate, Schedule, SystemJob, WorkflowJob
from awx.api.se... |
508 | get copied from assignment | import logging
from typing import List, Optional
from sqlalchemy.orm import Session
from lms.models import (
Assignment,
AssignmentGrouping,
AssignmentMembership,
Grouping,
LTIRole,
User,
)
from lms.services.upsert import bulk_upsert
LOG = logging.getLogger(__name__)
class AssignmentService... |
509 | coco keypoints | # Copyright The PyTorch Lightning team.
#
# 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 i... |
510 | locale | from .base import ObjectBase
class Order(ObjectBase):
def __init__(self, data, client):
super().__init__(data, client)
@classmethod
def get_resource_class(cls, client):
from ..resources import Orders
return Orders(client)
STATUS_CREATED = "created"
STATUS_PAID = "paid"
... |
511 | bind global | import io
import os
import sys
import copy
import json
import time
import uuid
import socket
import logging
import traceback
from threading import local
from collections import OrderedDict
from contextlib import contextmanager
LOG_TIMESTAMPS = "LOG_TIMESTAMPS" in os.environ
def json_handler(obj):
# if isinstance(ob... |
512 | build actuator | # Module 'panel'
#
# Support for the Panel library.
# Uses built-in module 'pnl'.
# Applications should use 'panel.function' instead of 'pnl.function';
# most 'pnl' functions are transparently exported by 'panel',
# but dopanel() is overridden and you have to use this version
# if you want to use callbacks.
from warnin... |
513 | init reader | # Copyright (c) 2020 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... |
514 | run script | import json
import logging
import sys
import traceback
import uuid
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from core.choices import JobStatusChoices
from core.models import Job
from extras.api.serializers import... |
515 | 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 . im... |
516 | allocate lock | """Drop-in replacement for the thread module.
Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
Suggested usage is::
try:
import thread
except ImportError:
import dummy_thread as thread
"""
# Exports onl... |
517 | get dummy pillow | import json
from django.test import SimpleTestCase, TestCase, override_settings
from pillowtop import get_all_pillow_instances
from corehq.apps.callcenter.tests.test_utils import CallCenterDomainMockTest
from corehq.apps.hqadmin.utils import check_for_rewind
from corehq.util.test_utils import generate_cases
from tes... |
518 | test general for multi qubit gate | # Copyright (C) Unitary Fund
#
# This source code is licensed under the GPL license (v3) found in the
# LICENSE file in the root directory of this source tree.
"""Unit tests for DDD rules."""
import pytest
from cirq import CNOT, Circuit, I, LineQubit, X, Y, Z, bit_flip
from mitiq.ddd.rules.rules import general_rule, ... |
519 | crate unpack | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' implementation for crates.io
"""
# Copyright (C) 2016 Doug Goldstein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
... |
520 | get m t obj | """
Description:
todo to be written
Usage:
todo tobe written
Author: YingzhiGou
Date: 20/06/2017
"""
import os
import mtpy.core.mt as mt
from mtpy.utils.mtpylog import MtPyLog
DEFAULT_GROUP_PREFIX = 'Group'
DEFAULT_GROUP = "Default Group"
class FileHandler():
"""
Desc... |
521 | add cli sdist | #!/usr/bin/env python
"""Script to create self contained install.
The goal of this script is simple:
* Create a self contained install of the CLI that
has requires no external resources during installation.
It does this by using all the normal python tooling
(virtualenv, pip) but provides a simple, easy to use
i... |
522 | test scan delete unseen key while scanning | from time import sleep
import pytest
import redis
from test.testtools import key_val_dict
def test_sscan_delete_key_while_scanning_should_not_returns_it_in_scan(r: redis.Redis):
size = 600
name = 'sscan-test'
all_keys_set = {f'{i}'.encode() for i in range(size)}
r.sadd(name, *[k for k in all_keys_se... |
523 | test writer crop | #
# DeepLabCut Toolbox (deeplabcut.org)
# © A. & M.W. Mathis Labs
# https://github.com/DeepLabCut/DeepLabCut
#
# Please see AUTHORS for contributors.
# https://github.com/DeepLabCut/DeepLabCut/blob/master/AUTHORS
#
# Licensed under GNU Lesser General Public License v3.0
#
import os
import pytest
from conftest import TE... |
524 | test vector length setter getter | # -----------------------------------------------------------------------------
# BSD 3-Clause License
#
# Copyright (c) 2022-2023, Science and Technology Facilities Council
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... |
525 | setup | from dataclasses import dataclass, field
from typing import ClassVar, Dict, Optional
from qm import generate_qua_script, qua
from qm.qua import declare, for_
from qm.QuantumMachinesManager import QuantumMachinesManager
from qibolab import AveragingMode
from qibolab.instruments.abstract import Controller
from .config... |
526 | add noise | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD-3-Clause
import math
import numpy as np
from scipy.signal import lfilter
from ..cov import Covariance, compute_whitener
fro... |
527 | test auto all | import datetime
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import MagicMock, call, patch
from piccolo.apps.migrations.commands.new import (
BaseMigrationManager,
_create_new_migration,
_generate_migration_meta,
new,
)
from piccolo.conf.apps import AppConfig... |
528 | get output file name | #!/usr/bin/env python3
# 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; specifically version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT A... |
529 | get all permissions | from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User, Permission
from django.db.models.base import Model
from django.contrib.auth.backends import ModelBackend
from tendenci.apps.perms.object_perms import ObjectPermission
from tendenci.apps.perms.utils import can_view
... |
530 | name | #########################################################################
#
# Copyright (C) 2023 Open Source Geospatial Foundation - all rights reserved
#
# 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 Fou... |
531 | set powermeter unit price | import asyncio
import json
import logging
from homematicip.aio.class_maps import (
TYPE_CLASS_MAP,
TYPE_GROUP_MAP,
TYPE_RULE_MAP,
TYPE_SECURITY_EVENT_MAP,
)
from homematicip.aio.connection import AsyncConnection
from homematicip.aio.securityEvent import AsyncSecurityEvent
from homematicip.base.enums im... |
532 | to json | ##############################################################
# Copyright 2023 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Identifier: LGPL-3.0
#####... |
533 | mfcalc | class MultiFieldSolverTimeControls:
def METHOD_NAME(self, fnumb="", freq="", **kwargs):
"""Specifies a calculation frequency for a field in an ANSYS Multi-field
APDL Command: MFCALC
solver analysis.
Parameters
----------
fnumb
Field number set by the MFE... |
534 | make ellipses | """
===============
GMM covariances
===============
Demonstration of several covariances types for Gaussian mixture models.
See :ref:`gmm` for more information on the estimator.
Although GMM are often used for clustering, we can compare the obtained
clusters with the actual classes from the dataset. We initialize th... |
535 | log binary | """Support functions used in library."""
import asyncio
import binascii
import functools
import logging
from os import environ, path
from typing import Any, List, Sequence, Union
import warnings
from google.protobuf.text_format import MessageToString
from pydantic import BaseModel
import pyatv
from pyatv import exce... |
536 | check activity dates | # Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
537 | find all classifier components | import streamlit as st
from sparknlp.annotator import *
import nlu
from nlu.pipe.utils.resolution.storage_ref_utils import StorageRefUtils
from nlu.universe.feature_node_ids import NLP_NODE_IDS
class StreamlitUtilsOS():
classifers_OS = [ClassifierDLModel, LanguageDetectorDL, MultiClassifierDLModel, NerDLModel, Ne... |
538 | to str | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.28
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
539 | read encoded uint32 | #
# This file is part of the PyRDP project.
# Copyright (C) 2020 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
"""
Common stream reading utilities.
All section numbers reference MS-RDPEGDI sections:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegdi/745f2eee-d110-464c-8aca-06fc1814f6ad
"""... |
540 | parse value string | #!/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.
"""
This script translates synth trace files in format version 2 to format version 3.
"""
import argparse
import jso... |
541 | test validate protected queries no queries | import pytest
from sentry.testutils.silo import validate_protected_queries
def METHOD_NAME():
validate_protected_queries([])
def test_validate_protected_queries__ok():
queries = [
{"sql": "SELECT * FROM sentry_organization"},
{"sql": "UPDATE sentry_team SET slug = 'best-team' WHERE id = 1"}... |
542 | equals | # -*- coding: utf-8 -*-
#
# ast_source_location.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 2 of the Lic... |
543 | package | from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd, valid_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
i... |
544 | test update settings flow | """
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v1.2.1
Contact: support@ory.sh
Generated by: https://open... |
545 | text leading | #
# Part of p5: A Python package based on Processing
# Copyright (C) 2017-2019 Abhik Pal
#
# 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
# (at your option) ... |
546 | name | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
import sys
from math import *
import json
import os
import csv
def data_cpu(name_demo, iteration, ii):
cpu = [0]*iteration
memory = [0]*iteration
i = 0
j = 0
a = name_demo
nb = len(name_demo)
while i != iteration*ii... |
547 | mobile net v2 x1 5 | #copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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 l... |
548 | tear down | """
Name: r.in.ascii test
Purpose: Tests r.in.ascii and its flags/options.
Author: Sunveer Singh, Google Code-in 2017
Copyright: (C) 2017 by Sunveer Singh and the GRASS Development Team
Licence: This program is free software under the GNU General Public
License (>=v2). Read the file COPYI... |
549 | setup | import logging
import pytest
from ocs_ci.ocs import constants, node
from ocs_ci.framework.testlib import ManageTest, tier2
log = logging.getLogger(__name__)
@tier2
@pytest.mark.polarion_id("OCS-2599")
class TestRbdBlockPvc(ManageTest):
"""
Tests RBD block PVC
"""
@pytest.fixture(autouse=True)
d... |
550 | summarize contacts by residue |
"""
Utility functions for analyzing lattice contacts. Used in:
`Fraser JS, van den Bedem H, Samelson AJ, Lang PT, Holton JM, Echols N, Alber
T. Accessing protein conformational ensembles using room-temperature X-ray
crystallography. Proc Natl Acad Sci U S A. 2011 Sep 27;108(39):16247-52.
<http://www.ncbi.nlm.nih.gov... |
551 | move to | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 3 16:53:34 2018
@author: ep558,wmd22
"""
from __future__ import division
from __future__ import print_function
from builtins import str
from past.utils import old_div
import nplab.instrument.serial_instrument as si
class ParkerStepper(si.SerialInstrument):
'''Step... |
552 | lower thresholds | # Author: Niels Nuyttens <niels@nannyml.com>
#
# License: Apache Software License 2.0
from __future__ import annotations
import sys
import typing
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Optional, Union # noqa: TYP001
if typing.TYPE_CHECKING:
from typing_extens... |
553 | get dev ops configuration | # 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 . im... |
554 | get chunks | import sys
from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping, MutableSequence
from multiprocessing.connection import Connection
from multiprocessing.context import BaseContext, Process
from multiprocessing.queues import Queue, SimpleQueue
from threading import Lock, Semaphore, Thread
fr... |
555 | survival function | # -*- coding: utf-8 -*-
import autograd.numpy as np
import warnings
from autograd.numpy import abs, log
from scipy.special import gammaincinv
from autograd_gamma import gammaincc, gammainc, gammaln, gammainccln, gammaincln
from lifelines.fitters import ParametricRegressionFitter
from lifelines.utils import CensoringTyp... |
556 | find quantized model file | import inspect
import re
from pathlib import Path
import accelerate
import torch
import transformers
from transformers import AutoConfig, AutoModelForCausalLM
import modules.shared as shared
from modules.logging_colors import logger
from gptq_for_llama import llama_inference_offload
from gptq_for_llama.modelutils im... |
557 | list share subscription synchronizations | # 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... |
558 | operator getoutput custom type fields container | #-------------------------------------------------------------------------------
# Operator
#-------------------------------------------------------------------------------
class OperatorAbstractAPI:
@staticmethod
def init_operator_environment(object):
pass
@staticmethod
def finish_operator_environment(object):... |
559 | step update | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# ------------------------------------------------------------------... |
560 | stop | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
561 | test budget authority endpoint sort year | import pytest
from model_bakery import baker
from rest_framework import status
@pytest.fixture
def model_instances():
baker.make("accounts.BudgetAuthority", year=2000, amount=2000000, agency_identifier="000")
baker.make("accounts.BudgetAuthority", year=2001, amount=2001000, agency_identifier="000")
baker... |
562 | test compute norm row index for blobs |
import unittest
from caffe2.python import workspace, brew, model_helper
from caffe2.python.modeling.compute_norm_for_blobs import ComputeNormForBlobs
import numpy as np
class ComputeNormForBlobsTest(unittest.TestCase):
def test_compute_norm_for_blobs(self):
model = model_helper.ModelHelper(name="tes... |
563 | request path | import logging
import uuid
from datetime import datetime
import architect
from django.contrib.auth.models import AnonymousUser, User
from django.db import models
from dimagi.utils.web import get_ip
from corehq.apps.domain.utils import get_domain_from_url
from corehq.util.models import (
ForeignValue,
NullJs... |
564 | test timing | ############################ Copyrights and license ############################
# #
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
# ... |
565 | update group | from typing import List, TypeVar
import logging
from dispatch.case.models import Case
from dispatch.database.core import SessionLocal
from dispatch.database.core import get_table_name_by_class_instance
from dispatch.event import service as event_service
from dispatch.incident.models import Incident
from dispatch.plugi... |
566 | filter log events | # Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... |
567 | test nodecode i386 | # pylint: disable=missing-class-docstring,no-self-use
import gc
import logging
import os
import pickle
import unittest
from common import slow_test
import angr
from angr.state_plugins.history import HistoryIter
l = logging.getLogger("angr.tests")
test_location = os.path.join(os.path.dirname(os.path.realpath(__file_... |
568 | validate | # This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
569 | train docs | # Copyright (c) 2022, NVIDIA CORPORATION. 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... |
570 | test get party shipping address | import unittest
import frappe
from frappe.test_runner import make_test_objects
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
from erpnext.accounts.party import get_party_shipping_addr... |
571 | get authorized user | """ Users management
Keeps functionality that couples with the following app modules
- users,
- login
- security
- resource_manager
"""
import logging
from datetime import datetime
import redis.asyncio as aioredis
from aiohttp import web
from models_library.emails import LowerCaseEmailStr
from pydan... |
572 | update user permissions | from typing import List, Optional
from fastapi import Depends, HTTPException, Security
from fastapi.security import SecurityScopes
from loguru import logger
from sqlalchemy.orm import Session
from starlette.status import HTTP_201_CREATED, HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND
from fides.api.api import deps
from fi... |
573 | test read entries order | #!/usr/bin/env python
from typing import Optional
from grr_response_core.lib import rdfvalue
from grr_response_server.rdfvalues import objects as rdf_objects
APIAuditEntry = rdf_objects.APIAuditEntry
def _Date(date: str) -> rdfvalue.RDFDatetime:
return rdfvalue.RDFDatetime.FromHumanReadable(date)
class Databas... |
574 | client | # 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, ... |
575 | get object in list by class | from typing import Any
import pytest
from fastjsonschema.exceptions import JsonSchemaValueException
from snuba.clickhouse.translators.snuba.mappers import (
ColumnToColumn,
ColumnToFunction,
ColumnToIPAddress,
ColumnToMapping,
ColumnToNullIf,
)
from snuba.datasets.configuration.entity_builder impo... |
576 | threshold | """
The RegressionFDR class implements the 'Knockoff' approach for
controlling false discovery rates (FDR) in regression analysis.
The knockoff approach does not require standard errors. Thus one
application is to provide inference for parameter estimates that are
not smooth functions of the data. For example, the k... |
577 | mode | import torch
from torch.distributions import constraints
from torch.distributions.categorical import Categorical
from torch.distributions.distribution import Distribution
__all__ = ["OneHotCategorical", "OneHotCategoricalStraightThrough"]
class OneHotCategorical(Distribution):
r"""
Creates a one-hot categori... |
578 | get matches | # -*- coding: utf-8 -*-
import io
import logging
import re
from babelfish import Language, language_converters
from guessit import guessit
try:
from lxml import etree
except ImportError:
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
fr... |
579 | addcrypted2 | # -*- coding: utf-8 -*-
import os
from base64 import standard_b64decode
from functools import wraps
from urllib.parse import unquote
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
import flask
from flask.json import jsonify
from p... |
580 | validate fileupload notification ttl | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
581 | affected channels groups | from pubnub import utils
from pubnub.endpoints.endpoint import Endpoint
from pubnub.errors import PNERR_MESSAGE_MISSING
from pubnub.exceptions import PubNubException
from pubnub.models.consumer.pubsub import PNPublishResult
from pubnub.enums import HttpMethod, PNOperationType
from pubnub.endpoints.mixins import TimeTok... |
582 | process | # coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
583 | rmse | """
A demo for multi-output regression
==================================
The demo is adopted from scikit-learn:
https://scikit-learn.org/stable/auto_examples/ensemble/plot_random_forest_regression_multioutput.html#sphx-glr-auto-examples-ensemble-plot-random-forest-regression-multioutput-py
See :doc:`/tutorials/mult... |
584 | get message | from django.core.mail import EmailMessage
from django.core.cache import cache
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.admin.models import LogEntry, CHANGE, ADDITION
from django.contrib.contenttypes.models import ContentType
from sponsors.models import Sp... |
585 | test check is bool boolean attr | # -*- coding: utf-8 -*-
from unittest import mock
from django.db import models
from django.test import TestCase
from tests.testapp.models import (
DummyRelationModel, InheritedFromPostWithUniqField, PostWithUniqField,
ReverseModel, SecondDummyRelationModel, ThirdDummyRelationModel,
)
from django_extensions.db... |
586 | is unknown | import logging
import os
from io import StringIO
from shlex import quote
from tron.config import schema
from tron.serialize import filehandler
from tron.utils import timeutils
from tron.utils.observer import Observable
from tron.utils.state import Machine
log = logging.getLogger(__name__)
class ActionCommand(Observ... |
587 | parse args | #!/usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/monitoring-plugins/blob/main/CONTRIBUTING.... |
588 | tear down | import os
import shutil
import tempfile
import logging
import subprocess
import time
import re
import pytest
from flask import Flask, request, Response
from threading import Thread
from collections import deque
from unittest import TestCase
from pathlib import Path
from werkzeug.serving import make_server
from samcli... |
589 | convert xml to dict | from typing import Union
from digitalpy.core.main.controller import (
Controller,
)
from digitalpy.core.domain.node import Node
from copy import deepcopy
from lxml.etree import Element # pylint: disable=no-name-in-module
from lxml import etree
import xmltodict
from ..configuration.xml_serializer_constants import (... |
590 | get first playing player | #!/usr/bin/env python3
import gi
gi.require_version("Playerctl", "2.0")
from gi.repository import Playerctl, GLib
from gi.repository.Playerctl import Player
import argparse
import logging
import sys
import signal
import gi
import json
import os
from typing import List
logger = logging.getLogger(__name__)
def signal_h... |
591 | test unknown | import unittest
from BaseClasses import PlandoOptions
from Options import PlandoBosses
class SingleBosses(PlandoBosses):
bosses = {"B1", "B2"}
locations = {"L1", "L2"}
option_vanilla = 0
option_shuffle = 1
@staticmethod
def can_place_boss(boss: str, location: str) -> bool:
if boss ==... |
592 | then conditional stdout does not match regexp | import json
import re
import textwrap
import jsonschema # type: ignore
import yaml
from behave import then, when
from hamcrest import assert_that, contains_string, equal_to, not_
from features.steps.shell import when_i_run_command
from features.util import SafeLoaderWithoutDatetime, process_template_vars
@then("I ... |
593 | json | import typing as t
from functools import wraps
import pydantic
from pydantic.fields import FieldInfo
from sqlglot import exp
from sqlmesh.core import dialect as d
if t.TYPE_CHECKING:
Model = t.TypeVar("Model", bound="PydanticModel")
DEFAULT_ARGS = {"exclude_none": True, "by_alias": True}
PYDANTIC_MAJOR_VERSI... |
594 | extract symbols | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... |
595 | shop filter | from module.base.button import ButtonGrid
from module.base.decorator import cached_property, del_cached_property
from module.base.timer import Timer
from module.logger import logger
from module.map_detection.utils import Points
from module.ocr.ocr import Digit, DigitYuv, Ocr
from module.shop.assets import *
from module... |
596 | get aws configs | """
Copyright 2021 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
597 | icon | # /*##########################################################################
#
# Copyright (c) 2016 European Synchrotron Radiation Facility
#
# 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... |
598 | system data | # 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 . im... |
599 | extract tag | """Generate gemoji index."""
import os
import requests
import json
import argparse
import shutil
import zipfile
import gen_emoji1
import gen_gemoji
import gen_twemoji
import gen_joypixels
current_dir = os.path.dirname(os.path.abspath(__file__))
GITHUB_API_HEADER = 'application/vnd.github.v3+json'
GITHUB_API = 'https:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.