id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
600 | build tfidf matrix | import argparse
import logging
import os
import pickle
import time
from scipy.sparse import save_npz, csr_matrix
import sklearn.preprocessing
import numpy as np
from utils import TfidfTgzReader
topic_list = [
'321', '336', '341',
'347', '350', '362',
'363', '367', '375', '378', '393',
'397', '400', '... |
601 | test norm object array | """ Test functions for linalg module
"""
import warnings
import numpy as np
from numpy import linalg, arange, float64, array, dot, transpose
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_array_equal,
assert_array_almost_equal, assert_array_less
)
class TestRegression:
def test... |
602 | test optional alternative | # coding=utf-8
import unittest
import string
from dragonfly.parsing.parse import spec_parser, CompoundTransformer
from dragonfly import Compound, Literal, Sequence, Optional, Empty, Alternative
# ===========================================================================
extras = {"an_extra": Alternative([Literal(u... |
603 | main | #!/usr/bin/env python
#
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===--------------------------------------... |
604 | left index | #!/usr/bin/env python2
"""
arith_parse.py: Parse shell-like and C-like arithmetic.
"""
from __future__ import print_function
import sys
import tdop
from tdop import CompositeNode
import demo_asdl
arith_expr = demo_asdl.arith_expr
op_id_e = demo_asdl.op_id_e
#
# Null Denotation -- token that takes nothing on the l... |
605 | disable session cookies | import json
import secrets
from pathlib import Path
from typing import Any, Dict
from flask.sessions import SecureCookieSessionInterface
from flask_mongoengine import MongoEngine
from flask_security import ConfirmRegisterForm, MongoEngineUserDatastore, Security, UserDatastore
from wtforms import StringField
from comm... |
606 | get boozer surface | from pathlib import Path
import numpy as np
from simsopt.configs import get_ncsx_data
from simsopt.field import coils_via_symmetries, BiotSavart
from simsopt.geo import Volume, Area, ToroidalFlux, SurfaceXYZFourier, SurfaceRZFourier, SurfaceXYZTensorFourier, BoozerSurface, MajorRadius
TEST_DIR = Path(__file__).parent... |
607 | setup ui | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'rare/ui/components/tabs/store/wishlist.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
... |
608 | warn | # Copyright 2023 Iguazio
#
# 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, softwa... |
609 | configure | #!/usr/bin/env python
# encoding: utf-8
# Hans-Martin von Gaudecker, 2012
"""
Run a Stata do-script in the directory specified by **ctx.bldnode**. The
first and only argument will be the name of the do-script (no extension),
which can be accessed inside the do-script by the local macro `1'. Useful
for keeping a log fi... |
610 | datetime to pretty str | # -*- coding: utf-8
# utility
# *******
#
# Utility Functions
import re
import uuid
from datetime import datetime, timedelta
from twisted.internet import reactor
from twisted.internet.defer import Deferred
def get_distribution_codename():
try:
with open("/etc/os-release", "r") as fd:
for... |
611 | exprdouble | import sys
from typing import Any, ClassVar
from typing_extensions import Literal, final
# _tkinter is meant to be only used internally by tkinter, but some tkinter
# functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl
# object that hasn't been converted to a string.
#
# There are not many ways to... |
612 | set up | from decimal import Decimal as D
from django.urls import reverse
from oscar.apps.dashboard.views import IndexView
from oscar.apps.order.models import Order
from oscar.core import prices
from oscar.core.loading import get_model
from oscar.test.factories import (
UserFactory,
create_basket,
create_order,
... |
613 | test list ordering version | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
614 | test train with empty input | # Copyright (c) 2023, 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... |
615 | serialize | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
# Copyright (C) 2023 Graz University of Technology.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Record re... |
616 | configure | #!/usr/bin/env python
from distutils.version import LooseVersion
from sys import exit
import argparse
import errno
import glob
import logging
import os
import pipes
import psutil
import shutil
import signal
import subprocess
import tarfile
CONTROLLER_DIR = "/tmp/yugabyte/controller"
CONTROLLER_PID_FILE = CONTROLLER_D... |
617 | stub add communication to case | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Stub functions that are used by the AWS Support unit tests.
"""
from datetime import datetime, timedelta
import json
from test_tools.example_stubber import ExampleStubber
class SupportStubber(ExampleStubbe... |
618 | conditional split merge reinterpret pipe | # Copyright (c) 2022, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
619 | register | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) according to PEP 3119."""
def abstractmethod(funcobj):
"""A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A
class that ... |
620 | initialize constants | '''
Author: car72
Date: 2020-12-09
Uses Felix Benz's circuit model combined with some of jjb's Igor code for combining cavity and antenna modes
"Generalized circuit model for coupled plasmonic systems"; Benz et al., Optics Express, 2015
"Hybridization of plasmonic antenna and cavity modes: Extreme optics of na... |
621 | test2 | # Python 3 positional, kwonly, varargs, and annotations. Ick.
# RUNNABLE!
def test1(args_1, c: int, w=4, *varargs: int, **kwargs: 'annotating kwargs') -> tuple:
return (args_1, c, w, kwargs)
def METHOD_NAME(args_1, args_2, c: int, w=4, *varargs: int, **kwargs: 'annotating kwargs'):
return (args_1, args_2, c, ... |
622 | test latest version | import os
import pytest
import salt.modules.pkgin as pkgin
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules(tmp_path):
return {pkgin: {"__opts__": {"cachedir": str(tmp_path)}}}
def test_search():
"""
Test searching for a package
"""
pkgin_out = [
... |
623 | get private endpoint connection output | # 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... |
624 | test create or update indexer | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
625 | test execute program no args | from __future__ import annotations
import json
import os.path
import platform
import subprocess
import sys
import tempfile
import threading
import time
import psutil
import pytest
from simpleflow import execute
from simpleflow.exceptions import ExecutionError, ExecutionTimeoutError
@execute.program(path="ls")
def ... |
626 | step | # 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 torch
from fairseq import utils
from fairseq.dataclass.utils import gen_parser_from_dataclass
class FairseqOptimizer(object):
def... |
627 | test single frame | # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import os
import unittest
import numpy as np
from common import (
j_loader,
run_dp,
tests_path,
)
from deepmd.env import (
GLOBAL_NP_FLOAT_PRECISION,
tf,
)
from deepmd.train.run_options import (
RunOptions,
)
from deepmd.train.trainer im... |
628 | new | # -*- coding: utf-8 -*-
#-----------------------
# Name: tmdb_request.py
# Python Library
# Author: Raymond Wagner
# Purpose: Wrapped urllib2.Request class pre-configured for accessing the
# TMDb v3 API
#-----------------------
from .tmdb_exceptions import *
from .locales import get_locale
from .cache import ... |
629 | run write instructions | import os
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from fastapi.exceptions import HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
import aimcore.transport.message_utils as utils
from aimcore.transport.router import ClientRouter
from aimcor... |
630 | autograd log det | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
from torch.distributions import (
AffineTransform,
Beta,
TransformedDistribution,
biject_to,
transform_to,
)
from pyro.distributions import constraints, transforms
from p... |
631 | signal recompose meanfreq | import matplotlib.pyplot as plt
import numpy as np
import scipy.cluster
from .signal_zerocrossings import signal_zerocrossings
def signal_recompose(components, method="wcorr", threshold=0.5, keep_sd=None, **kwargs):
"""**Combine signal sources after decomposition**
Combine and reconstruct meaningful signal ... |
632 | merge | import numpy
import pandas as pd
from pandas import DataFrame
from weaverbird.backends.pandas_executor.types import DomainRetriever, PipelineExecutor
from weaverbird.pipeline.steps.waterfall import (
_RESULT_COLUMN,
GROUP_WATERFALL_COLUMN,
LABEL_WATERFALL_COLUMN,
TYPE_WATERFALL_COLUMN,
WaterfallSte... |
633 | test analyze package invalid data | import sys
import pytest
from frictionless import Package
pytestmark = pytest.mark.skipif(
sys.version_info < (3, 10),
reason="Supported on Python3.10+",
)
# General
def test_analyze_package():
package = Package("data/package-1067.json")
analysis = package.analyze()
assert len(analysis) == 3
... |
634 | get traces | from pathlib import Path
import numpy as np
from spikeinterface.core import BaseRecording, BaseRecordingSegment
from spikeinterface.core.core_tools import define_function_from_class
try:
import h5py
HAVE_MCSH5 = True
except ImportError:
HAVE_MCSH5 = False
class MCSH5RecordingExtractor(BaseRecording):
... |
635 | test bootstrap for vector | """
This module is used to test the functionalities of the baseclass.
- test_pick_and_freeze_sampling:
Test the `generate_pick_and_test_samples` function.
- test_bootstrap_for_vector:
Test the bootstrap sampling for a vector.
- test_bootstrap_for_matrix:
Test the bootstrap sampling for a matrix.
"""
i... |
636 | server bind | # -*- coding: utf-8 -*-
"""
Helper module which exposes abstractions to write webservers easily
"""
from abc import ABC, abstractmethod
import socket
import http.server as http
from http import HTTPStatus
from urllib.parse import parse_qs, urlparse
import json
class Response():
""" Represents a HTTP `Respon... |
637 | cb | # Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
from __future__ import annotations
from typing import ContextManager, DefaultDict, Dict, Iterator, List, Tuple, Type, Union
try:
# Introduced in Python 3.8
from typing import Protocol
except ImportError:
from typing_exten... |
638 | get udp ports | """
owtf.config
~~~~~~~~~~~
The Configuration object parses all configuration files, loads them into
memory, derives some settings and provides framework modules with a central
repository to get info.
"""
import logging
from collections import defaultdict
try: # PY3
from urllib.parse import urlparse
except Impor... |
639 | test08 wrong os update | #!/usr/bin/env python3
import os
import tarfile
from gppylib.commands.base import ExecutionError
from gppylib.operations.test.regress.test_package import GppkgTestCase, unittest, GppkgSpec, RPMSpec, ARCH, OS, GPDB_VERSION
class SimpleNegativeTestCase(GppkgTestCase):
# @unittest.expectedFailure
def test00_wro... |
640 | get file name | import factory
from django.conf import settings
from django.core.files import File
from kitsune.questions.tests import QuestionFactory
from kitsune.sumo.tests import TestCase
from kitsune.upload.models import ImageAttachment
from kitsune.upload.storage import RenameFileStorage
from kitsune.upload.utils import FileTooL... |
641 | test pyrochem elemental sum | import unittest
import numpy as np
import pandas as pd
import pyrolite.geochem
from pyrolite.comp.codata import renormalise
from pyrolite.geochem.norm import get_reference_composition
from pyrolite.util.synthetic import normal_frame, normal_series
# [print("# " + i) for i in dir(df.pyrochem) if "__" not in i and not... |
642 | 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... |
643 | check scope | # 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... |
644 | configure | from __future__ import annotations
from .Layer import Layer
from .Node import Node
from .Printable import Printable
from .Emulator import Emulator
from .enums import NodeRole
from .Binding import Binding
from typing import Dict, List, Set, Tuple
from .BaseSystem import BaseSystem
class Server(Printable):
"""!
... |
645 | materials2 | """
merge_materials
===============
Autogenerated DPF operator classes.
"""
from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import Output, _Outputs
from ansys.dpf.core.operators.specification import PinSpecification,... |
646 | 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... |
647 | datastore job | # encoding: utf-8
import unittest.mock as mock
import pytest
import ckan.lib.jobs as jobs
import ckan.plugins as p
import ckan.tests.factories as factories
import ckan.tests.helpers as helpers
import ckanext.datastore.backend as backend
import ckanext.datastore.backend.postgres as db
@pytest.mark.ckan_config("ckan.... |
648 | get chunks | # 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... |
649 | main test | # Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
#
# SkyTemple 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 y... |
650 | yotpo loyalty erasure data | from typing import Any, Dict, Generator
import pydash
import pytest
import requests
from faker import Faker
from requests import Response
from sqlalchemy.orm import Session
from fides.api.cryptography import cryptographic_util
from fides.api.models.connectionconfig import (
AccessLevel,
ConnectionConfig,
... |
651 | estimate | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 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 derivat... |
652 | stream slices | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import datetime
import decimal
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple
import requests
import source_adjust.model
from airbyte_cdk.models import AirbyteMessage, AirbyteStateMessage, SyncMode, Type
from airbyte_cdk.so... |
653 | inner | # 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... |
654 | create output header | # -*- coding:utf-8 -*-
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All ... |
655 | test delayed | from datetime import datetime, timedelta
from django.test.utils import override_settings
from olympia.amo.tests import (
TestCase,
addon_factory,
block_factory,
user_factory,
version_factory,
)
from ..models import BlocklistSubmission
class TestBlocklistSubmissionManager(TestCase):
def METH... |
656 | active | # Copyright The IETF Trust 2016-2020, All Rights Reserved
# -*- coding: utf-8 -*-
import io
import os
import sys
import time
from pathlib import Path
from textwrap import dedent
from xym import xym
from django.conf import settings
from django.core.management.base import BaseCommand
import debug ... |
657 | is initialized | from hvac.api.system_backend.system_backend_mixin import SystemBackendMixin
from hvac.exceptions import ParamValidationError
class Init(SystemBackendMixin):
def read_init_status(self):
"""Read the initialization status of Vault.
Supported methods:
GET: /sys/init. Produces: 200 applica... |
658 | set up | # Copyright 2020 PerfKitBenchmarker 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... |
659 | stop | import sys
import datetime
import asyncio
import traceback
from aiohttp_json_rpc import JsonRpcClient
class WorkerClient(JsonRpcClient):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.add_methods(
("", self.start_job),
)
self.current_job =... |
660 | parse statement |
# Copyright 2008-2014 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This module contains the parser to parse expressions in templates
and returns an L{Expression} object.
'''
import re
import operator
import ast
from zim.parser import ParserError
from zim.templates.expression import \
ExpressionOperator, Exp... |
661 | test object equal self | import unittest
import collections
class TestSegment(unittest.TestCase):
def getSegment_line(self):
contour, unrequested = self.objectGenerator("contour")
unrequested.append(contour)
contour.appendPoint((0, 0), "move")
contour.appendPoint((101, 202), "line")
segment = cont... |
662 | save | from copy import deepcopy
from os.path import join, realpath
from typing import Union, Dict
import shapely.wkb
from shapely.geometry import Point, Polygon, LineString, MultiLineString
from shapely.ops import unary_union
from aequilibrae.project.basic_table import BasicTable
from aequilibrae.project.project_creation i... |
663 | gen random input fn | # Copyright 2019 Xilinx 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 agreed to in writing, ... |
664 | constant shift log scale fn | # Copyright 2017 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... |
665 | test deactivate preorder for variant | from django.db.models.aggregates import Sum
from ...product.models import ProductVariantChannelListing
from ..management import deactivate_preorder_for_variant
from ..models import Allocation, PreorderAllocation, Stock
def METHOD_NAME(
preorder_variant_global_and_channel_threshold,
preorder_allocation,
s... |
666 | pos tag | # Natural Language Toolkit: Taggers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
NLTK Taggers
This package contains classes and interfaces... |
667 | delete | from _collections_abc import Generator, dict_keys
from _typeshed import Incomplete, ReadableBuffer
from types import TracebackType
from typing_extensions import Literal, Self, TypeAlias
from pyasn1.type.base import Asn1Item
from .pooling import ServerPool
from .server import Server
SASL_AVAILABLE_MECHANISMS: Incompl... |
668 | do set parent | from panda3d.core import NodePath
from . import DistributedObjectAI
from . import GridParent
class DistributedNodeAI(DistributedObjectAI.DistributedObjectAI, NodePath):
def __init__(self, air, name=None):
# Be careful not to create multiple NodePath objects
if not hasattr(self, 'DistributedNodeAI_... |
669 | get | # Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
670 | test verbosity special | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated d... |
671 | has enough cpus | import ctypes
import logging
import os
import psutil
import subprocess
from abc import ABC
from os.path import realpath
from shutil import disk_usage
from .file_utils import get_kubeconfig_path, get_kubectl_directory
from . import definitions
logger = logging.getLogger(__name__)
class Auxiliary(ABC):
"""
B... |
672 | get criterion | import numpy as np
import torch
import torchaudio
from coqpit import Coqpit
from torch import nn
from TTS.encoder.losses import AngleProtoLoss, GE2ELoss, SoftmaxAngleProtoLoss
from TTS.utils.generic_utils import set_init_dict
from TTS.utils.io import load_fsspec
class PreEmphasis(nn.Module):
def __init__(self, c... |
673 | merge | """Lazy ZIP over HTTP"""
__all__ = ["HTTPRangeRequestUnsupported", "dist_from_wheel_url"]
from bisect import bisect_left, bisect_right
from contextlib import contextmanager
from tempfile import NamedTemporaryFile
from typing import Any, Dict, Generator, List, Optional, Tuple
from zipfile import BadZipfile, ZipFile
f... |
674 | test snake case | # Import AWS utils
from ScoutSuite.providers.aws.utils import (
get_keys,
no_camel,
get_name,
is_throttled,
get_aws_account_id,
get_partition_name,
snake_keys,
)
from ScoutSuite.utils import *
import collections
import unittest
from unittest import mock
import datetime
#
# Test methods for ... |
675 | run | """
An example that uses a function from external C library (OpenCV in this case).
Works for all C-based code generation targets (i.e. for cython and cpp_standalone
device) and for numpy (using the Python bindings).
This example needs a working installation of OpenCV 3.x and its Python bindings.
It has been tested on ... |
676 | forward |
import numpy as np
from . import sphere128 as sph
from dedalus.tools.cache import CachedMethod
class Sphere:
def __init__(self,L_max,S_max=0,N_theta=None,m_min=None,m_max=None):
self.L_max, self.S_max = L_max, S_max
if N_theta == None: N_theta = L_max+1
self.N_theta = N_theta
... |
677 | test sitemap generators | # -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2018 CERN.
#
# Zenodo 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
# License, or (at your option) any later v... |
678 | test make hovertext | import datetime
import logging
from textwrap import dedent
from typing import cast
import numpy as np
import pytest
from pytest import LogCaptureFixture
import optuna
from optuna.distributions import FloatDistribution
from optuna.study import create_study
from optuna.testing.visualization import prepare_study_with_tr... |
679 | create vm | #!/usr/bin/env python3
# group: rw backing
#
# Copyright (C) 2019 Red Hat, Inc.
#
# 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 the License, or
# (at your option) any later... |
680 | main | #!/usr/bin/env python3
############################################################
# Program is part of MintPy #
# Copyright (c) 2013, Zhang Yunjun, Heresh Fattahi #
# Author: Antonio Valentino, Joshua Zahner, Aug 2022 #
#####################################################... |
681 | get unit spike train | from pathlib import Path
import numpy as np
from spikeinterface.core import BaseSorting, BaseSortingSegment
from spikeinterface.core.core_tools import define_function_from_class
try:
import h5py
HAVE_HS2SX = True
except ImportError:
HAVE_HS2SX = False
class HerdingspikesSortingExtractor(BaseSorting):
... |
682 | test issue as dict | #
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
from unittest import mock
import testtools
import bandit
from bandit.core import constants
from bandit.core import issue
class IssueTests(testtools.TestCase):
def test_issue_create(self):
new_issue = _ge... |
683 | check storage needs cleanup | """Handle storage retention and usage."""
import logging
import shutil
import threading
from pathlib import Path
from peewee import fn
from frigate.config import FrigateConfig
from frigate.const import RECORD_DIR
from frigate.models import Event, Recordings
logger = logging.getLogger(__name__)
bandwidth_equation = ... |
684 | forward | import warnings
from collections import defaultdict
from typing import Dict, List, Optional
import torch
from torch import Tensor
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.module_dict import ModuleDict
from torch_geometric.typing import Adj, EdgeType, NodeType
from torch_geometric.uti... |
685 | write ctl | """
Solaris Platform Module (Incomplete)
"""
# Copyright (C) 2007 Invisigoth - See LICENSE file for details
import os
import struct
import array
# Control codes (long values) for messages written to ctl and lwpctl files.
PCNULL = 0 # null request, advance to next message */
PCSTOP = 1 # direct process or lwp to ... |
686 | get debuglevel | """
Copyright (c) 2016 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... |
687 | handle | """Windows service. Requires pywin32."""
import os
import win32api
import win32con
import win32event
import win32service
import win32serviceutil
from cherrypy.process import wspbus, plugins
class ConsoleCtrlHandler(plugins.SimplePlugin):
"""A WSPBus plugin for handling Win32 console events (like Ctrl-C)."""
... |
688 | test symlink exists different atomic | """
Tests for file.symlink function
"""
import os
import pytest
import salt.utils.path
from salt.exceptions import CommandExecutionError, SaltInvocationError
pytestmark = [
pytest.mark.windows_whitelisted,
]
@pytest.fixture(scope="module")
def file(modules):
return modules.file
@pytest.fixture(scope="fu... |
689 | identifier | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... |
690 | test locate async | from XRootD import client
from XRootD.client.utils import AsyncResponseHandler
from XRootD.client.flags import OpenFlags, QueryCode, MkDirFlags, AccessMode, \
DirListFlags, PrepareFlags
from env import *
import pytest
import sys
import os
import inspect
def test_filesystem():
c = cli... |
691 | test table metadata | from unittest.mock import ANY, Mock
import pytest
from yarl import URL
from faust.app.router import Router
from faust.exceptions import SameNode
from faust.web.exceptions import ServiceUnavailable
class Test_Router:
@pytest.fixture()
def assignor(self, *, app):
assignor = app.assignor = Mock(name="a... |
692 | tear down | from unittest import skipUnless, SkipTest
import uuid
from datetime import datetime
from django.conf import settings
from django.test import TestCase
from corehq.form_processor.backends.sql.dbaccessors import ShardAccessor
from corehq.form_processor.models import XFormInstance
from corehq.form_processor.tests.utils im... |
693 | test notify | # Author: Marvin Pinto <me@marvinp.ca>
# Author: Dennis Lutter <lad1337@gmail.com>
from sickchill import logger, settings
from sickchill.oldbeard.common import (
NOTIFY_DOWNLOAD,
NOTIFY_LOGIN,
NOTIFY_LOGIN_TEXT,
NOTIFY_SNATCH,
NOTIFY_SUBTITLE_DOWNLOAD,
NOTIFY_UPDATE,
NOTIFY_UPDATE_TEXT,
... |
694 | repl mathics | # -*- coding: utf-8 -*-
import re
import unicodedata
from django.utils.html import linebreaks
from mathics.doc.common_doc import (
ALLOWED_TAGS,
ALLOWED_TAGS_RE,
CONSOLE_RE,
DL_ITEM_RE,
DL_RE,
HYPERTEXT_RE,
IMG_PNG_RE,
IMG_RE,
LATEX_RE,
LIST_ITEM_RE,
LIST_RE,
MATHICS_RE... |
695 | read int | import json
from typing import IO, Any, Tuple, List
from .parser import Parser
from .symbols import (
RecordStart,
FieldStart,
Boolean,
Int,
Null,
String,
Long,
Float,
Double,
Bytes,
FieldEnd,
RecordEnd,
Union,
UnionEnd,
MapStart,
MapEnd,
MapKeyMarker... |
696 | output | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
697 | remove temp results | """This module contains everything involved in parsing and evaluating the
results of test runs. This includes the base for the 'result parser' plugins
themselves, as well as functions for performing this parsing. Additionally,
it contains the functions used to get the base result values, as well as
resolving result eva... |
698 | save settings | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# 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) any later version.
... |
699 | feature map | #!/usr/bin/env python
###############################################################################
# Copyright Kitware Inc. and Contributors
# Distributed under the Apache License, 2.0 (apache.org/licenses/LICENSE-2.0)
# See accompanying Copyright.txt and LICENSE files for details
##################################... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.