id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
1,000 | get converter | import numpy as np
from qutip import convert_unit, clebsch, n_thermal
import qutip.utilities as utils
from functools import partial
import pytest
@pytest.mark.parametrize(['w', 'w_th', 'expected'], [
pytest.param(np.log(2), 1, 1, id='log(2)'),
pytest.param(np.log(2)*5, 5, 1, id='5*log(2)'),
pytest.param(0... |
1,001 | kind | from .context import Context as Context
from .query import (
AND as AND, OR as OR, Query as Query, Node as Node,
ConjunctionNode as ConjunctionNode, DisjunctionNode as DisjunctionNode,
FilterNode as FilterNode)
from google.cloud import datastore
from redis import StrictRedis
from typing import (
Any, C... |
1,002 | get stream info | from logging import debug, info, warning, error, exception
import re
from datetime import datetime, timedelta
from .. import AbstractServiceHandler
from data.models import Episode, UnprocessedStream
class ServiceHandler(AbstractServiceHandler):
_show_url = "http://crunchyroll.com/{id}"
_show_re = re.compile("crunch... |
1,003 | test cite class | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
from ..core import *
# skip function tests utilizing ads.ExportQuery for now as it is unstable
# get file path of a static data file for testing
# def data_path(filename):
# data_dir = os.path.join(os.path.dirname(__file__), ... |
1,004 | installed solvers | """
Copyright 2013 Steven Diamond
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... |
1,005 | build tf graph | # Copyright 2023 The Magenta 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 applicable law or agreed to in ... |
1,006 | test search acquisition date | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation;... |
1,007 | get mn connection count | #!/usr/bin/env python3
# Copyright (c) 2015-2020 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import DashTestFramework
from test_framework.util import *
'''
llmq-conn... |
1,008 | convert val | from traitlets import Any, Bool, List, observe
from jdaviz.core.registries import tray_registry
from jdaviz.core.template_mixin import PluginTemplateMixin, DatasetSelectMixin
from jdaviz.core.user_api import PluginUserApi
from jdaviz.utils import PRIHDR_KEY, COMMENTCARD_KEY
__all__ = ['MetadataViewer']
@tray_regist... |
1,009 | test set dist type deb | import logging
from mock import (
patch, Mock, MagicMock
)
from pytest import (
raises, fixture
)
from kiwi.defaults import Defaults
from kiwi.solver.sat import Sat
from kiwi.exceptions import (
KiwiSatSolverPluginError,
KiwiSatSolverJobProblems,
KiwiSatSolverJobError
)
class TestSat:
@fixtu... |
1,010 | none to center | # coding=utf-8
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distributed i... |
1,011 | circle | """ An example of how to use Chaco to render a visual TraitsUI editor.
This particular editor allows the user to set two endpoints of an
interval.
"""
from traits.api import HasTraits
from traits.etsconfig.api import ETSConfig
if ETSConfig.toolkit == "wx":
from traitsui.wx.editor import Editor
else:
from trai... |
1,012 | merge | """Tools for working with NIDM-Experiment files"""
import click
from rdflib import Graph, util
from nidm.core import Constants
from nidm.experiment.Query import GetParticipantIDs
from nidm.experiment.tools.click_base import cli
# adding click argument parsing
@cli.command()
@click.option(
"--nidm_file_list",
... |
1,013 | dumpd | from collections import OrderedDict
from operator import attrgetter
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
Optional,
Union,
no_type_check,
)
from funcy import post_processing
from dvc.dependency import ParamsDependency
from dvc.output import Annotation, Output
f... |
1,014 | ssh keys | # 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... |
1,015 | test get patched otus | import pytest
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession
import virtool.indexes.db
from aiohttp.test_utils import make_mocked_coro
from virtool.indexes.db import (
attach_files,
get_current_id_and_version,
get_next_version,
get_patched_otus,
update_last_indexed_versions,
)
from vi... |
1,016 | get n pct | """
Functions that make it easier to provide a default centering
for a view state
"""
import math
from ..bindings.view_state import ViewState
from .type_checking import is_pandas_df
def _squared_diff(x, x0):
return (x0 - x) * (x0 - x)
def euclidean(y, y1):
"""Euclidean distance in n-dimensions
Paramete... |
1,017 | test whisper reader broken file | from .base import TestCase
import os
import mock
import shutil
import time
from django.conf import settings
import whisper
import gzip
from graphite.readers import WhisperReader, GzippedWhisperReader
from graphite.wsgi import application # NOQA makes sure we have a working WSGI app
class WhisperReadersTests(Test... |
1,018 | load db | #!/usr/bin/env python
# Copyright (c) 2009 Chris Moyer http://kopertop.blogspot.com/
#
# 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 ... |
1,019 | array | from collections import OrderedDict
import numpy as np
from pyop2.mpi import internal_comm, decref
import firedrake
from firedrake.petsc import PETSc
from firedrake.matrix import MatrixBase
__all__ = ['Vector', 'as_backend_type']
class VectorShim(object):
"""Compatibility layer to enable Dolfin-style as_back... |
1,020 | decode event data message | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
1,021 | handle errors | """
What is this tool
=================
This script allows you to pull down data from YouTube for a given playlist.
How to use this tool
====================
You'll need a Google API key:
- Go to https://console.developers.google.com
- Enable the "YouTube Data API v3" API
- Under credentials, create an ... |
1,022 | del optical image | import logging
from typing import Dict
import bottle
from sm.engine.db import DB
from sm.engine.es_export import ESExporter
from sm.engine.queue import QueuePublisher, SM_ANNOTATE, SM_DS_STATUS, SM_UPDATE, SM_LITHOPS
from sm.engine.errors import UnknownDSID, DSIsBusy
from sm.engine.config import SMConfig
from sm.rest... |
1,023 | get data | # Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations
from re import search, split
import requests
from cve_bin_tool.cve_scanner import CVEData
from cve_bin_tool.log import LOGGER
from cve_bin_tool.output_engine.util import ProductInfo, format_output
... |
1,024 | add brightness | # -*- coding: utf-8 -*-
"""
.. _vision__image_dataset_drift:
Image Dataset Drift
*******************
This notebooks provides an overview for using and understanding the image dataset
drift check, used to detect drift in simple image properties between train and
test datasets.
**Structure:**
* `What Is Image Dataset... |
1,025 | bytes available | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @File: F2TTL\ARCOM.py
# @Author: Niccolo' Bonacchi (@nbonacchi)
# @Date: Tuesday, December 7th 2021, 12:01:15 pm
"""
----------------------------------------------------------------------------
This file is part of the Sanworks ArCOM repository
Copyright (C) 2021 Sanworks... |
1,026 | get me | from fastapi import APIRouter, Depends, HTTPException, status
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from dispatch.config import DISPATCH_AUTH_REGISTRATION_ENABLED
from dispatch.auth.permissions import (
OrganizationMemberPermission,
PermissionsDependency,
)
from dispatch.auth.servi... |
1,027 | send ipc | # SPDX-License-Identifier: MIT
import struct
from ..common import *
from ...utils import *
from ..asc.base import *
class AFKEPMessage(Register64):
TYPE = 63, 48
class AFKEP_GetBuf(AFKEPMessage):
TYPE = 63, 48, Constant(0x89)
SIZE = 31, 16
TAG = 15, 0
class AFKEP_GetBuf_Ack(AFKEPMessage):
TYPE... |
1,028 | parse | # coding=utf-8
"""Provider code for Beyond-hd."""
from __future__ import unicode_literals
import logging
from medusa import tv
from medusa.bs4_parser import BS4Parser
from medusa.helper.common import convert_size
from medusa.logger.adapters.style import BraceAdapter
from medusa.providers.torrent.torrent_provider im... |
1,029 | rmdir | # Copyright 2020-2023 OpenDR European Project
#
# 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 agree... |
1,030 | put connection | from collections import deque
from typing import Deque, Dict, List, Optional, Tuple
from twisted.internet import defer
from twisted.internet.base import ReactorBase
from twisted.internet.defer import Deferred
from twisted.internet.endpoints import HostnameEndpoint
from twisted.python.failure import Failure
from twiste... |
1,031 | get total hits | """
===============
=== Purpose ===
===============
Extract a useful subset of the CDC data. Reads from `cdc` and `cdc_meta` (all
pages, and daily resolution) and writes to `cdc_extract` (selected pages, and
weekly resolution). The Epidata API is then used to read from `cdc_extract` and
update the `sensors` and `nowca... |
1,032 | register mode | ##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... |
1,033 | fake profile read only | import os
import json
try:
from urllib.parse import parse_qs
except ImportError:
from urlparse import parse_qs
import boto3.session
from chalice import Chalice, BadRequestError, NotFoundError, Response,\
CORSConfig, UnauthorizedError, AuthResponse, AuthRoute
# This is a test app that is used by integrat... |
1,034 | hook mem fetch unmapped | #!/usr/bin/env python
# Mariano Graziano
from unicorn import *
from unicorn.x86_const import *
import regress
#echo -ne "\x48\x31\xc0\x48\xb8\x04\x00\x00\x00\x00\x00\x00\x00\x48\x3d\x05\x00\x00\x00\x74\x05\xe9\x0f\x00\x00\x00\x48\xba\xbe\xba\x00\x00\x00\x00\x00\x00\xe9\x0f\x00\x00\x00\x48\xba\xca\xc0\x00\x00\x00\x00... |
1,035 | get survey id | # -*- coding: utf-8 -*-
# SDAPS - Scripts for data acquisition with paper based surveys
# Copyright(C) 2012 Benjamin Berg <benjamin@sipsolutions.net>
#
# 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 Founda... |
1,036 | test project form | from django.test.client import RequestFactory
from django.test.testcases import TestCase
from mediathread.factories import MediathreadTestMixin, ProjectFactory
from mediathread.main.course_details import ALLOW_PUBLIC_COMPOSITIONS_KEY, \
SELECTION_VISIBILITY_KEY
from mediathread.projects.forms import ProjectForm
fr... |
1,037 | verify tags | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with Amazon Simple Email Service
(Amazon SES) to manage email templates that contain replaceable tags.
"""
import logging
from pprint import pprint
im... |
1,038 | get account address | #!/bin/env python3
# Send a raw transaction
from web3 import Web3
from web3.middleware import geth_poa_middleware
from eth_account import Account
import os, sys
import json
import requests
def getFileContent(file_name):
file = open(file_name, "r")
data = file.read()
file.close()
return data.replace("\... |
1,039 | is symlink | #!/usr/bin/env python
"""A module with filesystem-related utility functions and classes."""
import array
import os
import platform
import stat
from typing import Dict
from typing import NamedTuple
from typing import Optional
from typing import Text
from grr_response_core.lib.util import precondition
class Stat(obj... |
1,040 | configure | import pathlib
import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.microsoft import check_min_vs, is_msvc
from conan.tools.apple import is_apple_os
from conan.tools.files import apply_conandata_patches, get, copy, rm
from conan.tools.build import check_min_cppstd
f... |
1,041 | time strided assign | from .common import Benchmark, get_squares, get_squares_
import numpy as np
from io import SEEK_SET, StringIO, BytesIO
class Copy(Benchmark):
params = ["int8", "int16", "float32", "float64",
"complex64", "complex128"]
param_names = ['type']
def setup(self, typename):
dtype = np.dty... |
1,042 | activate | """
Manage modjk workers
====================
Send commands to a :strong:`modjk` load balancer via the peer system.
This module can be used with the :ref:`prereq <requisites-prereq>`
requisite to remove/add the worker from the load balancer before
deploying/restarting service.
Mandatory Settings:
- The minion needs... |
1,043 | readinto | import sys
from _typeshed import ReadableBuffer
from collections.abc import Callable, Set as AbstractSet
from typing import Protocol
from typing_extensions import Self, final
if sys.version_info >= (3, 11):
__all__ = (
"md5",
"sha1",
"sha224",
"sha256",
"sha384",
"sh... |
1,044 | test transfer |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without ev... |
1,045 | section test plot view | import vtk
import slicer
from slicer.ScriptedLoadableModule import *
#
# PlotsSelfTest
#
class PlotsSelfTest(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "PlotsSelfTest"
self.parent.categories = ["Testing.TestCases... |
1,046 | test mips | import logging
import os
import unittest
import angr
import claripy
l = logging.getLogger("angr_tests")
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "binaries", "tests")
# pylint: disable=missing-class-docstring
# pylint: disable=no-self-use
class TestArgv(unittest.TestCase... |
1,047 | ensure dut readiness | import ast
import logging
import pytest
from tests.common.helpers.assertions import pytest_assert
from tests.common.utilities import wait_until
from tests.common.helpers.dut_utils import verify_orchagent_running_or_assert
from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success, expect_op_failu... |
1,048 | test multiple upgrades | # Copyright 2020 Least Authority TFA GmbH
# See COPYING for details.
"""
Tests for ``_zkapauthorizer.schema``.
"""
from testtools import (
TestCase,
ExpectedException,
)
from testtools.matchers import (
Equals,
MatchesStructure,
MatchesAll,
)
from hypothesis import (
given,
)
from hypothesis.... |
1,049 | upgrader | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os.path
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import configparser #To check whether the appropriate exceptions are raised.
import pytest #To register tests with.
... |
1,050 | test convert string to bool | # Copyright 2021 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
1,051 | write header | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 09 15:50:53 2016
@author: Alison Kirkby
read and write gocad objects
"""
import numpy as np
import os.path as op
import os
class Sgrid():
"""
class to read and write gocad sgrid files
need to provide:
workdir = working directory
fn = filename for ... |
1,052 | test list plugins disabled | """
Tests for `kolibri.utils.cli` module.
"""
from __future__ import absolute_import
from __future__ import print_function
import logging
import os
import tempfile
import pytest
from mock import patch
from kolibri.plugins.utils import autoremove_unavailable_plugins
from kolibri.utils import cli
from kolibri.utils im... |
1,053 | raise not implemented | import functools
from typing import NoReturn
from dbt.events.functions import warn_or_error
from dbt.events.types import JinjaLogWarning
from dbt.exceptions import (
DbtRuntimeError,
MissingConfigError,
MissingMaterializationError,
MissingRelationError,
AmbiguousAliasError,
AmbiguousCatalogMat... |
1,054 | 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
# --------------------------------... |
1,055 | test asfortranarray3 | import unittest
import pytest
import numpy
import cupy
from cupy import testing
class TestKind(unittest.TestCase):
@testing.for_orders('CFAK')
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
def test_asarray_chkfinite(self, xp, dtype, order):
a = [0, 4, 0, 5]
return xp.a... |
1,056 | get label | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
import torch.nn.functional as F
from mmcv.transforms import to_tensor
from mmengine.structures import LabelData
from mmaction.models import CutmixBlending, MixupBlending, RandomBatchAugment
from mmaction.structures import Act... |
1,057 | is match | # -*- coding: utf-8 -*-
import json
import os
import unittest
from SpiffWorkflow.bpmn.parser.BpmnParser import BpmnValidator
from SpiffWorkflow.task import TaskState
from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer, DEFAULT_SPEC_CONFIG
from .BpmnLoaderForTests import TestUserTaskConverter, T... |
1,058 | setup | # -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from . import lang_EU
ZERO = 'nulla'
class Num2Word_HU(lang_EU.Num2Word_EU):
GIGA_SUFFIX = "illiárd"
MEGA_SUFFIX = "illió"
def METHOD_NAME(self):
super(Num2Word_HU, self).METHOD_NAME()
self.negwo... |
1,059 | expect none | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... |
1,060 | bootstrap cc binary | """Macros that implement bootstrapping for the upb code generator."""
load(
"//bazel:upb_proto_library.bzl",
"upb_proto_library",
)
load(
"//cmake:build_defs.bzl",
"staleness_test",
)
_stages = ["_stage0", "_stage1", ""]
_protoc = "@com_google_protobuf//:protoc"
_upbc_base = "//upbc:protoc-gen-upb"
#... |
1,061 | test random pauli measurement output types | # Copyright (C) Unitary Fund
#
# This source code is licensed under the GPL license (v3) found in the
# LICENSE file in the root directory of this source tree.
"""Unit tests for quantum processing functions for classical shadows."""
import importlib
from typing import Callable, List
from unittest.mock import patch
i... |
1,062 | mock recovery dialog | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Project Contributors
#
# Distributed under the terms of the MIT License
# (see spyder/__init__.py for details)
# --------------------------------------------------------------------------... |
1,063 | prop descriptions | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergeo"
_path_str = "scattergeo.line"
_valid_props = {"color", "dash", "width"}
# col... |
1,064 | used s | from collections import ChainMap
from .LoopIR import LoopIR
from .memory import DRAM
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# Memory Analysis Pass
class MemoryAnalysis:
def __init__(self):
... |
1,065 | conv block | # 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... |
1,066 | test import macro | import pytest
import yaml
import copier
from copier.types import AnyByStrDict
from .helpers import build_file_tree
@pytest.mark.parametrize(
"subdir, settings",
[
(
"",
{
"_exclude": ["includes"],
},
),
(
"template",
... |
1,067 | build vector store query | """Base vector store index query."""
from typing import Any, Dict, List, Optional
from llama_index.constants import DEFAULT_SIMILARITY_TOP_K
from llama_index.data_structs.data_structs import IndexDict
from llama_index.indices.base_retriever import BaseRetriever
from llama_index.indices.query.schema import QueryBundl... |
1,068 | ff parse | # EPA_FactsAndFigures.py (scripts)
# !/usr/bin/env python3
# coding=utf-8
"""
Scrapes data from EPA's Facts and Figures Data table PDF. Includes
supporting functions.
"""
import io
from tabula.io import read_pdf
import pandas as pd
import numpy as np
from flowsa.location import US_FIPS
from flowsa.flowbyfunctions impo... |
1,069 | label | # 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
__all__ ... |
1,070 | set up | """Test measurement collection."""
import unittest
import mongomock
from database.measurements import create_measurement
from tests.fixtures import METRIC_ID, REPORT_ID, SOURCE_ID, SUBJECT_ID, create_report
class TestMeasurements(unittest.TestCase):
"""Unit tests for the measurements collection."""
def M... |
1,071 | test pauli interaction gates consistent protocols | # Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
1,072 | test skew x transform | from __future__ import annotations
from manim import *
from manim.utils.testing.frames_comparison import frames_comparison
from ..helpers.path_utils import get_svg_resource
__module_test__ = "img_and_svg"
# Tests break down into two kinds: one where the SVG is simple enough to step through
# and ones where the SVG ... |
1,073 | handle download | # -*- coding: utf-8 -*-
import re
import time
from datetime import timedelta
from ..base.simple_downloader import SimpleDownloader
class MegasharesCom(SimpleDownloader):
__name__ = "MegasharesCom"
__type__ = "downloader"
__version__ = "0.37"
__status__ = "testing"
__pattern__ = r"http://(?:www\... |
1,074 | test symbols | from pathlib import Path
from typing import cast
import cle
from cle import MachO
from cle.backends.macho.binding import MachOChainedFixup, MachORelocation
TEST_BASE = Path(__file__).resolve().parent.parent.parent / "binaries"
def test_fixups():
"""
Tests the pointer format DYLD_CHAINED_PTR_64_OFFSET
:r... |
1,075 | test students are unordered first student | # These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/kindergarten-garden/canonical-data.json
# File last updated on 2023-07-19
import unittest
from kindergarten_garden import (
Garden,
)
class KindergartenGardenTest(unittest.TestCase):
... |
1,076 | enable | """
Copyright (c) 2008-2011 Volvox Development Team
# 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, merge... |
1,077 | ssh login | """ This provides common functions for ipa """
from sssd.testlib.common.exceptions import SSSDException
from sssd.testlib.common.expect import pexpect_ssh
from sssd.testlib.common.exceptions import SSHLoginException
import subprocess
import pexpect
class ipaTools(object):
""" Collection of assorted functions for ... |
1,078 | test invalid block size | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.nddata import block_reduce, block_replicate, reshape_as_blocks
class TestReshapeAsBlocks:
def test_1d(self):
data = np.arange(16)
reshaped = reshape_as_blocks(data, 2)
assert res... |
1,079 | get model filename | import sys
from typing import Optional, Sequence
import requests
import typer
from wasabi import msg
from .. import about
from ..errors import OLD_MODEL_SHORTCUTS
from ..util import get_minor_version, is_package, is_prerelease_version, run_command
from ._util import SDIST_SUFFIX, WHEEL_SUFFIX, Arg, Opt, app
@app.co... |
1,080 | generate parser rst | """
Convert an argparse parser to option directives.
Inspired by sphinxcontrib.autoprogram but with a few differences:
- Contains some simple pre-processing on the help messages to make
the Sphinx version a bit prettier.
"""
import argparse
import re
from textwrap import dedent
from docutils import nodes
from doc... |
1,081 | debug cs | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
"""
C# support. A simple example::
def configure(conf):
conf.load('cs')
def build(bld):
bld(features='cs', source='main.cs', gen='foo')
Note that the configuration may compile C# snippets::
FRAG = '''
namespace Moo {
public class Test ... |
1,082 | cxx11 flag | # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
import sys
import llnl.util.lang
from spack.compiler import Compiler, UnsupportedCompilerFlag
from s... |
1,083 | get view | # 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... |
1,084 | get size | from pathlib import Path
from torch.autograd.profiler import profile
from .prof_utils import BaseProfiler, _format_time, _format_memory, _format_bandwidth
from typing import List
def METHOD_NAME(dtype: str):
if dtype == "fp16":
return 2
elif dtype == "fp32":
return 4
else:
raise No... |
1,085 | current filetype completion enabled | # Copyright (C) 2013-2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
#... |
1,086 | max | from collections import defaultdict, deque, OrderedDict
import copy
import datetime
import hashlib
import time
import paddle
import paddle.distributed as dist
import errno
import os
class SmoothedValue(object):
"""Track a series of values and provide access to smoothed values over a
window or the global seri... |
1,087 | test t5 bundler train | import copy
from unittest.mock import patch
import torch
from torch.nn import functional as F
from torchtext_unittest.common.case_utils import TestBaseMixin
class T5BaseTestModels(TestBaseMixin):
def test_t5_bundler_build_model(self) -> None:
from torchtext.models import T5Conf, T5Model, T5Bundle
... |
1,088 | 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... |
1,089 | step | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
1,090 | poison func 6 | # MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# 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
# r... |
1,091 | compute output resolution | # 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... |
1,092 | test jtvec adjoint test jxi bform | import unittest
import numpy as np
from scipy.constants import mu_0
from SimPEG.electromagnetics.utils.testing_utils import getFDEMProblem
testE = True
testB = True
verbose = False
TOL = 1e-5
FLR = 1e-20 # "zero", so if residual below this --> pass regardless of order
CONDUCTIVITY = 1e1
MU = mu_0
freq = 1e-1
addran... |
1,093 | test get setting not found with default | # Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
1,094 | build | import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.METHOD_NAME import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, replace_in_file, ge... |
1,095 | command signature | import datetime
import discord
import io
import random
import re
import traceback
from .checks import check_staff
from discord.ext import commands
from discord.utils import format_dt
from typing import Optional
class ConsoleColor(discord.Color):
@classmethod
def n3ds(cls):
return cls(0xCE181E)
... |
1,096 | 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
__all__ ... |
1,097 | option | #!/usr/bin/env pmpython
#
# Copyright (C) 2014-2017 Red Hat.
#
# 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 version.
#
# This ... |
1,098 | preprocess | """
Handler for Torchrec DLRM based recommendation system
"""
import json
import logging
import os
from abc import ABC
import torch
from torchrec.datasets.criteo import DEFAULT_CAT_NAMES
from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
from ts.torch_handler.base_handler import BaseHandler
logger = logging... |
1,099 | get weight index | from .GenericSource import *
from .GANSourceDefaultGenerator import GANSourceDefaultGenerator
import time
import scipy
class GANSourceDefaultPairsGenerator(GANSourceDefaultGenerator):
"""
Like GANSourceDefaultGenerator but for pairs of particle (PET)
"""
def __init__(self, user_info):
super()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.