id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
11,400 | test random seed deprecation | import numpy as np
import pytest
from skimage._shared import testing
from skimage._shared._warnings import expected_warnings
from skimage.draw import random_shapes
def test_generates_color_images_with_correct_shape():
image, _ = random_shapes((128, 128), max_shapes=10)
assert image.shape == (128, 128, 3)
d... |
11,401 | test list of strings in dict | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... |
11,402 | test delete indexer if unchanged | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
11,403 | get num samples | from typing import List, Union
import mmap
import warnings
from pathlib import Path
import numpy as np
from .baserecording import BaseRecording, BaseRecordingSegment
from .core_tools import write_binary_recording, define_function_from_class
from .job_tools import _shared_job_kwargs_doc
class BinaryRecordingExtracto... |
11,404 | get model | # 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,405 | encode | #! /usr/bin/env python3
# Copyright 1994 by Lance Ellinghouse
# Cathedral City, California Republic, United States of America.
# All Rights Reserved
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provid... |
11,406 | readlink | from collections.abc import Callable, Sequence
from contextlib import AbstractContextManager
from stat import S_IMODE as S_IMODE
from types import TracebackType
from typing import IO
from typing_extensions import Literal, Self, TypeAlias
import paramiko
from paramiko import AuthenticationException as AuthenticationExc... |
11,407 | save | __version__ = '1.2.0'
import os as _os
import sys as _sys
import matplotlib as _matplotlib
# If we try to load matplotlib.pyplot on a non-X system, it will fail
# unless 'Agg' is used before the import. All X-systems define the
# 'DISPLAY' environment variable, and all non-X-systems do not. We do make a
# distinction ... |
11,408 | nargs | from numba import typeof
from numba.core import types
from numba.np.ufunc.ufuncbuilder import GUFuncBuilder
from numba.np.ufunc.sigparse import parse_signature
from numba.np.numpy_support import ufunc_find_matching_loop
from numba.core import serialize
import functools
class GUFunc(serialize.ReduceMixin):
"""
... |
11,409 | test build webhook payload | from datetime import timedelta
from unittest import mock
from django.db.models.signals import post_save
from django.test import TestCase
import factory
from gnosis.eth import EthereumNetwork
from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_transaction_service.events.tasks import send_event_t... |
11,410 | test histograms length | # 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... |
11,411 | keygen | '''
El Gamal Public Key Encryption Scheme (Decisional Diffie-Hellman Assumption in groups of prime order)
| Available from: http://en.wikipedia.org/wiki/ElGamal_encryption
| Notes:
* type: encryption (public key)
* setting: DDH-hard prime order group
* assumption: DDH
:Authors: J Ayo Akinyele
:Dat... |
11,412 | test get dict with value prefix | # -*- coding: utf-8 -*-
import os
import unittest
import mozpack.path as mozpath
from mozunit import main
from six import StringIO
from mozbuild.dotproperties import DotProperties
test_data_path = mozpath.abspath(mozpath.dirname(__file__))
test_data_path = mozpath.join(test_data_path, "data")
class TestDotPropert... |
11,413 | change tracker | import pytest
import json
from six import StringIO
from mock import MagicMock
from thefuck.shells.generic import ShellConfiguration
from thefuck.entrypoints.not_configured import main
@pytest.fixture(autouse=True)
def usage_tracker(mocker):
return mocker.patch(
'thefuck.entrypoints.not_configured._get_not... |
11,414 | is device array | # SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""Provide a Dpex target for Numba's ``vectorize`` decorator."""
import warnings
import dpctl
import numpy as np
from numba.np.ufunc import deviceufunc
import numba_dpex as dpex
from numba_dpex.utils import (
as_usm_... |
11,415 | show hide | # -*- coding: utf-8; -*-
"""
Copyright (C) 2007-2013 Guake authors
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 progra... |
11,416 | test simple var like expression | #################################################################################
# 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,417 | get result | """Simple comparative benchmark runner.
"""
import click
import tomlkit
import subprocess
import re
import csv
import sys
import os
from concurrent import futures
import glob
__version__ = '1.0.0'
ARGS_RE = r'ARGS: (.*)'
def run_pipe(cmds, input, timeout):
"""Execute a pipeline of shell commands.
Send the... |
11,418 | test ksize1x1 stride2x3 rate1x1 | # Copyright 2015 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,419 | get spec from base spec | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... |
11,420 | test search in list of tags | import shutil
import os
from django.conf import settings
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.test import APIClient
from zds.api.pagination import REST_PAGE_SIZE, REST_MAX_PAGE_SIZE, REST_PAGE_SIZE_QUERY_PARAM
from rest_framew... |
11,421 | validate | from pysys.basetest import BaseTest
import time
import json
"""
Validate tedge-mapper-collectd messages that are published
on tedge/measurements
Given a configured system
When we start the tedge-mapper-collectd with sudo in the background
When we start tedge sub with sudo in the background
When we start two publish... |
11,422 | test condition oscillation extracted pars | import unittest
import pycqed as pq
import numpy as np
import matplotlib.pyplot as plt
import os
from pycqed.analysis_v2 import measurement_analysis as ma
class Test_flipping_analysis(unittest.TestCase):
@classmethod
def tearDownClass(self):
plt.close("all")
@classmethod
def setUpClass(self):... |
11,423 | test passmanager stage plugins not found | # This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
11,424 | next filehandle | """Files is a helper class for iterating over filenames."""
import glob
import io
import sys
import os.path
import bz2
import gzip
import lzma
import itertools
class Files(object):
"""Helper class for iterating over filenames.
It is used e.g. in ``udapi.core.basereader`` (as `self.files = Files(filenames=pa... |
11,425 | encode | from exceptions import *
from copy import copy
#from cd import *
from omexceptions import *
from objects import *
from re import compile
import StringIO
from xml.sax.saxutils import XMLGenerator
raiseException=True
class Context(object):
#TODO: Referenzen durch scope richtig behandeln
def __init__(self):
... |
11,426 | depack | '''
Native support of MultitouchSupport framework for MacBook (MaxOSX platform)
===========================================================================
'''
__all__ = ('MacMotionEventProvider', )
import ctypes
import threading
import collections
import os
from kivy.input.provider import MotionEventProvider
from ki... |
11,427 | update web uri | import logging
from datetime import datetime
from urllib.parse import urlparse
import sqlalchemy as sa
from h.db import Base, mixins
from h.models.annotation import Annotation
from h.models.document._exceptions import ConcurrentUpdateError
from h.models.document._meta import create_or_update_document_meta
from h.mode... |
11,428 | test scoring | # Sebastian Raschka 2014-2023
# mlxtend Machine Learning Library Extensions
# Author: Sebastian Raschka <sebastianraschka.com>
#
# License: BSD 3 clause
import os
import numpy as np
import pandas as pd
import pytest
from sklearn.base import BaseEstimator
from sklearn.linear_model import LogisticRegression
from sklear... |
11,429 | vertices | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2021 Pyresample developers
#
# 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 o... |
11,430 | check user is authenticated | # -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019-2022 RERO
#
# 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
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope... |
11,431 | set status | import logging
import os
import re
import socket
import urllib.error
import urllib.parse
import urllib.request
from html.parser import HTMLParser
from importlib import import_module
from os.path import join, exists
from PyQt5.QtCore import QObject, pyqtSignal
from .. import version_string
from ..constants import CONF... |
11,432 | test raise error funcall with unexpected keyword | """Unit tests for the keyword only argument specified in PEP 3102."""
__author__ = "Jiwon Seo"
__email__ = "seojiwon at gmail dot com"
import unittest
def posonly_sum(pos_arg1, *arg, **kwarg):
return pos_arg1 + sum(arg) + sum(kwarg.values())
def keywordonly_sum(*, k1=0, k2):
return k1 + k2
def keywordonly_no... |
11,433 | test dirty repo | """
Test the ability to export courses to xml from studio
"""
import copy
import os
import shutil
import subprocess
from uuid import uuid4
from django.conf import settings
from django.test.utils import override_settings
import cms.djangoapps.contentstore.git_export_utils as git_export_utils
from cms.djangoapps.cont... |
11,434 | ancestor paths | #!/usr/bin/env python3
import os
bundleFilesDir = 'tmp/bundleSizeDownloads'
yarnLockFile = 'yarn.lock'
packagesFile = 'package.json'
def isDividerLine(line):
# At least 80 chars, all slashes except the last (which is newline). The number is inconsistent for some reason.
return (len(line)>=80
and line.... |
11,435 | setup obj | # -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... |
11,436 | create command | # Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
11,437 | prepare helm repo path | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
11,438 | assert files | import os.path
import unittest
from xcube.constants import FORMAT_NAME_ZARR
from xcube.core.chunk import chunk_dataset
from xcube.core.dsio import rimraf
from xcube.core.new import new_cube
from xcube.core.unchunk import unchunk_dataset
class UnchunkDatasetTest(unittest.TestCase):
TEST_ZARR = 'test.zarr'
de... |
11,439 | translate batch | # -*- coding: utf-8 -*-
import logging
import sys
from typing import List, Optional
import requests
from deep_translator.base import BaseTranslator
from deep_translator.constants import BASE_URLS
from deep_translator.exceptions import MicrosoftAPIerror, ServerException
from deep_translator.validate import is_input_v... |
11,440 | test instance type | import pytest
import random
import string
from magma.symbol_table import (SymbolTable, SYMBOL_TABLE_INLINED_INSTANCE,
SYMBOL_TABLE_EMPTY)
_NUM_TRIALS = 100
_NAME_SIZE = 10
def _random_name(size):
return ''.join(random.choice(string.ascii_letters) for _ in range(size))
def _che... |
11,441 | test identity | # Copyright 2016 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,442 | summarize | # xml.etree test for cElementTree
import doctest
import sys
from test import test_support
from xml.etree import cElementTree as ET
SAMPLE_XML = """
<body>
<tag>text</tag>
<tag />
<section>
<tag>subtext</tag>
</section>
</body>
"""
SAMPLE_XML_NS = """
<body xmlns="http://effbot.org/ns">
<tag>text</tag... |
11,443 | preprocess | """
>>> test_simple_network()
>>> test_network_for_a_graph_with_attributes()
"""
from typing import Dict, Union
import torch
from torch_cluster import radius_graph
from torch_geometric.data import Data
from torch_scatter import scatter
from e3nn import o3
from e3nn.math import soft_one_hot_linspace
from .gate_points_... |
11,444 | bootloader reset | #!/usr/bin/env python2
# This file is part of the OpenMV project.
#
# Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
# Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
#
# This work is licensed under the MIT license, see the file LICENSE for details.
#
# Openmv module.
import struct... |
11,445 | get input specification | # Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
11,446 | layout | from conan import ConanFile
from conan.tools.build import stdcpp_library
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, replace_in_file, rm, rmdir
import os
required_conan_version = ">=1.54.0"
class NloptConan(ConanFile):
name = "nlopt"
description ... |
11,447 | normalize scale | import datetime
import re
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import numpy as np
from oceannavigator.settings import get_settings
settings = get_settings()
def get_filename(plot_type, dataset_name, extension):
if extension == "stats":
plot_type ... |
11,448 | tmpfunc | import io
import os
import sys
import copy
import json
import time
import uuid
import socket
import logging
import traceback
from threading import local
from collections import OrderedDict
from contextlib import contextmanager
LOG_TIMESTAMPS = "LOG_TIMESTAMPS" in os.environ
def json_handler(obj):
# if isinstance(ob... |
11,449 | test match numeric words wrong | from pytest import raises
from owid.datautils.format.numbers import (
IntegerNumber,
IntegerNumberWithSeparators,
IntegerNumberWithWords,
format_number,
num_to_str,
remove_multiple_whitespaces,
)
class TestIntegerNumberWithSeparators:
separators = [",", ".", " "]
numbers_valid = ["1,0... |
11,450 | test loading non existing file throws error | # Copyright 2017 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 ... |
11,451 | read whole binary file | BYTES_FOR_MAGIC_PATTERN = 32
BYTES_FOR_VERSION = 4
BYTES_PER_ENGINE_HEADER = 16
VERSION_MAJOR = 1
VERSION_MINOR = 2
class FlashBuilder:
class Header:
"""
Class that stores a header for a flash file system
The header comprises the addresses of the model, parameters, and operators
re... |
11,452 | handle connect | #!/usr/bin/env python3
import argparse
import asyncore
import dpkt
import fcntl
import math
import os
import re
import socket
import struct
import sys
import time
# Various constants
ARPHRD_ETHER = 1
IFNAMSIZ = 16
SIOCGIFHWADDR = 0x8927
SIOCGIFADDR = 0x8915
SIOCGIFINDEX = 0x8933
sockaddr_fmt = 'H14s'
sockaddr_in_f... |
11,453 | 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 . imp... |
11,454 | pre randomize | """Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
11,455 | create from dto | from slugify import slugify
from backend import db
from backend.exceptions import NotFound
from backend.models.dtos.organisation_dto import (
OrganisationDTO,
NewOrganisationDTO,
OrganisationManagerDTO,
)
from backend.models.postgis.user import User
from backend.models.postgis.campaign import Campaign, cam... |
11,456 | test unsupported version raises | """Unit tests for pyatv.storage.
These tests are generally more of the AbstractStorage class but MmoeryStorage is used
since it's a concrete implementation.
"""
from ipaddress import IPv4Address
import pytest
from pyatv import exceptions
from pyatv.conf import AppleTV, ManualService
from pyatv.const import Protocol... |
11,457 | clean passw history | import pytest
from tests.common.utilities import skip_release
from . import passw_hardening_utils
def set_default_passw_hardening_policies(duthosts, enum_rand_one_per_hwsku_hostname):
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
passw_hardening_ob_dis = passw_hardening_utils.PasswHardening(state='dis... |
11,458 | assert pipenv requirements | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from json import dumps
import pytest
from pants.backend.python.goals import lockfile
from pants.backend.python.macros import pipenv_requirements
from ... |
11,459 | set | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Google 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 req... |
11,460 | get temperature from pressure | """
Module for controlling the LED matrix or reading environment data on the SenseHat of a Raspberry Pi.
.. versionadded:: 2017.7.0
:maintainer: Benedikt Werner <1benediktwerner@gmail.com>, Joachim Werner <joe@suse.com>
:maturity: new
:depends: sense_hat Python module
The rotation of the Pi can be spec... |
11,461 | tear down | import unittest
from unittest import mock
from tethys_services.backends.hydroshare import HydroShareOAuth2
class HydroShareBackendTest(unittest.TestCase):
def setUp(self):
self.auth_server_hostname = "www.hydroshare.org"
self.http_scheme = "https"
self.auth_server_full_url = "{0}://{1}".fo... |
11,462 | on draw | # flake8: noqa
"""
Perspective example using the lower level rendering API.
This is definitely in the advanced section, but it can be
a useful tool to learn. Sometimes we want perspective
projection for things like backgrounds. This can be
done very efficiently with shaders.
In this example we render content into a f... |
11,463 | parse config files | from _typeshed import FileDescriptorOrPath, Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from re import Pattern
from typing import IO, Any, ClassVar, TypeVar, overload
from typing_extensions import TypeAlias
from .cmd import Command
command_re: Pattern[str]
_OptionsList: TypeAlias = list[t... |
11,464 | test delete dependency | #!/usr/bin/env python
"""This modules contains tests for artifact API handler."""
import io
import os
from absl import app
from grr_response_core import config
from grr_response_core.lib.rdfvalues import artifacts as rdf_artifacts
from grr_response_server import artifact
from grr_response_server.gui import api_call_... |
11,465 | test discount detail | #
# 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 ... |
11,466 | test initialized strings | import unittest
from ctypes import *
from ctypes.test import need_symbol
class StringArrayTestCase(unittest.TestCase):
def test(self):
BUF = c_char * 4
buf = BUF(b"a", b"b", b"c")
self.assertEqual(buf.value, b"abc")
self.assertEqual(buf.raw, b"abc\000")
buf.value = b"ABCD"... |
11,467 | test 01 cttexpress picking confirm simple | # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
# Copyright 2022 Tecnativa - David Vidal
from odoo.exceptions import UserError
from odoo.tests import Form, common
class TestDeliveryCTTExpress(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.shi... |
11,468 | streaming post to es | import logging
from elasticsearch import Elasticsearch, helpers
from time import perf_counter
from typing import List, Tuple
from usaspending_api.etl.elasticsearch_loader_helpers.delete_data import delete_docs_by_unique_key
from usaspending_api.etl.elasticsearch_loader_helpers.utilities import TaskSpec, format_log
... |
11,469 | handle one account | #
# This script handles general nightly jobs for the Stripe integration:
#
# * Expire old checkout sessions
# * Compare balance to accounting
# * Check for stalled refunds
# * Send logs
#
# Copyright (C) 2019, PostgreSQL Europe
#
from django.core.management.base import BaseCommand
from django.db import transaction... |
11,470 | select nested models | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from gammapy.modeling import Fit, Parameter
from gammapy.stats.utils import sigma_to_ts
__all__ = ["select_nested_models"]
class TestStatisticNested:
"""Compute the test statistic (TS) between two nested hypothesis.
The null hypothesis is the mi... |
11,471 | initialize options | """distutils.command.check
Implements the Distutils 'check' command.
"""
from distutils.core import Command
from distutils.errors import DistutilsSetupError
try:
# docutils is installed
from docutils.utils import Reporter
from docutils.parsers.rst import Parser
from docutils import frontend
from d... |
11,472 | documented fixture | """
This module provides decorator functions which can be applied to test objects
in order to skip those objects when certain conditions occur. A sample use case
is to detect if the platform is missing ``matplotlib``. If so, any test objects
which require ``matplotlib`` and decorated with ``@td.skip_if_no_mpl`` will be... |
11,473 | restore prefs | # (C) Copyright 2004-2023 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... |
11,474 | write cache | import json
from pathlib import Path
from robottelo.logging import logger
from robottelo.utils.ohsnap import dogfood_repository
from robottelo.utils.url import is_url
def post(settings):
settings_cache_path = Path(f'settings_cache-{settings.server.version.release}.json')
if getattr(settings.robottelo.setting... |
11,475 | test get page url raises attributeerror if | from django.test import TestCase, override_settings
from wagtail.models import Site
from wagtail.test.testapp.models import ImportantPagesGenericSetting
from .base import GenericSettingsTestMixin
@override_settings(ALLOWED_HOSTS=["localhost", "other"])
class GenericSettingModelTestCase(GenericSettingsTestMixin, Tes... |
11,476 | commit | #!/usr/bin/env python
import argparse
import sys
import sqlite3
from sqlite3 import Error
class sql_connect:
def __init__(self, db):
# create a database connection
self.conn = self.create_connection(db)
sql_create_metadata_table = """ CREATE TABLE IF NOT EXISTS metadata (
... |
11,477 | course calculate student most time being helped | from django.contrib.auth import get_user_model
from django.db.models import Avg, Case, Count, F, Sum, When
from django.db.models.functions import TruncDate
from django.utils import timezone
from ohq.models import CourseStatistic, Question, QueueStatistic
User = get_user_model()
def course_calculate_student_most_qu... |
11,478 | insert | # /*##########################################################################
#
# Copyright (c) 2015-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Sof... |
11,479 | run example | # Copyright © 2021 United States Government as represented by the Administrator of the
# National Aeronautics and Space Administration. All Rights Reserved.
"""
Example using the Ensemble Model feature
.. dropdown:: More details
Ensemble model is an approach to modeling where one or more different models are si... |
11,480 | sequence | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
OpenGEODE - A tiny SDL Editor for TASTE
This module is a template for backends such as code generators
Entry point:
The AST of the model that is parsed is described in ogAST.py
A Visitor Pattern using Python's "singledispatch" mechanism is used
... |
11,481 | is datetime | import json
from allauth.socialaccount import providers
from allauth.socialaccount.models import SocialApp
from django import forms, template
from django.utils.translation import ugettext_lazy as _
from vote.models import Vote
from manager.constants import (
ADD_ATTENDEE_PERMISSION_CODE_NAME, CAN_TAKE_ATTENDANCE_... |
11,482 | fetch access token | import asyncio
import logging
from datetime import datetime, timedelta
from itertools import chain
from typing import List, Optional
import pandas as pd
import requests
from aiohttp import ClientSession
from pydantic import Field
from toucan_connectors.common import get_loop
from toucan_connectors.json_wrapper import... |
11,483 | itest phonopy gruneisen flow | """
Integration tests for flows (require pytest, ABINIT and a properly configured environment)
"""
from __future__ import annotations
import os
import unittest
#import numpy.testing.utils as nptu
import numpy.testing as nptu
import abipy.data as abidata
import abipy.flowtk as flowtk
import abipy.flowtk.abiphonopy as a... |
11,484 | ismethod | '''
Test cases for pyclbr.py
Nick Mathewson
'''
from test.test_support import run_unittest, import_module
import sys
from types import ClassType, FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(cl... |
11,485 | wipe cluster | # SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under... |
11,486 | get unresolved threshold alerts | #
# Copyright (C) 2013 Uninett AS
# Copyright (C) 2022 Sikt
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program ... |
11,487 | read | from ssl import SSLContext
from typing import Optional
import trio
from .._exceptions import (
ConnectError,
ConnectTimeout,
ReadError,
ReadTimeout,
WriteError,
WriteTimeout,
map_exceptions,
)
from .._types import TimeoutDict
from .base import AsyncBackend, AsyncLock, AsyncSemaphore, Async... |
11,488 | po2csv | from io import BytesIO
from translate.convert import csv2po, METHOD_NAME, test_convert
from translate.storage import csvl10n, po
from translate.storage.test_base import first_translatable, headerless_len
class TestPO2CSV:
@staticmethod
def METHOD_NAME(posource):
"""helper that converts po source to c... |
11,489 | test build invalid schema | import json
import os
import subprocess
from pathlib import Path
import pytest
def test_build_without_predictor(docker_image):
project_dir = Path(__file__).parent / "fixtures/no-predictor-project"
subprocess.run(
["cog", "build", "-t", docker_image],
cwd=project_dir,
check=True,
)... |
11,490 | time 16bit 3sample 2frame | # Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Benchmarks for the numpy_handler module.
Requires asv and numpy.
"""
from platform import python_implementation
from tempfile import TemporaryFile
import numpy as np
from pydicom import dcmread
from pydicom.data import get_testdata_file
from py... |
11,491 | test ignores requests without service | from unittest.mock import MagicMock, call
import pytest
from localstack import config
from localstack.aws.api import RequestContext
from localstack.aws.chain import HandlerChain
from localstack.aws.forwarder import create_aws_request_context
from localstack.aws.handlers.analytics import ServiceRequestCounter
from loc... |
11,492 | bytes msg | import os
import unittest
import collections
import email
from email.message import Message
from email._policybase import compat32
from test.support import load_package_tests
from test.test_email import __file__ as landmark
# Load all tests in package
def load_tests(*args):
return load_package_tests(os.path.dirnam... |
11,493 | update submission status | import logging
import requests
logger = logging.getLogger(__name__)
URLS = {
"get_message_from_sqs_queue": "/api/jobs/challenge/queues/{}/",
"delete_message_from_sqs_queue": "/api/jobs/queues/{}/",
"get_submission_by_pk": "/api/jobs/submission/{}",
"get_challenge_phases_by_challenge_pk": "/api/chall... |
11,494 | array | import re
import struct
import collections
class Struct():
"""High-level wrapper around struct.Struct that makes it a bit easier to
unpack large, nested structures.
* Unpacks to dictionary allowing fields to be retrieved by name
* Optionally massages field data on read
* Handles arrays and nested... |
11,495 | receive data | import collections
import logging
from typing import NamedTuple
import h2.config
import h2.connection
import h2.events
import h2.exceptions
import h2.settings
import h2.stream
logger = logging.getLogger(__name__)
class H2ConnectionLogger(h2.config.DummyLogger):
def __init__(self, peername: tuple, conn_type: st... |
11,496 | unload | """
MAVProxy realtime graphing module
uses lib/live_graph.py for display
"""
from pymavlink import mavutil
import re, os, sys
from MAVProxy.modules.lib import live_graph
from MAVProxy.modules.lib import mp_module
class GraphModule(mp_module.MPModule):
def __init__(self, mpstate):
super(GraphModule,... |
11,497 | etag | # 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,498 | config | """
Node Library for Mininet
This contains additional Node types which you may find to be useful.
"""
from mininet.node import Node, Switch
from mininet.log import info, warn
from mininet.moduledeps import pathCheck
from mininet.util import quietRun
class LinuxBridge( Switch ):
"Linux Bridge (with optional span... |
11,499 | get first child | from __future__ import absolute_import, division, unicode_literals
from six import text_type
from collections import OrderedDict
from lxml import etree
from ..treebuilders.etree import tag_regexp
from . import base
from .. import _ihatexml
def ensure_str(s):
if s is None:
return None
elif isinstan... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.