id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
15,600
test quantized add relu fusion
# Owner(s): ["oncall: quantization"] # torch import torch from torch.testing import FileCheck from torch.testing._internal.common_quantization import QuantizationTestCase class TestFusionPasses(QuantizationTestCase): def METHOD_NAME(self): class MAdd(torch.nn.Module): def forward(self, x, y): ...
15,601
check enable terms and conditions
import logging from decimal import Decimal from constance import config from rest_framework.authentication import SessionAuthentication from rest_framework.permissions import IsAdminUser from rest_framework.response import Response from rest_framework.views import APIView from rest_framework import status from django...
15,602
create sockets
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import errno import os import socket import ssl import stat import sys import time from gunicorn import util class BaseSocket(object): def __init__(self, address, conf, log, fd=None): ...
15,603
downgrade
# encoding: utf-8 """Remove activity.revision_id Revision ID: d4d9be9189fe Revises: 01afcadbd8c0 Create Date: 2019-11-01 16:33:28.320542 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = u'd4d9be9189fe' down_revision = u'01afcadbd8c0' branch_labels = None depends...
15,604
load pool
# coding=utf-8 import re import sys STATES = { 0: 'EMPTY', 1: 'PLANNING', 2: 'QUEUED', 3: 'PENDING', 4: 'RUNNING' } TUMBLER = ['size', 'r', 'w', 'p', 'c'] def METHOD_NAME(filename): tumbler_pos = 0 current_buffer = 0 with open(filename) as mb: lines = mb.readlines() pool ...
15,605
get private endpoint connection by name
# coding=utf-8 # *** WARNING: this file was generated by pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities from . im...
15,606
inner
from __future__ import annotations # The Tutor plugin system is licensed under the terms of the Apache 2.0 license. __license__ = "Apache 2.0" import sys import typing as t from weakref import WeakSet from typing_extensions import ParamSpec from . import priorities from .contexts import Contextualized #: Action ge...
15,607
test store lookup cert
import abc import hashlib from ct.proto import certificate_pb2 def name_attribute(name): att = certificate_pb2.DNAttribute() att.type, att.value = "CN", name return att SAMPLE_CERT = certificate_pb2.X509Description() SAMPLE_CERT.der = "hello\x00" SAMPLE_CERT.subject.extend([name_attribute("com.example")])...
15,608
access cfg
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
15,609
test union array
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE import numpy as np import pytest # noqa: F401 import awkward as ak def test_ListOffsetArray(): v2_array = ak.highlevel.Array( [[0.0, 1.1, 2.2, 3.3], [], [4.4, 5.5, 6.6], [7.7], [8.8, 9.9, 10.0, 11.1, 12.2]] ).la...
15,610
get
from rest_framework import status from rest_framework.exceptions import ParseError from rest_framework.permissions import IsAuthenticated from rest_framework.request import Request from rest_framework.response import Response from sentry import features from sentry.api.api_publish_status import ApiPublishStatus from s...
15,611
create mesh
# -*- coding: utf-8 -*- # vispy: testskip # ----------------------------------------------------------------------------- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # -------------------------------------------------------------...
15,612
get api details
import shutil import pytest import time import os import yaml from wazuh_testing import logger from wazuh_testing.tools import LOG_FILE_PATH, CLIENT_KEYS_PATH, API_LOG_FILE_PATH from wazuh_testing.wazuh_db import insert_agent_in_db, clean_agents_from_db from wazuh_testing.tools.file import truncate_file from wazuh_tes...
15,613
get
# coding=utf-8 # Copyright (c) 2001-2022, Hove and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Hove (www.hove.com). # Help us simplify mobility and open pu...
15,614
test ignore topology frame
import pytest import sire as sr def assert_space_equal(box0, box1, precision): dims0 = box0.dimensions() dims1 = box1.dimensions() assert dims0.x().value() == pytest.approx(dims1.x().value(), precision) assert dims0.y().value() == pytest.approx(dims1.y().value(), precision) assert dims0.z().valu...
15,615
build s2s conformer encoder
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from pathlib import Path import torch from fairseq import checkpoint_utils from fairseq.models import register_model, registe...
15,616
get signature key
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Important The AWS SDKs sign API requests for you using the access key that you specify when you configure the SDK. When you use an SDK, you don’t need to learn how to sign API requests. We recommend that you...
15,617
test delete file
import logging import sys import pytest from porcupine.plugins.directory_tree import get_directory_tree, get_path from porcupine.plugins.filemanager import FilenameMode def add_project_and_select_file(file_path, project=None) -> None: tree = get_directory_tree() tree.add_project(project or file_path.parent)...
15,618
get endpoint
# 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...
15,619
parse
"""An object-oriented interface to .netrc files.""" # Module and documentation by Eric S. Raymond, 21 Dec 1998 import os, shlex, stat __all__ = ["netrc", "NetrcParseError"] class NetrcParseError(Exception): """Exception raised on syntax errors in the .netrc file.""" def __init__(self, msg, filename=None, l...
15,620
remove node connection
from __future__ import annotations from pathlib import Path from typing import Any, Dict, Optional from chia.cmds.cmds_util import NODE_TYPES, get_any_service_client from chia.rpc.rpc_client import RpcClient async def add_node_connection(rpc_client: RpcClient, add_connection: str) -> None: if ":" not in add_con...
15,621
do read default gw
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
15,622
handle
import argparse from django.core.management import call_command from django.core.management.base import BaseCommand HELP_TEXT = """ Performs Nautobot common server upgrade operations using a single entrypoint. This will run the following management commands with default settings, in order: - migrate - trace_paths ...
15,623
geti2cword i2ctool
####################################################### # # osutil.py # Python implementation of the Class osutil # Original author: sonic_rd@ruijie.com.cn # ####################################################### import time import glob import re #import chardet from rjutil.smbus import SMBus import time from functo...
15,624
get test config dir
import os from homeassistant import config_entries from homeassistant.components import input_boolean, input_number, light from homeassistant.components.light import ColorMode from homeassistant.const import ( CONF_ENTITY_ID, CONF_NAME, CONF_PLATFORM, CONF_UNIQUE_ID, STATE_ON, ) from homeassistant....
15,625
test interface on soft timeout
import importlib import os import sys from itertools import count from unittest.mock import Mock, patch import pytest from celery import concurrency from celery.concurrency.base import BasePool, apply_target from celery.exceptions import WorkerShutdown, WorkerTerminate class test_BasePool: def test_apply_targe...
15,626
test observe writes
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Test cases for L{twisted.logger._file}. """ from io import StringIO from types import TracebackType from typing import IO, Any, AnyStr, Optional, Type, cast from zope.interface.exceptions import BrokenMethodImplementation from zope.interface...
15,627
fetch soc
#!/usr/bin/env python3 import logging from typing import Union from modules.vehicles.vwid import libvwid import aiohttp import asyncio import time from datetime import datetime import json from modules.common.store import RAMDISK_PATH from modules.vehicles.vwid.config import VWId from modules.vehicles.vwid.socutils im...
15,628
test pressure
import logging import unittest import numpy as np try: import matplotlib except ImportError: matplotlib = None from simsopt.mhd import (ProfilePolynomial, ProfileScaled, ProfileSpline, ProfilePressure, ProfileSpec) logger = logging.getLogger(__name__) # logging.basicConfig(level=log...
15,629
mult const to ptxt
#!/usr/bin/env python3 # Copyright (C) 2020 IBM Corp. # This program is 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 applic...
15,630
get hash from name
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Supports mercurial repositories for the benchmarked project. """ import os import sys import re try: import hglib except ImportError: hglib = None from ..console import log from ..repo import Repo, NoSuchNameError from .. import util clas...
15,631
decorator
from functools import partial, wraps from ipaddress import IPv4Address from logging import getLogger from time import time from typing import Callable, Tuple, Type from common.agent_events import ExploitationEvent, PropagationEvent from common.event_queue import IAgentEventPublisher from common.tags.attack import ( ...
15,632
get area definition
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2019 Satpy developers # # This file is part of satpy. # # satpy is free software: you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or...
15,633
validate dimensions
from pathlib import Path from django.core.exceptions import ValidationError from django.utils.translation import pgettext from PIL import Image from . import store from ...conf import settings ALLOWED_EXTENSIONS = (".gif", ".png", ".jpg", ".jpeg") ALLOWED_MIME_TYPES = ("image/gif", "image/jpeg", "image/png", "image/...
15,634
test single field
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. """ Unit tests for the class :class:`iris.fileformats.um._fast_load_structured_fields.BasicFieldCollation`. """ # import iris...
15,635
roles
# coding=utf-8 # *** WARNING: this file was generated by pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities from . im...
15,636
test complex geometry
try: from . import common as c except BaseException: import common as c class VolumeIntegrationTest(c.unittest.TestCase): def test_volume_integration_1D(self): """ Test volume integration for splines using numerical integration of the Jacobi-Determinant """ # Test 1...
15,637
addons
import asyncio import importlib.machinery import importlib.util import logging import os import sys import types from collections.abc import Sequence import mitmproxy.types as mtypes from mitmproxy import addonmanager from mitmproxy import command from mitmproxy import ctx from mitmproxy import eventsequence from mitm...
15,638
raise for transaction exists
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from frappe import _ from frappe.model.document import Document pricing_rule_fields = [ "apply_on", "mixed_conditions", "is_cumulative", "other_item_code", "other_item_group", "a...
15,639
is file empty
import logging import tempfile from gzip import GzipFile from io import BytesIO import backoff from django.conf import settings from django.core.files import File from django.core.files.storage import Storage from google.cloud.exceptions import InternalServerError from google.cloud.storage import Client from google.cl...
15,640
deteriorate
# -*- coding: utf-8 -*- """Deterioration algorithm.""" import logging import math from itertools import zip_longest from typing import List, Union import click import more_click import torch from pykeen.triples import TriplesFactory from pykeen.typing import TorchRandomHint from pykeen.utils import ensure_torch_ran...
15,641
name
# 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...
15,642
get accelerator output
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
15,643
clamp
# Taken from https://gist.github.com/kevinastone/a6a62db57577b3f24e8a6865ed311463 # Context: https://github.com/encode/starlette/pull/1090 from __future__ import annotations import os import re import stat from typing import NamedTuple from urllib.parse import quote import aiofiles from aiofiles.os import stat as aio...
15,644
get client ipaddr
""" Rate limiter and quota system. Framework-independent rate limiting mechanism that provides: * IP address and token-based accounting * customizable quotas based on IP address and token * late limiting based on resource usage (time spent on API calls) * bucketing based on day, week, month * stati...
15,645
parent indices
# This file is part of the pyMOR project (https://www.pymor.org). # Copyright pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause) import weakref import numpy as np from pymor.discretizers.builtin.grids.boundaryinfos import GenericBoun...
15,646
molar heat capacity v
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for # the Earth and Planetary Sciences # Copyright (C) 2012 - 2021 by the BurnMan team, released under the GNU # GPL v2 or later. from . import equation_of_state as eos import warnings import numpy as np def volume(pressure, V_0, K_0, Kprime_...
15,647
get charts
# Copyright 2021 Collate # 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...
15,648
cli main
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from contextlib import redirect_stdout from fairseq import options from fairseq_cli import generate from examples.noisychannel imp...
15,649
patch namespaced cron job
#!/usr/bin/python3 # -*- coding:utf-8 -*- import json import time from kubernetes import client, config config.load_kube_config() def create_namespaced_cron_job(namespace='default', body=None): cronjob_json = body if body is None: print('body is required!') exit(0) name = body['metadata...
15,650
log entry
""" Start the service in testsuite. """ import logging import pathlib import sys import traceback import typing import pytest from testsuite.logging import logger from testsuite.utils import url_util from ..utils import colorize from ..utils import net logger_testsuite = logging.getLogger(__name__) class ColorL...
15,651
privilege check
from testflows.core import * from testflows.asserts import error from rbac.requirements import * from rbac.helper.common import * import rbac.helper.errors as errors aliases = {"ALTER FREEZE PARTITION", "FREEZE PARTITION", "ALL"} @TestSuite def privilege_granted_directly_or_via_role(self, table_type, privilege, node...
15,652
measure
#!/usr/bin/env python # Copyright 2008-2010 Isaac Gouy # Copyright (c) 2013, 2014, Regents of the University of California # Copyright (c) 2017, 2021, Oracle and/or its affiliates. # All rights reserved. # # Revised BSD license # # This is a specific instance of the Open Source Initiative (OSI) BSD license # template h...
15,653
process
""" Requires: CollectPublishedFiles CollectModules Provides: workfilePath - Path to tvpaint workfile sceneData - Scene data loaded from the workfile groupsData - layersData layersExposureFrames layersPrePostBehavior """ import os import uuid import json import shutil import pyblish.api ...
15,654
add session
# Copyright (c) 2015 aggftw@gmail.com # Distributed under the terms of the Modified BSD License. import sparkmagic.utils.configuration as conf import sparkmagic.utils.constants as constants from sparkmagic.utils.sparklogger import SparkLog from .sessionmanager import SessionManager from .livyreliablehttpclient import ...
15,655
reload dps module
#!/usr/bin/env python ######################################################################## # DellEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the PSUs' information which are available in the platform # #################################################################...
15,656
tear down module
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
15,657
id
# coding=utf-8 # *** WARNING: this file was generated by pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities from . im...
15,658
get random nd index
import numpy as np def compute_patch_indices(image_shape, patch_size, overlap, start=None): if isinstance(overlap, int): overlap = np.asarray([overlap] * len(image_shape)) if start is None: n_patches = np.ceil(image_shape / (patch_size - overlap)) overflow = (patch_size - overlap) * n_...
15,659
mavlink packet
#!/usr/bin/env python '''RC min/max setup''' from MAVProxy.modules.lib import mp_module class RCSetupModule(mp_module.MPModule): def __init__(self, mpstate): super(RCSetupModule, self).__init__(mpstate, "rcsetup") self.calibrating = False self.num_channels = 4 self.clear_rc_cal() ...
15,660
render mc3
import abc from _typeshed import Incomplete from typing import Any, ClassVar from typing_extensions import Self from passlib.ifc import PasswordHash from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS H64_CHARS = HASH64_CHARS B64_CHARS = BASE64_CHARS PADD...
15,661
test ctype tolower loc
# pylint: disable=missing-class-docstring,disable=no-self-use import os import angr import subprocess import unittest from common import skip_if_not_linux import logging l = logging.getLogger("angr.tests.test_ctype_locale") test_location = os.path.dirname(os.path.abspath(__file__)) class TestCtypeLocale(unittest....
15,662
convert check
#!/usr/bin/env python # -*- coding: utf-8 -*- # # 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 # # Un...
15,663
get from cache
#!/usr/bin/env python3 import functools import pickle from .errors import CachingError def cached(method=None, name=None, ignore_args=False): """A decorator allowing for specifying the name of a cache, allowing it to be modified elsewhere.""" if ignore_args: return _cached_ignore_args(method=method,...
15,664
test exists
"""Tests for ``rasterio.shutil```.""" import os import numpy import pytest import rasterio import rasterio.shutil from rasterio._err import CPLE_NotSupportedError from rasterio.errors import DriverRegistrationError, RasterioIOError @pytest.mark.parametrize("driver, extension", [ (None, "tif"), ("GTiff", '...
15,665
apply
# # The Python Imaging Library # $Id$ # # a simple math add-on for the Python Imaging Library # # History: # 1999-02-15 fl Original PIL Plus release # 2005-05-05 fl Simplified and cleaned up for PIL 1.1.6 # 2005-09-12 fl Fixed int() and float() for Python 2.4.1 # # Copyright (c) 1999-2005 by Secret Labs AB # Copy...
15,666
test normal2
import math import unittest import numpy import pytest from cupy._core import internal from cupy import testing class TestProd(unittest.TestCase): def test_empty(self): assert internal.prod([]) == 1 def test_one(self): assert internal.prod([2]) == 2 def test_two(self): assert ...
15,667
wkt
# The Hazard Library # Copyright (C) 2012-2023 GEM Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. #...
15,668
on mouse move
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # ----------------------------------------------------------------------------- #...
15,669
check args
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Author: Jeremy Maurer, Raymond Hogenson & David Bekaert # Copyright 2019, by the California Institute of Technology. ALL RIGHTS # RESERVED. United States Government Sponsorship acknowledged. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
15,670
load calibration
import hal import os import subprocess import threading import time from qtvcp.core import Action, Path ACTION = Action() PATH = Path() # path to TCL for external programs eg. halshow try: TCLPATH = os.environ['LINUXCNC_TCL_DIR'] INIPATH = os.environ.get('INI_FILE_NAME', '/dev/null') except: pass class ...
15,671
test login
# coding=utf-8 from unittest import TestCase from mock import patch, MagicMock from requests import Response from monitorrent.plugins.trackers import TrackerSettings, CloudflareChallengeSolverSettings from monitorrent.plugins.trackers.tapochek import TapochekNetTracker, TapochekLoginFailedException from tests import ...
15,672
increment total checks
"""Validation output reports.""" import sys from typing import List from ..logger import get_structured_logger from .errors import ValidationFailure class ValidationReport: """Class for reporting the results of validation.""" # pylint: disable=R0902 def __init__(self, errors_to_suppress: List[ValidationFa...
15,673
test scalar convert double
# coding: utf-8 import pytest import rpy2.rinterface as rinterface import rpy2.rlike.container as rlc rinterface.initr() def _noconsole(x): pass @pytest.fixture(scope='module') def silent_consolewrite(): module = rinterface.callbacks name = 'consolewrite_print' backup_func = getattr(module, name) ...
15,674
load
import numpy as np from aesara.graph.basic import Apply, Constant, Variable from aesara.graph.op import Op from aesara.graph.sched import key_to_cmp from aesara.link.c.type import Generic from aesara.tensor.type import tensor class LoadFromDisk(Op): """ An operation to load an array from disk. See Also ...
15,675
execute
# Copyright (C) 2020 Kelly McDonald, 2023 Sartography # # This file is part of SpiffWorkflow. # # SpiffWorkflow is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 3.0 of the License, or (a...
15,676
test matrix mixture remap keys
# pylint: disable=wrong-or-nonexistent-copyright-notice import cirq import numpy as np import pytest def test_matrix_mixture_from_mixture(): q0 = cirq.LineQubit(0) dp = cirq.depolarize(0.1) mm = cirq.MixedUnitaryChannel.from_mixture(dp, key='dp') assert cirq.measurement_key_name(mm) == 'dp' cirq.t...
15,677
create pyrcc task
#!/usr/bin/env python # encoding: utf-8 # Federico Pellegrin, 2016-2018 (fedepell) adapted for Python """ This tool helps with finding Python Qt5 tools and libraries, and provides translation from QT5 files to Python code. The following snippet illustrates the tool usage:: def options(opt): opt.load('py pyqt5') ...
15,678
clean geom
from django.utils.translation import gettext_lazy as _ from django import forms from django.forms.models import inlineformset_factory from crispy_forms.helper import FormHelper from crispy_forms.layout import Div, Fieldset, Layout from geotrek.common.forms import CommonForm from geotrek.core.widgets import LineTopolo...
15,679
get prefix by xml filename
import os import logging import re import shutil import tempfile from zipfile import ZipFile, ZIP_DEFLATED logger = logging.getLogger(__name__) def is_folder(source): return os.path.isdir(source) def is_zipfile(source): return os.path.isfile(source) and source.endswith(".zip") def xml_files_list(path):...
15,680
prepare
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (c) 2017-2018, Niklas Hauser # Copyright (c) 2019, Raphael Lehmann # # This file is part of the modm project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file,...
15,681
resolve for read
# The MIT License (MIT) # Copyright (c) 2014 Microsoft Corporation # 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 use, cop...
15,682
sample generator creator
# 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 applic...
15,683
break anywhere
import sys from _typeshed import ExcInfo, TraceFunction from collections.abc import Callable, Iterable, Mapping from types import CodeType, FrameType, TracebackType from typing import IO, Any, SupportsInt, TypeVar from typing_extensions import Literal, ParamSpec __all__ = ["BdbQuit", "Bdb", "Breakpoint"] _T = TypeVar...
15,684
transform sku for table output
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
15,685
register
"""Interface to overide kotsu code for sktime use.""" import re import warnings from typing import Callable, Optional, Union from sktime.utils.validation._dependencies import _check_soft_dependencies def _check_id_format(id_format: str, id: str) -> None: """Check if given input ID follows regex specified in id_...
15,686
on capabilities
# # This file is part of the PyRDP project. # Copyright (C) 2020-2021 GoSecure Inc. # Licensed under the GPLv3 or later. # from pyrdp.enum import CapabilityType from pyrdp.pdu import PlayerPDU from pyrdp.player.ImageHandler import ImageHandler from pyrdp.player.RenderingEventHandler import RenderingEventHandler impor...
15,687
test sct label vertebrae initz error
# pytest unit tests for sct_label_vertebrae import os import logging import pytest from spinalcordtoolbox.image import Image, compute_dice from spinalcordtoolbox.labels import check_missing_label from spinalcordtoolbox.utils import sct_test_path import spinalcordtoolbox.scripts.sct_label_vertebrae as sct_label_verte...
15,688
resource apply sparse duplicate indices
""" Copyright (c) 2021, NVIDIA CORPORATION. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
15,689
test example
#!/usr/bin/python import argparse import nidcpower import sys def example( resource_name, options, lcr_frequency, lcr_impedance_range, cable_length, lcr_voltage_rms, lcr_dc_bias_source, lcr_dc_bias_voltage_level, lcr_measurement_time, lcr_custom_measurement_time, lcr_sourc...
15,690
split up
"""Module for parsing and testing package version predicate strings. """ import re import distutils.version import operator re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)") # (package) (rest) re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses re_splitComparison = re.com...
15,691
test run task commit not found
from datetime import datetime import pytest import responses from cumulusci.core.config import OrgConfig, ServiceConfig, TaskConfig from cumulusci.core.exceptions import DependencyLookupError from cumulusci.tasks.github.commit_status import GetPackageDataFromCommitStatus from cumulusci.tasks.github.tests.util_github_...
15,692
main
#!/usr/bin/env python3 """ Helper script to perform two-way sync of a specific json file to a k8s secret object. traefik expects a JSON file (acme.json) to persist across time, to make sure Let's Encrypt certificates work. In kubernetes, pod restarts clear out the filesystem, making this hard. We could add a persisten...
15,693
message data
# -*- coding: utf-8 -*- # from __future__ import unicode_literals from django.core.cache import cache from django.shortcuts import redirect, reverse from django.utils.translation import gettext as _ from django.views.generic.base import TemplateView from common.utils import get_logger, FlashMessageUtil from orgs.uti...
15,694
add failure
"""Test result object""" import os import sys import traceback from StringIO import StringIO from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() retur...
15,695
get by ids
from chalicelib.core.integration_base_issue import BaseIntegrationIssue from chalicelib.utils import github_client_v3 from chalicelib.utils.github_client_v3 import github_formatters as formatter class GithubIntegrationIssue(BaseIntegrationIssue): def __init__(self, integration_token): self.__client = gith...
15,696
get selection state
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in LICENSE.txt and may be redistributed only under # the conditions described in the aforementioned license. The license # is also available online at...
15,697
get name
from django.contrib.auth import get_user_model from rest_framework.fields import DateTimeField from rest_framework.serializers import ModelSerializer, SerializerMethodField, CharField, IntegerField, Serializer from api.fields import NamedBase64ImageField from profiles.models import GithubUserInfo, Organization, Member...
15,698
with characteristic
"""Mapping a polymorphic-valued vertical table as a dictionary. Builds upon the dictlike.py example to also add differently typed columns to the "fact" table, e.g.:: Table('properties', metadata Column('owner_id', Integer, ForeignKey('owner.id'), primary_key=True), Column('key', Unico...
15,699
save reference rays philinear
""" Unit Tests for Py-ART's correct/attenuation.py module. """ # python test_phase_attenuation.py # to recreate the reference_rays.npz file. import os import numpy as np from numpy.testing import assert_allclose import pyart PATH = os.path.dirname(__file__) REFERENCE_RAYS_FILE = os.path.join(PATH, "attenuation_ray...