id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
6,500 | 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 ... |
6,501 | test get long text from | from dataclasses import asdict
from socket import gaierror
from unittest.mock import MagicMock, Mock, patch
import pytest
from tribler.core.components.reporter.exception_handler import CoreExceptionHandler
from tribler.core.sentry_reporter import sentry_reporter
from tribler.core.sentry_reporter.sentry_reporter impor... |
6,502 | athena getresult | from sqlalchemy import create_engine
class basefunc:
# athena
@staticmethod
def athena_getdb(uri, schema):
engine = create_engine(uri, echo=True)
res = engine.execute('SHOW DATABASES').fetchall()
db_list = []
for row in res:
for item in row:
db_l... |
6,503 | train | import math
import random
import torch
import tqdm
import editdistance
from torch import nn
from torch.optim import Adam
from torch.optim.lr_scheduler import ExponentialLR
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.dataset import random_split
from torch.nn.utils.rnn import pad_sequence
from ... |
6,504 | do eval | # Copyright 2020-2023 OpenDR European Project
#
# 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 agree... |
6,505 | get legacy ot types | """Safely unpickle objects stored in the database by older robot-server versions."""
from dataclasses import dataclass
from functools import lru_cache
from io import BytesIO
from logging import getLogger
from pickle import ( # noqa: F401
Unpickler,
# Re-export `dumps()` to allow this module to be used as a d... |
6,506 | etag | # 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... |
6,507 | process | # This file is part of project Sverchok. It's copyrighted by the contributors
# recorded in the version control history of the file, available from
# its original location https://github.com/nortikin/sverchok/commit/master
#
# SPDX-License-Identifier: GPL3
# License-Filename: LICENSE
import bpy
from mathutils import ... |
6,508 | main | # Copyright (c) 2021, 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... |
6,509 | do transformation | #
# -*- 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
#
# Unless required... |
6,510 | test pid | #!/usr/bin/env pmpython
#
# Copyright (C) 2016 Sitaram Shelke.
#
# 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.
#
# Thi... |
6,511 | list policy fragment references output | # 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... |
6,512 | auth | # Author: Google
# See the LICENSE file for legal information regarding use of this file.
# GCM derived from Go's implementation in crypto/cipher.
#
# https://golang.org/src/crypto/cipher/gcm.go
# GCM works over elements of the field GF(2^128), each of which is a 128-bit
# polynomial. Throughout this implementation, ... |
6,513 | is valid test tmpdir | #!/usr/bin/env python3
# Copyright (c) 2017-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Combine logs from multiple bitcoin nodes as well as the test_framework log.
This streams the combined ... |
6,514 | get | # SPDX-License-Identifier: MIT
import os, tempfile, shutil, subprocess, re
from . import sysreg
__all__ = ["AsmException", "ARMAsm"]
uname = os.uname()
if uname.sysname == "Darwin":
DEFAULT_ARCH = "aarch64-linux-gnu-"
if uname.machine == "arm64":
TOOLCHAIN = "/opt/homebrew/opt/llvm/bin/"
else:
... |
6,515 | load backend | # Copyright (c) 2012-2016 Seafile Ltd.
import datetime
from importlib import import_module
from warnings import warn
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from seahub.auth.signals import user_logged_in
from constance import config
SESSION_KEY = '_auth_user_name'
BA... |
6,516 | test flattener new | # Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
6,517 | test blame newest | # Copyright 2010-2023 The pygit2 contributors
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
# as published by the Free Software Foundation.
#
# In addition to the permissions in the GNU General Public License,
# the authors give ... |
6,518 | is valid episode | from logging import debug, info, warning, error, exception
import re
from datetime import datetime, timedelta
from .. import AbstractServiceHandler
from data.models import Episode, UnprocessedStream
class ServiceHandler(AbstractServiceHandler):
_playlist_api_query = "https://www.googleapis.com/youtube/v3/playlistIte... |
6,519 | test describe user unknown | import boto3
import pytest
from botocore.exceptions import ClientError
from moto import mock_mq
@mock_mq
def test_create_user():
client = boto3.client("mq", region_name="us-east-1")
broker_id = client.create_broker(
AutoMinorVersionUpgrade=False,
BrokerName="testbroker",
DeploymentMod... |
6,520 | filter special tags | # IMPORTATION STANDARD
import logging
import re
# IMPORTATION THIRDPARTY
# IMPORTATION INTERNAL
from openbb_terminal.core.config.paths import HOME_DIRECTORY
from openbb_terminal.core.log.generation.settings import AppSettings
from openbb_terminal.core.log.generation.user_logger import get_user_uuid
class FormatterWi... |
6,521 | test valid daily scheduler time and day | import datetime
from unittest import mock
from testifycompat import assert_equal
from testifycompat import assert_raises
from testifycompat import run
from testifycompat import TestCase
from tron.config import config_utils
from tron.config import ConfigError
from tron.config import schedule_parse
class TestPadSequen... |
6,522 | set values | """Context for datastore."""
# pylint: disable=missing-type-doc
from pymodbus.datastore.store import ModbusSequentialDataBlock
from pymodbus.exceptions import NoSuchSlaveException
from pymodbus.logging import Log
class ModbusBaseSlaveContext: # pylint: disable=too-few-public-methods
"""Interface for a modbus sla... |
6,523 | assert ispipe | import os
import stat
try:
from pathlib import Path
except ImportError:
try:
# Python 2 backport
from pathlib2 import Path
except ImportError:
class Path(object):
"""Dummy for isinstance checks"""
pass
__all__ = ['assert_path_exists', 'assert_not_path_exist... |
6,524 | dnc app 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
__all__ =... |
6,525 | get private key primitive | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
6,526 | ok | """About Dialog for IDLE
"""
import os
from sys import version
from Tkinter import *
from idlelib import textView
class AboutDialog(Toplevel):
"""Modal about dialog for idle
"""
def __init__(self, parent, title, _htest=False):
"""
_htest - bool, change box location when running htest
... |
6,527 | test event file read no pi | import numpy as np
import os
import matplotlib.pyplot as plt
from astropy.tests.helper import pytest
from astropy.utils.exceptions import AstropyUserWarning
from ..io import split_numbers
from ..io import ref_mjd
from ..io import high_precision_keyword_read
from ..io import load_events_and_gtis, read_mission_info
fro... |
6,528 | scrolled list | from tkinter import *
from tkinter.ttk import Frame, Scrollbar
from idlelib import macosx
class ScrolledList:
default = "(None)"
def __init__(self, master, **options):
# Create top frame, with scrollbar and listbox
self.master = master
self.frame = frame = Frame(master)
self... |
6,529 | test broken artifact | #!/usr/bin/env python
"""Tests for grr.server.grr_response_server.flows.general.collectors.
These tests cover the interaction of artifacts. They test that collection of
good artifacts can still succeed if some bad artifacts are defined, and the
various ways of loading artifacts.
"""
import os
from unittest import moc... |
6,530 | test construct | """
ckwg +31
Copyright 2020 by Kitware, 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 of conditions and the ... |
6,531 | stop test class inside fixtures | # testing/fixtures/orm.py
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
from __future__ import annotations
from typing import... |
6,532 | func result | import sys
from unittest import mock
from unittest.mock import Mock
import pytest
import pytest
from PySide6.QtCore import QThreadPool
from src.Model.Worker import Worker
class FakeClass:
def METHOD_NAME(self, result):
pass
def func_error(self, error):
pass
# qtbot is a pytest fixture used... |
6,533 | layout | import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get
from conan.tools.METHOD_NAME import basic_layout
from conan.tools.scm import Version
required_conan_version = ">=1.52.0"
class ContinuableCo... |
6,534 | mock terminate | import random
from operator import xor
from unittest import mock
import pytest
from tests.factories.agreements_pool import BufferedAgreement, BufferedAgreementFactory
from yapapi import agreements_pool
from yapapi.events import AgreementTerminated
def mock_agreement(**properties):
"""Return a coroutine that cre... |
6,535 | zero ext | """
Functions for acting on a axis of an array.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
def axis_slice(a, start=None, stop=None, step=None, axis=-1):
"""Take a slice along axis 'axis' from 'a'.
Parameters
----------
a : numpy.ndarray
The array ... |
6,536 | tokenize fn | import argparse
import os
import socket
from functools import partial
import pandas as pd
import ray
import torch
from coati.quant import llama_load_quant, low_resource_init
from coati.ray.detached_trainer_ppo import DetachedPPOTrainer
from coati.ray.experience_maker_holder import ExperienceMakerHolder
from coati.ray.... |
6,537 | parse events into yaml | # Copyright (C) 2015-2021, Wazuh Inc.
# Created by Wazuh, Inc. <info@wazuh.com>.
# This program is free software; you can redistribute it and/or modify it under the terms of GPLv2
import argparse
import json
import logging
import os
import subprocess
import time
import yaml
from wazuh_testing import logger
from wazuh... |
6,538 | api v1 models | import contextlib
import json
import ssl
import threading
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pathlib import Path
from typing import Any, Callable, Dict, Iterator, Optional, Tuple
import determined
from determined.common.api import bindings
from determined.common.api.authentication import... |
6,539 | conflicts with | import logging
from typing import Callable, Optional, Any, ContextManager
from types import ModuleType
import importlib
import importlib.util
import importlib.resources
import importlib.abc
import sys
from pathlib import Path
from dataclasses import dataclass
from esphome.const import SOURCE_FILE_EXTENSIONS
import esp... |
6,540 | data source | # ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
# ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
# ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄... |
6,541 | test lifecycle bad server unloaded signature | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2023, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
6,542 | test load programs | import unittest
from unittest import mock
from django.core.management import call_command
class CommandTests(unittest.TestCase):
def setUp(self):
stdout_patch = mock.patch("sys.stdout")
stdout_patch.start()
self.addCleanup(stdout_patch.stop)
@mock.patch(
"paying_for_college.m... |
6,543 | get api url | import copy
from django.contrib.postgres.indexes import GinIndex
from django.contrib.postgres.search import SearchVector, SearchVectorField
from django.db import models
from django.db.models import Q
from django.utils import timezone
from ...conf import settings
from ...core.utils import parse_iso8601_string
from ...... |
6,544 | init optimizer state | """Training algorithm track submission functions for LibriSpeech."""
import functools
from typing import Dict, Iterator, List, Tuple
from absl import logging
from flax import jax_utils
import jax
from jax import lax
import jax.numpy as jnp
import numpy as np
import optax
from algorithmic_efficiency import spec
_GRAD... |
6,545 | render html footnote item | import re
from ...mistune.inline_parser import LINK_LABEL
from ...mistune.scanner import unikey
__all__ = ['plugin_footnotes']
#: inline footnote syntax looks like::
#:
#: [^key]
INLINE_FOOTNOTE_PATTERN = r'\[\^(' + LINK_LABEL + r')\]'
#: define a footnote item like::
#:
#: [^key]: paragraph text to describe t... |
6,546 | test nested children | from __future__ import annotations
from collections.abc import Mapping, Sequence
import pytest
from ibis.common.collections import frozendict
from ibis.common.graph import (
Graph,
Node,
_flatten_collections,
_recursive_get,
bfs,
dfs,
toposort,
)
from ibis.common.grounds import Annotable,... |
6,547 | test plugins sorted by version | import random
from enum import Enum
from pathlib import PurePosixPath
import pytest
from semver import VersionInfo
from common.agent_plugins import AgentPluginMetadata, AgentPluginRepositoryIndex, AgentPluginType
from common.agent_plugins.agent_plugin_repository_index import ( # type: ignore[attr-defined]
DEVELO... |
6,548 | chunk keys | import zlib
from sentry.utils import metrics
from sentry.utils.json import prune_empty_keys
ATTACHMENT_META_KEY = "{key}:a"
ATTACHMENT_UNCHUNKED_DATA_KEY = "{key}:a:{id}"
ATTACHMENT_DATA_CHUNK_KEY = "{key}:a:{id}:{chunk_index}"
UNINITIALIZED_DATA = object()
class MissingAttachmentChunks(Exception):
pass
clas... |
6,549 | package info | from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rmdir
from conan.tools.microsoft import is_msvc
from conan.tools.scm import ... |
6,550 | test api | """Unit tests for the label printing mixin."""
import json
import os
from django.apps import apps
from django.urls import reverse
from PIL import Image
from InvenTree.unit_test import InvenTreeAPITestCase
from label.models import PartLabel, StockItemLabel, StockLocationLabel
from part.models import Part
from plugin... |
6,551 | set | # -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2015 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Gene... |
6,552 | cpu freq path | #!/usr/bin/env python
# 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 distributed in the hope that i... |
6,553 | get parameter projection | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
# Copyright 2018 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.
# You may obtain a copy of the License at
#
# ht... |
6,554 | build dirname | # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import inspect
import os
from typing import List
import llnl.util.filesystem as fs
import spack.builder
import spack.pack... |
6,555 | handle obj | # Stubs for xlrd.book (Python 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
import struct
from typing import Any, Optional
from .biffh import BaseObject
unpack = struct.unpack
empty_cell: Any
DEBUG: int
USE_FANCY_CD: int
TOGGLE_GC: int
MMAP_AVAILABLE: int
USE_MMAP = MMAP_AVAILABLE
M... |
6,556 | has started | # -*- python-mode -*-
## Copyright (C) 2012-2013 Daniel Pavel
##
## 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.
#... |
6,557 | build list request | # 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... |
6,558 | test revert commit | import base64
import os
import sys
import tarfile
import time
import zipfile
from io import BytesIO
import pytest
import gitlab
def test_repository_files(project):
project.files.create(
{
"file_path": "README.md",
"branch": "main",
"content": "Initial content",
... |
6,559 | define tables | """test the current state of the hasparent() flag."""
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import testing
from sqlalchemy.orm import attributes
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.orm import relationship
from sqlalchemy.testing import assert_raises_messa... |
6,560 | softmax np | # Copyright 2019-2022 ETH Zurich and the DaCe authors. All rights reserved.
# Original application code: NPBench - https://github.com/spcl/npbench
import dace.dtypes
import numpy as np
import dace as dc
import pytest
import argparse
from dace.fpga_testing import fpga_test, xilinx_test
from dace.transformation.interstat... |
6,561 | test submit name for area without any | from candidates.models import LoggedAction
from candidates.tests.auth import TestUserMixin
from candidates.tests.factories import MembershipFactory
from candidates.tests.uk_examples import UK2015ExamplesMixin
from django_webtest import WebTest
from people.tests.factories import PersonFactory
from utils.testing_utils im... |
6,562 | test vuln count | '''
Faraday Penetration Test IDE
Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
See the file 'doc/LICENSE' for the license information
'''
from faraday.server.models import db, Workspace
from tests.factories import (
HostFactory,
ServiceFactory,
SourceCodeFactory,
VulnerabilityFactory,
... |
6,563 | test sqlite ingestion column names mismatch | # Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import os
from unittest import mock
from click.testing import Result
from pytest import raises
from vdk.internal.core.errors import UserCodeError
from vdk.plugin.sqlite import sqlite_plugin
from vdk.plugin.sqlite.ingest_to_sqlite import IngestToS... |
6,564 | test get field value | import copy
import os.path
import collections
from tests.conftest import TESTSDIR, data_dict
from processor.helper.json.json_utils import save_json_to_file, json_from_file,\
json_from_string, valid_json, check_field_exists, get_field_value, put_value,\
parse_boolean, set_timestamp, get_container_dir, get_contai... |
6,565 | virtual hub | # 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... |
6,566 | stop | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2022 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
6,567 | test l10n nl | # python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2... |
6,568 | test step | # Copyright 2018 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... |
6,569 | deal with discrete | # Copyright 2022 The Kubeflow 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 ... |
6,570 | test enqueue in a function sets time | import datetime
import pytest
from kolibri.core.tasks.exceptions import JobRunning
from kolibri.core.tasks.job import Job
from kolibri.core.tasks.storage import Storage
from kolibri.core.tasks.test.base import connection
from kolibri.utils.time_utils import local_now
from kolibri.utils.time_utils import naive_utc_dat... |
6,571 | initialize boto3 credential providers | import logging
import os
import threading
import time
from typing import Any
import boto3
from botocore import session
from botocore.compat import ensure_unicode
from botocore.credentials import (
CredentialProvider,
Credentials,
ReadOnlyCredentials,
SharedCredentialProvider,
)
from botocore.session im... |
6,572 | test dashboard | # 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... |
6,573 | make im bigger if needed | import os
import shutil
import math
from zou.app.utils import fs
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
Image.MAX_IMAGE_PIXELS = 20000 * 20000
RECTANGLE_SIZE = 150, 100
SQUARE_SIZE = 100, 100
PREVIEW_SIZE = 1200, 0
BIG_SQUARE_SIZE = 400, 400
def save_file(tmp_folder, instance_id, ... |
6,574 | test linkerror | import os
import unittest
import osc.core
import osc.oscerr
from .common import GET, PUT, OscTestCase
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'setlinkrev_fixtures')
def suite():
return unittest.defaultTestLoader.loadTestsFromTestCase(TestSetLinkRev)
class TestSetLinkRev(OscTestCase):
def ... |
6,575 | process | import asab
import datetime
import logging
import os.path
from ..abc.sink import Sink
L = logging.getLogger(__file__)
class FileTableauSink(Sink):
ConfigDefaults = {
'path': '',
'rotate_period': 1,
'table_name': 'Extract',
}
def __init__(self, app, pipeline, id=None, config=None):
super().__init__(app,... |
6,576 | test eval | # Copyright 2020-2023 OpenDR European Project
#
# 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 agree... |
6,577 | test get forecast scalar | import copy
import unittest
from systems.tests.testdata import get_test_object_futures_with_rules
from systems.basesystem import System
from systems.forecast_scale_cap import ForecastScaleCap
class Test(unittest.TestCase):
def setUp(self):
(rules, rawdata, data, config) = get_test_object_futures_with_rul... |
6,578 | make request message | from typing import Dict, List, Tuple
from zulip_bots.bots.game_of_fifteen.game_of_fifteen import GameOfFifteenModel
from zulip_bots.game_handler import BadMoveException
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestGameOfFifteenBot(BotTestCase, DefaultTests):
bot_name = "game_of_fifteen"
... |
6,579 | reverse map | # sage.doctest: needs sage.rings.number_field
"""
QQbar decorators
Python decorators for use with the algebraic field QQbar.
AUTHORS:
- Brent Baccala (7 Jun 2018) -- handle_AA_and_QQbar
Decorators
==========
"""
from sage.misc.decorators import decorator_keywords, sage_wraps
@decorator_keywords
def handle_AA_and_... |
6,580 | find scale by percentile | # 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... |
6,581 | replace installed | import os
import pathlib
import sys
import libmambapy
from .utils import get_index, load_channels
__all__ = ["MambaSolver", "create", "install"]
class MambaSolver:
def __init__(self, channels, platform, context, output_folder=None):
self.channels = channels
self.platform = platform
self... |
6,582 | make bold | import abc
import colorlog
import contextlib
import inspect
import io
import logging
import sys
import traceback
from magma.backend.util import make_relative
from magma.common import Stack
from magma.config import config, EnvConfig
config._register(
log_stream=EnvConfig("MAGMA_LOG_STREAM", "stderr"),
log_lev... |
6,583 | related adjudicator set | from django.db import models
from django.utils.translation import gettext_lazy as _
class DebateAdjudicatorManager(models.Manager):
use_for_related_fields = True
def get_queryset(self):
return super().get_queryset().select_related('debate')
class DebateAdjudicator(models.Model):
TYPE_CHAIR = 'C... |
6,584 | save packages | # -*- coding: utf-8 -*-
#
# Copyright (c) 2008--2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You ... |
6,585 | create controller inventory | """Inventory creation from host profiles."""
from __future__ import annotations
import shutil
import typing as t
from .config import (
EnvironmentConfig,
)
from .util import (
sanitize_host_name,
exclude_none_values,
)
from .host_profiles import (
ControllerHostProfile,
ControllerProfile,
Ho... |
6,586 | load pascal annotation | # imports
import json
import time
import pickle
import scipy.misc
import skimage.io
import caffe
import numpy as np
import os.path as osp
from xml.dom import minidom
from random import shuffle
from threading import Thread
from PIL import Image
from tools import SimpleTransformer
class PascalMultilabelDataLayerSync... |
6,587 | cleanup | # Copyright (c) 2021, 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... |
6,588 | training step | # Copyright The Lightning AI team.
#
# 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... |
6,589 | present | """
Management of PostgreSQL databases
==================================
The postgres_database module is used to create and manage Postgres databases.
Databases can be set as either absent or present
.. code-block:: yaml
frank:
postgres_database.present
"""
def __virtual__():
"""
Only load if th... |
6,590 | on model | # Class for handling Wired Networking Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
from resources import constants, device_probe
from resources.build import support
from data import smbios_data, cpu_data
class BuildWiredNetworking:
"""
Build Library for Wired Networ... |
6,591 | test linear | # /*##########################################################################
# Copyright (C) 2016 European Synchrotron Radiation Facility
#
# 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 w... |
6,592 | print deprecation message | import logging
import sublime
from . import events, util
from .const import IS_ENABLED_SWITCH
from jsonschema import validate, FormatChecker, ValidationError
logger = logging.getLogger(__name__)
class Settings:
"""This class provides global access to and management of plugin settings."""
def __init__(self... |
6,593 | test empty storage | # coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
6,594 | test discover master sentinel down | import socket
import pytest
import redis.sentinel
from redis import exceptions
from redis.sentinel import (
MasterNotFoundError,
Sentinel,
SentinelConnectionPool,
SlaveNotFoundError,
)
@pytest.fixture(scope="module")
def master_ip(master_host):
yield socket.gethostbyname(master_host[0])
class S... |
6,595 | table dictize | # encoding: utf-8
from __future__ import annotations
import datetime
from typing import Any, Callable, Iterable
import sqlalchemy
from sqlalchemy import Table
from sqlalchemy.engine import Row # type: ignore
from sqlalchemy.orm import class_mapper
from ckan.model.core import State
from ckan.types import Context
#... |
6,596 | is hip clang | #!/usr/bin/env python3
import argparse
import os
import sys
sys.path.append(
os.path.realpath(
os.path.join(
__file__, os.path.pardir, os.path.pardir, os.path.pardir, "torch", "utils"
)
)
)
from hipify import hipify_python # type: ignore[import]
parser = argparse.ArgumentParser... |
6,597 | setup method | # Copyright (c) 2022, 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... |
6,598 | unify configs | import json
import os
import logging
from omegaconf import OmegaConf
from buildpack import util
from buildpack.databroker.config_generator.scripts.utils import (
convert_dot_field_to_dict,
get_value_for_constant,
)
from buildpack.databroker.config_generator.scripts.constants import (
ENV_VAR_RUNTIME_PREFIX... |
6,599 | to device | import copy
from typing import Any, cast
import srsly
from ..compat import mxnet as mx
from ..optimizers import Optimizer
from ..types import ArgsKwargs, FloatsXd
from ..util import (
convert_recursive,
get_array_module,
make_tempfile,
mxnet2xp,
xp2mxnet,
)
from .shim import Shim
class MXNetShim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.