id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
19,300 | slug | # coding=utf-8
from requests import HTTPError
from ..base import BitbucketCloudBase
from .permissions import Permissions
from .projects import Projects
from ..repositories import WorkspaceRepositories
class Workspaces(BitbucketCloudBase):
def __init__(self, url, *args, **kwargs):
super(Workspaces, self)... |
19,301 | test rm dns | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import types
import pytest
import salt.modules.win_dns_client as win_dns_client
import salt.utils.stringutils
from tests.support.mock import MagicMock, Mock, patch
wmi = pytest.importorskip("wmi", reason="WMI only available on Windows")
class Mockwmi... |
19,302 | initialize | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
import threading
from datetime import datetime
from functools import partial
from typing import Any, Dict, List, Optional, Type
from lisa import schema
from lisa.messages import MessageBase
from lisa.util import InitializableMixin, c... |
19,303 | from callable | """Discrete transitions."""
from typing import Callable, Optional
import numpy as np
from probnum import randvars
from probnum.randprocs.markov import _transition
from probnum.randprocs.markov.discrete import _condition_state
from probnum.typing import ArrayLike, FloatLike, IntLike
class NonlinearGaussian(_transit... |
19,304 | recover sequential from dict | import copy
import inspect
from collections import OrderedDict
try:
from torch.nn import Sequential as tSeq
from federatedml.nn.backend.torch import optim, init, nn
from federatedml.nn.backend.torch import operation
from federatedml.nn.backend.torch.base import Sequential, get_torch_instance
from fe... |
19,305 | test exponent32 | # /*##########################################################################
# Copyright (C) 2016-2021 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 Softw... |
19,306 | generate strategy with dim partition | import copy
import operator
from functools import reduce
from typing import List
from colossalai.auto_parallel.tensor_shard.sharding_strategy import MemoryCost, ShardingStrategy, TrainCycleItem
from colossalai.auto_parallel.tensor_shard.utils import (
enumerate_all_possible_1d_sharding,
enumerate_all_possible_... |
19,307 | clean meetingtype | import django.forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils import timezone
from collections import OrderedDict
from datetime import timedelta
from postgresqleu.util.time import time_sinceoruntil, datetime_string
from postgresqleu.util.widgets import Stati... |
19,308 | test model manager class | from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.test.testcases import TestCase
from django.urls import re_path
from wiki.conf import settings
from wiki.managers import ArticleManager
from wiki.models import Article
from wiki.models imp... |
19,309 | convert value | #
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... |
19,310 | test event file read and automatic sort | 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... |
19,311 | admin view | import sys
from collections.abc import Callable, Iterable
from typing import Any
from django.apps.config import AppConfig
from django.contrib.admin.options import ModelAdmin
from django.contrib.auth.forms import AuthenticationForm
from django.core.checks import CheckMessage
from django.db.models.base import Model
from... |
19,312 | from pil | """NDS rom icon banner, contains the localized rom name and icon"""
# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
#
# SkyTemple is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... |
19,313 | tosqlite | #!/usr/bin/env python3
from __future__ import print_function
import re
import json
import ROOT
import sqlite3
import argparse
parser = argparse.ArgumentParser(description="Convert arbitrary ROOT file to SQLite database, mapping TTrees to tables and converting TObjects to JSON.")
parser.add_argument('inputfile', help=... |
19,314 | list users | # THIS FILE IS AUTO-GENERATED. DO NOT EDIT
class OrganizationApi:
def __init__(self, client, base_path = "/v1"):
self.client = client
self.base_path = base_path
def addUser(self, body=None):
__query = {
}
if body is None:
raise Exception("Missing required parameter \"body\"")
format... |
19,315 | get str uuid | import uuid
import re
from datetime import date
from django.db import models
from django.db.models import Q, ExpressionWrapper, BooleanField
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse
from ckeditor.fields import RichTextField
from reversion import revisions
from core.mod... |
19,316 | test when create transformers nlp engine then | from pathlib import Path
import pytest
import spacy
from presidio_analyzer.nlp_engine import (
SpacyNlpEngine,
StanzaNlpEngine,
NlpEngineProvider,
)
from presidio_analyzer.nlp_engine.transformers_nlp_engine import TransformersNlpEngine
def test_when_create_nlp_engine__then_return_default_configuration()... |
19,317 | export create presigned url | """
Service handler for generating pre-signed URLs for S3 storages.
Permissions to request a URL for a given action are mapped against FC permissions
This service can serve presigned URL for any S3 storage it has the credentials for.
.. literalinclude:: ../ConfigTemplate.cfg
:start-after: ##BEGIN S3Gateway
:end-b... |
19,318 | format | #!/usr/bin/env python
"""Log utilities for tmuxp.
tmuxp.log
~~~~~~~~~
"""
import logging
import time
import typing as t
from colorama import Fore, Style
LEVEL_COLORS = {
"DEBUG": Fore.BLUE, # Blue
"INFO": Fore.GREEN, # Green
"WARNING": Fore.YELLOW,
"ERROR": Fore.RED,
"CRITICAL": Fore.RED,
}
L... |
19,319 | get test session | from sqlalchemy import create_engine
from sqlalchemy import MetaData
from sqlalchemy.orm import sessionmaker, session
from contextlib import contextmanager
import logging
from decouple import config as _config
from decouple import Choices
from pathlib import Path
import io
DATABASE = _config('CLOUD_SERVICE')
sslmode =... |
19,320 | handle input | # Copyright 2017 Battelle Energy Alliance, 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 t... |
19,321 | get bitcell pins | # See LICENSE for licensing information.
#
# Copyright (c) 2016-2023 Regents of the University of California, Santa Cruz
# All rights reserved.
#
from openram import debug
from openram.base import vector
from openram.sram_factory import factory
from openram.tech import layer_properties as layer_props
from openram impor... |
19,322 | test get classification | """
Tests for the OMeta tag MixIn
"""
import unittest
from unittest import TestCase
from metadata.generated.schema.api.classification.createClassification import (
CreateClassificationRequest,
)
from metadata.generated.schema.api.classification.createTag import CreateTagRequest
from metadata.generated.schema.enti... |
19,323 | make netloc | """
Conda lock supports two kinds of credentials used for channels
## Token based
These are used by anaconda.org, Anaconda Enterprise and Quetz
To pass one of these channels specify them in your source with an environment variable
Make sure this environment variable is not expanded.
--channel 'http://host.com/t/$M... |
19,324 | showcase requests | from collections import defaultdict
import cherrypy
from pockets.autolog import log
from uber.config import c
from uber.decorators import ajax, all_renderable, csv_file
from uber.errors import HTTPRedirect
from uber.models import Attendee, MITSTeam
from uber.utils import add_opt, check_csrf
@all_renderable()
class ... |
19,325 | option to map | #!/usr/bin/python3
# ==============================================================================
#
# Copyright (C) 2022 Sophgo Technologies Inc. All rights reserved.
#
# TPU-MLIR is licensed under the 2-Clause BSD License except for the
# third-party components.
#
# =================================================... |
19,326 | test transpose | """Tests for runway.cfngin.dag."""
# pyright: basic
import threading
from typing import Any, List
import pytest
from runway.cfngin.dag import (
DAG,
DAGValidationError,
ThreadedWalker,
UnlimitedSemaphore,
)
def test_add_node(empty_dag: DAG) -> None:
"""Test add node."""
dag = empty_dag
... |
19,327 | load importable | ###
#
# Copyright Alan Kennedy.
#
# You may contact the copyright holder at this uri:
#
# http://www.xhaus.com/contact/modjy
#
# The licence under which this code is released is the Apache License v2.0.
#
# The terms and conditions of this license are listed in a file contained
# in the distribution that also cont... |
19,328 | validate serial no | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from frappe import _
from frappe.utils import format_date, get_datetime
from erpnext.utilities.transaction_base import TransactionBase
class MaintenanceVisit(TransactionBase)... |
19,329 | get stimuli description | import os
import logging
import pg8000
from allensdk.core.authentication import credential_injector
from allensdk.core.auth_config import LIMS_DB_CREDENTIAL_MAP
from ipfx.string_utils import to_str
TIMEOUT = os.environ.get(
"IPFX_LIMS_TIMEOUT",
os.environ.get(
"IPFX_TEST_TIMEOUT",
None
)... |
19,330 | on shutdown | # Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2.... |
19,331 | set dtype | import numpy as np
import torch
class Config:
def __init__(self):
"""
Default configuration initilization.
"""
self.BACKEND = "numpy"
self.DTYPE = "float64"
self.DEVICE = None
self.SHOW_PROGRESS = True
def set_device(self, device=None):
"""
... |
19,332 | get activity object | # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import Optional
import ckan.authz as authz
import ckan.plugins.toolkit as tk
from ckan.types import Context, DataDict, AuthResult
from ..model import Activity
def METHOD_NAME(
context: Context, data_dict: Optional[DataDict] = None
) -> Act... |
19,333 | sentry enqueue job | from __future__ import absolute_import
import sys
from sentry_sdk._compat import reraise
from sentry_sdk._types import TYPE_CHECKING
from sentry_sdk import Hub
from sentry_sdk.consts import OP
from sentry_sdk.hub import _should_send_default_pii
from sentry_sdk.integrations import DidNotEnable, Integration
from sentry... |
19,334 | decode hash | # 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, ... |
19,335 | test should convert cmyk jpeg to heif | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2022 globo.com thumbor@googlegroups.com
from shutil import which
from preggy import expect
from tornado.tes... |
19,336 | get public gcs table metadata | """Generate and upload JSON metadata files for public datasets on GCS."""
import json
import logging
import os
import re
from argparse import ArgumentParser
from itertools import groupby
import smart_open
from google.cloud import storage # type: ignore
from bigquery_etl.config import ConfigLoader
from bigquery_etl.... |
19,337 | test artifactpriority detail api unauthorized | import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase
from dfirtrack_artifacts.models import Artifactpriority
class ArtifactpriorityAPIViewTestCase(TestCase):
"""artifactpriority API view tests"""
@classmethod
def setUpTestData(cls):
# create object
... |
19,338 | fit | # ==============================================================================
# Copyright 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.o... |
19,339 | show predictions | # Copyright The PyTorch Lightning 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 i... |
19,340 | on webserver init | """Blueprints define reusable web apps.
They are lazy and need to be registered to an app to be activated:
.. sourcecode:: python
from faust import web
blueprint = web.Blueprint('users')
cache = blueprint.cache(timeout=300.0)
@blueprint.route('/', name='list')
class UserListView(web.View):
... |
19,341 | create | from travertino.size import at_least
from ..libs import (
Gtk,
get_background_color_css,
get_color_css,
get_font_css,
gtk_alignment,
)
from .base import Widget
class MultilineTextInput(Widget):
def METHOD_NAME(self):
# Wrap the TextView in a ScrolledWindow in order to show a
#... |
19,342 | test jtvec adjoint test h jform | import unittest
import numpy as np
from scipy.constants import mu_0
from SimPEG.electromagnetics.utils.testing_utils import getFDEMProblem
testJ = True
testH = True
verbose = False
TOL = 1e-5
FLR = 1e-20 # "zero", so if residual below this --> pass regardless of order
CONDUCTIVITY = 1e1
MU = mu_0
freq = 1e-1
addran... |
19,343 | test change hidden layers | # coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
19,344 | get monitors info | #!/usr/bin/env python3
#
# This file is part of Checkbox.
#
# Copyright 2022 Canonical Ltd.
#
# Authors:
# Pierre Equoy <pierre.equoy@canonical.com>
#
# Checkbox 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 Softwar... |
19,345 | decrease refcnt | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Synchronized and object-oriented WebSocket class.
WebSocket guarantees that messages will not be divided at API level.
"""
from __future__ import annotations
__all__ = ['WsConnection']
import asyncio
import logging
from threading import L... |
19,346 | int2word | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .base import Num2Word_Base
from .utils import get_digits, splitbyx
ZERO = ('nulle',)
ONES = {
1: ('viens',),
2: ('divi',),
3: ('trīs',),
4: ('četri',),
5: ('pieci',),
6: ('seši',),
7: ('septiņi',),
8: ('astoņi',),
... |
19,347 | suitable | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
parse_iso8601,
float_or_none,
int_or_none,
compat_str,
determine_ext,
)
class HitboxIE(InfoExtractor):
IE_NAME = 'hitbox'
_VALID_URL = r'https?://(?:w... |
19,348 | test process name | #!/usr/bin/env pmpython
#
# Copyright (c) 2022 Oracle and/or its affiliates.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# 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; eit... |
19,349 | run continuous injection | # Copyright 2016, FBPIC contributors
# Authors: Remi Lehe, Manuel Kirchen
# License: 3-Clause-BSD-LBNL
"""
This test file is part of FB-PIC (Fourier-Bessel Particle-In-Cell).
It verifies that the continuous injection of plasma works as intended by:
- Initializing a plasma partially inside the box, and partially throug... |
19,350 | cached reading log leaderboard | """Loan Stats"""
import web
from infogami.utils import delegate
from ..core.lending import get_availabilities
from infogami.utils.view import public
from ..utils import dateutil
from .. import app
from ..core import cache
from ..core.observations import Observations
from ..core.booknotes import Booknotes
from ..core... |
19,351 | define from verilog file | from mako.template import Template
from magma.circuit import DeclareCircuit, DefineCircuit, EndDefine
from magma.common import deprecated
from magma.config import config, RuntimeConfig
from magma.frontend.dummy_verilog_importer import DummyVerilogImporter
from magma.frontend.verilog_importer import ImportMode
_pyver... |
19,352 | prefix | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2001-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... |
19,353 | mode helper | # Copyright 2023 The JAX 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
19,354 | extract dmg contents | # 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 os
import platform
import shutil
import subprocess
from pathlib import Path
from typing import List
import mozfi... |
19,355 | synthetic data | # Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
import pandas as pd
import pytest
from tests.common_utils import create_adult_income_dataset
# Constants representing columns in the synthetic_data fixture
SYNTHETIC_DATA_LABEL = "Label"
SYNTHETIC_DATA_GENDER = "Gender"
SYNTHETIC_DATA_ETHNICITY =... |
19,356 | select | import weakref
import numpy as np
from sqlalchemy import Boolean, Column, ForeignKey, Integer, func
from sqlalchemy.orm import Session, backref, relationship
from ..config import LARGE_BINARY
from ..log import logger
from . import Base, creator
from .dictionary import get_or_create_dictionary_item
from .halo import T... |
19,357 | load | # ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# Copyright (c) 2018-2023 www.open3d.org
# SPDX-License-Identifier: MIT
# ---------... |
19,358 | test protect lists of dicts | # SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
from __future__ import absolute_import
from __future__ import division
import json
import marshal
import pickle
from testlib import VdsmTestCase
from testlib import expandPermutations, permutations
from vdsm.common.password import (... |
19,359 | stack size | """ This module reimplements Python's native thread module using Panda
threading constructs. It's designed as a drop-in replacement for the
thread module for code that works with Panda; it is necessary because
in some compilation models, Panda's threading constructs are
incompatible with the OS-provided threads used b... |
19,360 | symptomatic contact of confirmed case | import datetime
from dateutil.relativedelta import relativedelta
from care.facility.models import (
DISEASE_CHOICES_MAP,
SYMPTOM_CHOICES,
PatientConsultation,
PatientContactDetails,
PatientRegistration,
PatientSample,
)
class PatientIcmr(PatientRegistration):
class Meta:
proxy = ... |
19,361 | factory | #!/usr/bin/env python
#
# Generated Sun Jun 14 12:18:10 2015 by parse_xsd.py version 0.5.
#
import saml2
from saml2 import SamlBase
NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
class TTimestampFault_(SamlBase):
"""The http://docs.oasis-open.org/wss/2004/01/o... |
19,362 | test import | #!/usr/bin/env python
#ckwg +28
# Copyright 2011-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,... |
19,363 | value and input files from input | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2023
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published... |
19,364 | xyorigin | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides tools for generating 2D image cutouts.
"""
import numpy as np
from astropy.nddata import extract_array, overlap_slices
from astropy.utils import lazyproperty
from photutils.aperture import BoundingBox
__all__ = ['CutoutImage']
... |
19,365 | check ipv4 | #!/usr/bin/env python
# Copyright (c) 2012 Hung-Te Lin <piaip@csie.ntu.edu.tw>. All rights reserved.
# Use of this source code is governed by a BSD license.
"""
banipd: Daemon to check if an IP is banned, and sending to reason.
"""
from io import open
import eventlet
import getopt
import logging
import pprint
import ... |
19,366 | bgp check hard reset | #!/usr/bin/env python
# SPDX-License-Identifier: ISC
#
# bgp_gr_notification.py
#
# Copyright (c) 2022 by
# Donatas Abraitis <donatas@opensourcerouting.org>
#
"""
TC1: Disable the link between R1-R2 and wait for HoldTimerExpire notification:
1) Check if R2 sent HoldTimerExpired notification
2) Check if the ro... |
19,367 | up | """Migration for the Submitty master database."""
def METHOD_NAME(config, database):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with given database for environment
:type ... |
19,368 | create position | """
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', '... |
19,369 | is state valid | #!/usr/bin/env python
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... |
19,370 | export study | from abc import ABC, abstractmethod
from pathlib import Path
from typing import IO, Generic, List, Optional, Sequence, TypeVar, Union
from antarest.core.exceptions import StudyNotFoundError
from antarest.core.model import JSON
from antarest.core.requests import RequestParameters
from antarest.study.model import Study,... |
19,371 | validate version | import os
import traceback
from enum import IntEnum
from os import path
from struct import unpack
from database.dbc.DbcDatabaseManager import DbcDatabaseManager
from game.world.managers.maps.helpers.Constants import RESOLUTION_ZMAP, RESOLUTION_LIQUIDS, RESOLUTION_AREA_INFO
from network.packet.PacketReader import Packe... |
19,372 | skus | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . imp... |
19,373 | main | #!/usr/bin/python
##################
# taskWorkerM.py
#
# Copyright David Baddeley, 2009
# d.baddeley@auckland.ac.nz
#
# 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 3 of the Li... |
19,374 | format time | import os
import re
from datetime import datetime, timezone, timedelta
def parse_timestamp(timestamp, tzinfo=timezone.utc):
"""Parse a ISO 8601 timestamp string.
For naive/unaware dt, assume it is in tzinfo timezone (default: UTC).
"""
dt = datetime.fromisoformat(timestamp)
if dt.tzinfo is None:
... |
19,375 | get test versions ids | """
tests.e2e.compat.test_with_versions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test current salt master with older salt minions
"""
import logging
import pathlib
import pytest
from saltfactories.daemons.container import SaltMinion
from saltfactories.utils import random_string
import salt.utils.platform
from... |
19,376 | calc mean | import ast
import operator
import statistics
from collections import defaultdict
from decimal import Decimal
from api import settings
from api.ext.moneyformat import truncate
NO_RATE = Decimal("NaN")
MAX_DEPTH = 8
class ExchangePair:
def __init__(self, left, right=None):
if right is None:
pa... |
19,377 | temporary file exists | import json
import os
import tempfile
import uuid
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.core.files import File
from django.db import models
from django.urls import Resolver404, resolve
from django.utils.translation import gettext_lazy as _
from d... |
19,378 | check sortings equal | import numpy as np
from numpy.testing import assert_array_equal
from .base import BaseExtractor
from .baserecording import BaseRecording
from .basesorting import BaseSorting
def check_sorted_arrays_equal(a1, a2):
a1 = np.sort(np.array(a1))
a2 = np.sort(np.array(a2))
assert_array_equal(a1, a2)
def check_... |
19,379 | test next page token | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from http import HTTPStatus
from unittest.mock import MagicMock
import pytest
from airbyte_cdk.sources.streams.http.auth import BasicHttpAuthenticator
from source_insightly.source import InsightlyStream
authenticator = BasicHttpAuthenticator(username="test... |
19,380 | get driver | #
# 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... |
19,381 | date | """Timestamp class and associated."""
# --- import --------------------------------------------------------------------------------------
import time
import dateutil
from dateutil import tz
import datetime
# --- define --------------------------------------------------------------------------------------
__all... |
19,382 | test reset method | #!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... |
19,383 | initiate | import json
import logging
import os
import subprocess
from dataclasses import dataclass
from datetime import datetime, timedelta
from pathlib import Path
import ape
import apischema
import pytest
from eth_typing import ChecksumAddress
from freezegun import freeze_time
import beamer.check.commands
from beamer.artifac... |
19,384 | call | # Standard Library
import errno
import os
import shutil
import time
# Third Party
import horovod.tensorflow as hvd
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import BatchNormalization, Conv2D, Dense, Flatten
from utils import log_result
# First Party
import smdistributed.modelparallel.ten... |
19,385 | update time | # 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... |
19,386 | share delete retention policy | # 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... |
19,387 | respond | from __future__ import annotations
from datetime import datetime
from inspect import isawaitable
from multiprocessing.connection import Connection
from os import environ
from pathlib import Path
from typing import Any, Dict, Mapping, Union
from sanic.exceptions import Unauthorized
from sanic.helpers import Default
fr... |
19,388 | header parameters | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
19,389 | handle inlay hint text edits | from .core.css import css
from .core.protocol import InlayHint
from .core.protocol import InlayHintLabelPart
from .core.protocol import MarkupContent
from .core.protocol import Request
from .core.registry import LspTextCommand
from .core.registry import LspWindowCommand
from .core.sessions import Session
from .core.set... |
19,390 | id | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . imp... |
19,391 | check koji pkg spec | #!/usr/bin/env python
"""
This is a tool for that makes it easy to understand what a given KojiPkgSpec
syntax will expand to.
The main use case is making sure the packages specified in a KojiInstaller
will match the packages you intended to install.
"""
import sys
import optparse
import os
# simple magic for using ... |
19,392 | get supported | from __future__ import print_function, unicode_literals
import collections
import os
import sys
import PIL
from . import Image
modules = {
"pil": "PIL._imaging",
"tkinter": "PIL._tkinter_finder",
"freetype2": "PIL._imagingft",
"littlecms2": "PIL._imagingcms",
"webp": "PIL._webp",
}
def check_m... |
19,393 | test ping unknown | import uuid
import pytest
from pr2test.context_manager import make_test_matrix
from pr2test.marks import require_root
from pr2test.tools import address_exists, interface_exists
from pyroute2.ndb.transaction import (
CheckProcess,
CheckProcessException,
Not,
PingAddress,
)
pytestmark = [require_root()... |
19,394 | run tests | #!/usr/bin/env python3
"""
author: deadc0de6 (https://github.com/deadc0de6)
Copyright (c) 2020, deadc0de6
tests launcher
"""
import os
import sys
import subprocess
import argparse
from concurrent import futures
from halo import Halo
GITHUB_ENV = 'GITHUB_WORKFLOW'
def is_cicd():
"""are we in a CICD env (githu... |
19,395 | test update org invited user set status | import pytest
from app.models import INVITE_PENDING, Notification
from tests.app.db import create_invited_org_user
@pytest.mark.parametrize(
"extra_args, expected_start_of_invite_url",
[
({}, "http://localhost:6012/organisation-invitation/"),
(
{"invite_link_host": "https://www.ex... |
19,396 | api librato webhook | from datetime import datetime, timezone
from typing import Any, Callable, Dict, List, Mapping, Tuple
import orjson
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from zerver.decorator import webhook_view
from zerver.lib.exceptions import JsonableError
from zerver.l... |
19,397 | is devdax | # SPDX-License-Identifier: BSD-3-Clause
# Copyright 2019-2023, Intel Corporation
#
"""External tools integration"""
import os
import json
import subprocess as sp
import futils
try:
import envconfig
envconfig = envconfig.config
except ImportError:
# if file doesn't exist create dummy object
envconfig ... |
19,398 | test describe regions dryrun | import boto3
import pytest
from botocore.exceptions import ClientError
from moto import mock_autoscaling, mock_ec2, mock_elb
from tests import EXAMPLE_AMI_ID, EXAMPLE_AMI_ID2
from uuid import uuid4
from .test_instances import retrieve_all_instances
def add_servers_to_region_boto3(ami_id, count, region):
ec2 = b... |
19,399 | on 204 | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.