filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_31878 | # -*- coding: utf-8 -*-
class Customer(object):
"""Implementation of the 'Customer' model.
The finicity customer record
Attributes:
id (string): Finicity’s ID for the customer
username (string): The username associated with the customer
first_name (string): The first... |
the-stack_106_31882 | """scrapli.driver.network_driver"""
import logging
import re
import warnings
from abc import ABC, abstractmethod
from collections import namedtuple
from typing import Any, Dict, List, Optional, Union
from scrapli.driver.generic_driver import GenericDriver
from scrapli.exceptions import CouldNotAcquirePrivLevel, Unknow... |
the-stack_106_31883 | #
# Copyright (c) 2017-2020 cTuning foundation.
# See CK COPYRIGHT.txt for copyright details.
#
# See CK LICENSE for licensing details.
# See CK COPYRIGHT for copyright details.
#
# Convert raw output of a GEMM test program to the CK format.
#
# Developer(s):
# - Anton Lokhmotov, dividiti, 2017, 2020
#
import json
i... |
the-stack_106_31884 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from CTFd.utils import set_config
from tests.helpers import *
from freezegun import freeze_time
def test_api_hint_404():
"""Are admin protected resources accessible by admins/non-admins"""
app = create_ctfd()
endpoints = ['/api/v1/configs/{}',
... |
the-stack_106_31888 | from django.contrib.postgres.search import SearchVector
from celery import shared_task
from .models import ProductSKU
@shared_task
def update_search_vector(obj_id):
product = ProductSKU.objects.get(id=obj_id)
product.search_vector = (
SearchVector('name', weight='A')
+ SearchVector('detail', w... |
the-stack_106_31889 | #!/usr/bin/python3
import csv
from operator import itemgetter
import sys
current_venue = ""
current_bat = ""
current_runs=0
current_deli=0
li=[]
tot_list=[]
for line in sys.stdin:
line = line.strip()
line_val = line.split(",")
if(len(line_val)==5):
venue, bat, runs, deli = line_val[0]+','+line_val[1], line_val[... |
the-stack_106_31893 | import logging
from typing import Optional
from fastapi import Depends, HTTPException, status
from fastapi.param_functions import Header
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials, SecurityScopes
from fastapi.security import utils as security_utils
from dependency_injector import wiring
fro... |
the-stack_106_31894 | import _plotly_utils.basevalidators
class NamelengthsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="namelengthsrc",
parent_name="scatterpolargl.hoverlabel",
**kwargs
):
super(NamelengthsrcValidator, self).__init__(
p... |
the-stack_106_31895 | import os
import unittest
#import satsearch.config as config
#from satsearch.scene import Scenes
from datetime import datetime
from satstac import utils
class Test(unittest.TestCase):
path = os.path.dirname(__file__)
remote_url = 'https://landsat-stac.s3.amazonaws.com/catalog.json'
def test_dict_merg... |
the-stack_106_31896 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018, KubeVirt Team <@kubevirt>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
module: k8s_auth
short_... |
the-stack_106_31898 | """
Including Other Files
=====================
FEE files may contain other files; to load another file, use the ``Include``
verb::
Include anchors.fee;
"""
from . import FEEVerb
import lark
import os
PARSEOPTS = dict(use_helpers=True)
GRAMMAR = """
?start: action
action: ESCAPED_STRING
"""
VERBS = ["Include",... |
the-stack_106_31899 | import datetime
from datetime import datetime
import time
import requests
import pyttsx3
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import speech_recognition as spreg
from selenium.webdriver.chrome.options import Options
driver = webdriver.Ch... |
the-stack_106_31901 | import pytest
from vending_machine.hoge.vending_machine import VendingMachine
# 自販機に金額を投入できることを確認するテスト
def test_insert_money():
vending_machine = VendingMachine()
vending_machine.insert(100)
# 【Vending Machineの機能】10円、100円、XX
## テスト内容:指定された金額は受け入れて、それ以外はErrorを起こすテスト
insert_money_list = [
(10),
(50),
... |
the-stack_106_31902 | from datetime import date
start = date(2020, 1, 1)
today = date.today()
delta = today - start
if (delta.days < 101):
print("Today is day {}".format(delta.days))
else:
print('100 Days of Code sprint has ended') |
the-stack_106_31903 | from django.db.models.fields.related import ManyToOneRel
from django.conf import settings
from django_filters import FilterSet, Filter
from django_filters.filterset import get_model_field
from django.contrib.gis import forms
from .settings import app_settings, API_SRID
from .widgets import HiddenGeometryWidget
clas... |
the-stack_106_31904 | from itertools import zip_longest
from typing import Callable, Dict
import urllib3
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport
# Disable insecure warnings
urllib3.disable_warni... |
the-stack_106_31905 | import os
from torch.utils.data import Dataset
import numpy as np
import torch
import torch.nn.functional as F
import re
class TextDataset(Dataset):
def __init__(self, txt_path, mode='train', seq_len=50, n_steps=50):
assert os.path.exists(txt_path), f"File not found {txt_path}\n"
with open(txt_pat... |
the-stack_106_31906 | #!/usr/bin/env python3
import argparse
from copy import deepcopy
import time
from botocore.exceptions import ClientError
module_info = {
# Name of the module (should be the same as the filename)
'name': 'elb__enum_logging',
# Name and any other notes about the author
'author': 'Spencer Gietzen of Rh... |
the-stack_106_31907 | """Test for tmuxp Server object."""
import logging
from libtmux import Server
from libtmux.common import has_gte_version
logger = logging.getLogger(__name__)
def test_has_session(server, session):
assert server.has_session(session.get("session_name"))
assert not server.has_session("asdf2314324321")
def te... |
the-stack_106_31908 | """Check whether a file format is supported by BIDS and then load it."""
# Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Teon Brooks <teon.brooks@gmail.com>
# Chris Holdgraf <choldgraf@berkeley.edu>
# Stefan App... |
the-stack_106_31911 | from v1_0.user_roles import anonymous_user, authenticated_user, bumblebee_user
import time
import unittest
import adsmutils
import datetime
#resources as of Beehive@v1.0.122
api_resources = {
"adsws.accounts": {
"base": "/v1/accounts",
"endpoints": [
"/oauth/authorize",
"/... |
the-stack_106_31912 | import unittest
import pandas as pd
# from sklearn.datasets import load_boston
import mesostat.utils.pandas_helper as ph
class TestMetricAutocorr(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
data = [
['cat', 5, 'F', 'Susan'],
... |
the-stack_106_31913 | from examples.scheduling.toy_rcpsp_examples import (
MyExampleMRCPSPDomain_WithCost,
MyExampleRCPSPDomain,
)
from skdecide.hub.solver.do_solver.sk_to_do_binding import build_do_domain
# Testing the binding between skdecide and discrete-optimization lib
def create_do_from_sk():
rcpsp_domain = MyExampleRCPS... |
the-stack_106_31914 | from vaccine_feed_ingest_schema import location
from vaccine_feed_ingest.stages import enrichment
def test_add_provider_from_name_minimal(minimal_location):
enrichment._add_provider_from_name(minimal_location)
def test_add_provider_from_name(full_location):
# Clear parent prganization to check
full_loc... |
the-stack_106_31915 | import numpy as np
class HumanOthelloPlayer():
def __init__(self, game):
self.game = game
def play(self, board):
# display(board)
valid = self.game.getValidMoves(board, 1)
for i in range(len(valid)):
if valid[i]:
print(int(i/self.game.n), int(i%self... |
the-stack_106_31918 | #!/usr/bin/env python
"""End to end tests for lib.flows.general.memory."""
import os
from grr.client.components.rekall_support import rekall_types as rdf_rekall_types
from grr.endtoend_tests import base
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import flow_runner
class AbstractTestAnalyze... |
the-stack_106_31919 | from datetime import timedelta
from airflow.utils.dates import days_ago
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
args = {
'owner': 'Airflow',
'start_date': days_ago(2),
}
script="""
set -e
cd /usr/local... |
the-stack_106_31920 | #!/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) 2011 globo.com thumbor@googlegroups.com
import logging
import logging.config
import os
import sys
import war... |
the-stack_106_31921 | """"
名称:089 童芯派 mBuild点阵屏 计时装置
硬件: 童芯派 mBuild点阵屏
功能介绍:
使用点阵屏实现可视化的计时效果,按下A键以点亮点阵屏的方式进行计时,
按下B键以熄灭点阵屏的方式进行计时。
使用到的API及功能解读:
1.cyberpi.led_matrix.on(x, y, 1)
点亮点阵屏指定x、y坐标的led灯
2.cyberpi.led_matrix.off(x, y, 1)
熄灭点阵屏指定x、y坐标的led灯
3.cyberpi.led_matrix.clear(1)
熄灭点阵屏所有的LED灯
难度:⭐⭐⭐⭐
支持的模式:上传模式、在线模式
无
"""
# ---------程序分割线... |
the-stack_106_31922 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... |
the-stack_106_31924 | """Support for Xiaomi water heaters."""
import logging
import math
from homeassistant.const import * # noqa: F401
from homeassistant.components.water_heater import (
DOMAIN as ENTITY_DOMAIN,
WaterHeaterEntity,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_OPERATION_MODE,
)
from . import (
DOMAIN,
CONF_... |
the-stack_106_31925 | # -*- coding: utf-8 -*-
#
# This file is part of MIEZE simulation.
# Copyright (C) 2019, 2020 TUM FRM2 E21 Research Group.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Conversion from eigenfrequency to indexes of the cap... |
the-stack_106_31926 | # Copyright 2022 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
the-stack_106_31927 | # 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 ... |
the-stack_106_31929 | from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="DataProviderStatus")
@attr.s(auto_attribs=True)
class DataProviderStatus:
""" """
is_active: Union[Unset, bool] = UNSET
driver: Union[Unset, str] = UNSET
error: Union[Unset... |
the-stack_106_31930 | # Copyright 2020 Huawei Technologies Co., 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 agreed to... |
the-stack_106_31931 | # -*- coding: utf-8 -*-
import logging
from django.conf import settings
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import MultiPolygon, Polygon
from bims.models.boundary import Boundary
from bims.models.boundary_type import BoundaryType
logger = logging.getLogger(__name__)
class Up... |
the-stack_106_31932 | """BleBox cover entity."""
from openpeerpower.components.cover import (
ATTR_POSITION,
STATE_CLOSED,
STATE_CLOSING,
STATE_OPENING,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
SUPPORT_STOP,
CoverEntity,
)
from . import BleBoxEntity, create_blebox_entities
from .const import B... |
the-stack_106_31933 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
''' A module for helping ban group join spammers. '''
from asyncio import sleep
from requests import get
from teletho... |
the-stack_106_31935 | #!/usr/bin/env python
from __future__ import division
from past.utils import old_div
import os, sys, json, requests, copy, math
from pprint import pprint, pformat
from frameMetadata.FrameMetadata import FrameMetadata
from utils.UrlUtils import UrlUtils
from utils.queryBuilder import postQuery, buildQuery, createMetaOb... |
the-stack_106_31938 | import numpy as np
import pickle
import pdb
from src.visualizations.make_pie_chart import make_pie_chart
def calc_aic(N: int, log_L: float, num_params: int) -> float:
return 2 * num_params - 2 * log_L
def calc_bic(N: int, log_L: float, num_params: int) -> float:
return -2 * log_L + np.log(N) * num_... |
the-stack_106_31942 | # Lint as: python3
# Copyright 2020 The Flax 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 la... |
the-stack_106_31943 | # -*- coding: utf-8 -*-
"""The graphical part of a DFTB+ BandStructure node"""
import logging
import tkinter as tk
import dftbplus_step
import seamm
logger = logging.getLogger(__name__)
class TkBandStructure(seamm.TkNode):
def __init__(
self,
tk_flowchart=None,
node=None,
canva... |
the-stack_106_31944 | # Simple demo of reading and writing the time for the PCF8523 real-time clock.
# Change the if False to if True below to set the time, otherwise it will just
# print the current date and time every second. Notice also comments to adjust
# for working with hardware vs. software I2C.
import time
import board
# For hard... |
the-stack_106_31946 | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_106_31947 | import os
import logging
from logging import Formatter
from logging.handlers import RotatingFileHandler
import json
from easydict import EasyDict
from pprint import pprint
from utils.dirs import create_dirs
def setup_logging(log_dir):
log_file_format = "[%(levelname)s] - %(asctime)s - %(name)s - : %(message)s ... |
the-stack_106_31950 |
"""
Google provides the defer() call as a wrapper around the taskqueue API. Unfortunately
it suffers from serious bugs, and "ticking timebomb" API decisions. Specifically:
- defer(_transactional=True) won't work transactionally if your task > 100kb
- A working defer() might suddenly start blowing up inside transactio... |
the-stack_106_31951 | # Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
import os
import platform
impor... |
the-stack_106_31955 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_106_31956 | """Network layer for MRP."""
from abc import abstractmethod
import asyncio
import logging
from pyatv import exceptions
from pyatv.core.net import tcp_keepalive
from pyatv.interface import StateProducer
from pyatv.protocols.mrp import protobuf
from pyatv.support import chacha20, log_binary, log_protobuf
from pyatv.sup... |
the-stack_106_31958 | import json
import plotly
import pandas as pd
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import word_tokenize
from flask import Flask
from flask import render_template, request, jsonify
from plotly.graph_objs import Bar
from sklearn.externals import joblib
from sqlalchemy import create_engine
app = ... |
the-stack_106_31959 | import threading
import shared
import time
import sys
import os
import pickle
import tr#anslate
from helper_sql import *
from helper_threading import *
from debug import logger
"""
The singleCleaner class is a timer-driven thread that cleans data structures
to free memory, resends messages when a remote node doesn't... |
the-stack_106_31961 | # https://adventofcode.com/2018/day/10
import re
from time import sleep
point = re.compile(r'^position=<\s*(-?\d+),\s*(-?\d+)> velocity=<\s*(-?\d+),\s*(-?\d+)>$')
with open('day10.txt') as file:
points = [tuple(map(int, point.match(line).groups())) for line in file]
def bounding_box(t, plot=False):
current =... |
the-stack_106_31962 | import random
from random import randrange
import time
import colorama
from colorama import Fore, Style
Alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def conv(num, to = 32, froM = 16):
if isinstance(num, str):
n = int(num, froM)
else:
n = int(num)
if n < to:
return Alphabet[n]
el... |
the-stack_106_31963 | r"""
Projective plane conics over a field
AUTHORS:
- Marco Streng (2010-07-20)
- Nick Alexander (2008-01-08)
"""
#*****************************************************************************
# Copyright (C) 2008 Nick Alexander <ncalexander@gmail.com>
# Copyright (C) 2009/2010 Marco Streng <marco.streng... |
the-stack_106_31964 | """This module provides a way to work with and enumerate implementation configurations."""
from dataclasses import dataclass
from enum import Enum
from itertools import product
from typing import (
get_type_hints,
Union,
get_origin,
get_args,
Generator,
FrozenSet,
Any,
)
from public import ... |
the-stack_106_31965 | #!/usr/bin/env python3
"""Figure 6.5, page 135"""
import random
import multiprocessing as mp
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
from tqdm.contrib.concurrent import process_map
ACTIONS_A = 2
ACTIONS_B = 10
INITIAL_Q = {'terminal': np.zeros(2),
'a': np.zeros(ACT... |
the-stack_106_31966 | try: #import default dependencies
import sys
import subprocess
import os
except Exception as p:
print(p)
import discord
from discord.ext import commands
class clone(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def clone(self, ctx,... |
the-stack_106_31967 | #!/usr/bin/env python3
import subprocess
import os
import sys
import json
sys.path.append("../")
sys.path.append("../../system/lib/")
sys.path.append("../array/")
import json_parser
import pos
import cli
import api
import pos_constant
import CREATE_VOL_BASIC_1
ARRAYNAME = CREATE_VOL_BASIC_1.ARRAYNAME
def clear_resul... |
the-stack_106_31971 | """Utilities functions file"""
import json
import re
def load_json(filename: str):
"""Loads a json file"""
with open(filename, encoding="utf-8", mode="r") as file:
data = json.load(file)
return data
def save_json(data: json, filename: str, should_be_sorted=True):
"""Saves a json fil... |
the-stack_106_31972 | import numpy as np
from scipy.spatial import distance
def _gt_weights(W):
"""Computes the weights V for a Guttman transform V X = B(X) Z."""
V = -W
V[np.diag_indices(V.shape[0])] = W.sum(axis=1) - W.diagonal()
return V
def _gt_mapping(D, W, Z):
"""Computes the mapping B(X) for a Guttman transf... |
the-stack_106_31973 | # -*- coding: utf-8 -*-
"""Compute statistical description of datasets"""
import multiprocessing
import itertools
from functools import partial
import numpy as np
import pandas as pd
import matplotlib
from pkg_resources import resource_filename
import pandas_profiling.formatters as formatters
import pandas_profiling.b... |
the-stack_106_31974 | import json
import time
from tools import logger as log
import strategies
def bank_open(**kwargs):
"""
A strategy to open a bank
:param kwargs: strategy, listener, and orders_queue
:return: the input strategy with a report
"""
strategy = kwargs['strategy']
listener = kwargs['listener']
... |
the-stack_106_31975 | """
example cmdline:
python test/reproduction/so/benchmark_so_litebo_math.py --problem branin --n 200 --init 3 --surrogate gp --optimizer scipy --rep 1 --start_id 0
"""
import os
import sys
import time
import numpy as np
import argparse
import pickle as pkl
sys.path.insert(0, os.getcwd())
from test.reproduction.so.s... |
the-stack_106_31978 | # -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Lice... |
the-stack_106_31979 | import math
import sys
import numpy as np
from numba.core.compiler import compile_isolated
import unittest
class TestAutoConstants(unittest.TestCase):
def test_numpy_nan(self):
def pyfunc():
return np.nan
cres = compile_isolated(pyfunc, ())
cfunc = cres.entry_point
... |
the-stack_106_31980 | # Copyright (c) 2015 bitlinker@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... |
the-stack_106_31983 | from collections import namedtuple
from logging import basicConfig, warning, error
from os.path import getmtime, abspath, dirname, join
from datetime import datetime as dt
from sys import argv
from jinja2 import Environment, FileSystemLoader
basicConfig()
Enum = namedtuple('Enum', 'name fields underlying_type')
c... |
the-stack_106_31984 | import shutil
from pathlib import Path
from simplegallery_bulkcreation import core
def cleanup_after_tests():
path = Path("example/gallery")
shutil.rmtree(path)
return True
def test_read_config_empty():
defaults, galleries = core.read_config("file_which_does_not_exists")
assert defaults == {
... |
the-stack_106_31985 | #!/usr/bin/env python3
import queue as q
from typing import List
class Node():
def __init__(self, value):
self.visited = False
self.neighbours: List[Node] = []
self.value = value
def __repr__(self):
return str(self.value)
class Graph():
def __init__(self, nodes):
... |
the-stack_106_31986 | import django_filters
from dal import autocomplete
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.urls import reverse
import operator
from functools import reduce
from .models import AbstractRelation
# TODO __sresch__ : Change th... |
the-stack_106_31987 | #!/usr/bin/python
#
import json
import os
import sqlite3
from datetime import datetime
import requests
from tornado import web, ioloop, httpserver
from .configuration import PlotmanConfig, get_db_path
def PostDat(dp: dict, cfg: PlotmanConfig):
print(dp)
# sending post request and saving response as response... |
the-stack_106_31988 | import pytest
import numpy as np
from aos.solver import Solver, SensitivitySolver
def test_abstract_solver():
with pytest.raises(TypeError):
Solver()
def test_sensitivity_solver_nominal():
solver = SensitivitySolver()
y0 = np.zeros(len(solver.y0) + 1)
# hack because Noll (1976) indexing starts... |
the-stack_106_31989 | # Copyright 2018 The TensorFlow Probability 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 o... |
the-stack_106_31990 | import json
from unittest.mock import MagicMock, patch
import pytest
from django.core.exceptions import PermissionDenied
from order import views
from order.models import Product
class TestBundleDetailView:
def test_get_active_group(self, rf):
"""
Test without any data to a group.
"""
... |
the-stack_106_31993 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import ipaddress
from functools import cached_property
from hashlib import sha256
from ansible_collections.arista.avd.plugins.module_utils.utils import AristaAvdError, get, default, template_var, AristaAvdMissingVariableE... |
the-stack_106_31994 | import logging
import sendgrid
import azure.functions as func
import simplejson as json
from os import environ
from sendgrid.helpers.mail import *
def main(req: func.QueueMessage) -> func.HttpResponse:
try:
logging.info("SendGrid email triggered.")
logging.debug("Parsing message data from reque... |
the-stack_106_31995 | #########################################################################
# _________ ___. ______________________ ___
# \_ ___ \___.__.\_ |__ ___________ / _____/\______ \ \/ /
# / \ \< | | | __ \_/ __ \_ __ \/ \ ___ | _/\ /
# \ \___\___ | | \_\... |
the-stack_106_31996 | from django import forms
from django.utils.translation import gettext_lazy as _
from oscar.core.loading import get_model
from oscar.forms import widgets
Voucher = get_model('voucher', 'Voucher')
VoucherSet = get_model('voucher', 'VoucherSet')
Benefit = get_model('offer', 'Benefit')
Range = get_model('offer',... |
the-stack_106_31997 | from os import path as osp
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from basicsr.data.transforms import augment
from basicsr.utils import FileClient, imfrombytes, img2tensor
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class FFHQ... |
the-stack_106_31999 | """
Fully Written by RoseLoverX
"""
from Evie import tbot, CMD_HELP, OWNER_ID
import os, re, csv, json, time, uuid, pytz
from datetime import datetime
from Evie.function import is_admin
from io import BytesIO
import Evie.modules.sql.feds_sql as sql
from telethon import *
from telethon import Button
from telethon.tl imp... |
the-stack_106_32000 | #!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test the SegWit changeover logic
#
from test_framework.test_framework import PericloinTestFramework
from ... |
the-stack_106_32001 | from pathlib import Path
from typing import Callable, Optional
from unittest import TestCase
# from polyfile import logger
import polyfile.magic
from polyfile.magic import MagicMatcher, MAGIC_DEFS
# logger.setLevel(logger.TRACE)
FILE_TEST_DIR: Path = Path(__file__).parent.parent / "file" / "tests"
class MagicTest... |
the-stack_106_32002 | '''
Author: your name
Date: 2022-02-14 10:27:42
LastEditTime: 2022-02-21 22:49:47
LastEditors: Please set LastEditors
Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
FilePath: \Work\Lensi\web.py
'''
import os
from urllib import request
from urllib.req... |
the-stack_106_32005 | # Copyright (c) 2019-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
the-stack_106_32007 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Sunil Govind and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import datetime
from frappe.utils import get_datetime
class TemporaryChangeNote(D... |
the-stack_106_32009 | '''
lab7
'''
#3.1
i = 0
while i <=5:
if i !=3:
print(i)
i - i +1
#3.2
i = 1
result =1
while i <=5:
result = result *1
i - i +1
print(result)
#3.3
i = 1
result -0
while i <=5:
result - result +1
i - i +1
print(result)
#3.4
i - 3
result -1
while i <=8:
r... |
the-stack_106_32011 | import json
from tabulate import tabulate
def load_json(filename):
"Load a JSON file and return its contents."
with open(filename) as f:
data = json.load(f)
return data
entries = [("Written", load_json('./Results/flickr_results.json')),
("Spoken", load_json('./Results/didec_results.json... |
the-stack_106_32012 | # Copyright (c) 2021 Emanuele Bellocchia
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... |
the-stack_106_32014 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
import logging
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--input-path',
help='The input directory.',
)
parser.add_argument(
'--string-parameter',... |
the-stack_106_32018 | #!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
the-stack_106_32019 | __author__ = "Weswit s.r.l."
__copyright__ = "Copyright 2015, http://www.weswit.com/"
__credits__ = [""]
__license__ = "Apache"
__version__ = "0.0.1"
__maintainer__ = "Weswit"
__email__ = ""
__status__ = "Development"
__url__ = 'https://github.com/Weswit/Lightstreamer-example-StockList-client-python'
__credits__ = ''
|
the-stack_106_32020 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
the-stack_106_32021 | import threading
# encoding=utf-8
__author__ = 'Hinsteny'
# 创建全局ThreadLocal对象:
local_school = threading.local()
def process_student():
# 获取当前线程关联的student:
std = local_school.student
print('Hello, %s (in %s)' % (std, threading.current_thread().name))
def process_thread(name):
# 绑定ThreadLocal的student... |
the-stack_106_32022 | # -*- coding: utf-8 -*-
import sys
def vrchk(vrep, res, buffer=False):
# Checks VREP return code. Set buffer to 1 if you are reading from a buffered
#call.
# (C) Copyright Renaud Detry 2013, Norman Marlier 2019.
# Distributed under the GNU General Public License.
# (See http://www.gnu.org/copy... |
the-stack_106_32023 | def youtube_video_whitelist(iframe_tag):
"""
Given an HTML iframe element, pass it through the filters we impose on
embedded YouTube video.
Returns the HTML iframe element as a string, which can be reinserted
at the position of the element that was passed.
"""
from bs4 import BeautifulSoup
... |
the-stack_106_32026 | from typing import Tuple, Type, Union
import numpy as np
from .base import BaseValue
from .utils import cnn, mlp
def _get_val_model(
arch: str, val_type: str, state_dim: str, hidden: Tuple, action_dim: int = None
):
"""
Returns Neural Network given specifications
:param arch: Specifies type of arch... |
the-stack_106_32032 | # Example 2.2: amorphous silicon, Tersoff potential
# Computes: Quasi Harmonic Green Kubo (QHGK) properties for amorphous silicon (512 atoms)
# Uses: LAMMPS
# External files: forcefields/Si.tersoff
# Import necessary packages
from ase.io import read
from kaldo.conductivity import Conductivity
from kaldo.controllers ... |
the-stack_106_32036 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 00:06:27 2019
@author: janej
"""
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
def multi_plane_viewer(struct):
struct_tran = struct.T
struct_fron = struct.transpose(1, 2, 0)
struct_sagi = struct.transpose(0, 2, 1)
... |
the-stack_106_32037 | """
Copyright (c) 2017-2020 Starwolf Ltd and Richard Freeman. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
A copy of the License is located at http://www.apache.org/licenses/LICENSE-2.0
or in the "license" file acc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.