id
int64
0
6k
code
stringlengths
4k
8k
code_compressed
listlengths
0
44
100
#/*########################################################################## # Copyright (C) 2004-2014 V.A. Sole, European Synchrotron Radiation Facility # # This file is part of the PyMca X-ray Fluorescence Toolkit developed at # the ESRF by the Software group. # # Permission is hereby granted, free of charge, to any...
[ { "body": " if _logger.getEffectiveLevel() == logging.DEBUG:\n StackPluginBase.pluginBaseLogger.setLevel(logging.DEBUG)\n StackPluginBase.StackPluginBase.__init__(self, stackWindow, **kw)\n self.methodDict = {}\n function = self.METHOD_NAME\n info = \"Fit stack with...
101
################################################################################ # Creme is a free/open-source Customer Relationship Management software # Copyright (C) 2009-2023 Hybird # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General P...
[ { "body": " return self.filter(\n is_deleted=False,\n relations__object_entity=entity,\n relations__type__in=self.linked_rtype_ids,\n ).distinct()", "name": "_linked(self,ActivityManager(CremeEntityManager):" }, { "body": " return self.filter(\n ...
102
#!/usr/bin/env python # CCP4InterRadiationDamageDetector.py # Copyright (C) 2006 CCLRC, Graeme Winter # # This code is distributed under the BSD license, a copy of which is # included in the root directory of this package. # # 15th January 2007 # # A detector for radiation damage between wavelengths - in particul...
[ { "body": " if self._hklin is None:\n raise RuntimeError(\"hklin not defined\")\n if not os.path.exists(self._hklin):\n raise RuntimeError(\"hklin %s does not exist\" % self._hklin)", "name": "check_hklin(self):class" }, { "body": " self._hklout = hklout", ...
103
import pytest from pybind11_tests import ConstructorStats from pybind11_tests import operators as m def test_operator_overloading(): v1 = m.Vector2(1, 2) v2 = m.Vector(3, -1) v3 = m.Vector2(1, 2) # Same value as v1, but different instance. assert v1 is not v3 assert str(v1) == "[1.000000, 2.000...
[ { "body": " \"\"\"#328: first member in a class can't be used in operators\"\"\"\n a = m.NestA()\n b = m.NestB()\n c = m.NestC()\n a += 10\n assert m.get_NestA(a) == 13\n b.a += 100\n assert m.get_NestA(b.a) == 103\n c.b.a += 1000\n assert m.get_NestA(c.b.a) == 1003\n b -= 1\n ...
104
#!/usr/bin/env python3 import argparse import logging import os import re import sys # logging.basicConfig(level="INFO") _logger = logging.getLogger(__name__) def METHOD_NAME(): desc = """Process C/C++ files for '#if 0' and '#if 1' blocks""" epilog = """This tool is for removing dead code from C/C++ files....
[ { "body": " desc = \"\"\"Process C/C++ files for '#if 0' and '#if 1' blocks\"\"\"\n epilog = \"\"\"This tool is for removing dead code from C/C++ files.\n It searches for '#if 0' and '#if 1' preprocessor directives (along\n with their '#else' clauses), and removes them along with any code\n which...
105
import argparse import json import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data def init_flags(): global FLAGS parser = argparse.ArgumentParser() parser.add_argument( "--datadir", default="/tmp/MNIST_data", ) parser.add_argument("--rundir", default=...
[ { "body": " global sess\n sess = tf.Session()\n sess.run(tf.global_variables_initializer())", "name": "METHOD_NAME():" }, { "body": " if step % 20 == 0:\n evaluate(step, last_training_batch, train_writer, \"training\")\n validate_data = {x: mnist.validation.images, y_: mnis...
106
# 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...
[ { "body": "\t\treturn self.get_query_params().get('SourceEndpoint.InstanceID')", "name": "get_SourceEndpointInstanceID(self):ConfigureSubscriptionInstanceRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('SourceEndpoint.InstanceID', SourceEndpointInstanceID)", "name": "set_SourceEndpo...
107
################################################################################ # Creme is a free/open-source Customer Relationship Management software # Copyright (C) 2009-2023 Hybird # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General P...
[ { "body": " return mail.subject", "name": "get_subject(self,Meta:" }, { "body": " for __ in range(10000): # NB: avoid infinite loop\n self.identifier = utils.generate_id()\n try:\n with atomic():\n self.save(force_insert=True)\n ...
108
"""Tests for anomaly detection with OTX CLI.""" # Copyright (C) 2021 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 # # Unle...
[ { "body": " otx_demo_deployment_testing(template, tmp_dir_path, otx_dir, args)", "name": "METHOD_NAME(self,TestToolsAnomalyDetection:" } ]
109
from __future__ import annotations import os import subprocess import sys import time import fsspec import pytest from fsspec.core import open_files from packaging.version import parse as parse_version import dask.bag as db from dask.utils import tmpdir files = ["a", "b"] requests = pytest.importorskip("requests") ...
[ { "body": " with tmpdir() as d:\n for fn in files:\n with open(os.path.join(d, fn), \"wb\") as f:\n f.write(b\"a\" * 10000)\n cmd = [sys.executable, \"-m\", \"http.server\", \"8999\"]\n p = subprocess.Popen(cmd, cwd=d)\n timeout = 10\n while True:\...
110
# Copyright 2022 Sony Group 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 ...
[ { "body": " tar_files,\n conf: DatasetConfig,\n rng=None):\n super(WebDatasetDataSourceLocal, self).__init__(\n shuffle=conf.shuffle_dataset, rng=rng)\n shuffle_size = 1\n if conf.shuffle_dataset:\n shuffle_size = 10000\n...
111
# 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...
[ { "body": "\t\treturn self.get_query_params().get('Description')", "name": "get_Description(self):CreateHybridMonitorTaskRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('Description', Description)", "name": "set_Description(self,CreateHybridMonitorTaskRequest(RpcRequest):" }, { ...
112
# 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...
[ { "body": "\t\treturn self.get_query_params().get('Description')", "name": "get_Description(self):ModifyTemplateRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('Description',Description)", "name": "set_Description(self,Description):ModifyTemplateRequest(RpcRequest):" }, { "b...
113
# 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...
[ { "body": "\t\treturn self.get_body_params().get('OperatingSystem')", "name": "get_OperatingSystem(self):CreateAppRequest(RpcRequest):" }, { "body": "\t\tself.add_body_params('OperatingSystem', OperatingSystem)", "name": "set_OperatingSystem(self,CreateAppRequest(RpcRequest):" }, { "body...
114
# coding=utf-8 # Copyright 2023 The TensorFlow Datasets 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 appl...
[ { "body": " self,\n version: Union[Version, str],\n experiments=None,\n tfds_version_to_prepare=None,", "name": "__init__(Version:" }, { "body": " \"\"\"Returns True if version implements given experiment.\"\"\"\n return self._experiments[experiment]", "name": "implemen...
115
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2009 Fermi Research Alliance, LLC # SPDX-License-Identifier: Apache-2.0 """ Project: glideinWMS Description: unit tests for glideinwms/lib/condorExe.py Author: tiradani <tiradani> """ import os import sys import unittest import xmlrunner from glideinwm...
[ { "body": " \"\"\"\n Test the iexe_cmd function for errors. There are two sets of worker\n functions that will be executed. The first set writes 20k lines to\n stdout and exits normally (exit code: 0). The second also writes 20k\n lines to stdout, but these exit abnormally ...
116
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import copy from typing import Iterator import torch from torch import Tensor, autograd, nn from torch.nn.modules.loss import _Loss from torch.optim.optimizer import Optimizer from archai.common import ml_utils from archai.common.config import ...
[ { "body": " return model.all_owned().param_by_kind('alphas')", "name": "METHOD_NAME(model:Model)->Iterator[nn.Parameter]:" }, { "body": " model: Model, lossfn: _Loss) -> None:\n self._w_momentum = w_momentum # momentum for w\n self._w_weight_decay = w_decay # weigh...
117
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResWithSource')", "name": "get_ResWithSource(self):AddCustomLiveStreamTranscodeRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResWithSource', ResWithSource)", "name": "set_ResWithSource(self,AddCustomLiveStreamTranscodeRequest(Rpc...
118
import warnings from dataclasses import asdict, dataclass from typing import Any, Dict, List, Optional, Sequence, Union import numpy as np from lhotse.features.base import FeatureExtractor, register_extractor from lhotse.utils import Seconds, compute_num_frames, is_module_available @dataclass class OpenSmileConfig:...
[ { "body": " return asdict(self)", "name": "METHOD_NAME(self)attributes" }, { "body": " return OpenSmileConfig(**data)", "name": "from_dict(data:attributes" }, { "body": " \"\"\"\n Returns list of strings with names of pretrained FeatureSets available in opensm...
119
# 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...
[ { "body": "\t\treturn self.get_query_params().get('AccessPointId')", "name": "get_AccessPointId(self):CreateRouterInterfaceRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('AccessPointId', AccessPointId)", "name": "set_AccessPointId(self,CreateRouterInterfaceRequest(RpcRequest):" }...
120
# 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...
[ { "body": "\t\treturn self.get_query_params().get('DynamicMode')", "name": "get_DynamicMode(self):CreateOTADynamicUpgradeJobRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('DynamicMode',DynamicMode)", "name": "set_DynamicMode(self,DynamicMode):CreateOTADynamicUpgradeJobRequest(RpcRe...
121
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerId')", "name": "get_ResourceOwnerId(self):CreateSmartAccessGatewayRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResourceOwnerId', ResourceOwnerId)", "name": "set_ResourceOwnerId(self,CreateSmartAccessGatewayRequest(R...
122
#!/usr/bin/env python3 ############################################################################### # Copyright 2020 The Apollo 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...
[ { "body": " cyber.init(\"Preprocessor\")\n preprocessor = Preprocessor()\n task_dir = preprocessor.create_tree()\n preprocessor.sanity_check_path(task_dir)\n cyber.shutdown()", "name": "main(argv):Preprocessor(object):" }, { "body": " self.record_num = FLAGS.record_num\n ...
123
""" This module defines options which should be available on all commands, such as the -v, --verbose option. To use it: - Add the `@add_common_options()` decorator after all the `click.option()` calls of the command function. - Add a `**kwargs: Any` argument to the command function. The `kwargs` argument is require...
[ { "body": " \"\"\"Returns the UserConfig object stored in Click context\"\"\"\n return cast(UserConfig, ctx.obj[\"config\"].user_config)", "name": "get_config_from_context(ctx:" }, { "body": " \"\"\"Helper function to define a Click option callback for simple cases where we only\n have t...
124
# 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...
[ { "body": "\t\treturn self.get_body_params().get('ClientToken')", "name": "get_ClientToken(self):CreateLoadBalancerRequest(RpcRequest):" }, { "body": "\t\tself.add_body_params('ClientToken', ClientToken)", "name": "set_ClientToken(self,CreateLoadBalancerRequest(RpcRequest):" }, { "body":...
125
# OPENCORE - ADD from shared.database.task.job.job import Job from shared.database.project import Project from shared.regular import regular_log from shared.shared_logger import get_shared_logger from shared.feature_flags.feature_checker import FeatureChecker from shared.settings import settings from shared.database.so...
[ { "body": " \"\"\"\n Returns a string with the final filename for an export.\n :param export:\n :return:\n \"\"\"\n # TODO (low priority) switch to starting to array with \"\".join() it\n # it's a bit faster and more importantly easier to read / check.\n filename = f\"_diffgram_annot...
126
# Copyright 2020 The Johns Hopkins University Applied Physics Laboratory # # 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 ...
[ { "body": " \"\"\"Constructor\n \"\"\"\n Service.__init__(self)", "name": "__init__(self):Mesh:" }, { "body": " x_range, y_range, z_range, time_range=None, \n id_list=[], voxel_unit=VoxelUnits.nm, \n voxel_size=[4,4,40], simp_fact=0, max_simplifi...
127
import aiohttp import asyncio import logging import time import ujson from typing import ( Any, Dict, Optional, ) from hummingbot.connector.exchange.ndax.ndax_auth import NdaxAuth from hummingbot.connector.exchange.ndax import ndax_constants as CONSTANTS, ndax_utils from hummingbot.connector.exchange.ndax...
[ { "body": " if cls._logger is None:\n cls._logger = logging.getLogger(__name__)\n return cls._logger", "name": "logger(cls)NdaxAPIUserStreamDataSource(UserStreamTrackerDataSource):" }, { "body": " super().__init__()\n self._shared_client = shared_client or self...
128
import sys from json import loads from typing import Iterator from galaxy.datatypes.tabular import Tabular from galaxy.model import DatasetInstance class BaseDataProvider: """ Base class for data providers. Data providers both: - read and package data from datasets - write subsets of data to new dat...
[ { "body": " self,\n converted_dataset=None,\n original_dataset=None,\n dependencies=None,\n error_max_vals=\"Only the first %i values are returned.\",", "name": "__init__(class" }, { "body": " \"\"\"\n Returns true if dataset has data in the specified...
129
#!/usr/bin/env python3 import cv2 import numpy as np import depthai as dai import argparse parser = argparse.ArgumentParser() parser.add_argument("-res", "--resolution", type=str, default="720", help="Sets the resolution on mono cameras. Options: 800 | 720 | 400") parser.add_argument("-md", "--mesh_dir", type=str...
[ { "body": " print(\"Saving mesh to:\", outputPath)\n meshLeft.tofile(outputPath + \"/left_mesh.calib\")\n meshRight.tofile(outputPath + \"/right_mesh.calib\")", "name": "METHOD_NAME(meshLeft," } ]
130
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with self work for additional information # regarding copyright ownership. The ASF licenses self file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
[ { "body": " EndpointResolverBase.__init__(self)\n self._location_service_endpoint = DEFAULT_LOCATION_SERVICE_ENDPOINT\n self._client = client\n self._invalid_product_codes = set()\n self._invalid_region_ids = set()\n self._valid_product_codes = set()\n self._vali...
131
# # junitxml: extensions to Python unittest to get output junitxml # Copyright (C) 2009 Robert Collins <robertc@robertcollins.net> # # Copying permitted under the LGPL-3 licence, included with this library. """unittest compatible JUnit XML output.""" import datetime import re import time import unittest # same f...
[ { "body": " self._offset = None", "name": "__init__(self):JUnitXmlResult(unittest.TestResult):" }, { "body": " if self._offset is None:\n t = 1260423030 # arbitrary, but doesn't handle dst very well\n dt = datetime.datetime\n self._offset = (dt.fromtime...
132
import pytest from api.base.settings.defaults import API_BASE from osf.migrations import ensure_invisible_and_inactive_schema from osf.models import RegistrationSchema from osf_tests.factories import ( AuthUserFactory, ) pytestmark = pytest.mark.django_db SCHEMA_VERSION = 2 @pytest.fixture() def user(): re...
[ { "body": " return AuthUserFactory()", "name": "user():" }, { "body": " return RegistrationSchema.objects.filter(\n name='OSF Preregistration',\n schema_version=SCHEMA_VERSION\n ).first()", "name": "METHOD_NAME():" }, { "body": " return ensure_invisible_and_inac...
133
# Copyright (c) ZenML GmbH 2021. 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: # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
[ { "body": " \"\"\"Read from artifact store.\n Args:\n data_type: An Image.Image type.\n Returns:\n An Image.Image object.\n \"\"\"\n files = io_utils.find_files(self.uri, f\"{DEFAULT_IMAGE_FILENAME}.*\")\n filepath = [file for file in files if not ...
134
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. import unittest as ut from h5py import h5p, h5f, ve...
[ { "body": " '''test get/set virtual prefix '''\n dalist = h5p.create(h5p.DATASET_ACCESS)\n self.assertEqual(dalist.get_virtual_prefix().decode(), '')\n virtual_prefix = \"path/to/virtual/dataset\"\n dalist.set_virtual_prefix(virtual_prefix.encode('utf-8'))\n self.assert...
135
import os, json from opendm import log from opendm.pseudogeo import get_pseudogeo_utm, get_pseudogeo_scale from opendm.location import transformer from pyproj import CRS from osgeo import gdal import numpy as np import cv2 def get_rotation_matrix(rotation): """Get rotation as a 3x3 matrix.""" return cv2.Rodrig...
[ { "body": " \"\"\"The origin of the pose in world coordinates.\"\"\"\n return -get_rotation_matrix(np.array(shot['rotation'])).T.dot(np.array(shot['translation']))", "name": "METHOD_NAME(shot):" }, { "body": " \"\"\"\n Extract shots from OpenSfM's reconstruction.json\n \"\"\"\n pse...
136
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from logging import getLogger from conda.common.path import ( get_major_minor_version, missing_pyc_files, url_to_path, win_path_backout, ) log = getLogger(__name__) def METHOD_NAME(): assert url_to_path("file:///etc/fstab...
[ { "body": " assert url_to_path(\"file:///etc/fstab\") == \"/etc/fstab\"\n assert url_to_path(\"file://localhost/etc/fstab\") == \"/etc/fstab\"\n assert url_to_path(\"file://127.0.0.1/etc/fstab\") == \"/etc/fstab\"\n assert url_to_path(\"file://::1/etc/fstab\") == \"/etc/fstab\"", "name": "METHOD...
137
import pytest from eth_utils.toolz import ( compose, curry, ) from hexbytes import ( HexBytes, ) AMBIGUOUS_CONTRACT_ABI = [ { "constant": False, "inputs": [{"name": "input", "type": "uint256"}], "name": "blockHashAmphithyronVersify", "outputs": [{"name": "", "type": "ui...
[ { "body": " deploy_txn = string_contract_factory.constructor(\"Caqalai\").transact()\n deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn)\n assert deploy_receipt is not None\n contract_address = address_conversion_func(deploy_receipt[\"contractAddress\"])\n contract = string_contrac...
138
''' These functions are rather specific to Amod's deeplearning code and should probably be either moved or completely deleted. It might make sense to develop some more universal normalization utility functions. ''' import numpy as np def piecewise_linear_normalize(in_img_data, ref_img_data): '''Function to piece...
[ { "body": " # in_img_data = wm_peak_normalize(in_img_data)\n # ref_img_data = wm_peak_normalize(ref_img_data)\n in_img_data_flat = in_img_data.flatten()\n in_img_fg = in_img_data_flat[in_img_data_flat > 0] # foreground is > 0\n ref_img_data_flat = ref_img_data.flatten()\n ref_img_fg = ref_img...
139
# 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...
[ { "body": "\t\treturn self.get_query_params().get('MinAvailableAddrNum')", "name": "get_MinAvailableAddrNum(self):AddGtmAddressPoolRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('MinAvailableAddrNum', MinAvailableAddrNum)", "name": "set_MinAvailableAddrNum(self,AddGtmAddressPoolReq...
140
# 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...
[ { "body": "\t\treturn self.get_body_params().get('ProductCode')", "name": "get_ProductCode(self):DescribeInstanceAmortizedCostByAmortizationPeriodDateRequest(RpcRequest):" }, { "body": "\t\tself.add_body_params('ProductCode', ProductCode)", "name": "set_ProductCode(self,DescribeInstanceAmortized...
141
# 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...
[ { "body": "\t\treturn self.get_body_params().get('RuntimePolicy')", "name": "get_RuntimePolicy(self):CreateAppInstanceGroupRequest(RpcRequest):" }, { "body": "\t\tself.add_body_params(\"RuntimePolicy\", json.dumps(RuntimePolicy))", "name": "set_RuntimePolicy(self,CreateAppInstanceGroupRequest(Rp...
142
# # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
[ { "body": " \"\"\"Raises a ValueError if the provided Message is not a FHIR reference.\"\"\"\n if not annotation_utils.is_reference(reference):\n raise ValueError(\n f'Message {reference.DESCRIPTOR.name} is not a FHIR reference.')", "name": "METHOD_NAME(reference:" }, { "body": " refe...
143
# -*- coding: utf-8 -*- from __future__ import print_function from acq4.util import Qt import os import acq4.util.database as database import acq4.Manager import acq4.analysis.modules as analysis import acq4.analysis.AnalysisHost as AnalysisHost import acq4.analysis.dataModels as models from pyqtgraph import FileDialo...
[ { "body": " Qt.QWidget.__init__(self, parent)\n self.ui = Ui_Form()\n self.ui.setupUi(self)\n self.man = acq4.Manager.getManager()\n self.mod = mod\n self.dbFile = None\n self.db = None\n self.mods = []\n self.currentModel = None\n self.popul...
144
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ServerEncryption')", "name": "get_ServerEncryption(self):CreateDataAddressRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ServerEncryption',ServerEncryption)", "name": "set_ServerEncryption(self,ServerEncryption):CreateDataAddressR...
145
# coding: utf-8 """ Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ import unittest from unittest.mock import patch import urllib3 import typing_extensions import unit_test_api from unit_test_api.paths.request_body_post_allof_with_base_schema_request_body.post import...
[ { "body": " content_type = 'application/json'\n # valid\n with patch.object(urllib3.PoolManager, 'request') as mock_request:\n payload = (\n {\n \"foo\":\n \"quux\",\n \"bar\":\n 2,...
146
# -*- coding: utf-8 -*- import re import hmac import hashlib import logging from django.apps import apps from nameparser import HumanName from werkzeug.utils import cached_property from framework.flask import request from website import settings from website.conferences.exceptions import ConferenceError logger = ...
[ { "body": " self.request = request._get_current_object()", "name": "__init__(self):ConferenceMessage(object):" }, { "body": " \"\"\"Verify that request comes from Mailgun. Based on sample code from\n http://documentation.mailgun.com/user_manual.html#webhooks\n \"\"\"\n ...
147
# Copyright 2021 Sony Corporation. # Copyright 2021 Sony Group 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 requi...
[ { "body": " self.model = create_model(\n opt.arch,\n opt.heads,\n opt.head_conv,\n opt.num_layers,\n training=False,\n channel_last=opt.channel_last,\n )\n if opt.trained_model_path != '':\n extension = os.path.spl...
148
# 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...
[ { "body": "\t\tself.add_query_param('LayoutId', LayoutId)", "name": "METHOD_NAME(self,ModifyCasterLayoutRequest(RpcRequest):" } ]
149
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ClientToken')", "name": "get_ClientToken(self):CreateClusterRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ClientToken',ClientToken)", "name": "set_ClientToken(self,ClientToken):CreateClusterRequest(RpcRequest):" }, { "bod...
150
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerId')", "name": "get_ResourceOwnerId(self):ModifyScalingRuleRequest(RpcRequest):" }, { "body": "\t\treturn self.get_query_params().get('ScaleInEvaluationCount')", "name": "get_ScaleInEvaluationCount(self):ModifyScalingRuleRequest(Rpc...
151
""" handle reading a csv from an external service, defaults are from Goodreads """ import csv from datetime import timedelta from typing import Iterable, Optional from django.utils import timezone from bookwyrm.models import ImportJob, ImportItem, SiteSettings, User class Importer: """Generic class for csv data ...
[ { "body": " \"\"\"patch up a job that was in the old format\"\"\"\n items = job.items\n first_item = items.first()\n if first_item is None:\n return\n headers = list(first_item.data.keys())\n job.mappings = self.create_row_mappings(headers)\n job.updat...
152
import shutil import warnings from contextlib import contextmanager from pathlib import Path import pytest from pharmpy.internals.fs.cwd import chdir from pharmpy.model import Model from pharmpy.tools import run_amd from pharmpy.workflows import default_tool_database def test_invalid_search_space_raises(tmp_path, t...
[ { "body": " with chdir(tmp_path):\n db, model = _load_model(testdata)\n with pytest.raises(\n ValueError,\n match='Invalid `search_space`, could not be parsed:',\n ):\n run_amd(\n model,\n results=model.modelfit_results,\n ...
153
# 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...
[ { "body": "\t\tself.add_query_param('OrderDirection', OrderDirection)", "name": "set_OrderDirection(self,DescribeDtsJobsRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('Tags', Tags)", "name": "METHOD_NAME(self,DescribeDtsJobsRequest(RpcRequest):" } ]
154
""" DataProvider related decorators. """ # I'd like to decorate the factory methods that give data_providers by the name they can be accessed from. e.g.: # @provides( 'id_seq' ) # where 'id_seq' is some 'data_format' string/alias # def get_id_seq_provider( dataset, **settings ): # then in some central dispatch (maybe...
[ { "body": " \"\"\"\n Wraps a class (generally a Datatype), finds methods within that have been\n decorated with `@dataprovider` and adds them, by their name, to a map\n in the class.\n This allows a class to maintain a name -> method map, effectively\n 'registering' dataprovider factory method...
155
import IMP import IMP.test import IMP.algebra from io import BytesIO import pickle class Tests(IMP.test.TestCase): def test_trivial_constructor(self): """Test trivial SpherePatch3D constructor""" p = IMP.algebra.SpherePatch3D() def METHOD_NAME(self): """Check that a patch of a sphere...
[ { "body": " \"\"\"Test trivial SpherePatch3D constructor\"\"\"\n p = IMP.algebra.SpherePatch3D()", "name": "test_trivial_constructor(self):Tests(IMP.test.TestCase):" }, { "body": " \"\"\"Check that a patch of a sphere is constructed correctly\"\"\"\n center = IMP.algebra....
156
# 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...
[ { "body": "\t\treturn self.get_query_params().get('QueueNumber')", "name": "get_QueueNumber(self):CreateNetworkInterfaceRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('QueueNumber', QueueNumber)", "name": "set_QueueNumber(self,CreateNetworkInterfaceRequest(RpcRequest):" }, { ...
157
# 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...
[ { "body": "\t\treturn self.get_query_params().get('Country')", "name": "get_Country(self):SaveSingleTaskForCreatingOrderActivateRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('Country', Country)", "name": "set_Country(self,SaveSingleTaskForCreatingOrderActivateRequest(RpcRequest):"...
158
import logging import re from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, get_headers, ) from galaxy.datat...
[ { "body": " try:\n return dataset.peek\n except Exception:\n return f\"ESTScan scores matrices ({nice_size(dataset.get_size())})\"", "name": "display_peek(self,Smat(Text):" }, { "body": " if not dataset.dataset.purged:\n dataset.peek = get_file_p...
159
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerAccount')", "name": "get_ResourceOwnerAccount(self):BindAxbRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResourceOwnerAccount', ResourceOwnerAccount)", "name": "set_ResourceOwnerAccount(self,BindAxbRequest(RpcRequest...
160
#!/usr/bin/python3 -u # Copyright 2021 Memgraph Ltd. # # Use of this software is governed by the Business Source License # included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source # License, and you may not use this file except in compliance with the Business...
[ { "body": " binary, queries, should_fail=False, failure_message=\"\", username=\"\", password=\"\", check_failure=True", "name": "execute_tester(" }, { "body": " binary: str, queries: List[str], expected: int, username: str = \"\", password: str = \"\", db: str = \"memgraph\"", "name": "ex...
161
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerId')", "name": "get_ResourceOwnerId(self):DescribeCapacityReservationsRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResourceOwnerId', ResourceOwnerId)", "name": "set_ResourceOwnerId(self,DescribeCapacityReservationsR...
162
from typing import Type from collections import OrderedDict from AnyQt.QtWidgets import QLineEdit, QSizePolicy from Orange.data import Table from Orange.data.sql.backend import Backend from Orange.data.sql.backend.base import BackendError from Orange.widgets import gui, report from Orange.widgets.credentials import C...
[ { "body": " super().__init__()\n self.backend = None # type: Optional[Backend]\n self.data_desc_table = None # type: Optional[Table]\n self.database_desc = None # type: Optional[OrderedDict]\n self._setup_gui()\n self.connect()", "name": "__init__(self):Error(OWW...
163
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerId')", "name": "get_ResourceOwnerId(self):ModifyForwardEntryRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResourceOwnerId', ResourceOwnerId)", "name": "set_ResourceOwnerId(self,ModifyForwardEntryRequest(RpcRequest):"...
164
from functools import partial from urllib.parse import unquote, urlparse from django.conf import settings from django.urls import reverse from creme.creme_core.models import FakeContact, FakeOrganisation, FieldsConfig from creme.creme_core.tests.views.base import ViewsTestCase class SearchAndViewTestCase(ViewsTestC...
[ { "body": " self.assertEqual(200, response.status_code)\n self.assertRedirects(response, entity.get_absolute_url())", "name": "assertDetailview(self,SearchAndViewTestCase(ViewsTestCase):" }, { "body": " user = self.login_as_root_and_get()\n phone = '999999999'\n ur...
165
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerAccount')", "name": "get_ResourceOwnerAccount(self):CreateSslVpnServerRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResourceOwnerAccount', ResourceOwnerAccount)", "name": "set_ResourceOwnerAccount(self,CreateSslVpnSe...
166
# 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...
[ { "body": "\t\treturn self.get_query_params().get('LogPosition')", "name": "METHOD_NAME(self):DescribeHanaBackupsAsyncRequest(RpcRequest):" }, { "body": "\t\treturn self.get_query_params().get('ResourceGroupId')", "name": "get_ResourceGroupId(self):DescribeHanaBackupsAsyncRequest(RpcRequest):" ...
167
#!/usr/bin/python3 # # Bluetooth conenection agent (C) 2019 @kaymes # # 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. # # This program is distributed in the hope that it will b...
[ { "body": " print(\"ActivatePairMode called with %s\" % (timeout,))\n if timeout > 0:\n self.pair_mode_active_until = time.time() + timeout\n else:\n self.pair_mode_active_until = -float('inf')", "name": "ActivatePairMode(self,Agent(dbus.service.Object):" }, { ...
168
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ResourceOwnerId')", "name": "get_ResourceOwnerId(self):DescribeDisksFullStatusRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ResourceOwnerId', ResourceOwnerId)", "name": "set_ResourceOwnerId(self,DescribeDisksFullStatusRequest(Rpc...
169
# 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...
[ { "body": "\t\treturn self.get_body_params().get('MessageType')", "name": "get_MessageType(self):SendChatappMessageRequest(RpcRequest):" }, { "body": "\t\tself.add_body_params('MessageType', MessageType)", "name": "set_MessageType(self,SendChatappMessageRequest(RpcRequest):" }, { "body":...
170
# 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...
[ { "body": "\t\treturn self.get_body_params().get('Description')", "name": "get_Description(self):UpdateCdrsMonitorRequest(RpcRequest):" }, { "body": "\t\tself.add_body_params('Description', Description)", "name": "set_Description(self,Description):UpdateCdrsMonitorRequest(RpcRequest):" }, { ...
171
#!/usr/bin/env python import argparse import pathlib import re import requests import toml HERE = pathlib.Path(__file__).resolve().parent ROOT = HERE.parent FALCON_CREATOR = 'kgriffs' FALCON_REPOSITORY_API = 'https://api.github.com/repos/falconry/falcon' STABLE_RELEASE_TAG = r'^\d+\.\d+\.\d+(\.post\d+)?$' AUTHORS...
[ { "body": " page = 1\n uri = f'{FALCON_REPOSITORY_API}/commits'\n resp = requests.get(uri, headers=headers)\n resp.raise_for_status()\n while commits := resp.json():\n for commit in commits:\n if until and commit['sha'].startswith(until):\n return\n yie...
172
import os.path from unittest import TestCase from pcs import settings from pcs.common.reports import codes as report_codes from pcs.lib.commands import cluster from pcs_test.tools import fixture from pcs_test.tools.command_env import get_env_tools class SuccessMinimal(TestCase): def setUp(self): self.en...
[ { "body": " self.config.env.set_cib_data(\"<cib />\")\n self.env_assist.assert_raise_library_error(\n lambda: cluster.remove_nodes_from_cib(\n self.env_assist.get_env(),\n self.nodes,\n ),\n [\n fixture.error(\n ...
173
# 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...
[ { "body": "\t\treturn self.get_query_params().get('ClusterName')", "name": "get_ClusterName(self):DescribeImageListWithBaselineNameRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('ClusterName', ClusterName)", "name": "set_ClusterName(self,DescribeImageListWithBaselineNameRequest(Rpc...
174
# Copyright (c) 2015 - 2023, Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # import sys PYTHON_PATHS = [ "/usr/lib/python3.6/site-packages", "/usr/lib64/python3.6/site-packages"] for p in PYTHON_PATHS: if p not in sys.path: sys.path.insert(0, p) import os import json impor...
[ { "body": " try:\n for c in controls:\n c[\"setting\"] = pio.read_signal(c[\"name\"], c[\"domain_type\"],\n c[\"domain_idx\"])\n except RuntimeError as e:\n reject_event(f\"Unable to read signal {c['name']}: {e}\")", "name": "read_cont...
175
import time def _wait_and_get_responses(job_ids, batch_client): """Waits on all given jobs to terminate; returns the job descriptions.""" job_responses = {} for job in job_ids: terminated = False while not terminated: response = batch_client.describe_jobs(jobs=[job]) ...
[ { "body": " \"\"\"Waits on all given jobs to terminate; returns the job descriptions.\"\"\"\n job_responses = {}\n for job in job_ids:\n terminated = False\n while not terminated:\n response = batch_client.describe_jobs(jobs=[job])\n job_response = response[\"jobs\"]...
176
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) # # 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...
[ { "body": " expected_tags = prepare_for_role_model_test(entity_class, entity_identifier)\n # try to get tags for object\n error_text = pipe_tag_get(entity_class, entity_identifier, token=token)[1]\n assert_access_is_denied(entity_class, entity_identifier, error_text, expected_tags)\n access_is_de...
177
# 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...
[ { "body": "\t\treturn self.get_query_params().get('HealthCheckTimeout')", "name": "get_HealthCheckTimeout(self):CreateHealthCheckTemplateRequest(RpcRequest):" }, { "body": "\t\tself.add_query_param('HealthCheckTimeout', HealthCheckTimeout)", "name": "set_HealthCheckTimeout(self,CreateHealthCheck...
178
"""Collection of compose pipelines for segmentation task.""" # Copyright (C) 2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # from collections.abc import Sequence from copy import deepcopy import numpy as np from mmcv.utils import build_from_cfg from mmseg.datasets.builder import PIPELINES from scipy.n...
[ { "body": " assert isinstance(transforms, Sequence)\n assert isinstance(probs, Sequence)\n assert len(transforms) == len(probs)\n assert all(p >= 0.0 for p in probs)\n sum_probs = float(sum(probs))\n assert sum_probs > 0.0\n norm_probs = [float(p) / sum_probs for...
179
# coding=utf-8 # Copyright 2023 The TensorFlow Datasets 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 appl...
[ { "body": " \"\"\"Get the key of the section.\n The key is used to merge similar sections across builder configs. For\n instance, https://www.tensorflow.org/datasets/catalog/wiki40b only display\n once the `FeatureDict`, homepage,... as those sections are the same for\n all configs.\n Args:\n ...
180
# 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...
[ { "body": "\t\treturn self.get_body_params().get('Options')", "name": "get_Options(self):UpdateBackupPlanRequest(RpcRequest):" }, { "body": "\t\treturn self.get_query_params().get('SourceType')", "name": "get_SourceType(self):UpdateBackupPlanRequest(RpcRequest):" }, { "body": "\t\treturn...
181
from __future__ import annotations import logging import os from xia2.Decorators.DecoratorFactory import DecoratorFactory from xia2.Driver.DriverFactory import DriverFactory from xia2.Handlers.Phil import PhilIndex from xia2.lib.bits import transpose_loggraph from xia2.Wrappers.CCP4.Ctruncate import Ctruncate from xi...
[ { "body": " \"\"\"A factory for TruncateWrapper classes.\"\"\"\n if PhilIndex.params.ccp4.truncate.program == \"ctruncate\":\n return Ctruncate(DriverType)\n elif PhilIndex.params.ccp4.truncate.program == \"cctbx\":\n return FrenchWilson(DriverType)\n DriverInstance = DriverFactory.Dri...
182
#!/usr/bin/env python3 # Copyright (c) 2016-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Wallet encryption""" import time from test_framework.test_framework import BitcoinTestFramework ...
[ { "body": " self.setup_clean_chain = True\n self.num_nodes = 1", "name": "set_test_params(self):WalletEncryptionTest(BitcoinTestFramework):" }, { "body": " self.skip_if_no_wallet()", "name": "METHOD_NAME(self):WalletEncryptionTest(BitcoinTestFramework):" }, { "body":...
183
""" Author : Dhruv B Kakadiya """ import pygame as pg from .statics import * from .pieces import * # checker board creation class checker_board: def __init__(self): self.board = [] self.selected = None self.black_l = self.white_l = 12 self.black_k = self.white_k = 0 self.M...
[ { "body": " window.fill(green)\n for row in range(rows):\n for col in range(row % 2, cols, 2):\n pg.draw.rect(\n window, yellow, (row * sq_size, col * sq_size, sq_size, sq_size)\n )", "name": "draw_cubes(self,checker_board:" }, { ...
184
# GemRB - Infinity Engine Emulator # Copyright (C) 2003 The GemRB Project # # 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 versi...
[ { "body": "\tOpenEnemyWindow (1)", "name": "METHOD_NAME():" } ]
185
import unittest from decimal import Decimal from pathlib import Path from typing import Dict from unittest.mock import patch import yaml from hummingbot.client.config.config_helpers import ClientConfigAdapter from hummingbot.client.config.config_var import ConfigVar from hummingbot.client.settings import ConnectorSet...
[ { "body": " super().setUp()\n config_settings = self.get_default_map()\n get_exchange_names_mock.return_value = set(self.METHOD_NAME().keys())\n get_connector_settings_mock.return_value = self.METHOD_NAME()\n self.config_map = ClientConfigAdapter(HedgeConfigMap(**config_settin...
186
#!/usr/bin/env conda-execute # conda execute # env: # - python # - click # - jinja2 # - requests # - ruamel.yaml # - conda-smithy # - pygithub # - fuzzywuzzy # channels: # - conda-forge # run_with: python import click import conda_smithy.feedstocks as feedstocks import jinja2 import json import requests impo...
[ { "body": " \"\"\"Match package names in pr against existing feedstocks.\n Tools to match package names in from all the recipes in a pr against\n the existing conda-forge feedstocks.\n \"\"\"\n pass", "name": "cli():NullUndefined(jinja2.Undefined):" }, { "body": " \"Iterate over op...
187
import gradio as gr import numpy as np import os import sentencepiece as spm import time import ctranslate2 from onmt.utils.logging import init_logger from onmt.translate.translator import build_translator from onmt.inputters.text_utils import textbatch_to_tensor from onmt.inputters.inputter import IterOnDevice from ...
[ { "body": " parser = ArgumentParser(description=\"translate.py\")\n opts.config_opts(parser)\n opts.translate_opts(parser, dynamic=True)\n return parser", "name": "_get_parser():" }, { "body": " if CACHE.get(\"translator\", None) is None:\n ArgumentParser.validate_translate_opt...
188
# pylint: disable=redefined-outer-name # -*- coding: utf-8 -*- # # This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for # more information about the licensing of this file. import pytest import os import tempfile import shutil import copy from inginious.common.base import directory_compare_fr...
[ { "body": " \"\"\" Create a temporary folder \"\"\"\n dir_path = tempfile.mkdtemp()\n yield (dir_path)\n \"\"\" Some FUT could create content in the prefix \"\"\"\n shutil.rmtree(dir_path)", "name": "init_tmp_dir(request):TestJSONYAMLReaderWriter(object):" }, { "body": " tmp_di...
189
import pytest from conftest import SYSTEM_RELEASE_ENV from envparse import env def assign_packages(packages=None): # If nothing was passed down to packages, set it to an empty list if not packages: packages = [] ol_7_pkgs = ["oracle-release-el7", "usermode", "rhn-setup", "oracle-logos"] ol_8...
[ { "body": " \"\"\"\n Helper function.\n Install packages that cause trouble/needs to be checked during/after rollback.\n Some packages were removed during the conversion and were not backed up/installed back when the rollback occurred.\n \"\"\"\n packages_to_remove_at_cleanup = []\n for pac...
190
# -*- coding: utf-8 -*- from __future__ import division, absolute_import, print_function, unicode_literals ################################################################################################# import time from datetime import datetime from ..helper import LazyLogger #####################################...
[ { "body": " LOG.debug(\"Credentials initializing...\")", "name": "__init__(self):Credentials(object):" }, { "body": " self.credentials = credentials", "name": "set_credentials(self,Credentials(object):" }, { "body": " return self.get()", "name": "get_credentials(...
191
import pytest from api_tests.utils import UserRoles from osf_tests.factories import AuthUserFactory from osf_tests.factories import NodeFactory, CollectionFactory, CollectionProviderFactory from osf.migrations import update_provider_auth_groups from osf.models import CollectionSubmission from osf.utils.workflows impor...
[ { "body": " collection_provider = CollectionProviderFactory()\n update_provider_auth_groups()\n return collection_provider", "name": "collection_provider():" }, { "body": " METHOD_NAME = NodeFactory(is_public=True)\n METHOD_NAME.save()\n return METHOD_NAME", "name": "METHOD_NAM...
192
import sys import types import py from py.builtin import set, frozenset def test_enumerate(): l = [0,1,2] for i,x in enumerate(l): assert i == x def test_any(): assert not py.builtin.any([0,False, None]) assert py.builtin.any([0,False, None,1]) def test_all(): assert not py.builtin.all([T...
[ { "body": " assert issubclass(IndexError, py.builtin.BaseException)\n assert issubclass(Exception, py.builtin.BaseException)\n assert issubclass(KeyboardInterrupt, py.builtin.BaseException)\n class MyRandomClass(object):\n pass\n assert not issubclass(MyRandomClass, py.builtin.BaseExceptio...
193
from django.urls import reverse from .base import AuthenticatedAPITestCase from pydis_site.apps.api.models import DocumentationLink class UnauthedDocumentationLinkAPITests(AuthenticatedAPITestCase): def setUp(self): super().setUp() self.client.force_authenticate(user=None) def test_detail_lo...
[ { "body": " url = reverse('api:bot:documentationlink-detail', args=('whatever',))\n response = self.client.get(url)\n self.assertEqual(response.status_code, 401)", "name": "test_detail_lookup_returns_401(self):UnauthedDocumentationLinkAPITests(AuthenticatedAPITestCase):" }, { "b...
194
# 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...
[ { "body": "\t\treturn self.get_query_params().get('SubDomainDnsAddress')", "name": "get_SubDomainDnsAddresss(self):CreateADConnectorOfficeSiteRequest(RpcRequest):" }, { "body": "\t\treturn self.get_query_params().get('EnableInternetAccess')", "name": "get_EnableInternetAccess(self):CreateADConne...
195
from django.contrib.contenttypes.models import ContentType from django.utils.translation import gettext as _ from creme.creme_core.core.deletion import ( REPLACERS_MAP, FixedValueReplacer, SETReplacer, ) from creme.creme_core.models import ( FakeCivility, FakeContact, FakeDocument, FakeDocu...
[ { "body": " civ = FakeCivility.objects.create(title='Kun')\n model_field = FakeContact._meta.get_field('civility')\n replacer1 = FixedValueReplacer(model_field=model_field, value=civ)\n self.assertEqual(model_field, replacer1.model_field)\n self.assertEqual(civ, replacer1._fix...
196
import shutil import os import stat import bpy import arm.utils from arm import log if arm.is_reload(__name__): log = arm.reload_module(log) arm.utils = arm.reload_module(arm.utils) else: arm.enable_reload(__name__) assets = [] reserved_names = ['return.'] khafile_params = [] khafile_defs = [] khafile_def...
[ { "body": " global assets\n # Asset already exists, do nothing\n if asset_file in assets:\n return\n asset_file_base = os.path.basename(asset_file)\n for f in assets:\n f_file_base = os.path.basename(f)\n if f_file_base == asset_file_base:\n return\n assets.appe...
197
#!/usr/bin/env python3 # # Copyright (c) 2015 - 2023, Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # import os import sys import unittest import subprocess import io import json import geopmpy.agent import geopmdpy.topo from integration.test import geopm_test_launcher from integration.test import util...
[ { "body": " script_dir = os.path.dirname(os.path.realpath(__file__))\n cls._app_exec_path = os.path.join(script_dir, '.libs', 'test_enforce_policy')\n # note: if /etc/geopm/environment-*.json sets the same variables, this\n # test will not work.\n for env_file in ['/etc/geopm/...
198
"""Behavior (validation, encoding, and transformations) for vobjects.""" from .base import ( Component, ContentLine, NativeError, ValidateError, VObjectError, defaultSerialize, ) class Behavior: """Abstract class to describe vobject options, requirements and encodings. Behaviors are ...
[ { "body": " raise VObjectError(\"Behavior subclasses are not meant to be instantiated\")", "name": "__init__(self):if" }, { "body": " \"\"\"Check if the object satisfies this behavior's requirements.\n @param obj:\n The L{ContentLine<base.ContentLine>} or\n ...
199
# coding: utf-8 """ Lightly API Lightly.ai enables you to do self-supervised learning in an easy and intuitive way. The lightly.ai OpenAPI spec defines how one can interact with our REST API to unleash the full potential of lightly.ai # noqa: E501 The version of the OpenAPI document: 1.0.0 Contact: ...
[ { "body": " \"\"\"Returns the string representation of the model\"\"\"\n return pprint.pformat(self.dict(by_alias=by_alias))", "name": "to_str(self,Config:" }, { "body": " \"\"\"Returns the JSON representation of the model\"\"\"\n return json.dumps(self.to_dict(by_alias=b...