id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
0 | set up class | # python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2... |
1 | str indent | import re, inspect, textwrap, pydoc
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
from six import iteritems
class SphinxDocString(NumpyDocString):
# string conversion routines
def _str_header(self, name, symbol='`'):
return ['.. rubric:: ' + name, '']
def _str_field_list(self, name):... |
2 | set mkl envs | #!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import sys
import subprocess as sp
DEFAULT_SEASTAR_PORT="3333"
JEMALLOC_244 = "libjemalloc.so.2.4.4"
JEMALLOC_251 = "libjemalloc.so.2.5.1"
def gen_cluster_info(worksp... |
3 | asym enc | # 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... |
4 | test monitors pg | import os
import json
from bgpcfgd.template import TemplateFabric
from bgpcfgd.config import ConfigMgr
from .util import load_constants_dir_mappings
TEMPLATE_PATH = os.path.abspath('../../dockers/docker-fpm-frr/frr')
def load_tests(peer_type, template_name):
constants = load_constants_dir_mappings()
path ... |
5 | webhook payment gateway initialize tokenization response | import json
import graphene
import mock
import pytest
from ....core.models import EventDelivery
from ....payment.interface import (
PaymentGatewayInitializeTokenizationRequestData,
PaymentGatewayInitializeTokenizationResponseData,
PaymentGatewayInitializeTokenizationResult,
)
from ....settings import WEBH... |
6 | test mobile get unauthenticated user | """
Tests for reset deadlines endpoint.
"""
import datetime
import ddt
from django.urls import reverse
from django.utils import timezone
from edx_toggles.toggles.testutils import override_waffle_flag
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.models import CourseEnroll... |
7 | run test | #
# This script needs to be run on startup
# qemu -kernel ${KERNEL} -s -S
# and then:
# gdb ${KERNEL}.vmlinux -x ${QEMU_SRC}/tests/guest-debug/test-gdbstub.py
import gdb
failcount = 0
def report(cond, msg):
"Report success/fail of test"
if cond:
print ("PASS: %s" % (msg))
else:
print ("F... |
8 | fp16 to fp32 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import logging
import torch
logger: logging.Logger = logging.getLogger()
try:
# p... |
9 | get six digit naics count | from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.views import APIView
from django.db.models.functions import Length
from django.db.models import Q
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.validator.tinyshiel... |
10 | test ties broken alphabetically | # These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/tournament/canonical-data.json
# File last updated on 2023-07-19
import unittest
from tournament import (
tally,
)
class TournamentTest(unittest.TestCase):
def test_just_the_header_... |
11 | get severity level | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import logging
from typing import Sequence, Any
from opentelemetry._logs.severity import SeverityNumber
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.sdk._logs import LogData
from opentelemetry.sdk... |
12 | delete empty color blocks | # Authors: see git history
#
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from sys import exit
from typing import List
from inkex import errormsg
from ..i18n import _
from ..svg import PIXELS_PER_MM
from ..utils.geometry import Point
from ..utils.... |
13 | test print topic help with devel for | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program 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 is distributed in ... |
14 | test type raises for unknown type of | import pytest
from h import models
from h.models.group import AUTHORITY_PROVIDED_ID_MAX_LENGTH, ReadableBy, WriteableBy
def test_init_sets_given_attributes():
group = models.Group(name="My group", authority="example.com", enforce_scope=False)
assert group.name == "My group"
assert group.authority == "ex... |
15 | prep param lists | import torch
import torch.nn as nn
from torch.autograd import Variable
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
class tofp16(nn.Module):
"""
Utility module that implements::
def forward(self, input):
return input.half()
"""
def __init__(self):
... |
16 | test results display | import pytest
from grandchallenge.components.models import (
ComponentInterface,
ComponentInterfaceValue,
)
from grandchallenge.evaluation.models import Evaluation, Phase
from grandchallenge.evaluation.tasks import calculate_ranks
from tests.evaluation_tests.factories import EvaluationFactory, PhaseFactory
fro... |
17 | nptensor2np | from typing import Tuple, Type
import numpy as np
from ..image_utils import MAX_VALUES_BY_DTYPE, as_3d
def np_denorm(x: np.ndarray, min_max: Tuple[float, float] = (-1.0, 1.0)) -> np.ndarray:
"""Denormalize from [-1,1] range to [0,1]
formula: xi' = (xi - mu)/sigma
Example: "out = (x + 1.0) / 2.0" for den... |
18 | simple policy | """Test the flask oso plugin."""
from pathlib import Path
import pytest
from flask import Flask
from oso import Oso, OsoError
from werkzeug.exceptions import Forbidden
from flask_oso import FlaskOso, authorize, skip_authorization
@pytest.fixture
def flask_app():
return Flask("test")
@pytest.fixture
def oso():... |
19 | slice | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# The following code has been taken from
# https://github.com/facebookresearch/DPR, which is CC-BY-NC 4.0
# licensed as of now. More details on the license can be found
# at https://github.com/facebookresearch/DPR/blob/m... |
20 | build | from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import apply_conandata_patches, chdir, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
from conans import Auto... |
21 | main | # Developed for module tiericide, this script will quickly print out a market
# conversion map based on patch notes, as well as database conversion mapping.
import argparse
import os.path
import sqlite3
import sys
# Add eos root path to sys.path so we can import ourselves
path = os.path.dirname(__file__)
sys.path.app... |
22 | test set api key | import json
from pathlib import Path
from unittest.mock import MagicMock, Mock, patch
from urllib.parse import unquote_plus
import pytest
from tribler.gui.utilities import TranslatedString, compose_magnetlink, create_api_key, dict_item_is_any_of, \
duration_to_string, format_api_key, get_i18n_file_path, get_langu... |
23 | test writing and reading registers | """Tests for Alazar DLL API
This suite of tests is expected to be executed on a Windows PC with a single
Alazar board installed.
"""
import gc
import logging
import os
from weakref import WeakValueDictionary
import pytest
from pytest import LogCaptureFixture
from qcodes.instrument_drivers.AlazarTech.ATS import Alaz... |
24 | test empty play | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
25 | roi align common | # 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... |
26 | test main | """Test suite for the cProfile module."""
import sys
from test.test_support import run_unittest, TESTFN, unlink
# rip off all interesting stuff from test_profile
import cProfile
from test.test_profile import ProfileTest, regenerate_expected_output
class CProfileTest(ProfileTest):
profilerclass = cProfile.Profile... |
27 | get statistics | # -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
#
# 2018-08-01 Cornelius Kölbel, <cornelius.koelbel@netknights.it>
# Initial writeup
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free So... |
28 | on attachment revision post save | import os
from django.conf import settings as django_settings
from django.db import models
from django.db.models import signals
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from wiki import managers
from wiki.decorators import disable_signal_for_loaddata
from wiki... |
29 | do all | """
Base class for TIM plugin server. THIS IS DEPRECATED, DO NOT USE IN NEW CODE!
Serving from local port 5000.
"""
import http.server
import json
import logging
import os
import socketserver
from tim_common.fileParams import (
get_template,
file_to_string,
do_headers,
multi_post_params,
get_param,... |
30 | forward | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from fairseq import checkpoint_uti... |
31 | test write user to vault skipped | from collections.abc import Callable
import pytest
from pytest_mock import MockerFixture
import reconcile.terraform_users as integ
from reconcile.gql_definitions.common.pgp_reencryption_settings import (
PgpReencryptionSettingsQueryData,
)
from reconcile.terraform_users import (
send_email_invites,
write_... |
32 | get new attachments | from django.utils.translation import npgettext, pgettext
from rest_framework import serializers
from rest_framework.fields import empty
from . import PostingEndpoint, PostingMiddleware
from ....acl.objectacl import add_acl_to_obj
from ...serializers import AttachmentSerializer
class AttachmentsMiddleware(PostingMidd... |
33 | tag names iter | """Abstract representation of a Potential object."""
from abc import abstractmethod
from typing import Any, Dict, Iterator, List
from gmso.abc.gmso_base import GMSOBase
from gmso.utils.expression import PotentialExpression
try:
from pydantic.v1 import Field, validator
except ImportError:
from pydantic import ... |
34 | test address update mutation | from unittest.mock import patch
import graphene
from freezegun import freeze_time
from ......account.search import generate_address_search_document_value
from ......webhook.event_types import WebhookEventAsyncType
from .....tests.utils import assert_no_permission, get_graphql_content
from ..utils import generate_addr... |
35 | application instance | import json
import time
from urllib.parse import urlencode
import oauthlib.common
import oauthlib.oauth1
import pytest
from h_matchers import Any
from lms.models import Assignment
from lms.resources._js_config import JSConfig
from tests import factories
class TestBasicLTILaunch:
def test_requests_with_no_oauth_... |
36 | fit | import argparse
import logging
import os
import sys
import tensorflow as tf
from datasets import load_dataset
from tqdm import tqdm
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
from transformers.file_utils import is_sagemaker_dp_enabled
if os.environ.get("SDP_ENABLED") or is_sagemaker_... |
37 | dd | # Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
38 | test | ##########################################################################
#
# Copyright (c) 2020, Cinesite VFX Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions ... |
39 | test repr | import pytest
from qcodes.parameters import Parameter
from qcodes.parameters.sweep_values import SweepValues
from qcodes.validators import Numbers
@pytest.fixture(name='c0')
def _make_c0():
c0 = Parameter('c0', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None)
yield c0
@pytest.fixture(name='c1')
def _make... |
40 | make layer | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from mmcv.cnn import ConvModule
from torch.nn.modules.batchnorm import _BatchNorm
from mmpose.registry import MODELS
from .base_backbone import BaseBackbone
from .utils import InvertedResidual
@MODELS.register_module()
class MobileNetV3(BaseBackbone):
... |
41 | get slope inter | # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... |
42 | test single with none value | '''
Faraday Penetration Test IDE
Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
See the file 'doc/LICENSE' for the license information
'''
import time
import datetime
import pytest
from collections import namedtuple
from marshmallow import Schema, fields, ValidationError
from faraday.server.schemas im... |
43 | print info | from lxml import html
import requests
from bs4 import BeautifulSoup
import sys
import os
import re
import time
REGEX = '\s*([\d.]+)'
count = 0
#this code prints out information (vulnerability ID, description, severity, and link) for all the vulnerabilities for a given dependency passed in through command line
def usag... |
44 | get field | # -*- coding: utf-8 -*-
# Copyright (c) 2022, Jonathan Lung <lungj@heresjono.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import (absolute_import, division, print_function)
__metaclass_... |
45 | setup method | # 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.
#----------------------------------------------------------------------... |
46 | all time | from __future__ import annotations
import datetime
import logging
from dataclasses import dataclass
from typing import Optional
import pandas as pd
from dbt_semantic_interfaces.dataclass_serialization import SerializableDataclass
from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
from me... |
47 | get column number | """Different kinds of SAX Exceptions"""
import sys
if sys.platform[:4] == "java":
from java.lang import Exception
del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can contain
basic error or warning information from either the XML parser o... |
48 | test multiple markdown entries to jsonl | # Standard Packages
import json
from pathlib import Path
import os
# Internal Packages
from khoj.processor.markdown.markdown_to_jsonl import MarkdownToJsonl
from khoj.utils.fs_syncer import get_markdown_files
from khoj.utils.rawconfig import TextContentConfig
def test_markdown_file_with_no_headings_to_jsonl(tmp_path... |
49 | configure system disk | import logging
from virttest import qemu_storage
from virttest import data_dir
from virttest import utils_disk
from provider import backup_utils
from provider import job_utils
from provider.virt_storage.storage_admin import sp_admin
LOG_JOB = logging.getLogger('avocado.test')
class BlockDevCommitTest(object):
... |
50 | tags | # 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__ ... |
51 | print reaction math | #!/usr/bin/env python3
##
## @file printMath.py
## @brief Prints Rule, Reaction, and Event formulas in a given SBML Document
## @author Ben Bornstein
## @author Sarah Keating
##
##
## <!--------------------------------------------------------------------------
## This sample program is distributed under a dif... |
52 | write vtk cell types | #! /usr/bin/env python
import os
import pathlib
def _write_vtk_header(file_like):
"""Write the file header."""
file_like.write("# vtk DataFile Version 2.0\n")
file_like.write("Landlab output\n")
file_like.write("ASCII\n")
file_like.write("DATASET UNSTRUCTURED_GRID\n\n")
def _write_vtk_points(gr... |
53 | get cisco snmp obj | #!/usr/bin/env python
#############################################################################
# Copyright (c) 2020 One Identity
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation, ... |
54 | prepare lib | """
mbed SDK
Copyright (c) 2014-2017 ARM Limited
Copyright (c) 2018 ON Semiconductor
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 ... |
55 | update local dataset | import logging
import copy
import torch
from torch import nn
from .fednova import FedNova
class Client:
def __init__(
self,
client_idx,
local_training_data,
local_test_data,
local_sample_number,
args,
device,
):
self.client_idx = client_idx
... |
56 | proxy call | import json
from collections import defaultdict
from dataclasses import dataclass
from threading import Lock, get_ident
from types import FunctionType, TracebackType
from typing import Any, Dict, List, Optional, Tuple, Union
from lazy_object_proxy import Proxy
from wrapt import ObjectProxy
from brownie._config import... |
57 | create usgs | import os
import re
from typing import Optional, Union
from pathlib import Path
from flood_forecast.preprocessing.closest_station import (
get_weather_data,
process_asos_data,
)
from flood_forecast.preprocessing.process_usgs import (
make_usgs_data,
process_intermediate_csv,
)
from flood_forecast.gcp_in... |
58 | test not populated move | import unittest
from zulip_bots.simple_lib import SimpleStorage
from ..libraries import database, game_data, interface, mechanics
class GridTest(unittest.TestCase):
def test_out_of_grid(self):
points = [[v, h] for h in range(7) for v in range(7)]
expected_outcomes = [
True,
... |
59 | all chains | """iptables helper functions.
Unlike the `firewall` module, these functions know nothing about PaaSTA and
could effectively be a third-party library. They just make working with
iptables a little bit easier.
"""
import collections
import contextlib
import logging
import iptc
log = logging.getLogger(__name__)
RULE_... |
60 | build arguments schema | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
61 | download fr24 | # ruff: noqa: E501
from __future__ import annotations
import io
from pathlib import Path
from typing import Any, ClassVar
import requests
from tqdm.rich import tqdm
import pandas as pd
from ... import cache_expiration
from ...core.mixins import GeoDBMixin
from ...core.structure import Airport
__all__ = ["Airport",... |
62 | is multicast | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... |
63 | test requires grad outputs side effects | # Owner(s): ["oncall: jit"]
import torch
from torch.testing._internal.common_utils import skipIfTorchDynamo
from torch.testing._internal.jit_utils import JitTestCase
from typing import List
@skipIfTorchDynamo()
class TestAutodiffJit(JitTestCase):
def test_undefined_tensor_lists(self):
def fn(tensor_list... |
64 | value to string | from enum import Enum
import django
from django.utils import six
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.fields import BLANK_CHOICE_DASH
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from .forms i... |
65 | get response plan output | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... |
66 | id | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__all__ ... |
67 | test record subtraction with none adds | # Copyright (c) 2022. The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details
import itertools
import pytest
from ldap_sync.concepts import types
from ldap_sync.concepts.action import A... |
68 | build tree | import unittest
from Cython.Compiler.Visitor import PrintTree
from Cython.TestUtils import TransformTest
from Cython.Compiler.TreePath import find_first, find_all
from Cython.Compiler import Nodes, ExprNodes
class TestTreePath(TransformTest):
_tree = None
def METHOD_NAME(self):
if self._tree is None:
... |
69 | created date | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... |
70 | gitlab project name to path | import pickle
import hashlib
import re
import markdown
from markdown.extensions import Extension
from pgpdump.packet import SignaturePacket
from django.core.cache import cache
from django.db import connections, router
from django.http import HttpResponse
from django.utils.timezone import now
from django.template.defa... |
71 | shutdown | """A client for in-process kernels."""
# -----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file LICENSE, distributed as part of this software.
# ----------... |
72 | get ff | r"""Functions for $K\to \pi\ell\nu$ decays."""
from math import sqrt, log
import flavio
from flavio.classes import Observable, Prediction
def METHOD_NAME(q2, par, K):
ff_name = 'K->pi form factor'
ff_K0 = flavio.classes.AuxiliaryQuantity[ff_name].prediction(par_dict=par, wc_obj=None, q2=q2)
if K == 'KL' ... |
73 | test sa dep virtual server sync devices | from functools import reduce
import operator
from django.contrib.auth.models import Group, Permission
from django.db.models import Q
from django.urls import reverse
from django.utils.crypto import get_random_string
from django.test import TestCase, override_settings
from accounts.models import APIToken, User
from .util... |
74 | test compose support error msg | import asyncio
import concurrent.futures
import time
import timeit
import urllib.parse
from contextlib import contextmanager
from datetime import datetime
from urllib.parse import unquote_plus
import pytest
import yarl
from simcore_service_webserver.utils import (
DATETIME_FORMAT,
compose_support_error_msg,
... |
75 | test lan | #
# Copyright (C) 2010 Uninett AS
#
# 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 is distributed in the hope... |
76 | run | import asyncio
import logging
import math
from asyncio import FIRST_COMPLETED
from gettext import gettext as _
from pulpcore.plugin.models import Artifact, ProgressReport, Remote
from pulpcore.plugin.stages import (
DeclarativeArtifact,
DeclarativeContent,
DeclarativeVersion,
Stage,
)
from pulp_ansibl... |
77 | test file upload file name with space | import os
from urllib.parse import urlparse
from django.core.files.storage import default_storage
from ....product.tests.utils import create_image
from ...tests.utils import (
assert_no_permission,
get_graphql_content,
get_multipart_request_body,
)
FILE_UPLOAD_MUTATION = """
mutation fileUpload($file: Up... |
78 | lru cached method | # 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... |
79 | init attributes | ############################ Copyrights and license ############################
# #
# Copyright 2023 Mauricio Martinez <mauricio.martinez@premise.com> #
# ... |
80 | test 04 delete applications fail | import time
import json
from flask import url_for
from portality import constants
from doajtest.fixtures import ApplicationFixtureFactory
from doajtest.helpers import DoajTestCase, with_es
from portality import models
from portality.api.current import ApplicationsBulkApi
from portality.api import Api401Error, Api400Err... |
81 | num points | import pytest
import numpy as np
from firedrake import *
from pyadjoint.tape import get_working_tape, pause_annotation
@pytest.fixture(autouse=True)
def handle_taping():
yield
tape = get_working_tape()
tape.clear_tape()
@pytest.fixture(autouse=True, scope="module")
def handle_annotation():
from fire... |
82 | serialize modbus pdu child | #
# 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... |
83 | validate file | #
# Copyright 2018-2023 Elyra 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 writ... |
84 | count | import io
import json
import os
import time
import requests
from PIL import Image
from requests.adapters import HTTPAdapter
from module.base.utils import save_image
from module.config.config import AzurLaneConfig
from module.exception import ScriptError
from module.logger import logger
from module.statistics.utils im... |
85 | remove punc | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# The following code has been taken from
# https://github.com/facebookresearch/DPR, which is CC-BY-NC 4.0
# licensed as of now. More details on the license can be found
# at https://github.com/facebookresearch/DPR/blob/m... |
86 | get imported resource | from typing import List, Tuple
class ImportStatement:
"""Represent an import in a module
`readonly` attribute controls whether this import can be changed
by import actions or not.
"""
def __init__(
self, import_info, start_line, end_line, main_statement=None, blank_lines=0
):
... |
87 | get contents | #!/bin/true
#
# util.py - part of autospec
# Copyright (C) 2015 Intel Corporation
#
# 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 lat... |
88 | disable | # encoding:utf-8
# 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 program is distributed in the hope that it wi... |
89 | change position |
from django.apps.registry import apps
from django.db.models import Q
from rest_framework.decorators import action
from rest_framework.response import Response
from drfautoapi.drfautoapi import ApiViewSetConstrutor, \
customize, wrapper_queryset_response_for_drf_action
from sapl.api.permissions import SaplModelPer... |
90 | test loaders convert context to values | """
Tests for salt.loader.lazy
"""
import sys
import pytest
import salt.loader
import salt.loader.context
import salt.loader.lazy
import salt.utils.files
@pytest.fixture
def loader_dir(tmp_path):
"""
Create a simple directory with a couple modules to load and run tests
against.
"""
mod_contents ... |
91 | config boolean | """Provides the code to load PRAW's configuration file ``praw.ini``."""
from __future__ import annotations
import configparser
import os
import sys
from pathlib import Path
from threading import Lock
from .exceptions import ClientException
class _NotSet:
def __bool__(self) -> bool:
return False
__n... |
92 | job count | """
Job scheduler
Dispatch jobs with each submitted calculation
Common methods:
has_results(): returns whether there are any results available
results(): return an iterator yielding ( identifier, result ) tuples
submit(target, args = (), kwargs = {}): submits job, return identifier
is_empty(): returns whether... |
93 | field2utext | ##############################################################################
#
# 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... |
94 | schema read permission | # -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2016 CERN.
#
# CERN Analysis Preservation Framework 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... |
95 | update releases | import logging
import shutil
import tkinter as tk
import webbrowser
from tkinter import ttk
from modlunky2.config import Config
from modlunky2.ui.widgets import ToolTip
from modlunky2.utils import open_directory
logger = logging.getLogger(__name__)
class ControlsFrame(ttk.Frame):
def __init__(self, parent, play... |
96 | test one typevar | from typing import *
from typing import Callable, ForwardRef
from pytest import skip
from python_ta.typecheck.base import (
TypeConstraints,
TypeFail,
TypeInfo,
TypeResult,
create_Callable,
)
skip_msg = "Skipped"
tc = TypeConstraints()
# Helper functions
def unify_helper(arg1: type, arg2: type,... |
97 | require 8021q | import errno
import os
import platform
import pwd
import re
import stat
import subprocess
import sys
import uuid
from socket import AF_INET, AF_INET6
import netaddr
import pytest
from pyroute2 import config
from pyroute2.iproute.linux import IPRoute
try:
import httplib
except ImportError:
import http.client ... |
98 | loc directive regex | from numba import cuda, float32, int32
from numba.core.errors import NumbaInvalidConfigWarning
from numba.cuda.testing import CUDATestCase, skip_on_cudasim
from numba.tests.support import ignore_internal_warnings
import re
import unittest
import warnings
@skip_on_cudasim('Simulator does not produce lineinfo')
class T... |
99 | on click | # -*- coding: utf-8 -*-
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
# Pour l'utiliser
# from resources.lib.captcha import Captcha_Get_Reponse
try:
import urllib2
except ImportError:
import urllib.request as urllib2
import xbmcvfs
import xbmc
import xbmcgui
from resources.lib.comaddon import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.