id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
9,500
test empty resizes min args
import unittest import importlib import numpy as np utils = importlib.import_module('extensions.sd-webui-controlnet.tests.utils', 'utils') utils.setup_test_env() from copy import copy from scripts import external_code from scripts import controlnet from modules import scripts, ui, shared class TestExternalCodeWork...
9,501
test 02 delete stats
# -*- coding: utf-8 -*- from .base import MyApiTestCase from privacyidea.lib.monitoringstats import write_stats from privacyidea.lib.tokenclass import AUTH_DATE_FORMAT from privacyidea.models import db import datetime class APIMonitoringTestCase(MyApiTestCase): def test_01_get_stats(self): # create som...
9,502
prepare
#! /usr/bin/env python """Retrieving DOIs from a papers website/url as a prep operation""" from __future__ import annotations import collections import re from dataclasses import dataclass from sqlite3 import OperationalError from typing import TYPE_CHECKING import requests import zope.interface from dataclasses_json...
9,503
outputs
""" rotate_fc ========= Autogenerated DPF operator classes. """ from warnings import warn from ansys.dpf.core.dpf_operator import Operator from ansys.dpf.core.inputs import Input, _Inputs from ansys.dpf.core.METHOD_NAME import Output, _Outputs from ansys.dpf.core.operators.specification import PinSpecification, Specifi...
9,504
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 os import spack.build_systems.cmake import spack.build_systems.generic from spack.package import * class Superlu(...
9,505
test poa chain connection
#!/usr/bin/env python3 # encoding: utf-8 import unittest as ut from SEEDBlockchain import Wallet from web3 import Web3 from seedemu import * class MultipleChainsTestCase(ut.TestCase): @classmethod def setUpClass(cls) -> None: cls.wallet1 = Wallet(chain_id=1337) cls.wallet2 = Wallet(chain_id=13...
9,506
create archiver
#!/usr/bin/env python3 """ DESCRIPTION """ import sys import pscheduler from kafka import KafkaProducer from kafka.errors import KafkaError import tempfile import os MAX_SCHEMA = 1 SECURITY_PROTOCOL_SSL = "SSL" log_prefix = "archiver-kafka" log = pscheduler.Log(prefix=log_prefix, quiet=False) archiver = None cl...
9,507
physical resource id
from typing import Any, Dict, List, Optional from moto.core import CloudFormationModel from moto.core.utils import iso_8601_datetime_with_milliseconds, utcnow from .core import TaggedEC2Resource from ..utils import random_nat_gateway_id, random_private_ip class NatGateway(CloudFormationModel, TaggedEC2Resource): ...
9,508
test decimals include nan
# 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...
9,509
version
""" Module for managing dnsmasq """ import logging import os import salt.utils.files import salt.utils.platform from salt.exceptions import CommandExecutionError log = logging.getLogger(__name__) def __virtual__(): """ Only work on POSIX-like systems. """ if salt.utils.platform.is_windows(): ...
9,510
resolve possibly secret value
import re import sentry_sdk from flask import current_app from spiffworkflow_backend.exceptions.api_error import ApiError from spiffworkflow_backend.models.db import db from spiffworkflow_backend.models.secret_model import SecretModel class SecretService: CIPHER_ENCODING = "ascii" @classmethod def _encr...
9,511
has access
# Copyright 2019 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, ...
9,512
list modes
from boxbranding import getBoxType, getMachineName, getHaveRCA, getHaveDVI, getHaveSCART, getHaveAVJACK from Screens.Wizard import WizardSummary from Screens.WizardLanguage import WizardLanguage from Screens.Rc import Rc from Components.AVSwitch import iAVSwitch as iAV from Components.Pixmap import Pixmap from Compone...
9,513
read
"""Simple class to read IFF chunks. An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File Format)) has the following structure: +----------------+ | ID (4 bytes) | +----------------+ | size (4 bytes) | +----------------+ | data | | ... | +----------------+ The ID is a 4-byte s...
9,514
component metadata
# Copyright 2019 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...
9,515
add doc meta data to answer
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # Copyright 2021 deepset GmbH. 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.o...
9,516
set instance
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
9,517
merge
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import json from dataclasses import dataclass from typing import Any, Iterable, Mapping from pants.util.frozendict import FrozenDict from pants.util.st...
9,518
resolve target str
from abc import ABC, abstractmethod from numba.core.registry import DelayedRegistry, CPUDispatcher from numba.core.decorators import jit from numba.core.errors import InternalTargetMismatchError, NumbaValueError from threading import local as tls _active_context = tls() _active_context_default = 'cpu' class _Target...
9,519
make order by deterministic
from collections import namedtuple from sqlalchemy import select from db.columns import utils as col_utils from db.records.exceptions import BadSortFormat, SortFieldNotFound def METHOD_NAME(relation, order_by=None): """ Makes an order_by deterministic (totally ordering). Given a relation, and a `order_by...
9,520
test state universe get states map
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
9,521
test update atc post
from functools import reduce import operator from django.contrib.auth.models import Group, Permission from django.db.models import Q from django.test import TestCase, override_settings from django.urls import reverse from django.utils.crypto import get_random_string from accounts.models import User from zentral.contrib...
9,522
write block
from __future__ import absolute_import from six.moves import range __date__ = "02 Aug 2012" __author__ = 'olivier.mattelaer@uclouvain.be' from .function_library import * class ParamCardWriter(object): header = \ """######################################################################\n""" + \ """##...
9,523
uniq edges
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
9,524
is number
#!/usr/bin/env python # encoding: utf8 class MainCategories: Letter = 'Letter' Mark = 'Mark' Number = 'Number' Punctuation = 'Punctuation' Symbol = 'Symbol' Separator = 'Separator' Control = 'Control' Format = 'Format' Surrogate = 'Surrogate' PrivateUse = 'Private_Use' Unassigned = 'Unassigned' ...
9,525
test un camel case
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- # # Copyright 2010 Google Inc. 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/LIC...
9,526
is full pending transaction pool
# coding=utf-8 # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. import heapq from pyqrllib.pyqrllib import bin2hstr from qrl.core import config from qrl.core.misc import logger from qrl.core.Block import Block from qrl.core.txs.T...
9,527
test getneighbourpositions
import unittest2 as unittest # import unittest from math import sqrt from libagent import playground, error class TestPlayground(unittest.TestCase): def setUp(self): self.pg = playground.Playground() def test_stringcoordinate(self): self.assertEqual(self.pg.stringcoordinate("foo", "bar"), []...
9,528
setup link
"""Service for linking the project to Minecraft.""" __all__ = [ "LinkManager", ] import logging import os import platform from pathlib import Path from typing import List, Optional, Union from beet import Cache, CachePin, Context, ErrorMessage, MultiCache, PackOverwrite from beet.core.utils import FileSystemPa...
9,529
assert no error
from typing import Any, Callable import unittest from uuid import uuid4 import numpy as np from rastervision.pipeline.file_system import get_tmp_dir from rastervision.core.data import ( ClassConfig, DatasetConfig, RasterioSourceConfig, MultiRasterSourceConfig, ReclassTransformerConfig, SceneConfig, Semant...
9,530
process result value
# -*- coding: utf-8 -*- #Copyright (C) Nathan Jones ncjones@users.sourceforge.net #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later v...
9,531
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...
9,532
test morphsnakes simple shape geodesic active contour
import numpy as np import pytest from numpy.testing import assert_array_equal from skimage.segmentation import (disk_level_set, inverse_gaussian_gradient, morphological_chan_vese, morphological_geodesic_active_contour...
9,533
get label
#!/usr/bin/env python # --!-- coding: utf8 --!-- from PyQt5.QtCore import Qt from PyQt5.QtGui import QBrush from PyQt5.QtWidgets import QComboBox from manuskript.enums import Outline class cmbOutlineLabelChoser(QComboBox): def __init__(self, parent=None): QComboBox.__init__(self, parent) self.act...
9,534
dats path
import json import pytest from scripts.dats_jsonld_annotator.annotator import annotate_dats_object from scripts.dats_jsonld_annotator.annotator import CONTEXT_DIR from scripts.dats_jsonld_annotator.annotator import find_context from scripts.dats_jsonld_annotator.annotator import find_schema from scripts.dats_jsonld_a...
9,535
test pending ops
# Copyright (c) MONAI Consortium # 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, so...
9,536
test missing signing key
from unittest.mock import Mock, patch from canonicalwebteam.store_api.exceptions import StoreApiResponseErrorList from tests.admin.tests_models import TestModelServiceEndpoints class TestGetPolicies(TestModelServiceEndpoints): @patch("webapp.admin.views.admin_api.get_store_model_policies") def test_get_polic...
9,537
get browser name
import os import sqlite3 from scripts.artifact_report import ArtifactHtmlReport from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, get_next_unused_name, open_sqlite_db_readonly def METHOD_NAME(file_name): if 'brave' in file_name.lower(): return 'Brave' elif 'microsoft' in file_...
9,538
test time
# Copyright (c) Microsoft Corporation # All rights reserved. # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated # documentation files (the "Software"), to deal in the Software without restriction, including without limitation # the rights to ...
9,539
test records ui request
from functools import cached_property from unittest.mock import Mock, patch, sentinel from django.test import RequestFactory, override_settings from rest_framework.permissions import AllowAny from rest_framework.response import Response from sentry.api.base import Endpoint from sentry.middleware.ratelimit import Rate...
9,540
test holidays
# 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...
9,541
main
#!/usr/bin/env python # pylint: disable=unused-argument, import-error # This program is dedicated to the public domain under the CC0 license. """ First, a few callback functions are defined. Then, those functions are passed to the Application and registered at their respective places. Then, the bot is started and runs...
9,542
get multi topic offset
from kafka.common import OffsetRequestPayload from corehq.apps.app_manager.util import app_doc_types from corehq.apps.change_feed.connection import get_simple_kafka_client from corehq.apps.change_feed.exceptions import UnavailableKafkaOffset from corehq.form_processor.models import XFormInstance DOMAIN = 'domain' MET...
9,543
det loss
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
9,544
solve via data
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
9,545
check value error
""" Tests for numpy/core/src/multiarray/conversion_utils.c """ import re import sys import pytest import numpy as np import numpy.core._multiarray_tests as mt from numpy.testing import assert_warns, IS_PYPY class StringConverterTestCase: allow_bytes = True case_insensitive = True exact_match = False ...
9,546
ccc
import sys from _typeshed import SupportsRead, SupportsReadline from collections.abc import Callable, Iterable, Iterator from socket import socket from ssl import SSLContext from types import TracebackType from typing import Any, TextIO from typing_extensions import Literal, Self __all__ = ["FTP", "error_reply", "erro...
9,547
test batch issue 56273
""" tests.pytests.functional.cli.test_batch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ import salt.cli.batch import salt.config import salt.utils.jid from tests.support.mock import Mock, patch class MockPub: """ Mock salt.client.LocalClient.pub method """ calls = 0 initial_ping = False batch...
9,548
run
# Copyright (c) MONAI Consortium # 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, so...
9,549
is valid ipv6
from trex.common.trex_exceptions import TRexError from trex.common.trex_types import listify from trex.emu.trex_emu_conversions import Mac, Ipv4, Ipv6 try: basestring except NameError: basestring = str def is_valid_mac(mac): return Mac.is_valid(mac) def is_valid_ipv4(addr): return Ipv4.is_valid(addr, mc ...
9,550
request factory
from __future__ import annotations import functools from typing import Callable, Optional, Tuple import pytest from django.contrib.auth.models import AnonymousUser, User from django.core.cache import cache from django.http import HttpRequest from django.test import override_settings from sentry.app import env from s...
9,551
test mandatory files
"""Tests for checking the recipes and their files. Authors * Mirco Ravanelli 2022 """ import os import csv from speechbrain.utils.data_utils import get_all_files, get_list_from_csv __skip_list = ["README.md", "setup", "full_inference.csv"] def test_recipe_list( search_folder="recipes", hparam_ext=[".yaml"]...
9,552
get abbr impl
"""Generate and work with PEP 425 Compatibility Tags.""" import distutils.util import platform import sys import sysconfig import warnings try: from importlib.machinery import get_all_suffixes except ImportError: from imp import get_suffixes as get_all_suffixes def get_config_var(var): try: retu...
9,553
test setlangs ro
#!/usr/bin/python # # Copyright (c) 2008--2015 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should...
9,554
test starred assignment
"""Tests for the unparse.py script in the Tools/parser directory.""" import unittest import test.support import io import os import random import tokenize import ast from test.test_tools import basepath, toolsdir, skip_if_missing skip_if_missing() parser_path = os.path.join(toolsdir, "parser") with test.support.Di...
9,555
kill instances
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from mock import patch, MagicMock from physical.tests.factory import InstanceFactory from model_mommy import mommy from physical.models import EngineType class UsedAndTotalValidator(object): @staticmethod def assertEqual(a, b):...
9,556
create
############################################################################## # For copyright and license notices, see __manifest__.py file in module root # directory ############################################################################## from odoo import fields, models, api, _ from odoo.exceptions import Valid...
9,557
create
from datetime import datetime from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from django.utils import timezone import django_filters from rest_framework import exceptions, mixins, serializers, viewsets fr...
9,558
bgp peer address
# 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...
9,559
to str
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: release-1.28 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import si...
9,560
convert
import sys import json import argparse markdown = "" tab = " " list_tag = '* ' inline_code = '`' code_block = '```' subtitle = '## ' htag = '#' if sys.version_info < (3, 0): raise Exception("[ERROR] This program requires Python 3.0 or greater") def load_json(file): try: with open(file, 'r') as f: ...
9,561
ask pass
""" SSH-MITM Askpass This is a Python implementation of the SSH-ASKPASS utility which provides a simple Tkinter-based GUI dialog to obtain a password from the user. This utility is often used in conjunction with the OpenSSH ssh-agent program to securely store private keys. The ssh-agent program is able to hold privat...
9,562
get enterprise plan
from django.core.files.uploadedfile import SimpleUploadedFile from django_prbac.models import Role from django.contrib.sessions.middleware import SessionMiddleware from corehq.apps.accounting.models import ( SoftwarePlan, SoftwarePlanEdition, SoftwarePlanVisibility, SoftwareProductRate, SoftwarePl...
9,563
allowed transition names and token types
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # Modifications: # Copyright David Halter and Contributors # Modifications are dual-licensed: MIT and PSF. # 99% of the code is different from pgen2, now. """ The ``Parser`` tries to convert the availa...
9,564
setup method
from numpy.testing import (assert_, assert_array_equal) import numpy as np import pytest from numpy.random import Generator, MT19937 class TestRegression: def METHOD_NAME(self): self.mt19937 = Generator(MT19937(121263137472525314065)) def test_vonmises_range(self): # Make sure generated rand...
9,565
eeg positions
import os import warnings import csv import numpy as np from .file_finder import SubjectFiles def read_csv_positions(fn): ''' Reads positions from a .csv file Parameters ------------ fn: str Name of csv file Returns -------- type: list Type of position in each row ('Gene...
9,566
sample predictor configs
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
9,567
get byd bat power
#!/usr/bin/env python3 import logging from typing import Dict, Union, Optional, List from dataclass_utils import dataclass_from_dict from helpermodules.cli import run_using_positional_cli_args from modules.devices.byd.config import BYD, BYDBatSetup, BYDConfiguration from modules.devices.byd.device import Device as BYD...
9,568
add addon
import uuid from django.conf import settings from django.db import models from django.urls import reverse from olympia import activity, amo from olympia.addons.models import Addon from olympia.amo.fields import PositiveAutoField from olympia.amo.models import ManagerBase, ModelBase from olympia.translations.fields im...
9,569
test and or
# SPDX-License-Identifier: MPL-2.0 # Copyright (C) 2020 - 2021 Vereniging van Nederlandse Gemeenten, Gemeente Amsterdam import copy import time from datetime import datetime from django.contrib.gis import geos from django.test import TestCase from freezegun import freeze_time from signals.apps.dsl.ExpressionEvaluator...
9,570
hide submenus
from browser import console, document, html, window, alert style_sheet = """ /* Classes for brython.widgets.menu */ :root { --brython-menu-font-family: Arial; --brython-menu-font-size: 100%; --brython-menu-navbar-bgcolor: CadetBlue; --brython-menu-navbar-bgcolor-selected: SkyBlue; --brython-menu-navbar-colo...
9,571
open
# Copyright 2017 Workiva # 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 #...
9,572
power
# 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...
9,573
write settings
""" netcdf exporter of scalar products for 1d simulations """ from collections import namedtuple from copy import deepcopy import numpy as np from scipy.io import netcdf_file class NetCDFExporter_1d: # pylint: disable=too-few-public-methods,too-many-instance-attributes def __init__( # pylint: disable = too-ma...
9,574
prepare optparser
#v 1.0 import sys, os, time, re import urllib, urllib2 from optparse import OptionParser from HTMLParser import HTMLParser from xml.dom.minidom import parseString #id mapping def getPDBIdandChain(uniprotID): #data from http://www.bioinf.org.uk/pdbsws/ dirPath = os.path.dirname(sys.argv[0]) fileName ='pdb_...
9,575
test no param
import re import unittest from ...core.inputscanner import InputScanner class TestInputScanner(unittest.TestCase): @classmethod def setUpClass(cls): pass def setUp(self): self.value = "howdy" self.inputscanner = InputScanner(self.value) def test_new(self): inputscanne...
9,576
aten fft ihfft
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # mypy: disable-error-code="misc,arg-type,type-arg,valid-type,assignment...
9,577
set module
#!/usr/bin/env python """ Do the initial installation and configuration of a DIRAC component """ from DIRAC import S_OK from DIRAC import exit as DIRACexit from DIRAC import gConfig, gLogger from DIRAC.Core.Base.Script import Script from DIRAC.Core.Utilities.Extensions import extensionsByPriority from DIRAC.FrameworkSy...
9,578
source
from conan import ConanFile from conan.tools.microsoft import is_msvc from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os required_co...
9,579
reverse permute data
import numpy as np import nibabel as nib from nilearn.image import new_img_like, resample_to_img import random import itertools def scale_image(image, scale_factor): scale_factor = np.asarray(scale_factor) new_affine = np.copy(image.affine) new_affine[:3, :3] = image.affine[:3, :3] * scale_factor new_...
9,580
get track groups
# Copyright (C) 2014 Dustin Spicuzza # # 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, or (at your option) # any later version. # # This program is distributed in the hope that...
9,581
run timer
# Copyright (C) 2021 Open Source Robotics Foundation # # 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 o...
9,582
replacefunc
# Copyright 2010-2016 Jaap Karssenberg <jaap.karssenberg@gmail.com> '''Thin wrapper for 'datetime' module from the standard library. Provides timezone info for the local time. Based on example code from standard library datetime documentation. Main usage of this module is the function L{now()}. It imports all from t...
9,583
trainable args update method
import tempfile import pytest from ray import tune from autogluon.core.hpo.ray_hpo import AutommRayTuneAdapter, RayTuneAdapter, TabularRayTuneAdapter, run from autogluon.core.hpo.ray_tune_constants import SCHEDULER_PRESETS, SEARCHER_PRESETS class DummyAdapter(RayTuneAdapter): supported_searchers = list(SEARCHE...
9,584
check and add owner
from __future__ import annotations import base64 import zlib from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR from DIRAC.Core.Utilities.DErrno import EWMSSUBM, EWMSJMAN from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader f...
9,585
make locations list
#!/usr/bin/env python """Various helper functions for workqueue""" import logging import os from WMCore.Services.CRIC.CRIC import CRIC __dbses = {} def get_dbs(url): """Return DBS object for url""" try: return __dbses[url] except KeyError: from WMCore.Services.DBS.DBSReader import DBSRe...
9,586
a
import re def _prefer_non_zero(*args): for arg in args: if arg != 0: return arg return 0.0 def _ntos(n): # %f likes to add unnecessary 0's, %g isn't consistent about # decimals return ("%.3f" % n).rstrip("0").rstrip(".") def _strip_xml_ns(tag): # ElementTree API doesn't pro...
9,587
reindent
#! /usr/bin/env python """ This script generates ReST files based on the contents of the GPI. These files are then parsed by Sphinx to create the GPI documentation. """ from __future__ import print_function, absolute_import import sys import os import inspect from itertools import zip_longest import shutil doc_dir ...
9,588
setup
# Copyright (c) 2008, Thomas Hurst <tom@hur.st> # # Use of this file is unrestricted provided this notice is retained. # If you use it, it'd be nice if you dropped me a note. Also beer. from terminatorlib.util import dbg, err from terminatorlib.version import APP_NAME, APP_VERSION import socket import threading impo...
9,589
on get item image
from __future__ import absolute_import, division, print_function import wxtbx.bitmaps from libtbx.queuing_system_utils import sge_utils from libtbx.utils import Sorry import wx try : from wx.lib.agw.genericmessagedialog import GenericMessageDialog except ImportError : GenericMessageDialog = wx.MessageBox import s...
9,590
find replacement
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import logging from dataclasses import dataclass from itertools import chain from typing import Any from pants.backend.docker.goals.package_image impor...
9,591
print errors
""" Test Result ----------- Provides a TextTestResult that extends unittest's _TextTestResult to provide support for error classes (such as the builtin skip and deprecated classes), and hooks for plugins to take over or extend reporting. """ import logging try: # 2.7+ from unittest.runner import _TextTestResu...
9,592
tls mac add
# This file is part of Scapy # Copyright (C) 2007, 2008, 2009 Arnaud Ebalard # 2015, 2016, 2017 Maxence Tury # This program is published under a GPLv2 license """ TLS helpers, provided as out-of-context methods. """ from __future__ import absolute_import import struct from scapy.compat import orb, chb ...
9,593
load service with agent image
import datetime import os import kubernetes.client import kubernetes.config import kubernetes.dynamic import pytest from junit_report import JunitTestSuite from service_client import log from tests.base_test import BaseTest class TestUpgradeAgent(BaseTest): @pytest.fixture(scope="session") def namespace(sel...
9,594
remove file ext
from __future__ import print_function, division, absolute_import import os import re try: import tesedml as libsedml except ImportError: import libsedml #Only load this class if phrasedml exists try: import phrasedml class phrasedmlImporter(object): def __init__(self, sbml_map={}): ...
9,595
get header
""" Generates setups for 2d shallow water MMS tests """ import sympy from sympy import init_printing init_printing() # coordinates x, y, z = sympy.symbols('x[0] x[1] x[2]') z_tilde = sympy.symbols('z_tilde') # domain lenght, x in [0, Lx], y in [0, Ly] lx, ly = sympy.symbols('lx ly') # depth scale h0 = sympy.symbols(...
9,596
build sequence
# Copyright (c) Microsoft Corporation # All rights reserved. # # MIT License # # 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...
9,597
evaluate list
import sys from typing import Any from typing import Iterator from typing import Tuple from typing import Type from typing import TypeVar from typing import Union from typing_extensions import get_args from typing_extensions import get_origin NONE_TYPE = type(None) try: from types import UnionType # type: igno...
9,598
laletterbuilder pdf response
import base64 from project.util.demo_deployment import is_not_demo_deployment from project.util.letter_sending import ( render_multilingual_letter, send_letter_via_lob, ) from . import models from io import BytesIO import logging from django.http import FileResponse from django.utils import timezone from django...
9,599
register task
import logging import os import threading import time from collections import defaultdict from typing import List from croniter import croniter from robusta.core.persistency.scheduled_jobs_states_dal import SchedulerDal from robusta.core.schedule.model import DynamicDelayRepeat, JobStatus, ScheduledJob, SchedulingInfo...