id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
17,000
validate mx curp
""" Clean and validate a DataFrame column containing Mexican personal identifiers (CURPs). """ # pylint: disable=too-many-lines, too-many-arguments, too-many-branches from typing import Any, Union from operator import itemgetter import dask.dataframe as dd import numpy as np import pandas as pd from stdnum.mx import ...
17,001
get image processor
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
17,002
system eeprom info
#!/usr/bin/env python ############################################################################# # DellEmc Z9264F # # Platform and model specific eeprom subclass, inherits from the base class, # and provides the followings: # - the eeprom format definition # - specific encoder/decoder if there is special need #####...
17,003
test delete not found fail
# 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 # distributed under t...
17,004
process caa
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
17,005
add1 mutable
# -*- coding: utf-8 -*- """ Performance Test for Clone Protocol see :class:`sage.structure.list_clone.ClonableArray` EXAMPLES:: sage: from sage.structure.list_clone_timings import * sage: cmd =["", ....: "e.__copy__()", ....: "copy(e)", ....: "e.clone()", ....: "e.__class__(e....
17,006
test putting non equivalent queries into cache
import unittest.mock import pytest from szurubooru import search from szurubooru.func import cache def test_retrieving_from_cache(): config = unittest.mock.MagicMock() with unittest.mock.patch("szurubooru.func.cache.has"), unittest.mock.patch( "szurubooru.func.cache.get" ): cache.has.sid...
17,007
expanduser
"""Pathname and path-related operations for the Macintosh.""" import os from stat import * import genericpath from genericpath import * __all__ = ["normcase","isabs","join","splitdrive","split","splitext", "basename","dirname","commonprefix","getsize","getmtime", "getatime","getctime", "islink",...
17,008
generate key
def METHOD_NAME(length): key = "0x" key = key + (length//8) * "0b" return key def configure_ipsec_esp_aead(m1, ip1, m2, ip2, algo, algo_key, icv_len, ipsec_mode, spi_vals): for m, in1, in2, in [(m1, ip2, ip1), (m2, ip1, ip2)]: m.run("ip xfrm policy flush") ...
17,009
test request missing upgrade
import contextlib import unittest from websockets.datastructures import Headers from websockets.exceptions import ( InvalidHandshake, InvalidHeader, InvalidHeaderValue, InvalidUpgrade, ) from websockets.legacy.handshake import * from websockets.utils import accept_key class HandshakeTests(unittest.Te...
17,010
test to cfn resource name properties
import os import re import mock import sys import click import pytest from six import StringIO from hypothesis.strategies import text from hypothesis import given import string from dateutil import tz from datetime import datetime from chalice import utils class TestUI(object): def setup(self): self.out...
17,011
add remaining beetmover config
# 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, You can obtain one at http://mozilla.org/MPL/2.0/. import posixpath from copy import deepcopy from taskgraph.transforms.base import TransformSequence from taskgraph.util....
17,012
sample
import os import threading import time from enum import Enum from typing import List import torch from colossalai.gemini.ophooks import BaseOpHook from colossalai.gemini.stateful_tensor import StatefulTensor from colossalai.legacy.engine import Engine from colossalai.utils.profiler.extention import ProfilerExtension ...
17,013
scale size
''' Cover Behavior ============== The :class:`~kivy.uix.behaviors.cover.CoverBehavior` `mixin <https://en.wikipedia.org/wiki/Mixin>`_ is intended for rendering textures to full widget size keeping the aspect ratio of the original texture. Use cases are i.e. rendering full size background images or video content in a ...
17,014
test it returns 400 if authority param
import base64 import pytest from h.models.auth_client import GrantType class TestReadUser: def test_it_returns_http_404_if_auth_client_missing(self, app, user): url = f"/api/users/{user.userid}" res = app.get(url, expect_errors=True) assert res.status_code == 404 def test_it_retur...
17,015
filter user group related
# -*- coding: utf-8 -*- # from django.db.models import Q from django.shortcuts import get_object_or_404 from rest_framework.generics import ListAPIView from assets.models import Asset from common.utils import get_logger from orgs.mixins import generics from perms.filters import AssetPermissionFilter from perms.models ...
17,016
run main
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
17,017
setup parser
# SPDX-License-Identifier: Apache-2.0 # Copyright Contributors to the Rez Project ''' Print information about the current rez context, or a given context file. ''' from __future__ import print_function # Disable the following: # - context tracking # - package caching # # Use of rez-context is't really 'using' the co...
17,018
test set thumbnail setting
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Tests for vimiv.config.settings.""" import pytest from vimiv.api import settings @pytest.fixture() def prompt_setting(): """Fixture to retrieve a clean prompt setting.""" yield settings.PromptSetting( "prompt", settings.PromptSetting.Opti...
17,019
parse args
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
17,020
squeezenet
""" Copyright 2020 The OneFlow 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 applicable law or agr...
17,021
custom updates
#!/usr/bin/env python # This program is dedicated to the public domain under the CC0 license. # pylint: disable=import-error,unused-argument """ Simple example of a bot that uses a custom webhook setup and handles custom updates. For the custom webhook setup, the libraries `Django` and `uvicorn` are used. Please instal...
17,022
set widgets
import wx from meerk40t.gui.choicepropertypanel import ChoicePropertyPanel from meerk40t.gui.wxutils import ScrolledPanel from ...core.units import Length from ..balor_params import Parameters _ = wx.GetTranslation class BalorOperationPanel(ScrolledPanel): name = "Balor" def __init__(self, *args, context=...
17,023
plugin preferences
# Copyright 2018 Phidica Veia # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. import os import sqlite3 from gi.repos...
17,024
alarm disarm
"""Support alarm_control_panel entity for Xiaomi Miot.""" import logging from homeassistant.const import * # noqa: F401 from homeassistant.components.alarm_control_panel.const import * from homeassistant.components.alarm_control_panel import ( DOMAIN as ENTITY_DOMAIN, AlarmControlPanelEntity, AlarmControl...
17,025
to expr
"""Implementation of :class:`FiniteField` class.""" from __future__ import annotations import numbers import random from ..core import Dummy, integer_digits from ..ntheory import factorint, is_primitive_root, isprime from ..polys.polyerrors import CoercionFailedError from .field import Field from .groundtypes import...
17,026
build url
import binascii import codecs import csv import datetime import decimal import hashlib import io import os import random import re import uuid import pystache import pytz import simplejson import sqlparse from flask import current_app from funcy import select_values from sqlalchemy.orm.query import Query from redash ...
17,027
create show nfo
# -*- coding: utf-8 -*- """ Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix) Copyright (C) 2019 Smeulf (original implementation module) Functions for Kodi library NFO creation SPDX-License-Identifier: MIT See LICENSES/MIT.md for more information. """ import xml.etree.ElementTree as ET fr...
17,028
state
""" A module to show the currently active network connection (ethernet or wifi) and connection strength if the connection is wireless. Requires the Python netifaces package and iw installed on Linux. A simpler take on nic and network_traffic. No extra config necessary! """ import util.cli import util.format impor...
17,029
get handle
# Copyright 2017 The Forseti Security 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 ap...
17,030
get next
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
17,031
get system info
# 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, You can obtain one at http://mozilla.org/MPL/2.0/. """ This file contains functions used for telemetry. """ import math import os import platform import sys import distr...
17,032
restore prefs
# (C) Copyright 2004-2023 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...
17,033
initialize variational distribution
#!/usr/bin/env python3 import abc import torch from linear_operator.operators import CholLinearOperator, TriangularLinearOperator from linear_operator.utils.cholesky import psd_safe_cholesky from ..distributions import MultivariateNormal from ._variational_distribution import _VariationalDistribution class _Natura...
17,034
test cicular verification
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase import numpy as np from mmpose.codecs import SPR from mmpose.registry import KEYPOINT_CODECS from mmpose.testing import get_coco_sample from mmpose.utils.tensor_utils import to_numpy, to_tensor class TestSPR(TestCase): def setUp(self...
17,035
find packages
import logging import ckan.plugins.toolkit as tk log = logging.getLogger(__name__) get_action = tk.get_action class TagRecommender(object): FACET_LIMIT = 10 def __init__(self, title, organization, extra_fq=None, with_retry=True, facet_limit=FACET_LIMIT): super(TagRecommender, self).__init__() ...
17,036
reshape
# Copyright 2019 Intel Corporation. import enum import logging import six import plaidml.edsl as edsl from plaidml.ffi import ffi, ffi_call, lib logger = logging.getLogger(__name__) class AutoDimMode(enum.IntEnum): MATCH = 0 FILL = -1 class AutoGroupMode(enum.IntEnum): UNGROUPED = 0 # Group size ex...
17,037
naemon is running
from behave import given, when, then, use_step_matcher import subprocess import os import os.path import signal import time from support import slurp_file use_step_matcher('re') @given('I have naemon (?P<object_type>.+) objects') def add_naemon_object(context, object_type): print("Object type %s" % object_type)...
17,038
to dict
from typing import Dict, List, Any, Optional from haystack.preview import component, Document, default_to_dict, default_from_dict, DeserializationError from haystack.preview.document_stores import MemoryDocumentStore, document_store @component class MemoryRetriever: """ A component for retrieving documents f...
17,039
unknown endtag
#!/usr/bin/env python import sgmllib, string import re whitespace_re = re.compile("\s+") def normalise_space(s): """Normalise space in the same manner as HTML. Any substring of multiple whitespace characters will be replaced with a single space char. """ return whitespace_re.sub(" ", str(s)) ...
17,040
consumer date of birth
from .base import ObjectBase class Order(ObjectBase): def __init__(self, data, client): super().__init__(data, client) @classmethod def get_resource_class(cls, client): from ..resources import Orders return Orders(client) STATUS_CREATED = "created" STATUS_PAID = "paid" ...
17,041
add number
#!/usr/bin/env python3 import os from shoebot.core.backend import gi from gi.repository import Gtk from shoebot.core.events import VARIABLE_CHANGED_EVENT, publish_event from shoebot.core.var_listener import VarListener from pkg_resources import resource_filename, Requirement ICON_FILE = resource_filename( Require...
17,042
get queryset
import uuid from django.conf import settings from django.db import models from django.urls import reverse from olympia import activity, amo from olympia.addons.models import Addon from olympia.amo.fields import PositiveAutoField from olympia.amo.models import ManagerBase, ModelBase from olympia.translations.fields im...
17,043
to lon 360
# The MIT License (MIT) # Copyright (c) 2021 by the xcube development team and contributors # # 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...
17,044
test tiles by partition
import numpy as np from libertem.udf import UDF from libertem.io.dataset.memory import MemoryDataSet from utils import _mk_random class SimpleTestByPartitionUDF(UDF): def get_result_buffers(self): return { 'test': self.buffer( kind="nav", dtype="float32" ) ...
17,045
get template extremum channel peak shift
import numpy as np import warnings from .sparsity import compute_sparsity, _sparsity_doc from .recording_tools import get_channel_distances, get_noise_levels def get_template_amplitudes(waveform_extractor, peak_sign: str = "neg", mode: str = "extremum"): """ Get amplitude per channel for each unit. Para...
17,046
patch logging
# pylint: disable=redefined-outer-name # pylint: disable=unused-argument import asyncio import logging import pickle import socket import threading from collections import deque from logging.handlers import DEFAULT_UDP_LOGGING_PORT, DatagramHandler from pathlib import Path from typing import AsyncIterator, Final, Ite...
17,047
test flags
import pytest from qtpy.QtCore import QModelIndex, Qt from napari._qt.containers import QtNodeTreeModel, QtNodeTreeView from napari._qt.containers._base_item_view import index_of from napari.utils.events._tests.test_evented_list import NESTED_POS_INDICES from napari.utils.tree import Group, Node @pytest.fixture def ...
17,048
set up
from tracardi.service.plugin.domain.register import Plugin, Spec, MetaData, Documentation, PortDoc, Form, FormGroup, \ FormField, FormComponent from tracardi.service.plugin.runner import ActionRunner from pydantic import validator from typing import Dict, Any from tracardi.service.plugin.domain.result import Result...
17,049
to str
# coding: utf-8 """ OpenPerf API REST API interface for OpenPerf # noqa: E501 OpenAPI spec version: 1 Contact: support@spirent.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class PacketGeneratorConfig(object): "...
17,050
start
#!/usr/bin/env python3 # Copyright (c) 2015-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. """Dummy Socks5 server for testing.""" import socket import threading import queue import logging logger...
17,051
test av rules
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com> # # Copyright (C) 2006 Red Hat # see file 'COPYING' for use and warranty information # # 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; v...
17,052
start edge
import logging from typing import Any, Dict from freqtrade import constants from freqtrade.configuration import setup_utils_configuration from freqtrade.enums import RunMode from freqtrade.exceptions import OperationalException from freqtrade.misc import round_coin_value logger = logging.getLogger(__name__) def se...
17,053
test get task state and steps
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
17,054
update template folder
from flask import Blueprint, current_app, jsonify, request from sqlalchemy.exc import IntegrityError from sqlalchemy.orm.exc import NoResultFound from app.dao.dao_utils import transactional from app.dao.service_user_dao import dao_get_active_service_users, dao_get_service_user from app.dao.services_dao import dao_fetc...
17,055
test peername
from __future__ import annotations import copy import dataclasses import enum from collections.abc import Mapping from dataclasses import dataclass from typing import Literal import pytest from mitmproxy.coretypes import serializable from mitmproxy.coretypes.serializable import SerializableDataclass class Serializ...
17,056
prefix
# This module contains abstractions for the input stream. You don't have to # looks further, there are no pretty code. # # We define two classes here. # # Mark(source, line, column) # It's just a record and its only use is producing nice error messages. # Parser does not use it for any other purposes. # # Reader(so...
17,057
default config
""" cos === Autogenerated DPF operator classes. """ from warnings import warn from ansys.dpf.core.dpf_operator import Operator from ansys.dpf.core.inputs import Input, _Inputs from ansys.dpf.core.outputs import Output, _Outputs from ansys.dpf.core.operators.specification import PinSpecification, Specification class c...
17,058
plugin with name sholud exist
from os import remove import os import random import subprocess import shutil import time def prepare_persistence_dir(): os.system("mkdir -p build/persistence") class Neuron(object): process = 0 profiler_process = None def __init__(self): pass def Start_Neuron(self): prepare_pe...
17,059
inject current span
# Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
17,060
eat h3
# Copyright (c) 2021 CINN 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 applicable la...
17,061
sync static
from functools import partial from typing import Any, AsyncGenerator, Generator import pytest from litestar.di import Provide from litestar.exceptions import ImproperlyConfiguredException, LitestarWarning from litestar.types import Empty def generator_func() -> Generator[float, None, None]: yield 0.1 async de...
17,062
set pylibdirs
## # Copyright 2013-2023 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), # Flemish Research Foundation (F...
17,063
remove locations
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
17,064
buffered print
import os import sys import termios import tty from typing import Callable, List, Optional, Tuple def METHOD_NAME() -> Tuple[Callable, Callable]: buffer = [] def __print(*args): for arg in args: buffer.append(arg) def __show(): nonlocal buffer print("".join(buffer), f...
17,065
set up
import unittest import pytest import sys from pathlib import Path if __name__ != "__main__": import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from spikeinterface import extract_waveforms, load_waveforms, download_dataset import spikeinterface.extractors as se import spikeinterface.widg...
17,066
pre load data
""" Command to: - load all fixtures named 'demo-*.*' - create copy the demo media files This should only be called in a clean database, such as after `resetdb` is run. This should generally only be used in development environments. """ import os import shutil from django.conf import settings from django.core.managem...
17,067
get native path
# Copyright 2015-2022 the openage authors. See copying.md for legal info. """ Provides - Wrapper, a utility class for implementing wrappers around FSLikeObject. - WriteBlocker, a wrapper that blocks all writing. - Synchronizer, which adds thread-safety to a FSLikeObject by wrapping a threading.Loc...
17,068
get encryption cert der bytes
from datetime import datetime, timedelta import logging from uuid import uuid4 from cryptography import x509 from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption, load_de...
17,069
is event animation
from module.base.button import Button from module.campaign.campaign_base import CampaignBase as CampaignBase_ from module.exception import CampaignNameError from module.logger import logger ANIMATION_PINK = Button( area=(1186, 446, 1272, 493), color=(255, 153, 172), button=(1186, 446, 1272, 493), name='ANIMATION_P...
17,070
test mix rgb
# -*- coding: utf-8 -*- import unittest import numpy as np from pydrake.math import RigidTransform, RollPitchYaw, RotationMatrix from pydrake.perception import BaseField, Fields, PointCloud from pydrake.systems.analysis import Simulator from pydrake.systems.framework import DiagramBuilder from pydrake.systems.percept...
17,071
get status
############################################################### # Copyright 2020 Lawrence Livermore National Security, LLC # (c.f. AUTHORS, NOTICE.LLNS, COPYING) # # This file is part of the Flux resource manager framework. # For details, see https://github.com/flux-framework. # # SPDX-License-Identifier: LGPL-3.0 ####...
17,072
pre update
from typing import Callable, List, TYPE_CHECKING, Type, Union if TYPE_CHECKING: # pragma: no cover from ormar import Model def receiver( signal: str, senders: Union[Type["Model"], List[Type["Model"]]] ) -> Callable: """ Connect given function to all senders for given signal name. :param signal:...
17,073
example 4
# -*- coding: utf-8 -*- import asyncio import os from random import randint import sys from pprint import pprint root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt.async_support as ccxt # noqa: E402 print('CCXT Version:', ccxt.__versio...
17,074
test go application variables
import re from unit.applications.lang.go import ApplicationGo prerequisites = {'modules': {'go': 'all'}} client = ApplicationGo() def METHOD_NAME(date_to_sec_epoch, sec_epoch): client.load('variables') body = 'Test body string.' resp = client.post( headers={ 'Host': 'localhost', ...
17,075
write symbols asm
import re, os, json from collections import defaultdict from rom.addressTypes import ValueSingle from rom.addresses import Addresses from rom.rom import snes_to_pc import utils.log class Symbols(object): def __init__(self, patchAccess=None): self.log = utils.log.get('Symbols') self._patchAccess ...
17,076
test mask noop
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch import tensor from torch.distributions import kl_divergence from pyro.distributions.torch import Bernoulli, Normal from pyro.distributions.util import broadcast_shape, scale_and_mask from test...
17,077
maybe assert valid y
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
17,078
test pull copy source does not exist
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015-2018 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in ...
17,079
get mail to
# -*- test-case-name: twisted.mail.test.test_mail -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Support for relaying mail. """ import os import pickle from twisted.internet.address import UNIXAddress from twisted.mail import smtp from twisted.python import log class DomainQueuer: ...
17,080
after populate obj
"""""" from __future__ import annotations import html from typing import Dict, cast import sqlalchemy as sa import sqlalchemy.orm from flask import render_template_string, request from flask_babel import format_datetime from flask_login import current_user from sqlalchemy.sql.expression import asc, desc, func, nullsl...
17,081
test query sales with filter discount type
from datetime import timedelta import pytest from django.utils import timezone from freezegun import freeze_time from .....discount import DiscountValueType from .....discount.models import Sale, SaleChannelListing from ....tests.utils import get_graphql_content QUERY_SALES_WITH_FILTER = """ query ($filter: Sale...
17,082
test defaults for initially empty app settings
###################################################################################################################### # Copyright (C) 2017-2023 Spine project consortium # This file is part of Spine Toolbox. # Spine Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Gen...
17,083
truth to bool
# coding=utf-8 """General utility functions.""" from __future__ import unicode_literals from builtins import str from datetime import datetime from dateutil import tz from six import string_types, viewitems from six.moves.collections_abc import Iterable def generate(it): """ Generate items from an iterabl...
17,084
sync
from __future__ import division, print_function import os import logging import socket HOST = socket.gethostname() from libtbx.mpi4py import MPI COMM = MPI.COMM_WORLD if not hasattr(COMM, "rank"): COMM.rank = 0 COMM.size = 1 # gather all hostnames and create sub-communicators for all processes on a given host ...
17,085
test odbc impersonation
# 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...
17,086
n cluster servers
from . import clusterIO import socket import queue import threading import logging logger = logging.getLogger(__name__) QUEUE_MAX_SIZE = 200 # ~10k frames class Stream(object): """ Class to handle spooling files in an asynchronous / non blocking manner to a single server TODO - use this in the spoole...
17,087
safe values
from __future__ import annotations import collections import functools import numpy as np import pandas as pd import toolz import ibis.expr.operations as ops from ibis.backends.pandas.dispatch import execute_node @execute_node.register(ops.Map, np.ndarray, np.ndarray) def map_ndarray_ndarray(op, keys, values, **kw...
17,088
snap cleanup
import os import core.exceptions as ex from core.resource import Resource def find_mount(rs, dir): """Sort mounts from deepest to shallowest and return the first mount whose 'mount_point' is matching 'dir' """ for m in sorted(rs.resources, reverse=True): if m.is_disabled(): co...
17,089
test hdf5 io engines
# -*- coding: utf-8 -*- """ Created on Tue Jan 26 20:36:38 2021 @author: erwan """ import pytest from radis.api.hdf5 import DataFileManager, hdf2df from radis.io.hitemp import fetch_hitemp from radis.misc.config import getDatabankEntries @pytest.mark.fast def METHOD_NAME(*args, **kwargs): """Test different eng...
17,090
get creator info
""" Content Provider: Walters Art Museum ETL Process: Use the API to identify all CC licensed images. Output: TSV file containing the images and the respective meta-data. Notes: http://api.thewalters.org/ Rate limit: 25...
17,091
generate include text
import os from scripts.project_details import ProjectDetails from scripts.release_locations import ReleaseLocations from scripts.utilities import write_file, read_file, get_file_name from typing import Dict, List, Union class Parts: def __init__(self, file:str, include_files: List[str]) -> None: self.f...
17,092
extras keys
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
17,093
test exit as default
from cStringIO import StringIO import os import sys import unittest import unittest.test class Test_TestProgram(unittest.TestCase): def test_discovery_from_dotted_path(self): loader = unittest.TestLoader() tests = [self] expectedPath = os.path.abspath(os.path.dirname(unittest.test.__fil...
17,094
test auto accounts parent close
import unittest from beancount.plugins import close_tree from beancount.parser import options from beancount.parser import cmptest from beancount import loader class TestCloseTree(cmptest.TestCase): def test_empty_entries(self): new_entries, _ = close_tree.close_tree([], options.OPTIONS_DEFAULTS.copy()) ...
17,095
list
# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRe...
17,096
get dotted config value
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
17,097
psd
from __future__ import absolute_import, unicode_literals import pytest import logging from psd_tools.api.psd_image import PSDImage from psd_tools.api import adjustments from ..utils import full_name logger = logging.getLogger(__name__) FILL_ADJUSTMENTS = PSDImage.open(full_name('fill_adjustments.psd')) @pytest.fi...
17,098
main
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
17,099
test summation
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...