id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
11,800 | print header | # Copyright (c) Alibaba, Inc. and its affiliates.
import torch
import torch.nn as nn
import torch.nn.functional as F
from .fsmn import AffineTransform, Fsmn, LinearTransform, RectifiedLinear
from .model_def import HEADER_BLOCK_SIZE, ActivationType, LayerType, f32ToI32
class FSMNUnit(nn.Module):
""" A multi-chan... |
11,801 | test nonposted checkgroups | import cherrypy
import pytest
from mock import Mock
import uber
from uber.config import c
from uber.models import Job, Attendee
from uber.utils import localized_now
@pytest.fixture
def attendee(): return Attendee()
@pytest.fixture
def job(): return Job()
@pytest.fixture
def post(request):
request.addfinalize... |
11,802 | has parameter | import re
from datetime import datetime
from inspect import signature
from typing import Any, Callable
import pandas as pd
import streamlit as st
from rich.table import Table
from openbb_terminal.dashboards.stream.common_vars import STOCKS_VIEWS
REGEX_RICH = re.compile(r"\[\/{0,1}[a-zA-Z0-9#]+\]|\[\/\]")
STOCKS_CLE... |
11,803 | test matrix norm | """Test functions for the sparse.linalg.norm module
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.linalg import norm as npnorm
from numpy.testing import assert_equal, assert_allclose
from pytest import raises as assert_raises
from scipy._lib._version import NumpyV... |
11,804 | run act ckpt codegen | import pytest
import torch
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint
import colossalai
from colossalai.core import global_context as gpc
from colossalai.fx import ColoTracer
from colossalai.fx.graph_module import ColoGraphModule
from colossalai.testing import rerun_if_address_is_in_... |
11,805 | extract output | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
11,806 | minimal borders | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import Any, Dict, Generator, Iterable, List, Tuple
from kitty.borders import BorderColor
from kitty.types import Edges
from kitty.typing import WindowType
from kitty.window_list import WindowGroup, WindowList
fr... |
11,807 | test | # Copyright (c) 2021 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... |
11,808 | meshed region get has point region | #-------------------------------------------------------------------------------
# MeshedRegion
#-------------------------------------------------------------------------------
class MeshedRegionAbstractAPI:
@staticmethod
def init_meshed_region_environment(object):
pass
@staticmethod
def finish_meshed_region_en... |
11,809 | graph | from unittest import mock
import pytest
import string
import dbt.exceptions
import dbt.METHOD_NAME.selector as graph_selector
import dbt.METHOD_NAME.cli as graph_cli
from dbt.node_types import NodeType
import networkx as nx
from dbt import flags
from argparse import Namespace
from dbt.contracts.project import User... |
11,810 | get keys and times | import sys,os
import shutil
import h5py
import numpy as np
import argparse
def get_keys(dat, time_range=None):
"""Collect all time index keys, optionally only those in a given 2-tuple of start and end time."""
keys = sorted(dat[next(iter(dat.keys()))].keys(), key=int)
if time_range is not None:
al... |
11,811 | metric | # Copyright The 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 in writin... |
11,812 | test create machine credential | from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from awx.main.models import Credential, CredentialType, Organization
@pytest.fixture
def cred_type():
# Make a credential type which will be used by the credential
ct = CredentialType.objects.create(
... |
11,813 | save | ## @file
# This file hooks file and directory creation and removal
#
# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
'''
File hook
'''
import os
import stat
import time
import zipfile
from time import sleep
from Library import GlobalData
__b... |
11,814 | validate | # (C) Datadog, Inc. 2023-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x va... |
11,815 | test tasks builds theme css files that | import pytest
from ....cache.test import assert_invalidates_cache
from ... import THEME_CACHE
from ..css import change_css_source, get_theme_media_map, rebuild_css
from ..tasks import build_single_theme_css, build_theme_css
@pytest.fixture
def assert_snapshot_match(snapshot, theme):
def _assert_snapshot_match(re... |
11,816 | get message stats | # (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... |
11,817 | storage account id | # 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... |
11,818 | test auto reset | # coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
11,819 | find conf | # MIT License
#
# Copyright (c) Jason Reaves - @sysopfb
#
# 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, ... |
11,820 | create large owl file | import pytest
import time
import os
import pyuploader.uploaders as uploaders
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
SECRETS_PATH = os.path.join(THIS_DIR,'dummy_services_secrets')
SECRETS_FILE_PATH = os.path.join(THIS_DIR,'dummy_services_secrets', 'dummy_test_auth')
URL_FILE_PATH = os.path.join(THIS_DIR,... |
11,821 | extract | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
from typing import Iterator, Union
from pyhocon import ConfigFactory, ConfigTree
from databuilder.extractor import sql_alchemy_extractor
from databuilder.extractor.base_extractor import Extractor
from databuilder.m... |
11,822 | test override | # This file is a part of the AnyBlok project
#
# Copyright (C) 2015 Georges Racinet <gracinet@anybox.fr>
#
# 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 pytes... |
11,823 | tear down class | # 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 2.0 (the
# "License"); you may not u... |
11,824 | test equality | import pytest
from praw.exceptions import (
APIException,
ClientException,
DuplicateReplaceException,
InvalidFlairTemplateID,
InvalidImplicitAuth,
InvalidURL,
MediaPostFailed,
MissingRequiredAttributeException,
PRAWException,
RedditAPIException,
RedditErrorItem,
WebSocke... |
11,825 | test int64 int | # -*- coding: utf-8 -*-
from datetime import date
from datetime import datetime
import six
from mock import patch
from bravado_core.formatter import SwaggerFormat
from bravado_core.formatter import to_python
from bravado_core.spec import Spec
if not six.PY2:
long = int
def test_none(minimal_swagger_spec):
... |
11,826 | build dataset | """CIFAR10 workload implemented in PyTorch."""
import contextlib
import functools
import random
from typing import Any, Dict, Optional, Tuple
import torch
import torch.distributed as dist
import torch.nn.functional as F
from torch.nn.parallel import DistributedDataParallel as DDP
from torchvision import transforms
fr... |
11,827 | translate | #!/usr/bin/env python3
# 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 o... |
11,828 | get header | #!/usr/bin/env python3
# BlockStore: a helper class that keeps a map of blocks and implements
# helper functions for responding to getheaders and getdata,
# and for constructing a getheaders message
#
from .mininode import CBlock, CBlockHeader, CBlockLocator, CTransaction, msg_block, msg_header... |
11,829 | h1 | #!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
import urllib
from collections import namedtuple
from fnmatch import fnmatch
import requests
try:
import semver
except ImportError:
print("Missing required library: semver.")
exit(1)
REDASH_HOME = os.environ.get("REDASH_HOME", ... |
11,830 | test spin up down threads | """
Unit test for MicroBatchHandler class.
"""
import json
import random
import sys
from pathlib import Path
import pytest
from torchvision.models.resnet import ResNet18_Weights
from ts.torch_handler.image_classifier import ImageClassifier
from ts.torch_handler.unit_tests.test_utils.mock_context import MockContext
fr... |
11,831 | get parameter | from __future__ import absolute_import, division, print_function
import NuRadioReco.framework.parameters as parameters
import NuRadioReco.framework.parameter_serialization
from radiotools import helper as hp, coordinatesystems
import pickle
import logging
logger = logging.getLogger('Shower')
class BaseShower:
d... |
11,832 | name | # 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... |
11,833 | policy data | # 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... |
11,834 | decompress data | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com.
#
# 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 2 of t... |
11,835 | prepare type | #########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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... |
11,836 | update dlg | import copy
from typing import Dict, Any
from PyQt5.QtWidgets import QDialog, QTextEdit, QVBoxLayout, QLabel
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QComboBox
from btchip.btchip import BTChipException
from electrumsv.gui.qt.password_dialog import PasswordLineEdit
from electrumsv.i18n import _
from electrums... |
11,837 | reset | from typing import Any, Dict, Mapping, Sequence
from pymongo import MongoClient
from common.credentials import Credentials
from monkey_island.cc.repositories import (
ICredentialsRepository,
RemovalError,
RetrievalError,
StorageError,
)
from monkey_island.cc.server_utils.encryption import ILockableEnc... |
11,838 | test sentry app actions | from unittest.mock import patch
import pytest
from rest_framework import serializers
from sentry.rules.actions.sentry_apps import NotifyEventSentryAppAction
from sentry.silo import SiloMode
from sentry.tasks.sentry_apps import notify_sentry_app
from sentry.testutils.cases import RuleTestCase
from sentry.testutils.sil... |
11,839 | test status | """
:codeauthor: Rahul Handay <rahulha@saltstack.com>
"""
import errno
import os
import pytest
import salt.modules.puppet as puppet
import salt.utils.args
import salt.utils.files
from salt.exceptions import CommandExecutionError
from tests.support.mock import MagicMock, mock_open, patch
@pytest.fixture
def con... |
11,840 | run | # ----------------------------------------------------------------------------
# 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 ... |
11,841 | init erddapy | """
Fetcher to retrieve CTD reference data from Ifremer erddap
"""
import xarray as xr
from .erddap_data import ErddapArgoDataFetcher
from argopy.options import OPTIONS
from argopy.utilities import Chunker
from argopy.stores import httpstore_erddap_auth
import logging
# Load erddapy according to available version (bre... |
11,842 | test attribute types | #! /usr/bin/env python
# encoding: utf-8
#
# This file is part of MXCuBE.
#
# MXCuBE 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 Foundation, either version 3 of the License, or
# (at your option) any later vers... |
11,843 | test serialize sets | import re
import sys
import pytest
from sentry_sdk.serializer import MAX_DATABAG_BREADTH, MAX_DATABAG_DEPTH, serialize
try:
from hypothesis import given
import hypothesis.strategies as st
except ImportError:
pass
else:
def test_bytes_serialization_decode_many(message_normalizer):
@given(binar... |
11,844 | test doc | # Copyright 2019 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... |
11,845 | calculate flags | """Predefined validators."""
import re
from six.moves import reduce
from .errors import ValidationError
from . import utilities
class Min(object):
"""Validator for minimum value."""
def __init__(self, minimum_value, exclusive=False):
"""Init.
:param minimum_value: Minimum value for valida... |
11,846 | context | from enum import Enum
from functools import wraps
from typing import Iterable, List, Union
from graphene import ResolveInfo
from ..attribute import AttributeType
from ..core.exceptions import PermissionDenied
from ..permission.auth_filters import is_app, is_staff_user
from ..permission.enums import (
BasePermissi... |
11,847 | reset access type | # Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
"""
Defines classes that will keep results of different calculations.
"""
class declaration_algs_cache_t(object):
def... |
11,848 | validate | # Copyright (c) 2017, Frappe Technologies and contributors
# License: MIT. See LICENSE
import base64
import hashlib
import hmac
import json
from time import sleep
from urllib.parse import urlparse
import requests
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils.jinja im... |
11,849 | test radioset inner navigation post build | from __future__ import annotations
from textual.app import App, ComposeResult
from textual.widgets import RadioButton, RadioSet
class RadioSetApp(App[None]):
def __init__(self):
super().__init__()
self.events_received = []
def compose(self) -> ComposeResult:
with RadioSet(id="from_bu... |
11,850 | test redirect both | from pybind11_tests import iostream as m
import sys
from contextlib import contextmanager
try:
# Python 3
from io import StringIO
except ImportError:
# Python 2
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
# Python 3.4
from con... |
11,851 | copy aircraft def | # JSBSim_nb_utils.py
#
# Some utilities to help developing Jupyter notebooks (Python 3 kernel) to test JSBSim.
#
# Copyright (c) 2018 JSBSim-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... |
11,852 | dae | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES).
#
# Copyright (c) 2018-2023 by the software own... |
11,853 | assert isinstance | import keyword
import enum
import json
from datetime import datetime
import jsonschema
from enum import Enum
import six
def format_date(obj):
if isinstance(obj, datetime):
return str(obj)
class SchemaProperty(property):
def __init__(self, name=None, *args, **kwargs):
super(SchemaProperty,... |
11,854 | test empty package dir | """Tests for distutils.command.build_py."""
import os
import sys
import unittest
from distutils.command.build_py import build_py
from distutils.core import Distribution
from distutils.errors import DistutilsFileError
from distutils.tests import support
from test.support import run_unittest
class BuildPyTestCase(su... |
11,855 | variable | # This file comes from
# https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py
# Do not edit! Edit the upstream one instead.
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that alr... |
11,856 | list tasks | # Stubs for marathon.client (Python 3.7)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Optional
from .models import (
MarathonApp as MarathonApp,
MarathonDeployment as MarathonDeployment,
MarathonGroup as MarathonGroup,
MarathonInfo as MarathonInf... |
11,857 | test servicefile create failure permission denied not |
import logging
import json
import io
from unittest import mock
from django.test import TestCase, tag
from django.conf import settings
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from core.storage import connect_storage
from servicefiles.models import... |
11,858 | test revert lambda long number format | # IMPORTATION STANDARD
import datetime
from pathlib import Path
# IMPORTATION THIRDPARTY
import pandas as pd
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.helper_funcs import (
check_start_less_than_end,
export_data,
remove_timezone_from_dataframe,
revert_lambda_long_number_format,
)
# p... |
11,859 | plot | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""PatternNet dataset."""
import os
from typing import Callable, Optional, cast
import matplotlib.pyplot as plt
from torch import Tensor
from .geo import NonGeoClassificationDataset
from .utils import download_url, extract... |
11,860 | get request body data | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from dataclasses import InitVar, dataclass
from typing import Any, Iterable, List, Mapping, Optional, Union
import dpath.util
from airbyte_cdk.models import AirbyteMessage, SyncMode, Type
from airbyte_cdk.sources.declarative.interpolation.interpolated_strin... |
11,861 | download entity | """ utils.py offers different utilities
"""
import sys
import subprocess
import os
import gdown
import formatter
from formatter import Color
from globals import (
SEPARATOR,
ESMINI_CMAKE_TARGET_FLAGS,
ESMINI_COMPILERS,
ESMINI_DIRECTORY_EXTERNALS,
)
YES_OR_NO_STR = (
Color.GREEN + " y(yes)" + Co... |
11,862 | test model | #!/usr/bin/env python3
# Copyright (c) 2021 CINN 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 r... |
11,863 | backend | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# 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 derivat... |
11,864 | custom route handler | from typing import Callable
from fastapi import FastAPI
from fastapi.responses import Response as FastAPIResponse
from fastapi.routing import APIRoute as FastAPIRoute
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from opentelemetry.instrumentation.fastapi import F... |
11,865 | is this | """Convert expressions from oso into a format that the SQLAlchemy translation can use."""
from collections import defaultdict
from typing import Dict, List, Optional, Union
from polar.exceptions import UnsupportedError
from polar.expression import Expression
from polar.variable import Variable
TGroupedExpressions = ... |
11,866 | get corr | # Copyright (c) 2021 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... |
11,867 | debug | #!/usr/bin/env python3
#
# main.py
#
# Command-line utility for interacting with PSU Controller in PDDF mode in SONiC
#
try:
import sys
import os
import click
from tabulate import tabulate
from utilities_common.util_base import UtilHelper
except ImportError as e:
raise ImportError("%s - require... |
11,868 | restore | #!/usr/bin/env python3
import fcntl
import os
import pathlib
import pty
import shutil
import subprocess
import sys
import termios
import time
CRIU_BIN = "../../../criu/criu"
CRIU_NS = "../../../scripts/criu-ns"
IMG_DIR = "dumpdir"
DUMP_LOG = "dump.log"
RESTORE_LOG = "restore.log"
PIDFILE = "pidfile"
def check_dump... |
11,869 | test wwinp reader | from pathlib import Path
import numpy as np
import openmc
import pytest
# check that we can successfully read wwinp files with the following contents:
#
# - neutrons on a rectilinear mesh
# - neutrons and photons on a rectilinear mesh
# check that the following raises the correct exceptions (for now):
#
# - wwinp... |
11,870 | get model | # Copyright 2019 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... |
11,871 | test prior type | #!/usr/bin/env python3
import math
import unittest
import torch
from gpytorch.kernels import CosineKernel
from gpytorch.priors import NormalPrior
class TestCosineKernel(unittest.TestCase):
def test_computes_periodic_function(self):
a = torch.tensor([[4, 1], [2, 2], [8, 0]], dtype=torch.float)
b... |
11,872 | test fit | import numpy as np
import pandas as pd
import pytest
from darts import TimeSeries
from darts.logging import get_logger
from darts.tests.conftest import tfm_kwargs
from darts.utils import timeseries_generation as tg
logger = get_logger(__name__)
try:
import torch.nn as nn
from darts.models.components.transfo... |
11,873 | data type str | #!/usr/bin/env python3
# Copyright (c) 2020 Samsung Electronics Co., Ltd. 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.... |
11,874 | is system | import argparse
import logging
import os
import platform
import random
import shutil
import subprocess
import sys
import tempfile
import time
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional
from utils import EX... |
11,875 | hook set thread locale | #!/usr/bin/env python3
#
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
#
from qiling import Qiling
from qiling.os.windows.api import *
from qiling.os.windows.const import *
from qiling.os.windows.fncc import *
# BOOL SetThreadLocale(
# LCID Locale
# );
@winsdkapi(cc=STDCALL, params={
... |
11,876 | test getattribute | import unittest
from authlib.jose.errors import MissingClaimError, InvalidClaimError
from authlib.oidc.core import CodeIDToken, ImplicitIDToken, HybridIDToken
from authlib.oidc.core import UserInfo, get_claim_cls_by_response_type
class IDTokenTest(unittest.TestCase):
def test_essential_claims(self):
claim... |
11,877 | iis factory | """
This module contains functions for computing an irreducible infeasible set
for a Pyomo MILP or LP using a specified commercial solver, one of CPLEX,
Gurobi, or Xpress.
"""
import abc
import logging
from pyomo.environ import SolverFactory
logger = logging.getLogger("pyomo.contrib.iis")
logger.setLevel(logging.INFO... |
11,878 | teardown func | import os
import tempfile
from unittest import mock
import numpy as np
from numpy.testing import assert_equal
from yt.testing import assert_rel_equal, fake_amr_ds, fake_random_ds
from yt.units.unit_object import Unit
LENGTH_UNIT = 2.0
def setup():
from yt.config import ytcfg
ytcfg["yt", "internals", "with... |
11,879 | test monomial | # ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2022
# National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of ... |
11,880 | preprocess | import logging
from abc import ABC
import torch
import transformers
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from accelerate import init_empty_weights
from accelerate import load_checkpoint_and_dispatch
from ts.context import Context
from ts.torch_handler.base_handl... |
11,881 | test trainer with vqa with model and | # Copyright (c) Alibaba, Inc. and its affiliates.
import os
import shutil
import tempfile
import unittest
from modelscope.hub.snapshot_download import snapshot_download
from modelscope.metainfo import Trainers
from modelscope.models.multi_modal import MPlugForAllTasks
from modelscope.msdatasets import MsDataset
from m... |
11,882 | test operator no space style | # Copyright 2016 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 a... |
11,883 | test normal submission grade inquiry panel | from .base_testcase import BaseTestCase
import os
import unittest
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
class TestGradeInquiry(BaseTestCase):
... |
11,884 | temp dir | """Helpers for writing unit tests."""
from collections.abc import Iterable
from io import BytesIO
import os
import re
import shutil
import sys
import tempfile
from unittest import TestCase as _TestCase
from fontTools.config import Config
from fontTools.misc.textTools import tobytes
from fontTools.misc.xmlWriter import... |
11,885 | test invalid id | from indra.databases import mesh_client
def test_mesh_id_lookup_from_web():
mesh_id = 'D003094'
mesh_name = mesh_client.get_mesh_name_from_web(mesh_id)
assert mesh_name == 'Collagen', mesh_name
def METHOD_NAME():
mesh_name = mesh_client.get_mesh_name_from_web('34jkgfh')
assert mesh_name is None
... |
11,886 | serialize | import os
import time
import warnings
from lxml import etree
from SpiffWorkflow.workflow import Workflow
from SpiffWorkflow.task import Task
from SpiffWorkflow.specs.WorkflowSpec import WorkflowSpec
from SpiffWorkflow.serializer.prettyxml import XmlSerializer as PrettyXmlSerializer
from SpiffWorkflow.serializer.xml ... |
11,887 | raise exception | # BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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, t... |
11,888 | teardown method | from tempfile import TemporaryDirectory
from typing import List
from .tokenizer_service import TokenizerService
from .window_service_factory import WindowServiceFactory
from .test_utils import get_tokenizer_service, TEST_PROMPT
class TestPalmyraWindowService:
TEST_PROMPT_LENGTH: int = 51
TEST_TOKEN_IDS: List... |
11,889 | cauchy mult torch | # This code is derived from https://github.com/HazyResearch/state-spaces
import torch
from cauchy_mult import (
cauchy_mult_bwd,
cauchy_mult_fwd,
cauchy_mult_sym_bwd,
cauchy_mult_sym_fwd,
)
from einops import rearrange
def METHOD_NAME(
v: torch.Tensor, z: torch.Tensor, w: torch.Tensor, symmetric=... |
11,890 | test flag method init called | import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
import gradio as gr
from gradio import flagging
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
class TestDefaultFlagging:
def test_default_flagging_callback(self):
with tempfile.TemporaryDirectory() as tmpdirname:
... |
11,891 | test dpnp full like from queue | # SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""Tests for dpnp ndarray constructors."""
import math
import sys
import dpctl
import dpctl.tensor as dpt
import dpnp
import numpy
import pytest
from numba import errors
from numba_dpex import dpjit
shapes = [11, (3, 7)... |
11,892 | set world path array idx | import threading
import math
import numpy as np
import cv2
from math import pi as pi
class Grid:
def __init__(self, frame):
self.lock = threading.Lock()
self.destiny = None
self.pathFinded = False
self.map = None
self.gWidth = int(frame.width())
self.gHeight = int(frame.height())
self.wWidth = float(f... |
11,893 | identity | # 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... |
11,894 | test adjacency list undirected vector set | from __future__ import absolute_import, division, print_function
from boost_adaptbx import graph
import unittest
class TestGraph(unittest.TestCase):
def manipulation(self, g, unique_edge, directed):
vd1 = g.add_vertex( label = "CA" )
vd2 = g.add_vertex( label = "C" )
vd3 = g.add_vertex( label = "C" ... |
11,895 | test state fail empty | import json
import pytest
from localstack.testing.aws.util import is_aws_cloud
from localstack.testing.pytest import markers
from localstack.testing.snapshots.transformer import JsonpathTransformer
from tests.aws.services.stepfunctions.templates.base.base_templates import BaseTemplate
from tests.aws.services.stepfunc... |
11,896 | test progress error | import vaex.misc.progressbar
import pytest
from unittest.mock import MagicMock
from common import *
def test_progress_bar():
pb = vaex.misc.progressbar.ProgressBar(0, 100)
pb.update(0)
pb.update(50)
assert "50.00%" in repr(pb)
pb.finish()
assert "elapsed time" in repr(pb)
def test_progress_bar... |
11,897 | end trace | import json
from typing import Any, Dict, List, Optional
from llama_index.callbacks.base import BaseCallbackHandler
from llama_index.callbacks.schema import CBEventType, EventPayload
class OpenAIFineTuningHandler(BaseCallbackHandler):
"""
Callback handler for OpenAI fine-tuning.
This handler will collec... |
11,898 | write |
from jamovi.core import ColumnType
from jamovi.core import DataType
from jamovi.core import MeasureType
from jamovi.librdata import Parser as RDataParser
from jamovi.librdata import DataType as RDataType
from jamovi.librdata import Writer
def get_readers():
return [ ( 'rds', read ), ( 'rdata', read ) ]
def g... |
11,899 | test heterogeneous feature store | import torch
from torch_geometric.distributed import LocalFeatureStore
def test_local_feature_store_global_id():
store = LocalFeatureStore()
feat = torch.tensor([
[0.0, 0.0, 0.0],
[1.0, 1.0, 1.0],
[2.0, 2.0, 2.0],
[3.0, 3.0, 3.0],
[4.0, 4.0, 4.0],
[5.0, 5.0, 5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.