id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
1,400
native
from contextlib import suppress from io import TextIOWrapper from . import abc class SpecLoaderAdapter: """ Adapt a package spec to adapt the underlying loader. """ def __init__(self, spec, adapter=lambda spec: spec.loader): self.spec = spec self.loader = adapter(spec) def __get...
1,401
url
# -------------------------------------------------------------------------------------------- # 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 aaz-dev-tools # --------------------------------...
1,402
certificate arn
# 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...
1,403
convert stack polar
import numpy as np import matplotlib.pyplot as plt from py4DSTEM.process.utils.elliptical_coords import * ## What else is used here? These fns have ## moved around some. In general, specifying ## the fns is better practice. TODO: change ## this import from py4DSTEM.process.calibration import fit_ellipse_amorphous_rin...
1,404
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...
1,405
test get auxreader for
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) #...
1,406
test flush oneway
# Copyright 2017 Workiva # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software #...
1,407
pyinit
#------------------------------------------------------------------------------- # ConnectivityMap #------------------------------------------------------------------------------- from PYB11Generator import * @PYB11template("Dimension") class ConnectivityMap: PYB11typedefs = """ typedef typename %(Dimension)s...
1,408
convert db precision to digits
from typing import List from ..abcs.database_types import ( DbPath, JSON, Timestamp, TimestampTZ, Float, Decimal, Integer, TemporalType, Native_UUID, Text, FractionalType, Boolean, Date, ) from ..abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue from ...
1,409
test field alias order irrelevant
from dagster import Field, Permissive, Selector, Shape from dagster._config import compute_fields_hash def _hash(fields): return compute_fields_hash(fields, description=None) def test_compute_fields_hash(): assert isinstance(_hash({"some_int": Field(int)}), str) def test_hash_diff(): assert _hash({"so...
1,410
reset
from collections import namedtuple from typing import Any import numpy as np import randaugment.augmentation_transforms as augmentation_transforms import randaugment.policies as found_policies import torch from torch import nn # From: https://github.com/quark0/DARTS Genotype = namedtuple("Genotype", "normal normal_co...
1,411
grepx
#!/usr/bin/env python """Create grep like remote behavior on show run or command output.""" from __future__ import print_function from __future__ import unicode_literals import argparse import sys import os import subprocess import threading try: from Queue import Queue except ImportError: from queue import Q...
1,412
rate guard
# coding: utf-8 """ Definition of the job dashboard interface. """ __all__ = ["BaseJobDashboard", "NoJobDashboard", "cache_by_status"] import time import functools from contextlib import contextmanager from abc import ABCMeta, abstractmethod import six from law.util import perf_counter def cache_by_status(func)...
1,413
method
# -------------------------------------------------------------------------------------------- # 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 aaz-dev-tools # --------------------------------...
1,414
test soft voided
from hathor.conf import HathorSettings from hathor.graphviz import GraphvizVisualizer from hathor.simulator import FakeConnection, Simulator from hathor.simulator.trigger import StopAfterNTransactions from tests import unittest from tests.simulation.base import SimulatorTestCase from tests.utils import add_custom_tx, g...
1,415
process
from __future__ import print_function import numpy as np import os import kaldiio from multiprocessing import Pool import argparse from tqdm import tqdm import math from funasr.utils.types import str2triple_str import logging from typing import List, Union, Tuple, Sequence from funasr.bin.sv_inference import inference_...
1,416
run
import queue import subprocess import threading from steps.common import debug class Podman: def __init__(self, context, container_name): self.context = context self.container_name = container_name self.container = None debug(self.context, "Podman.__init__()") self.new_co...
1,417
main
#!/usr/bin/env python3 #=========================================================================== # # Print a json file # #=========================================================================== from __future__ import print_function import os import sys import shutil import subprocess from optparse import Opti...
1,418
get jinja2 package
# Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
1,419
do messages
from datetime import timedelta from dash.orgs.models import Org from django.core.management.base import BaseCommand, CommandError from django.utils import timezone from django.utils.timezone import now class Command(BaseCommand): help = "Dumps information about the synced state of each org's contacts and messag...
1,420
default value
# SPDX-License-Identifier: Apache-2.0 # Copyright Contributors to the Rez Project from Qt import QtCore, QtWidgets from functools import partial class Config(QtCore.QSettings): """Persistent application settings. Methods are also provided for easily attaching widgets to settings. """ def __init__(s...
1,421
test strip bom
import sys import codecs from unittest import TestCase import simplejson as json from simplejson.compat import unichr, text_type, b, BytesIO class TestUnicode(TestCase): def test_encoding1(self): encoder = json.JSONEncoder(encoding='utf-8') u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER...
1,422
get hunt comment
# 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...
1,423
test can multiple values
# Copyright 2013 Christoph Reiter # # 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 shutil from io imp...
1,424
inject or
"""Admin request context class. A request context provided by the admin server to admin route handlers. """ from typing import Mapping, Optional, Type from ..core.profile import Profile, ProfileSession from ..config.injector import Injector, InjectionError, InjectType from ..config.injection_context import Injection...
1,425
calculate voltage
#!/usr/bin/env python # # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) # # 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/li...
1,426
get param
# Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT import logging from pathlib import Path from typing import Optional import click import git from packit.local_project import LocalProject, LocalProjectBuilder, CALCULATE from packit.utils.repo import git_remote_url_to_https_url logger = ...
1,427
test l10n br sale discount percent with
# Copyright (C) 2022-Today - Engenere (<https://engenere.one>). # @author Felipe Motter Pereira <felipe@engenere.one> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo.tests import Form, SavepointCase class L10nBrSaleDiscount(SavepointCase): @classmethod def setUpClass(cls): ...
1,428
test get ls tree line submodule
import io from datalad_service.common.annex import parse_ls_tree_line, read_ls_tree_line, compute_rmet, parse_remote_line, parse_rmet_line, read_rmet_file, encode_remote_url expected_file_object = { 'filename': 'dataset_description.json', 'id': '43502da40903d08b18b533f8897330badd6e1da3', 'key': '838d19644...
1,429
multifractal
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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. # # This program is distrib...
1,430
state machine config
"""The definition for the states section of the toolbox.""" from functools import partial from gaphas.item import SE from gaphor import UML from gaphor.core import gettext from gaphor.diagram.diagramtoolbox import ToolDef, ToolSection, new_item_factory from gaphor.UML import diagramitems from gaphor.UML.recipes impo...
1,431
gracefully terminate
#!/usr/bin/env python3 from datetime import datetime import logging import os import signal import subprocess import sys import time PROG = os.path.basename(sys.argv[0]) try: tool_output_dir = sys.argv[1] except IndexError: print(f"{PROG}: missing required tool output directory argument", file=sys.stderr) ...
1,432
test run two dependent models from json
import os from pathlib import Path import numpy as np import pandas import pytest from pywr.parameters import DataFrameParameter from pywr.model import MultiModel, Model from pywr.core import Scenario # def load_multi_model(filename: Path): from pywr.nodes import Input, Link, Output from pywr.parameters.multi_model_...
1,433
test echo alias
import pytest from tests.utils import active_character, end_init, start_init pytestmark = pytest.mark.asyncio async def METHOD_NAME(avrae, dhttp): avrae.message("!alias foobar echo foobar") await dhttp.receive_message("Alias `foobar` added.```py\n!alias foobar echo foobar\n```") avrae.message("!foobar")...
1,434
is namedtuple
""" Tests for the `TypeChecker`-based type interface. The actual correctness of the type checking is handled in `test_jsonschema_test_suite`; these tests check that TypeChecker functions correctly at a more granular level. """ from collections import namedtuple from unittest import TestCase from jsonschema import Val...
1,435
stop
# *************************************************************** # Copyright (c) 2023 Jittor. All Rights Reserved. # Maintainers: # Guoye Yang <498731903@qq.com> # Dun Liang <randonlang@gmail.com>. # # # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this s...
1,436
search symop lib for ccp4 symbol
from __future__ import absolute_import, division, print_function from cctbx import sgtbx import libtbx.load_env import os.path as op from six.moves import range if (libtbx.env.has_module("ccp4io")): for _ in ["libccp4/data", "data"]: ccp4io_lib_data = libtbx.env.under_dist( module_name="ccp4io", path=_) ...
1,437
public visit
# =============================================================================== # NAME: TopologyIDVisitor.py # # DESCRIPTION: A visitor responsible for the generation of component # base class source code file. # # AUTHOR: reder # EMAIL: reder@jpl.nasa.gov # DATE CREATED : Feb 5, 2007 # # Copyright 201...
1,438
get product history
""" Logging system to allow users to view & understand actions done in the strategy Copyright (C) 2021 Emerson Dove This program 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 ...
1,439
generate meta
""" Copyright (c) 2018-2023 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
1,440
main
#!/usr/bin/env python3 """ 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" BAS...
1,441
tmpfunc
import io import os import sys import copy import json import time import uuid import socket import logging import traceback from threading import local from collections import OrderedDict from contextlib import contextmanager LOG_TIMESTAMPS = "LOG_TIMESTAMPS" in os.environ def json_handler(obj): # if isinstance(ob...
1,442
mean
#!/usr/bin/env python ## # @file # This file is part of SeisSol. # # @author Carsten Uphoff (c.uphoff AT tum.de, http://www5.in.tum.de/wiki/index.php/Carsten_Uphoff,_M.Sc.) # # @section LICENSE # Copyright (c) 2016, SeisSol Group # All rights reserved. # # Redistribution and use in source and binary forms, with or with...
1,443
create record
"""Module provider for PointHQ""" import json import logging from argparse import ArgumentParser from typing import List import requests from lexicon.exceptions import AuthenticationError from lexicon.interfaces import Provider as BaseProvider LOGGER = logging.getLogger(__name__) class Provider(BaseProvider): ...
1,444
get next
# 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...
1,445
test time timerange
import pytest import astropy.units as u from sunpy.net import _attrs as core_attrs from sunpy.net import attr from sunpy.net import attrs as a from sunpy.net.vso import attrs as va from sunpy.time import TimeRange, parse_time def test_simpleattr_apply(): a = attr.ValueAttr({('test', ): 1}) dct = {} va._...
1,446
make instance
import numpy as np from ..optics import Wavefront, AgnosticOpticalElement, make_agnostic_forward, make_agnostic_backward from ..field import Field, evaluate_supersampled from ..fourier import FastFourierTransform, make_fft_grid, FourierFilter class AngularSpectrumPropagator(AgnosticOpticalElement): '''The monochr...
1,447
send
import asyncio from collections.abc import Sequence from typing import Any from jsonpointer import set_pointer import reactpy from reactpy.core.layout import Layout from reactpy.core.serve import serve_layout from reactpy.core.types import LayoutUpdateMessage from reactpy.testing import StaticEventHandler from tests....
1,448
test download with 302
import json import unittest.mock import pytest import github3 from .helper import create_example_data_helper from .helper import create_url_helper from .helper import UnitHelper from .helper import UnitIteratorHelper from github3.repos.release import Asset from github3.repos.release import Release from github3.users ...
1,449
test pop python
# Copyright 2017 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...
1,450
test ssh pty
""" Cloudflared Integration tests """ import unittest import subprocess import os import tempfile from contextlib import contextmanager from pexpect import pxssh class TestSSHBase(unittest.TestCase): """ SSH test base class containing constants and helper funcs """ HOSTNAME = os.environ["SSH_HOSTNA...
1,451
get resources to apply
# # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # from glob import glob from typing import List, Optional, Tuple import airbyte_api_client import click from octavia_cli.base_commands import OctaviaCommand from octavia_cli.check_context import REQUIRED_PROJECT_DIRECTORIES, requires_init from .diff_helpers ...
1,452
process
""" Update vote data for Reddit datasets """ import shutil import praw, praw.exceptions import csv from prawcore.exceptions import Forbidden, NotFound, PrawcoreException from backend.lib.processor import BasicProcessor from common.lib.user_input import UserInput from common.lib.exceptions import ProcessorInterruptedE...
1,453
resolution
# The PEP 484 type hints stub file for the QtSvg module. # # Generated by SIP 6.4.0 # # Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> # # This file is part of PyQt5. # # This file may be used under the terms of the GNU General Public License # version 3.0 as published by the Free Softwa...
1,454
create participant
""" Generate fake records. Only used in dev & test. """ from datetime import date from generic.models import User from app.models import * from semester.models import Semester, SemesterType from boot import config from utils.marker import fix_me UIDS = ["1", "2"] TEACHER_UIDS = ["10", "11"] ORG_UIDS = ['zz00001', '...
1,455
get general dataframe
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2018-2022 F4PGA 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 # # Unl...
1,456
get property
# -*- coding: utf-8 -*- # *************************************************************************** # * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> * # * * # * This program is free software; you can redistribute it a...
1,457
create model
# coding=utf-8 # Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. # Copyright 2018 The Google AI Language Team 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...
1,458
test define output file
import os import filecmp import pytest from .test_utils import ( ExampleTest, compare_stdout_with_file, compare_files_ignore_newline, ) class TestTLSFingerprinting(ExampleTest): pytestmark = [pytest.mark.tlsfingerprinting, pytest.mark.no_network] def _get_default_args(self, tmpdir=None): ...
1,459
test validation
# # # from unittest import TestCase from helpers import SimpleProvider from octodns.record import Record from octodns.record.cname import CnameRecord from octodns.record.exception import ValidationError from octodns.zone import Zone class TestRecordCname(TestCase): zone = Zone('unit.tests.', []) def asser...
1,460
log
# Copyright (c) Alibaba, Inc. and its affiliates. import datetime import os import os.path as osp from collections import OrderedDict import json import torch from torch import distributed as dist from modelscope.metainfo import Hooks from modelscope.trainers.hooks.builder import HOOKS from modelscope.utils.constant ...
1,461
setup testing defaults
"""Miscellaneous WSGI-related Utilities""" import posixpath __all__ = [ 'FileWrapper', 'guess_scheme', 'application_uri', 'request_uri', 'shift_path_info', 'setup_testing_defaults', ] class FileWrapper: """Wrapper to convert file-like objects to iterables""" def __init__(self, filelike, blksize=819...
1,462
watch bands
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # 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 a...
1,463
format as sql rows
""" Import prescribing data from CSV files into SQLite """ from collections import namedtuple import csv from itertools import groupby import logging import os import sqlite3 import gzip import heapq from matrixstore.matrix_ops import sparse_matrix, finalise_matrix from matrixstore.serializer import serialize_compress...
1,464
test plot connections color by
import pytest import numpy as np import openpnm as op import matplotlib.pyplot as plt from numpy.testing import assert_allclose class PlotToolsTest: def setup_class(self): self.ws = op.Workspace() def test_plot_tutorial(self): pn = op.network.Cubic(shape=[4, 4, 1]) # This runs locall...
1,465
validate archive restore
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
1,466
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 ...
1,467
parse xml
#!/usr/bin/env python3 # # Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) # # SPDX-License-Identifier: BSD-2-Clause or GPL-2.0-only # # seL4 Invocation ID Generator # ============================ from __future__ import print_function from jinja2 import Environment, BaseLoader import argparse import sys import xml...
1,468
test vcs url for stable version
from django.test import TestCase from django.test.utils import override_settings from django_dynamic_fixture import get from readthedocs.builds.constants import BRANCH, EXTERNAL, LATEST, TAG from readthedocs.builds.models import Version from readthedocs.projects.models import Project class VersionMixin: fixtures...
1,469
test uncond acquire return val
"""Generic thread tests. Meant to be used by dummy_thread and thread. To allow for different modules to be used, test_main() can be called with the module to use as the thread implementation as its sole argument. """ import dummy_thread as _thread import time import Queue import random import unittest from test impo...
1,470
test nested conditions
from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.const import ( CONF_CONDITION, CONF_ENTITY_ID, STATE_OFF, STATE_ON, STATE_UNAVAILABLE, ) from homeassistant.core import HomeAssistant from custom_components.powercalc.const import ( CONF_COMPOSITE, CONF_FIXED, ...
1,471
test genetic modification upgrade 8 9
import pytest def test_genetic_modification_upgrade_1_2(upgrader, genetic_modification_1): value = upgrader.upgrade('genetic_modification', genetic_modification_1, current_version='1', target_version='2') assert value['schema_version'] == '2' assert value.get('modification_des...
1,472
test configure
# -*- coding: utf-8 -*- # Copyright (C) 2014-2018 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at your option) any later version. # This program is distributed ...
1,473
choices
import enum from django.contrib.postgres.fields import ArrayField from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models from django.db.models import F from django.urls import reverse from zentral.contrib.inventory.models import BaseEnrollment # configuration class Prin...
1,474
convert to igrf dipole coefficients
# # ISC License # # Copyright (c) 2016, Autonomous Vehicle Systems Lab, University of Colorado at Boulder # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all...
1,475
last modified by
# 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 ._en...
1,476
on reset
# # Copyright (C) 2016 TUDelft # # This file is part of paparazzi. # # paparazzi 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 # (at your option) any later version. # # pa...
1,477
test embedding loaded
# Copyright 2018 The TensorFlow Hub 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 app...
1,478
test default protocol
import unittest import shelve import glob from test import support from collections.abc import MutableMapping from test.test_dbm import dbm_iterator def L1(s): return s.decode("latin-1") class byteskeydict(MutableMapping): "Mapping that supports bytes keys" def __init__(self): self.d = {} de...
1,479
test binary classes
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
1,480
delete rules
"""iptables helper functions. Unlike the `firewall` module, these functions know nothing about PaaSTA and could effectively be a third-party library. They just make working with iptables a little bit easier. """ import collections import contextlib import logging import iptc log = logging.getLogger(__name__) RULE_...
1,481
send
from __future__ import annotations import dataclasses from enum import Enum, auto import logging import math from anyio import ( TASK_STATUS_IGNORED, WouldBlock, create_memory_object_stream, create_task_group, ) from anyio.abc import TaskStatus from anyio.streams.memory import MemoryObjectReceiveStream,...
1,482
test read top layer
import pytest import numpy as np import mikeio from mikeio.spatial import GeometryUndefined from mikeio.spatial import Grid2D, Grid3D def test_dfs3_repr(): dfs = mikeio.open("tests/testdata/test_dfs3.dfs3") assert "<mikeio.Dfs3>" in repr(dfs) assert "geometry: Grid3D" in repr(dfs) def test_dfs3_project...
1,483
visit ndarray
from parsimonious import Grammar, NodeVisitor from hail.expr.nat import NatVariable from . import types from hail.utils.java import unescape_parsable type_grammar = Grammar( r""" type = _ (array / ndarray / set / dict / struct / union / tuple / interval / int64 / int32 / float32 / float64 / bool / str / call /...
1,484
info
from __future__ import annotations import dataclasses import logging import time from icclim.models.registry import Registry @dataclasses.dataclass class Verbosity: verbosity_level: str log_level: str class VerbosityRegistry(Registry[Verbosity]): _item_class = Verbosity LOW = Verbosity("LOW", "INF...
1,485
assume
"""Assume an AWS IAM role.""" from __future__ import annotations import logging from datetime import datetime from typing import TYPE_CHECKING, ContextManager, Optional, Type, cast from typing_extensions import TypedDict if TYPE_CHECKING: from types import TracebackType from mypy_boto3_sts.type_defs import ...
1,486
poisson train
from .... import config from ..device import NeuronDevice from ....simulation.results import SimulationRecorder from ....exceptions import * from ....reporting import report, warn import numpy as np @config.node class SpikeGenerator(NeuronDevice): defaults = {"record": True} casts = { "radius": float,...
1,487
add error
import traceback import unittest from code_feedback import Feedback, GradingComplete from pl_execute import UserCodeFailed from pl_helpers import DoNotRun, GradingSkipped, print_student_code class PLTestResult(unittest.TestResult): """ Helper class for generating results of a test suite using the Python ...
1,488
test login failed exceptions 173
# coding=utf-8 import pytz from datetime import datetime from mock import patch from monitorrent.plugins.trackers import LoginResult, TrackerSettings, CloudflareChallengeSolverSettings from monitorrent.plugins.trackers.kinozal import KinozalPlugin, KinozalLoginFailedException, KinozalTopic from monitorrent.plugins.trac...
1,489
test named args
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the Apache 2.0 License. # See the LICENSE file in the project root for more information. # COM Interop tests for IronPython from iptest.assert_util import skiptest skiptest("win32") from iptest.cominte...
1,490
relabel on boot
#!/usr/bin/python3 import dbus import dbus.service from dbus.mainloop.glib import DBusGMainLoop from gi.repository import GObject from gi.repository import GLib import os import selinux from subprocess import Popen, PIPE, STDOUT class selinux_server(dbus.service.Object): default_polkit_auth_required = "org.selin...
1,491
control led
############################################################################### # # The MIT License (MIT) # # Copyright (c) typedef int GmbH # # 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 ...
1,492
test create shared memory
import multiprocessing as mp from collections import OrderedDict from multiprocessing import Array, Process from multiprocessing.sharedctypes import SynchronizedArray import numpy as np import pytest from gymnasium.error import CustomSpaceError from gymnasium.spaces import Dict, Tuple from gymnasium.vector.utils.shar...
1,493
get run
from typing import TYPE_CHECKING, Optional, Sequence, Tuple, cast import dagster._check as check from dagster._core.errors import DagsterRunNotFoundError from dagster._core.execution.plan.state import KnownExecutionState from dagster._core.host_representation.external import ExternalJob from dagster._core.instance imp...
1,494
write action transfer
from typing import TYPE_CHECKING from apps.common.writers import ( write_bytes_fixed, write_bytes_unchecked, write_uint8, write_uint16_le, write_uint32_le, write_uint64_le, write_uvarint, ) if TYPE_CHECKING: from trezor.messages import ( EosActionBuyRam, EosActionBuyRam...
1,495
test content id
import json import os import re from contextlib import contextmanager from io import BytesIO from tempfile import NamedTemporaryFile, TemporaryDirectory from unittest.mock import patch from urllib.request import Request, urlopen from zipfile import ZipFile import pytest from repo2docker.__main__ import make_r2d from ...
1,496
test not valid when empty multivalues
# -*- coding: utf-8 -*- from django import forms from django.core.exceptions import ValidationError from django.test import SimpleTestCase from ralph.admin.fields import MultilineField, MultivalueFormMixin from ralph.tests.models import TestAsset class SimpleTestForm(MultivalueFormMixin, forms.Form): multivalue_...
1,497
should hide score
import functools from datetime import datetime, timezone from sqlalchemy.orm import relationship from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.sql.sqltypes import Boolean, Integer, String, Text from files.classes.cron.tasks import (RepeatableTask, ScheduledTaskType, ...
1,498
load
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals import dnf.conf import dnf.repo from .common import TestCase class DnfRepoApiTest(TestCase): def test_init(self): # dnf.repo.Repo.__init__ self.assertHasAttr(dnf.repo, "Repo") self.a...
1,499
addx
#!/usr/bin/python # # Simson's simple stats. If what you want isn't here, use stats. import time import os class statbag: """A simple statistics package for 1 and two dimensional values. Also does histograms.""" def __init__(self): self.x = [] self.y = [] self.hist = {} ...