id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
10,000
min cppstd
from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rm from conan.tools.scm import Version import os required_conan_version = ">=1.50.0" ...
10,001
db is updated
#!/usr/bin/env python import logging import time from os import getenv import random import pathlib import datetime import copy import difflib from flask import Flask, request, jsonify from healthcheck import HealthCheck import sentry_sdk from sentry_sdk.integrations.logging import ignore_logger from common.constant...
10,002
reset logical devices
# Copyright 2022 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...
10,003
format error message
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
10,004
create api
# -*- coding: utf-8 -*- ''' ''' import sys from Crypto.Cipher import AES from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP import ast import base64 import os import glob import binascii import rsa import base64 import json import logging LOG = logging.getLogger() PRIVATE_KEY = 'privateKey.pem' P...
10,005
test feature store manager same instance
# Copyright 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" file accompan...
10,006
alt callback
from testfixtures import LogCapture from twisted.internet import defer from twisted.trial.unittest import TestCase from scrapy import Request, signals from scrapy.http.response import Response from scrapy.utils.test import get_crawler from tests.mockserver import MockServer from tests.spiders import SingleRequestSpide...
10,007
test dont write empty
from collections import OrderedDict import os import unittest import tempfile from robot. errors import DataError from robot.utils import ET, ETSource, XmlWriter from robot.utils.asserts import assert_equal, assert_raises, assert_true PATH = os.path.join(tempfile.gettempdir(), 'test_xmlwriter.xml') class XmlWriterW...
10,008
read helper
"""Test script for the dbm.open function based on testdumbdbm.py""" import unittest import dbm import os from test.support import import_helper from test.support import os_helper try: from dbm import ndbm except ImportError: ndbm = None dirname = os_helper.TESTFN _fname = os.path.join(dirname, os_helper.TEST...
10,009
get owner info
# # Copyright © 2023 Josep Maria Viñolas Auquer, Alberto Larraz Dalmases # # This file is part of IsardVDI. # # IsardVDI 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...
10,010
get fileset name
#!/usr/bin/env python """ _TaskMaker_ This should take an incoming WMWorkload, break it into tasks and then for each task do the jobs necessary for the task to start as a proper job. """ from __future__ import print_function from builtins import object import logging import os.path import threading from WMCore.WMBS...
10,011
read css properties
#!/usr/bin/env python3 # # Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """Generates CssStyleDeclaration extension with all property getters and setters f...
10,012
add page
""" Problem Statement LRU Cache Design:- Cache is the memory very close to CPU and has less access time. Cache is fast but also has less Space compared to RAM. Since it is small we need to have efficient utilization of small size memory. LRU(Least Recently Used) is one of the techniques for this p...
10,013
test2
# This file is part of the MapProxy project. # Copyright (C) 2011 Omniscale <http://omniscale.de> # # 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...
10,014
set config key
import pysys from pysys.basetest import BaseTest from pysys.constants import * import time """ Validate command line options config: get set unset Given a running system When we call tedge config list Then then we get exit code 0 When we get and store the keys for later When we unset all keys Then we check if they ...
10,015
test simple super apply
from numpy.linalg import norm from qutip import ( Qobj, tensor, vector_to_operator, operator_to_vector, kraus_to_super, subsystem_apply, rand_dm, rand_unitary, ) from qutip.random_objects import rand_kraus_map class TestSubsysApply(object): """ A test class for the QuTiP function for applying superop...
10,016
meta trace
import torch from torch.fx import Graph, Node from torch.utils._pytree import tree_map def normalize_tuple(x): if not isinstance(x, tuple): return (x,) return x def is_autogradable(x): return isinstance(x, torch.Tensor) and x.is_floating_point() def METHOD_NAME(module: torch.nn.Module, fake_de...
10,017
disable output
# -*- coding: utf-8 -*- """QCoDes- Base driver for Thorlab instruments using the LS commands Authors: iago-rst https://github.com/iago-rst, 2023 Julien Barrier <julien@julienbarrier.eu>, 2023 """ import ctypes import logging from time import sleep from typing import Optional from qcodes.parameters import Para...
10,018
evaluate perf fair
# coding: utf-8 import logging import pytest import fairgbm as lgb from .utils import load_baf_base, binarize_predictions, evaluate_recall, evaluate_fairness @pytest.fixture def lightgbm_params() -> dict: return { "objective": "cross_entropy", "seed": 3402, "num_iterations": 1000, ...
10,019
test probs min max error
#!/usr/bin/env python # coding: utf-8 import numpy as np from cleanlab.benchmarking import noise_generation import pytest seed = 0 np.random.seed(0) def test_main_pipeline( verbose=False, n=10, valid_noise_matrix=True, frac_zero_noise_rates=0, ): trace = 1.5 py = [0.1, 0.1, 0.2, 0.6] K =...
10,020
get conf image
""" Overlay for confidence maps. Currently a `DataOverlay` gets data from a model (i.e., it runs inference on the current frame) and then uses a `ConfMapsPlot` object to show the resulting confidence maps. Example: :: >>> cm = ConfMapsPlot(conf_data.get_frame(0)) >>> window.view.scene.addItem(cm) """ from ...
10,021
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 ...
10,022
convert pointwise example
# 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...
10,023
images dir
# -*- coding: utf-8 -*- import pytest import os import uuid from unittest.mock import MagicMock import tempfile import urllib.request import sys sys._called_from_test = True sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) # If the QT application is not initialized we can got segfault f...
10,024
header parameters
# -------------------------------------------------------------------------------------------- # 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 aaz-dev-tools # --------------------------------...
10,025
main
"""This demo program solves the incompressible Navier-Stokes equations on an L-shaped domain using Chorin's splitting method.""" # Copyright (C) 2010-2011 Anders Logg # # This file is part of DOLFIN. # # DOLFIN is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Publi...
10,026
load task params
import datetime import json import unittest from a2ml.api.stats.feature_divergence import FeatureDivergence from a2ml.api.utils import fsclient class TestFeatureDivergence(unittest.TestCase): def test_build_and_save_model(self): fd = FeatureDivergence(self.METHOD_NAME()) res = fd.build_and_save_mo...
10,027
initialize options
import sys from typing import TYPE_CHECKING, List, Dict from distutils.command.build import build as _build from ..warnings import SetuptoolsDeprecationWarning if sys.version_info >= (3, 8): from typing import Protocol elif TYPE_CHECKING: from typing_extensions import Protocol else: from abc import ABC as...
10,028
normalize files
#!/usr/bin/env python3 # Copyright 2015 The Kubernetes Authors. # # 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 appl...
10,029
extract data
# pylint: disable=too-many-lines # 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) AutoRe...
10,030
create
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
10,031
deadlock handler
# SPDX-License-Identifier: GPL-2.0-only # # This file is part of Nominatim. (https://nominatim.org) # # Copyright (C) 2022 by the Nominatim developer community. # For a full list of authors see the git log. """ Non-blocking database connections. """ from typing import Callable, Any, Optional, Iterator, Sequence import ...
10,032
create zip addon
#********************************************************************** # Copyright 2020 Advanced Micro Devices, Inc # 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.or...
10,033
one sample intermediate layer outputs
""" Provides a class for torch model evaluation. """ from __future__ import absolute_import import warnings from functools import partial import torch from .utils import common from pdb import set_trace as st class PyTorchModel: """ Class for torch model evaluation. Provide predict, intermediate_layer_out...
10,034
num tokens
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from collections import OrderedDict from typing import Dict, Sequence import numpy as np from . import FairseqDataset, Langua...
10,035
method
# -------------------------------------------------------------------------------------------- # 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 aaz-dev-tools # --------------------------------...
10,036
stats
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project # All rights reserved. # # This file is part of NeuroM <https://github.com/BlueBrain/NeuroM> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
10,037
test set key
import base64 import contextlib import os import tempfile from contextlib import contextmanager import mock import pytest from RPA.Crypto import Crypto, Hash from RPA.Robocorp.Vault import Secret @contextmanager def temp_path(content=None, suffix=None): with tempfile.NamedTemporaryFile(delete=False, suffix=suffi...
10,038
test num debates with sides unconfirmed
from django.test import TestCase from adjallocation.models import DebateAdjudicator from availability.utils import set_availability from draw.models import Debate, DebateTeam from participants.models import Adjudicator, Team from tournaments.models import Round, Tournament from venues.models import Venue class TestR...
10,039
invoke command
import os import sys import subprocess from signal import Signals from textwrap import dedent, indent try: from signal import SIGKILL except ImportError: # A non-POSIX platform SIGKILL = None # type: ignore[assignment] def run_shell_command(cmd, raise_errors=False, extra_env=None): """ Run the g...
10,040
invisible
#!/usr/bin/env python import os import sys import unittest import kconfiglib try: import gen_kconfig_doc except ImportError: sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..'))) import gen_kconfig_doc class ConfigTargetVisibilityTestCase(unittest.TestC...
10,041
print enum
import os import sys import json from ctypesgen.ctypedescs import CtypesBitfield from ctypesgen.messages import status_message # From: # http://stackoverflow.com/questions/1036409/recursively-convert-python-object-graph-to-dictionary def todict(obj, classkey="Klass"): if isinstance(obj, dict): for k in o...
10,042
test variable append read
#!/usr/local/bin/env python """ Test storageinterface.py facility. The tests are written around the netcdf storage handler for its asserts (its default) Testing the storage handlers themselves should be left to the test_storage_iodrivers.py file """ # ================================================================...
10,043
get template by show version
# -*- 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...
10,044
test multiselect option over max selections
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022) # # 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 appl...
10,045
test register
"""Unit test for connection manager.""" from datetime import datetime import threading from unittest.mock import AsyncMock, patch from xknx import XKNX from xknx.core import XknxConnectionState, XknxConnectionType from xknx.io import ConnectionConfig from xknx.util import asyncio_timeout class TestConnectionManager:...
10,046
test bgp set aspath replace test1
#!/usr/bin/env python # SPDX-License-Identifier: ISC # # test_bgp_set_aspath_replace.py # # Copyright (c) 2022 by # Donatas Abraitis <donatas.abraitis@gmail.com> # """ Test if `set as-path replace` is working correctly for route-maps. """ import os import sys import json import pytest import functools CWD = os.path...
10,047
test editoast bulk delete
import json from typing import Iterable import requests from .services import API_URL, EDITOAST_URL def _update_simulation_with_mareco_allowances(base_url, train_Schedule_id): response = requests.get(base_url + f"train_schedule/{train_Schedule_id}/") assert response.status_code == 200 train_schedule = r...
10,048
test input error
import pytest import astropy.units as u from sunpy.net import _attrs as core_attrs from sunpy.net import attr from sunpy.net import attrs as a from sunpy.net.vso import attrs as va from sunpy.time import TimeRange, parse_time def test_simpleattr_apply(): a = attr.ValueAttr({('test', ): 1}) dct = {} va._...
10,049
get split names
"""Base storage interfaces.""" import abc class SplitStorage(object, metaclass=abc.ABCMeta): """Split storage interface implemented as an abstract class.""" @abc.abstractmethod def get(self, split_name): """ Retrieve a split. :param split_name: Name of the feature to fetch. ...
10,050
save
from typing import Set from django.db import models from django.utils import timezone from data_refinery_common.models.jobs.job_managers import ( FailedJobsManager, HungJobsManager, LostJobsManager, UnqueuedJobsManager, ) from data_refinery_common.models.sample import Sample class ProcessorJob(model...
10,051
test evaluate list
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 ag...
10,052
cli
# This file is part of Indico. # Copyright (C) 2002 - 2023 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import sys import click from indico.METHOD_NAME.core import cli_group from indico.core import signals fr...
10,053
js property
# MIT License # # Copyright (c) 2015-2022 Iakiv Kramarenko # # 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, modif...
10,054
note type
# 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 pprint import time import anki # pylint: disable=unused-import import anki.collection import anki.decks import anki.notes import anki.template from...
10,055
run stochkv model
"""StochKv cell example""" # pylint: disable=R0914 import os import bluepyopt.ephys as ephys script_dir = os.path.dirname(__file__) morph_dir = os.path.join(script_dir, 'morphology') def stochkv_hoc_filename(deterministic=False): """Return stochkv hoc model filename""" return os.path.join( script_...
10,056
is valid tennessee zip
from typing import Optional import zipcodes from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.execution_engine import PandasExecutionEngine from great_expectations.expectations.expectation import ColumnMapExpectation from great_expectations.expectations.met...
10,057
qsfp port end
# sfputil.py # # Platform-specific SFP transceiver interface for SONiC # try: import time import string import pprint from ctypes import create_string_buffer from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) # fr...
10,058
retract
from __future__ import annotations import re from typing import Optional from src.containers import UserSet, UserDict from src.decorators import command from src.events import Event, event_listener from src.functions import get_players, get_all_players, get_main_role, get_target from src.messages import messages from...
10,059
serialize user token
from datetime import datetime from typing import Any, Callable, Dict, List, Optional import pytz from pyrfc3339 import parser as rfc3339_parser from szurubooru import db, errors, model, rest from szurubooru.func import auth, serialization, users, util class InvalidExpirationError(errors.ValidationError): pass ...
10,060
ajax resources
import math from operator import attrgetter from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.models import Q from django.http import Http404, HttpResponseRedirect from django.shortcuts import get_object_or_404, render from django.views.generic.detail import DetailV...
10,061
initialize synchronization
import copy from functools import partial import itertools import json import math import multiprocessing as mp import os import platform import posixpath import signal import traceback import numpy as np import concurrent.futures from tqdm import tqdm from ....lib import ( xyzrange, min2, max2, Vec, Bbox, sip, ...
10,062
kind
# 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...
10,063
test edit distance affine
""" Edit distance tests The initial version was copied from https://bitbucket.org/marcelm/sqt/src/af255d54a21815cb9a3e0b279b431a320d4626bd/tests/testalign.py """ from whatshap.align import edit_distance as ed from whatshap.align import edit_distance_affine_gap as ed_aff from random import choice, seed, randint STRIN...
10,064
small ts fixture
# # Copyright (C) 2020 University of Oxford # # This file is part of tsinfer. # # tsinfer 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) any later versio...
10,065
prepare metadata for build wheel
#!/usr/bin/env python3 """ maturin's implementation of the PEP 517 interface. Calls maturin through subprocess Currently, the "return value" of the rust implementation is the last line of stdout On windows, apparently pip's subprocess handling sets stdout to some windows encoding (e.g. cp1252 on my machine), even tho...
10,066
run
from typing import TYPE_CHECKING, Optional from PyQt5.QtWidgets import QLabel, QVBoxLayout, QGridLayout, QPushButton, QComboBox, QLineEdit, QSpacerItem, QWidget, QHBoxLayout from electrum.i18n import _ from electrum.transaction import PartialTxOutput, PartialTransaction from electrum.lnutil import MIN_FUNDING_SAT fro...
10,067
capacitive equivalent
# NanoVNASaver # # A python program to view and export Touchstone data from a NanoVNA # Copyright (C) 2019, 2020 Rune B. Broberg # Copyright (C) 2020ff NanoVNA-Saver Authors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publishe...
10,068
test create delta table for recipient lookup
"""Automated Integration Tests for the lifecycle of Delta Lake tables NOTE: Uses Pytest Fixtures from immediate parent conftest.py: usaspending_api/etl/tests/conftest.py """ from pyspark.sql import SparkSession from django.core.management import call_command from usaspending_api.etl.management.commands.create_delta_...
10,069
init screen
import math import time from random import random import machine import badger2040 # Overclock the RP2040 to run the sim faster badger2040.system_speed(badger2040.SYSTEM_TURBO) # ------------------------------ # Program setup # ------------------------------ # Global constants CELL_SIZE = 6 # Size of cell ...
10,070
handler
# -------------------------------------------------------------------------------------------- # 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 aaz-dev-tools # --------------------------------...
10,071
test accuracy score
import pytest import numpy as np pytest.importorskip("sklearn.metrics") from sklearn import metrics import vaex.datasets import vaex.ml import vaex.ml.metrics from vaex.ml.metrics import ensure_string_arguments df_binary = vaex.from_arrays(x=[1, 0, 1, 1, 0, 0, 0], y=[1, 0, 1, 1, 0, 1, 1],...
10,072
sim multicycle
import pyrtl import random """ testcase_utils This file (intentionally misspelled) is created to store common utility functions used for the test cases. I am documenting this rather well because users have a good reason to look at it - John Clow """ def calcuate_max_and_min_bitwidths(max_bitwidth=None, exact_bitwi...
10,073
wsgi get bytes
import sys import operator import functools try: import builtins except ImportError: import __builtin__ as builtins PY2 = sys.version_info[0] == 2 _identity = lambda x: x if PY2: unichr = unichr text_type = unicode string_types = (str, unicode) integer_types = (int, long) int_to_byte = c...
10,074
test immutable fields
from unittest.mock import MagicMock from django.core.exceptions import ObjectDoesNotExist from django.test import TestCase from payments.models import Payment from payments.payables import ( NotRegistered, Payable, PaymentError, payables, prevent_saving, prevent_saving_related, ) from payments...
10,075
test contextvars
import asyncio import contextvars import random import threading from sqlalchemy import exc from sqlalchemy.testing import async_test from sqlalchemy.testing import eq_ from sqlalchemy.testing import expect_raises from sqlalchemy.testing import expect_raises_message from sqlalchemy.testing import fixtures from sqlalch...
10,076
list by sku
# pylint: disable=too-many-lines # 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) AutoRe...
10,077
set up
""" Unittests for creating a course in an chosen modulestore """ from io import StringIO from django.core.management import CommandError, call_command from django.test import TestCase from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.dja...
10,078
test not in text multiline
import pytest from pytest import raises def otherfunc(a, b): assert a == b def somefunc(x, y): otherfunc(x, y) def otherfunc_multi(a, b): assert a == b @pytest.mark.parametrize("param1, param2", [(3, 6)]) def test_generative(param1, param2): assert param1 * 2 < param2 class TestFailing: de...
10,079
batch space multibinary
"""Utility functions for gymnasium spaces: batch space and iterator.""" from collections import OrderedDict from copy import deepcopy from functools import singledispatch from typing import Iterator import numpy as np from gymnasium.error import CustomSpaceError from gymnasium.spaces import ( Box, Dict, D...
10,080
get codes
# Copyright (c) 2001-2022, Hove and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Hove (www.hove.com). # Help us simplify mobility and open public transport: #...
10,081
evaluate batch
import os from typing import Any, Dict, Sequence, Union import torch import torch.nn as nn import torch.nn.functional as F import torchvision.datasets as dset from data import BilevelDataset from model_search import Network from optimizer import EG from torch.optim.lr_scheduler import CosineAnnealingLR from utils impo...
10,082
send 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 ...
10,083
set
""" GNOME implementations """ import logging import re import salt.utils.path try: import pwd HAS_PWD = True except ImportError: HAS_PWD = False try: from gi.repository import Gio, GLib # pylint: disable=W0611 HAS_GLIB = True except ImportError: HAS_GLIB = False log = logging.getLogger...
10,084
slerp weights
"""Spherical linear interpolation (SLERP).""" import numpy as np from ._utils import (check_axis_angle, check_quaternion, angle_between_vectors, check_rotor) def axis_angle_slerp(start, end, t): """Spherical linear interpolation. Parameters ---------- start : array-like, shape (4...
10,085
run
# Urwid main loop code # Copyright (C) 2004-2012 Ian Ward # Copyright (C) 2008 Walter Mundt # Copyright (C) 2009 Andrew Psaltis # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Fo...
10,086
get gcs blob path
# Copyright 2019 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, ...
10,087
deinit
"""ESP-NOW Module The `espnow` module provides an interface to the `ESP-NOW <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/network/esp_now.html>`_ protocol provided by Espressif on its SoCs. **Sender** .. code-block:: python import espnow e = espnow.ESPNow() peer = esp...
10,088
get token
# -*- coding: utf-8 -*- # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import logging from typing import Callable, Iterator, NewType from ratelimit import limits, sle...
10,089
add outerjoins
import typing as T from functools import cached_property from sqlalchemy import func, text from sqlalchemy.orm import Query, aliased from cumulusci.core.exceptions import BulkDataException Criterion = T.Any class LoadQueryExtender: """Class that transforms a load.py query with columns, filters, joins""" @...
10,090
train dataloader
import datasets from transformers import AutoTokenizer, PreTrainedTokenizer from colossalai.booster.plugin.dp_plugin_base import DPPluginBase class GLUEDataBuilder: task_text_field_map = { "cola": ["sentence"], "sst2": ["sentence"], "mrpc": ["sentence1", "sentence2"], "qqp": ["qu...
10,091
get models list
#!/usr/bin/env python # coding: utf-8 import pprint import logging import time import csv import sys import os from shapely.geometry import Point, shape from collections import Counter from openquake.baselib import sap from openquake.hazardlib.geo.packager import fiona from openquake.qa_tests_data import mosaic CLOSE...
10,092
set wsgi classes
### # # Copyright Alan Kennedy. # # You may contact the copyright holder at this uri: # # http://www.xhaus.com/contact/modjy # # The licence under which this code is released is the Apache License v2.0. # # The terms and conditions of this license are listed in a file contained # in the distribution that also cont...
10,093
do post
# -*- coding: utf-8 -*- """ Helper module which exposes abstractions to write webservers easily """ from abc import ABC, abstractmethod import http.server as http from http import HTTPStatus import json from urllib.parse import parse_qs, urlparse class Response(): """ Represents a HTTP `Response` object """...
10,094
delete from blockstore
import os import time from hashlib import sha256 from typing import Optional from inbox.config import config from inbox.logging import get_logger from inbox.util.stats import statsd_client log = get_logger() # TODO: store AWS credentials in a better way. STORE_MSG_ON_S3 = config.get("STORE_MESSAGES_ON_S3", None) f...
10,095
file
""" Tests for file.rename function """ import os import shutil import pytest pytestmark = [ pytest.mark.windows_whitelisted, ] @pytest.fixture(scope="module") def METHOD_NAME(modules): return modules.METHOD_NAME @pytest.fixture(scope="module") def multiline_string(): return """\ Lorem ipsum do...
10,096
test large moves
# Copyright (c) 2009-2023 The Regents of the University of Michigan. # Part of HOOMD-blue, released under the BSD 3-Clause License. """Test Image list generation for small box / large move size simulations.""" import hoomd import pytest import numpy @pytest.fixture(scope="function") def one_cube_simulation(simulati...
10,097
test social details step with first name
"""Tests for the social pipeline `social_auth` module.""" from unittest import mock from django.conf import settings from django.test import TestCase, override_settings from social_django.utils import load_backend, load_strategy from waffle.testutils import override_switch from marsha.account.social_pipeline import ...
10,098
test plugin blocked name
# Copyright 2021-2023 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 from unittest.mock import patch import pytest from pluggy import PluginManager from vdk.api.plugin.hook_markers import hookimpl from vdk.api.plugin.hook_markers import hookspec from vdk.api.plugin.plugin_registry import PluginException from vdk.i...
10,099
generate builtin super code
# Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...