id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
5,900 | render template string | from __future__ import annotations
from typing import Any, AsyncIterator, TYPE_CHECKING
from flask.templating import DispatchingJinjaLoader as DispatchingJinjaLoader # noqa: F401
from jinja2 import Environment as BaseEnvironment, Template
from .ctx import has_app_context, has_request_context
from .globals import ap... |
5,901 | perform destroy | """Mixins for (API) views in the whole project."""
from django.core.exceptions import FieldDoesNotExist
from rest_framework import generics, mixins, status
from rest_framework.response import Response
from InvenTree.fields import InvenTreeNotesField
from InvenTree.helpers import remove_non_printable_characters, stri... |
5,902 | can squeeze another process | """Run groups of experiments, hyperparameter sweeps, etc."""
import argparse
import os
import subprocess
import sys
import time
from os.path import join
from sample_factory.utils.utils import ensure_dir_exists, log
def add_os_parallelism_args(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
parser.a... |
5,903 | set jemalloc version | #!/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... |
5,904 | test no weight | # Copyright (c) 2017 The University of Manchester
#
# 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 ... |
5,905 | test is remote control supported | """Unit tests for pyatv.protocols.airplay.features."""
import pytest
from pyatv.auth.hap_pairing import (
NO_CREDENTIALS,
TRANSIENT_CREDENTIALS,
parse_credentials,
)
from pyatv.const import PairingRequirement, Protocol
from pyatv.core import MutableService
from pyatv.protocols.airplay.utils import (
Ai... |
5,906 | get specific | from django.contrib.contenttypes.models import ContentType
from django.db.models import DEFERRED
from django.utils.functional import cached_property
class SpecificMixin:
"""
Mixin for models that support multi-table inheritance and provide a
``content_type`` field pointing to the specific model class, to ... |
5,907 | visit | """Generic visitor pattern implementation for Python objects."""
import enum
class Visitor(object):
defaultStop = False
@classmethod
def _register(celf, clazzes_attrs):
assert celf != Visitor, "Subclass Visitor instead."
if "_visitors" not in celf.__dict__:
celf._visitors = ... |
5,908 | test on ready override | import os
import unittest
import tempfile
import time
from mock import Mock, PropertyMock, patch
from patroni.dcs.raft import Cluster, DynMemberSyncObj, KVStoreTTL, \
Raft, RaftError, SyncObjUtility, TCPTransport, _TCPTransport
from pysyncobj import SyncObjConf, FAIL_REASON
def remove_files(prefix):
for f in... |
5,909 | simple encrypt | import functools
import secrets
from base64 import urlsafe_b64decode, urlsafe_b64encode
from typing import Optional
import nacl.pwhash
from nacl.bindings import crypto_aead
from nacl.bindings.crypto_generichash import generichash_blake2b_salt_personal
from nacl.bindings.utils import sodium_memcmp
from nacl.exceptions ... |
5,910 | set up | # Contents in this file are referenced from the sphinx-generated docs.
# "magictoken" is used for markers as beginning and ending of example text.
import unittest
from numba.tests.support import captured_stdout, skip_parfors_unsupported
from numba import set_parallel_chunksize
from numba.tests.support import TestCase
... |
5,911 | osm changeset | import io
from typing import Dict, Optional, Tuple
from uuid import UUID
from asyncpg import Connection
from fastapi import APIRouter, Depends, HTTPException, Request
from modules import OsmSax, utils
from modules.dependencies import database
from .tool import oauth
from .tool.session import SessionData, backend, co... |
5,912 | test module data frame mapping | # /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2020-2021, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... |
5,913 | test secret lookup error | # SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
import uuid
import libvirt
import pytest
from vdsm.virt.vmdevices import storage
from . import vmfakelib
def test_secret_define_new():
con = vmfakelib.Connection()
xml = """
<secret>
<uuid>uuid</uuid>
<... |
5,914 | need json response | # This file is part of Indico.
# Copyright (C) 2002 - 2023 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import traceback
from uuid import uuid4
import sentry_sdk
from flask import g, jsonify, render_template, ... |
5,915 | get next | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
5,916 | has tag | from typing import AbstractSet, Any, Mapping, Optional, cast
from dagster import (
DagsterRun,
JobDefinition,
OpDefinition,
_check as check,
)
from dagster._annotations import public
from dagster._core.definitions.dependency import Node, NodeHandle
from dagster._core.execution.context.compute import Ab... |
5,917 | test easy thumbnails image field | """Tests for the fields module."""
import sys
from importlib import reload
from unittest.mock import patch, MagicMock, PropertyMock
from django.core.exceptions import ImproperlyConfigured
from django.db.models import ImageField
from django.test import TestCase
from newsletter import fields
class FieldsTestCase(TestC... |
5,918 | handle | from __future__ import annotations
import argparse
from typing import Any
from django.core.management import BaseCommand
from django.core.management import CommandError
from django.db import connections
from django.db import DEFAULT_DB_ALIAS
from django.db.utils import ConnectionDoesNotExist
from django_mysql.utils ... |
5,919 | test copy | import unittest
import tempfile
import json
import copy
import numpy as np
import pandas as pd
import os
from numpy.testing import assert_almost_equal
from sklearn import datasets
from supervised.algorithms.catboost import CatBoostAlgorithm, additional
from supervised.utils.metric import Metric
import tempfile
additi... |
5,920 | on download finished | # Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os
from typing import List, Dict, Any, cast
from UM import i18n_catalog
from UM.Extension import Extension
from UM.Logger import Logger
from UM.Message import Message
from UM.PluginRegistry import PluginRegistry
fro... |
5,921 | to csv | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import csv
import json
from io import StringIO
import requests
import frappe
from frappe import _, msgprint
from frappe.utils import cint, comma_or, cstr, flt
def read_csv_content_from_attached_file(doc):
fileid = frap... |
5,922 | transformed input np | # 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... |
5,923 | test args lat | import pytest
from pyroSAR.ancillary import getargs
from pyroSAR.gamma import api
@pytest.mark.skipif('diff' not in dir(api), reason='requires GAMMA installation with module DIFF')
def test_args_diff():
from pyroSAR.gamma.api import diff
assert getargs(diff.gc_map) == ['DEM', 'DEM_par', 'DEM_seg', 'DEM_seg_pa... |
5,924 | get | #!/usr/bin/env python
'''settings object for MAVProxy modules'''
import time
class MPSetting:
def __init__(self, name, type, default, label=None, tab=None,
range=None, increment=None, format=None,
digits=None, choice=None):
if label is None:
label = name
... |
5,925 | update | import time
import numpy as np
from openpilot.common.realtime import DT_MDL
from openpilot.common.numpy_fast import interp
from openpilot.system.swaglog import cloudlog
from openpilot.selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import LateralMpc
from openpilot.selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import N ... |
5,926 | response generator | import argparse
from io import BytesIO
import zlib
from flask import Flask, Response
import numpy as np
from PIL import Image
from drake import lcmt_image, lcmt_image_array
from pydrake.lcm import DrakeLcm
from pydrake.systems.sensors import ImageDepth32F, ImageLabel16I, ImageRgba8U
from pydrake.visualization import ... |
5,927 | test propagation credentials endpoint put not found | import json
from http import HTTPStatus
from typing import Sequence
from urllib.parse import urljoin
import pytest
from tests.common import StubDIContainer
from tests.data_for_tests.propagation_credentials import LM_HASH, NT_HASH, PASSWORD_1, PASSWORD_2
from tests.monkey_island import InMemoryCredentialsRepository
fr... |
5,928 | test encode | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: CC0-1.0
from __future__ import annotations
from io import BytesIO
from pathlib import Path
import pytest
from hypothesis import example, given, settings
from hypothesis.strategies import binary, characters, text
import pikepdf.codec
def tes... |
5,929 | test get none | from __future__ import annotations
import unittest
from functools import partial
from typing import Any, MutableMapping
from unittest.mock import Mock, patch
import pytest
from sentry.testutils.cases import TestCase
from sentry.utils.canonical import CanonicalKeyDict
from sentry.utils.safe import (
get_path,
... |
5,930 | blocked path | import json
import os
import secrets
from django.conf import settings
from django.utils.functional import cached_property
from filtercascade import FilterCascade
from filtercascade.fileformats import HashAlgorithm
import olympia.core.logger
from olympia.amo.utils import SafeStorage
from olympia.constants.blocklist i... |
5,931 | get build info | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
5,932 | test thread safety | import os
import sys
import unittest
import random
from string import ascii_lowercase as ascii_lc
from time import sleep
from copy import deepcopy
from abc import ABC
from concurrent.futures import ThreadPoolExecutor, wait
from virttest import _wrappers
def create_module(name, inner_val, path=''):
""" Creates a... |
5,933 | extract data | # pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
5,934 | callback | # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from __future__ import annotations
from anki.collection import OpChanges
from anki.decks import DEFAULT_DECK_ID, DeckId
from aqt import AnkiQt, gui_hooks
from aqt.qt import *
from aqt.utils i... |
5,935 | create optimizer | """ optim factory """
import os
from typing import Optional
from mindspore import load_checkpoint, load_param_into_net, nn
from .adamw import AdamW
from .adan import Adan
from .lion import Lion
from .nadam import NAdam
__all__ = ["create_optimizer"]
def init_group_params(params, weight_decay):
decay_params = [... |
5,936 | resource apply dense | # Copyright 2020 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... |
5,937 | download | #
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
#
# 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/licen... |
5,938 | test emit multiline message | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.python.failure import Failure
from twisted.trial.unittest import TestCase
try:
import syslog as _stdsyslog
except ImportError:
stdsyslog = None
else:
stdsyslog = _stdsyslog
from twisted.python import syslog
class Sy... |
5,939 | handle | # Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
import argparse
import json
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from django.utils.text import slugify
from weblate.trans.models import Component, Project
f... |
5,940 | measure frequency | import time
import threading
import multiprocessing
import sys
from datetime import datetime
import re
import json
import importlib
import rospy
from std_srvs.srv import Empty
import cv2
from user_functions import GUIFunctions, HALFunctions
from console import start_console, close_console
from shared.value import Sh... |
5,941 | print verbose | # Copyright 2021-2022 NVIDIA 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 ... |
5,942 | init connection | import os
import pytest
from mongoengine import connect
from kairon import Utility
from kairon.shared.metering.constants import MetricType
from kairon.shared.metering.metering_processor import MeteringProcessor
from kairon.shared.metering.data_object import Metering
class TestMetering:
@pytest.fixture(autouse=... |
5,943 | get lprobs | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.criterions import LegacyFairseqCriterion, reg... |
5,944 | test draw write round trip | # This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Copyright the Hypothesis Authors.
# Individual contributors are listed in AUTHORS.rst and the git log.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the... |
5,945 | test claim one | import pytest
from rotkehlchen.accounting.structures.balance import Balance
from rotkehlchen.accounting.structures.evm_event import EvmEvent
from rotkehlchen.accounting.structures.types import HistoryEventSubType, HistoryEventType
from rotkehlchen.chain.ethereum.modules.stakedao.constants import (
CPT_STAKEDAO,
... |
5,946 | get destination | #
# Copyright (c) 2022, Neptune Labs Sp. z o.o.
#
# 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 agr... |
5,947 | test psycopg connection params | from unittest.mock import AsyncMock, patch
import asyncpg
from tortoise import connections
from tortoise.contrib import test
class TestConnectionParams(test.SimpleTestCase):
async def asyncSetUp(self) -> None:
await super().asyncSetUp()
async def asyncTearDown(self) -> None:
await super().a... |
5,948 | fetch changelog | import hashlib
import os
import sys
from functools import wraps
from pipenv.patched.pip._vendor.packaging.version import parse as parse_version
from pathlib import Path
import pipenv.vendor.click as click
# Jinja2 will only be installed if the optional deps are installed.
# It's fine if our functions fail, but don't... |
5,949 | get multi | """
Cache configuration.
This works in conjunction with dogpile.cache_ to provide caching for any Weasyl
project.
.. _dogpile.cache: http://dogpilecache.readthedocs.org/en/latest/
"""
import json
import threading
import dogpile.cache
import dogpile.cache.backends.memcached
import pylibmc
from dogpile.cache.api impo... |
5,950 | test disctrack | # 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.
from tests import TestCase
import os
from senf import fsnative
from ... |
5,951 | check progress complete | import sys, os
from PyQt4.QtGui import QApplication, QWizard
from PyQt4 import QtCore
from PyQt4 import QtGui
from ui_create import Ui_Wizard
if __name__ == '__main__':
parentdir = sys.path[0].split(os.sep)[:-1]
sys.path.append(os.sep.join(parentdir))
from tomblib.tomb import Tomb
from worker import TombCreat... |
5,952 | get connection | #
# We use a background thread for sharing fds on Unix, and for sharing sockets on
# Windows.
#
# A client which wants to pickle a resource registers it with the resource
# sharer and gets an identifier in return. The unpickling process will connect
# to the resource sharer, sends the identifier and its pid, and then ... |
5,953 | convert ppid | import os
import sys
class ArgHandlerWithParam:
'''
Handler for some arguments which needs a value
'''
def __init__(self, arg_name, convert_val=None, default_val=None):
self.arg_name = arg_name
self.arg_v_rep = '--%s' % (arg_name,)
self.convert_val = convert_val
self.d... |
5,954 | test local lcpencrypt | import pytest
from mock import patch, create_autospec, MagicMock
from parameterized import parameterized
from pyfakefs.fake_filesystem_unittest import Patcher
from api.lcp.encrypt import LCPEncryptor, LCPEncryptionException, LCPEncryptionConfiguration, LCPEncryptionResult
from core.model import Identifier
from core.mo... |
5,955 | kibana group | # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.
"""Kibana cli commands."""
import sys
import click
import kql
from kibana ... |
5,956 | launch | #
# SPDX-FileCopyrightText:
# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""This is a helper module for distributed training.
The code uses an official implementation of
distributed data parallel launcher as just a reference.
https://github.com/p... |
5,957 | logging set handlers | """
This file contains general-purpose utilities.
"""
import logging
import numpy as np
import os
import uuid
def METHOD_NAME(logger_name, handler, log_level):
logger = logging.getLogger(logger_name)
# set all handlers to ERROR
for handler in logger.handlers:
handler.setLevel(logging.ERROR)
# ... |
5,958 | 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__ ... |
5,959 | test logical not equal | import pytest
from PIL import Image, ImageMath
def pixel(im):
if hasattr(im, "im"):
return f"{im.mode} {repr(im.getpixel((0, 0)))}"
if isinstance(im, int):
return int(im) # hack to deal with booleans
A = Image.new("L", (1, 1), 1)
B = Image.new("L", (1, 1), 2)
Z = Image.new("L", (1, 1), 0) ... |
5,960 | sample images | import os
import random
import shutil
import json
from plantcv.plantcv import fatal_error
def METHOD_NAME(source_path, dest_path, num=100):
if not os.path.exists(source_path):
raise IOError(f"Directory does not exist: {source_path}")
if not os.path.exists(dest_path):
os.makedirs(dest_path) #... |
5,961 | test param model is not permitted | from unittest import mock
import pytest
from fastapi import HTTPException
from fastapi.encoders import jsonable_encoder
from pydantic import ValidationError
from mlflow.gateway.config import RouteConfig
from mlflow.gateway.constants import MLFLOW_AI_GATEWAY_ANTHROPIC_MAXIMUM_MAX_TOKENS
from mlflow.gateway.providers.a... |
5,962 | do genesis | # 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... |
5,963 | move device like | # Copyright (c) Facebook, Inc. and its affiliates.
"""
Wrappers around on some nn functions, mainly to support empty tensors.
Ideally, add support directly in PyTorch to empty tensors in those functions.
These can be removed once https://github.com/pytorch/pytorch/issues/12013
is implemented
"""
import warnings
from... |
5,964 | main | #!/usr/bin/env python3
# Copyright 2018 Nagoya University (Tomoki Hayashi)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import logging
from distutils.util import strtobool
import kaldiio
import numpy
import resampy
from espnet2.utils.types import int_or_none
from espnet.transform.spec... |
5,965 | test ckyx 1x1 | ################################################################################
#
# Copyright (C) 2020-2022 Advanced Micro Devices, Inc. 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
... |
5,966 | test area datetime nat | import datetime as dt
import pandas as pd
import numpy as np
from holoviews.element import Area, Overlay
from ...utils import LoggingComparisonTestCase
from .test_plot import TestBokehPlot, bokeh_renderer
class TestAreaPlot(LoggingComparisonTestCase, TestBokehPlot):
def test_area_with_nans(self):
area ... |
5,967 | expect problem | """
A simple client that uses the Python ACME library to run a test issuance against
a local Boulder server.
Usage:
$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt
$ python chisel2.py foo.com bar.com
"""
import json
import logging
import os
import sys
import signal
import threading
import tim... |
5,968 | cam cls seg | import torch
import torch.nn.functional as F
from annotator.mmpkg.mmcv.cnn import ConvModule, Scale
from torch import nn
from annotator.mmpkg.mmseg.core import add_prefix
from ..builder import HEADS
from ..utils import SelfAttentionBlock as _SelfAttentionBlock
from .decode_head import BaseDecodeHead
class PAM(_SelfA... |
5,969 | initialize test shared folders | import logging
import os
import shlex
import shutil
import subprocess
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from core.models import Job, Event
from core.serializers import EventSerializer, JobSerializer
logg... |
5,970 | test graph fold bn | #
# -*- coding: utf-8 -*-
#
import unittest
import tensorflow as tf
from tensorflow.core.framework import graph_pb2
from tensorflow.python.framework import dtypes
from neural_compressor.adaptor.tf_utils.graph_rewriter.generic.fold_batch_norm import FoldBatchNormNodesOptimizer
from neural_compressor.adaptor.tf_utils.... |
5,971 | test comparator parser | """ Tests for validation"""
def test_comparatorLexer():
from processor.comparison.comparisonantlr.comparatorLexer import comparatorLexer
val = comparatorLexer()
assert val is not None
def test_comparatorListener():
from antlr4 import InputStream, ParseTreeWalker
from antlr4 import CommonTokenStre... |
5,972 | validate details | from enum import Enum
from typing import Any, Dict, List, Optional, Union
from fideslang.validation import FidesKey
from pydantic import Extra, ValidationError, root_validator, validator
from pydantic.main import BaseModel
from fides.api.schemas.api import BulkResponse, BulkUpdateFailed
class ResponseFormat(Enum):
... |
5,973 | cmake args | # 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 re
from spack.package import *
class RocmDbgapi(CMakePackage):
"""The AMD Debugger API is a library that pro... |
5,974 | format | import datetime
import enum
import sys
from _typeshed import Unused
from collections.abc import Iterable, Sequence
from time import struct_time
from typing import ClassVar
from typing_extensions import Literal, TypeAlias
__all__ = [
"IllegalMonthError",
"IllegalWeekdayError",
"setfirstweekday",
"firstw... |
5,975 | kwargs row | """
psycopg row factories
"""
# Copyright (C) 2021 The Psycopg Team
import functools
from typing import Any, Callable, Dict, List, Optional, NamedTuple, NoReturn
from typing import TYPE_CHECKING, Sequence, Tuple, Type, TypeVar
from collections import namedtuple
from typing_extensions import TypeAlias
from . import p... |
5,976 | get scp base command | """
Cloudflared Integration tests
"""
import unittest
import subprocess
import os
import tempfile
from contextlib import contextmanager
from pexpect import pxssh
class TestSSHBase(unittest.TestCase):
"""
SSH test base class containing constants and helper funcs
"""
HOSTNAME = os.environ["SSH_HOSTNA... |
5,977 | get proc with parent | #!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
"""
TODO: docs
"""
import os
from qautils.gppylib.gplog import *
from qautils.gppylib.gparray import *
from base import *
from unix import *
logger = get_default_logger()
GPHOME=os.environ.get('GPHOME')
#-----------------------... |
5,978 | data received | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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... |
5,979 | test advocate blocks invalid urls | import re
from ipaddress import ip_network
from unittest.mock import patch
from django.core.exceptions import ValidationError
from django.test import override_settings
import httpretty as httpretty
import pytest
from baserow.contrib.database.webhooks.validators import url_validator
from baserow.test_utils.helpers im... |
5,980 | molar mass | # This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for
# the Earth and Planetary Sciences
# Copyright (C) 2012 - 2017 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
This module provides several helper minerals/materials.
"""
from __future__ import absolute_import
from __fu... |
5,981 | load |
import copy
import glob
import os
import pickle
import sys
from GangaCore.Core.GangaRepository import RepositoryError, allRegistries
from GangaCore.GPIDev.Persistency import METHOD_NAME, stripped_export
from GangaCore.Utility.logging import getLogger
from .GangaRepository import GangaRepository
logger = getLogger()... |
5,982 | evaluate | import logging
import time
import jax
import numpy as np
import optax
import haiku as hk
import jax.numpy as jnp
from typing import NamedTuple
import wandb
from fedml import mlops
from fedml.core import ServerAggregator
class TrainingState(NamedTuple):
params: hk.Params
avg_params: hk.Params
opt_state: ... |
5,983 | wrapper | import asyncio
import inspect
import warnings
from dataclasses import dataclass, field
from functools import partial
from multiprocessing import Queue
from typing import Any, Callable, Dict, Optional, Tuple
from .dataclasses import KWONLY_SLOTS
from .globals import log
method_queue: Queue = Queue()
response_queue: Qu... |
5,984 | basic ack | from __future__ import annotations
import time
from itertools import count
from typing import TYPE_CHECKING
from unittest.mock import Mock
from kombu.transport import base
from kombu.utils import json
if TYPE_CHECKING:
from types import TracebackType
class _ContextMock(Mock):
"""Dummy class implementing __... |
5,985 | size to int | #!/usr/bin/env python3
# group: rw
#
# Tests for shrinking images
#
# Copyright (c) 2016-2017 Parallels International GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of t... |
5,986 | mde integration | # 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... |
5,987 | test func | import json
from django.contrib.auth.mixins import UserPassesTestMixin
from django.http import Http404
from rest_framework.response import Response
from rest_framework.views import APIView
from bims.models import (
TaxonGroup, Taxonomy, BiologicalCollectionRecord,
TaxonExtraAttribute
)
def update_taxon_group_... |
5,988 | total rev for current deck | # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
# pylint: disable=invalid-name
from typing import Optional
from anki._legacy import deprecated
from anki.cards import Card, CardId
from anki.consts import (
CARD_TYPE_RELEARNING,
QUE... |
5,989 | step | """
Brax env integration.
"""
import sys
from typing import Dict, List, Optional, Tuple, Union
import gymnasium as gym
import numpy as np
import torch
import torch.utils.dlpack as tpack
from gymnasium.core import RenderFrame
from torch import Tensor
from sample_factory.algo.utils.gymnasium_utils import convert_space
... |
5,990 | main | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... |
5,991 | mock list open workflow executions | from __future__ import annotations
from datetime import datetime
from simpleflow.swf.mapper.constants import REGISTERED
from simpleflow.swf.mapper.models.workflow import CHILD_POLICIES, WorkflowExecution
from simpleflow.swf.mapper.utils import datetime_timestamp
def mock_list_workflow_types(*args, **kwargs):
ov... |
5,992 | test default | # Copyright Cartopy Contributors
#
# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Tests for the Albers Equal Area coordinate system.
"""
import numpy as np
from numpy.testing import assert_almost_e... |
5,993 | register | from tracardi.service.notation.dict_traverser import DictTraverser
from tracardi.service.plugin.domain.METHOD_NAME import Plugin, Spec, MetaData, Documentation, PortDoc, Form, FormGroup, \
FormField, FormComponent
from tracardi.service.plugin.domain.result import Result
from tracardi.service.plugin.runner import Ac... |
5,994 | test c void p arg | from ctypes import *
from ctypes.test import need_symbol
import unittest
# IMPORTANT INFO:
#
# Consider this call:
# func.restype = c_char_p
# func(c_char_p("123"))
# It returns
# "123"
#
# WHY IS THIS SO?
#
# argument tuple (c_char_p("123"), ) is destroyed after the function
# func is called, but NOT before ... |
5,995 | fetch parents | ######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# This file is part of Spine Toolbox.
# Spine Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Gen... |
5,996 | info | """
This type stub file was generated by pyright.
"""
"""
Logger implementation loosely modeled on PEP 282. We don't use the
PEP 282 logger implementation in the stdlib ('logging') because it's
idiosyncratic and a bit slow for our purposes (we don't use threads).
"""
class LevelsByName:
CRIT = ...
ERRO = ...
... |
5,997 | get representative | # @license
# Copyright 2017 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 required by applicable law or agreed to in... |
5,998 | fix keywords | #!/usr/bin/python2
"""
Translate from PEP8 Python style to Mininet (i.e. Arista-like)
Python style
usage: unpep8 < old.py > new.py
- Reinstates CapWords for methods and instance variables
- Gets rid of triple single quotes
- Eliminates triple quotes on single lines
- Inserts extra spaces to improve readability
- Fix... |
5,999 | test zero | #!/usr/bin/env py.test
# -*- coding: utf-8 -*-
__authors__ = "Martin Sandve Alnæs"
__date__ = "2009-02-13 -- 2009-02-13"
import pytest
import math
from ufl import *
from ufl.constantvalue import as_ufl
def testScalars():
s = as_ufl(123)
e = s((5, 7))
v = 123
assert e == v
def METHOD_NAME():
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.