filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_25663
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
the-stack_106_25668
from typing import TYPE_CHECKING, Union from rotkehlchen.crypto import sha3 from rotkehlchen.errors import DBUpgradeError from rotkehlchen.typing import Location, TradeType if TYPE_CHECKING: from rotkehlchen.db.dbhandler import DBHandler def v6_deserialize_location_from_db(symbol: str) -> Location: """We co...
the-stack_106_25671
from model.film import Film from model.user import User #from selenium_fixture import app def test_add_film(app): new_film = Film.unic_name() app.ensure_login_as(User.Admin()) app.add_film(new_film) assert app.is_film_created(new_film)
the-stack_106_25672
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2016 Alex Forencich 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...
the-stack_106_25674
# coding=utf-8 # Copyright 2020 The Trax 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 a...
the-stack_106_25676
from typing import Optional from aws_xray_sdk import global_sdk_config from aws_xray_sdk.core import xray_recorder from aws_xray_sdk.core.async_recorder import AsyncSubsegmentContextManager from aws_xray_sdk.core.models.dummy_entities import DummySegment from aws_xray_sdk.core.models.subsegment import ( Subsegment...
the-stack_106_25677
from sklearn import svm, grid_search, datasets from sklearn.externals import joblib from sklearn.ensemble import RandomForestClassifier # Use spark_sklearn’s grid search instead: from spark_sklearn import GridSearchCV iris = datasets.load_iris() param_grid = {"max_depth": [3, None], "max_features": [1, ...
the-stack_106_25679
""" OCCAM Copyright (c) 2011-2017, SRI International 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 con...
the-stack_106_25680
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
the-stack_106_25681
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ import unittest import requests from django.contrib.auth.models import User from django.test import TestCase from museum_site.common i...
the-stack_106_25684
# a basic script to run the case in this directory import sys,os from mpi4py import MPI from pygeo import * from pyspline import * from idwarp import * import numpy gcomm = MPI.COMM_WORLD meshOptions = { 'gridFile':os.getcwd(), 'fileType':'openFoam', 'symmetryPlanes':[[[0,0,0], [0,1,0]]], 'aExp':3, ...
the-stack_106_25686
#!/usr/bin/env python3 import numpy as np from scipy import spatial from scipy.spatial.transform import Rotation as R from scipy.spatial.transform import Slerp class PoseDistance: def __init__(self): # Assumes unit sphere self.mass_matrix = np.identity(6) # for finding translations ...
the-stack_106_25687
import _plotly_utils.basevalidators class CmaxValidator(_plotly_utils.basevalidators.NumberValidator): def __init__(self, plotly_name="cmax", parent_name="scattersmith.marker", **kwargs): super(CmaxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
the-stack_106_25688
from typing import Any, Dict, List, NamedTuple, Tuple, cast from ee.clickhouse.client import substitute_params, sync_execute from ee.clickhouse.models.action import format_action_filter from ee.clickhouse.queries.person_distinct_id_query import get_team_distinct_ids_query from ee.clickhouse.queries.retention.retention...
the-stack_106_25690
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='D2Det', pretrained='torchvision://resnet101', backbone=dict( type='ResNet', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1,...
the-stack_106_25695
#!/usr/bin/env python # encoding: utf-8 """ pymongo.py This is the new mongo adapter for scout that skips mongoengine and uses pymongo, it is a communicator for quering and updating the mongodatabase. This is best practice: uri = "mongodb://%s:%s@%s" % ( quote_plus(user), quote_plus(password), host) cl...
the-stack_106_25698
# -*- coding: utf-8 -*- from hearthstone.entities import Entity from entity.spell_entity import SpellEntity class LETL_450(SpellEntity): """ 火球术5 造成$12点伤害。0造成$13点伤害。0造成$14点伤害。0造成$15点伤害。0造成$16点伤害。 """ def __init__(self, entity: Entity): super().__init__(entity) self.damage...
the-stack_106_25704
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from attacks.abstract_attack import AbstractAttack from lib.rsalibnum import gcd from Crypto.Util.number import long_to_bytes, bytes_to_long import gmpy2 import itertools # Source: https://crypto.stackexchange.com/a/60404 def bytes_to_integer(data): output = 0 si...
the-stack_106_25706
#!/usr/bin/env python """ turtle-example-suite: tdemo_yinyang.py Another drawing suitable as a beginner's programming example. The small circles are drawn by the circle command. """ from turtle import * def yin(radius, color1, color2): width(3) color("black") fill(True) circle(ra...
the-stack_106_25707
#!/usr/bin/env python from scipy.stats import t, laplace, norm import numpy as np import matplotlib.pylab as pl x = np.linspace(-4, 4, 100) n = norm.pdf(x, loc=0, scale=1) l = laplace.pdf(x, loc=0, scale=1 / (2 ** 0.5)) t = t.pdf(x, df=1, loc=0, scale=1) pl.plot(n, 'k:', t, 'b--', l, 'r-') pl.legend(...
the-stack_106_25708
"""Fully-connected architecture.""" import torch import torch.nn as nn __all__ = ['MLP'] class MLP(nn.Module): def __init__(self, input_size, output_size, nhidden=3, dhidden=16, activation=nn.ReLU, bias=True): super(MLP, self).__init__() self.nhidden = nhidden if isinstance(dhidden, int)...
the-stack_106_25712
import polygon from polygon import StreamClient, enums import datetime from datetime import datetime import time import threading import config import traceback import requests import redis import json print("starting stream...") key = config.polygon_key def connections(): # redis_pool = redis.C...
the-stack_106_25713
# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php from io import BytesIO import mmap import os import sys import zlib from gitdb.fun import ( msb_size, ...
the-stack_106_25714
"""A main program for Byterun.""" import argparse import logging from . import execfile parser = argparse.ArgumentParser( prog="byterun", description="Run Python programs with a Python bytecode interpreter.", ) parser.add_argument( '-m', dest='module', action='store_true', help="prog is a module name...
the-stack_106_25715
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Program for filtering variants from a VCF file to *de novo* variants. This program implements the filters and heuristics similar to the one by Wong et al. and Besenbacher et al. """ import argparse import collections import datetime import itertools import logging imp...
the-stack_106_25716
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt x_axix = [0,0.1,0.5,1,2,3] cer = [66.12,63.07,69.03,63.65,63.46,69.54] f1 = [47.61,50.69,45.88,50.5,52.38,46.01] bleu1 = [41.73,50.24,34.09,46.98,45.12,30.18] bleu2 = [32.8,39,27.1,36.83,36.13,24.51] unigram = [3.2,2.9,3.5,3,2.9,2.9] bigram =...
the-stack_106_25717
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import unittest from collections import defaultdict from chinese_calendar.constants import holidays, workdays class HolidayAmountTests(unittest.TestCase): def test_holiday_amount(self): holiday_amounts = defaultdict(int) ...
the-stack_106_25718
#!/usr/bin/env python # This shows how to leverage the endpoints API to get a new hidden # service up and running quickly. You can pass along this API to your # users by accepting endpoint strings as per Twisted recommendations. # # http://twistedmatrix.com/documents/current/core/howto/endpoints.html#maximizing-the-re...
the-stack_106_25719
#!/usr/bin/env python # -*- coding:utf-8 -*- def is_leap(year): """ 输入年份 如果是闰年输出True 否则输出False """ try: year = int(year) except Exception as err: print(err) else: is_leap = year % 4 == 0 and year % 100 != 0 or \ year % 400 == 0 return is_leap ...
the-stack_106_25723
import os import django DEBUG = True TEMPLATE_DEBUG = DEBUG SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', '...
the-stack_106_25726
from logging import getLogger import tkinter as tk import traceback from typing import Optional, Tuple, List from thonny import get_workbench from thonny.codeview import SyntaxText, CodeViewText, get_syntax_options_for_tag from thonny.common import SignatureInfo, SignatureParameter from thonny.editors import Editor fr...
the-stack_106_25728
import serial import logging from . import EELS_controller from nion.swift.model import HardwareSource import socket __author__ = "Yves Auad" class EELS_Spectrometer(EELS_controller.EELSController): def __init__(self, sport): super().__init__() self.success = False self.serial_success = F...
the-stack_106_25730
import numpy as np from . import rans from utils.distributions import discretized_logistic_cdf, \ mixture_discretized_logistic_cdf import torch precision = 24 n_bins = 4096 def cdf_fn(z, pz, variable_type, distribution_type, inverse_bin_width): if variable_type == 'discrete': if distribution_type == ...
the-stack_106_25732
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import ubelt as ub def read_tensorboard_scalars(train_dpath, verbose=1, cache=1): """ Reads all tensorboard scalar events in a directory. Caches them becuase reading events of interest from protobuf ...
the-stack_106_25735
import yaml import logging import requests import os REL_PATH = os.path.realpath(__file__).rsplit('/', 1)[0] class MirrorConfig: """Class that contains config for crypto-mirror UI and stuff""" def __init__(self, *args, **kwargs): self.__dict__.update(kwargs) self.validate_token() def valid...
the-stack_106_25737
import os import albumentations as A abs_path = os.path.dirname(__file__) args = { 'model_path': '/root/gld_pd/models/', 'data_path': '/root/snacks_data/5/', 'data_path_2019': '/root/snacks_data/5/', 'valid_csv_fn': 'test_filtered.csv', 'train_csv_fn': 'train_filtered.csv', 'gpus': '0', '...
the-stack_106_25740
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import time import uuid from django.core.exceptions import ImproperlyConfigured from django.utils.encoding import force_text from . import codex from . import exceptions from . import saml2idp_metadata from . import xml_render from .request...
the-stack_106_25742
'''OpenGL extension ARB.vertex_buffer_object Overview (from the spec) This extension defines an interface that allows various types of data (especially vertex array data) to be cached in high-performance graphics memory on the server, thereby increasing the rate of data transfers. Chunks of data are encapsula...
the-stack_106_25743
import unittest import nn_grad_test as nt import numpy as np import start.neural_network as nn import start.layer_dict as ld import start.weight_update_params as wup class TestTrainSigo2(unittest.TestCase): def test(self): net = nn.NeuralNetwork("test_net", 1) layer = ld.hdict["fc"](10) ...
the-stack_106_25745
import os import shutil import torch import torch.nn as nn import torch.optim as optim from torch_mimicry.nets.basemodel.basemodel import BaseModel class ExampleModel(BaseModel): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.linear = nn.Linear(1, 4) nn.init....
the-stack_106_25746
import os from distutils.dir_util import copy_tree import time import pytest from nixui.graphics import main_window from nixui import state_model from nixui.options.option_tree import OptionTree from nixui.options.attribute import Attribute SAMPLES_PATH = 'tests/sample' def pytest_addoption(parser): parser.ad...
the-stack_106_25747
# Author: Gustavo Solcia # E-mail: gustavo.solcia@usp.br """3D reconstruction using a segmentation image. We apply Marching Cubes algorithm and a surface smoothing from the largest connected region. LOOK AT YOUR DATA: for some cases the surface smoothing can shrink parts of your surface. """ import os import ...
the-stack_106_25750
# -*- coding: utf-8 -*- u"""run test files in separate processes :copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function from pykern.pkcollections import PKDict def default_comma...
the-stack_106_25751
import numpy as np import torch from torch.nn import functional as F from nflows.transforms.base import InputOutsideDomain from nflows.utils import torchutils from nflows.transforms.standard import PointwiseAffineTransform DEFAULT_MIN_BIN_WIDTH = 1e-3 DEFAULT_MIN_BIN_HEIGHT = 1e-3 DEFAULT_MIN_DERIVATIVE = 1e-3 def ...
the-stack_106_25756
# -*- coding: utf-8 -*- from django.conf import settings from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy as _ from mollie.ideal.helpers import _get_mollie_xml, get_mollie_bank_choices class MollieIdealPayment(models.Model): transaction...
the-stack_106_25757
from pptx import Presentation from pptx.util import Mm, Pt from pptx.dml.color import RGBColor from pptx.enum.shapes import MSO_SHAPE, MSO_CONNECTOR from pptx.enum.text import PP_ALIGN import importlib.resources as pkg_resources from concurrent.futures import ThreadPoolExecutor, Future from threading import Lock from ....
the-stack_106_25760
from setuptools import setup, find_packages with open("README.md", "r") as f: long_description = f.read() setup( name="wplay", version="5.0.3", install_requires=["python-telegram-bot >= 11.1.0", "datetime >= 4.3", "playsound >= 1.2.2", ...
the-stack_106_25761
from __future__ import annotations from collections import OrderedDict from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import TypeVar, Union, Type, ForwardRef from .addon import AddonBase TAddon = TypeVar('TAddon') del TYPE_CHECKING import logging logger =...
the-stack_106_25762
"""Opcodes printing Takes .py files and yield opcodes (and their arguments) for ordinary python programs. This file can also be imported as a module and contains the following functions: * expand_bytecode - function find and extends bytecode result * bc_print - function print instructions names and human re...
the-stack_106_25763
# Time: O(h) # Space: O(h) # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def deleteNode(self, root, key): """ :type root: TreeNode :type key:...
the-stack_106_25764
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from mock import MagicMock from indico.modules.groups import GroupProxy from indico.modules.networks.mode...
the-stack_106_25765
#!/usr/bin/python # -*- coding: UTF-8 -*- import subprocess import socket import datetime import os import ctypes import platform NO_NGINX = 0 NO_NGINX_CONF = 1 NO_NGINX_LOG = 2 SUCCESS = 6 def check_memory(path, style='M'): i = 0 for dirpath, _, filename in os.walk(path): for ii in filename: ...
the-stack_106_25766
import eel import logging from core.cmp.functions import analize_grammar, make_tree @eel.expose def pipeline(data): values = analize_grammar(data) fd = open("./web/template.html", 'r', encoding='UTF-8') data = fd.read() fd.close() sec = data.split('%s') html = [] for i in ra...
the-stack_106_25767
import os from conans import ConanFile, CMake class Protobuf(ConanFile): name = "protobuf" settings = "os", "arch", "compiler", "build_type" options = {"shared": [True, False]} default_options = {"shared": False} exports = "*" generators = "cmake", "cmake_find_package" requires = "zlib/0...
the-stack_106_25768
import os import logging import time import pathlib import condoloader def main(datadir): target = condoloader.CondoLoader() if target.databaseisready(): target.loadpluto_load(datadir) target.loadcondo_load(datadir) target.loadcondo() else: readymsg = ("{0}{1}" ...
the-stack_106_25769
import numpy as np import matplotlib import matplotlib.pyplot as plt def intensity_histogram( data, bins, x_label, y_label, legend, filename, markers , display=True): plt.figure(figsize=(18,10), facecolor='w') # first make a simple histogram plt.hist( data, bins, alpha=0.7, label=legend) # now plot th...
the-stack_106_25773
"""Support functions for the second-order update equation""" from abc import ABC, abstractmethod from typing import Optional __all__ = ['Sigma', 'numerical_estimate_A'] class Sigma(ABC): """Function σ(t) for the second order update equation. This is an abstract bases class. For any optimization that requir...
the-stack_106_25774
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Copyright (c) 2017-2018 The CruZeta developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test for -rpcbind, as well as -rpcallowip and -rpcconnect ...
the-stack_106_25775
from django.shortcuts import render,redirect from django.http import HttpResponse,Http404,HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.core.exceptions import ObjectDoesNotExist from .models import Post,Profile,Comment,Like,User from .forms import NewPostForm,ProfileForm,Com...
the-stack_106_25783
import os import cv2 import random import tensorflow as tf import os.path as osp import numpy as np import cityscapesscripts.helpers.labels as CSLabels # to be deprecated from glob import glob # physical_devices = tf.config.list_physical_devices('GPU') # try: # tf.config.experimental.set_memory_growth(physica...
the-stack_106_25784
import json from collections import defaultdict name_box_id = defaultdict(list) id_name = dict() f = open( r"F:\2_doc\7_datasets\COCO2017\annotations\instances_train2017.json", encoding='utf-8') data = json.load(f) annotations = data['annotations'] for ant in annotations: id = ant['image_id'] name = r...
the-stack_106_25786
# -*- coding: utf-8 -*- # Investigating ConvNets to create high quality xG models - https://www.opengoalapp.com/xg-with-cnns-full-study # by @openGoalCharles # Tested with tensorflow 2.2.0 - some of the visualisations will definitely need >= v2.0.0, not sure about the core code # The model is lightweight - will train...
the-stack_106_25788
import struct def ieee_single_encode(number: float) -> str: packed = struct.pack("!f", number) unpacked = [f"{b:b}".rjust(8, "0") for b in packed] encoded = "".join(unpacked) return encoded if __name__ == "__main__": with open("sideinfordeci.txt") as input_f, open( "sideinforbina.txt", "...
the-stack_106_25789
# Reminder: For the history array, "cooperate" = 1, "defect" = 0 def forgivingCopycat(history): round = history.shape[1] if history[1,-1] == 0: if round > 3: if history [0, -1] == 1 and history [0,-2] == 0 and history [1, -2] == 1: return "cooperate" return "defect" ...
the-stack_106_25790
from itertools import product import numpy as np INV_SQRT_3 = 1.0 / np.sqrt(3.0) ASIN_INV_SQRT_3 = np.arcsin(INV_SQRT_3) def csgrid_GMAO(res): """ Return cubedsphere coordinates with GMAO face orientation Parameters ---------- res : cubed-sphere Resolution """ CS = CSGrid(res, offset=-...
the-stack_106_25791
# 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. """ Userbot module containing userid, chatid and log commands""" from time import sleep from telethon.tl.functions.chan...
the-stack_106_25793
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: Ansible Project # 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 = ''' --- module: gce_instance_template short_descri...
the-stack_106_25798
__author__ = "Nicolas Delplanque" __credits__ = ["Nicolas Delplanque"] __version__ = "1.0.1" __maintainer__ = "Nicolas Delplanque" __email__ = "nicolas.delplanque@student.umons.ac.be" from SPJRUD.SPJRUD import SPJRUD from Representation.Relation import Relation from Representation.Attribute import Attribute from SPJR...
the-stack_106_25799
"""Nutanix Integration for Cortex XSOAR - Unit Tests file""" import io import json from datetime import datetime from typing import * import pytest from CommonServerPython import DemistoException, CommandResults from NutanixHypervisor import Client from NutanixHypervisor import USECS_ENTRIES_MAPPING from NutanixHype...
the-stack_106_25800
# Copyright (c) 2018 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 app...
the-stack_106_25802
# encoding=utf-8 import logging from typing import Any from hamcrest.core.core.isanything import IsAnything from hamcrest.core.description import Description from hamcrest.core.matcher import Matcher logger = logging.getLogger(__name__) def append_matcher_description( field_matcher: Matcher[Any], field_name: st...
the-stack_106_25803
import auxiliary.process as process import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns import keywords import random import json # mode = 'any' # mode = "all" sns.set(style="whitegrid", rc={'figure.figsize':(20,10)}) random.seed(1) def selectHost(time...
the-stack_106_25806
#-*- coding: utf-8 -*- import os from django.test import TestCase from django.core.urlresolvers import reverse import django.core.files from django.contrib.admin import helpers from django.contrib import admin from django.contrib.auth.models import User from django.conf import settings from filer.models.filemodels imp...
the-stack_106_25807
#coding:utf-8 # Copyright (c) 2019 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 re...
the-stack_106_25812
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
the-stack_106_25814
''' Script contains helper functions to load data from MIMIC-III. ''' import pandas as pd import torch.utils.data as data_utils def load_mimic3(fpath='data/sepsis3_processed_data.csv'): data = pd.read_csv(fpath, index_col=0) traj_ids = data['traj'].unique() return traj_ids, data def collate_fn(batch): ...
the-stack_106_25816
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Tcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test proper accounting with a double-spend conflict # from test_framework.test_framework import TcoinT...
the-stack_106_25820
import os import subprocess currentdir = os.path.dirname(__file__) examplesdir = os.path.join( currentdir, os.path.join(os.pardir, os.pardir), 'examples' ) example_files = [] for root, dirs, files in os.walk(examplesdir): for basneame in files: if basneame.endswith('.py'): example_files.ap...
the-stack_106_25822
from django import template register = template.Library() @register.filter def flow_color(value): if value == 0.0: return "rgb(255, 255, 255)" elif value > 0.0: max_light = 196 light = int(max_light - min(max_light, value / 30.0 * max_light)) return "rgb({}, {}, 255)".format(l...
the-stack_106_25823
# -*- coding: utf-8 -*- # Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
the-stack_106_25824
from network import WLAN wlan = WLAN(mode=WLAN.STA) import pycom import time # initialisation code pycom.heartbeat(False) pycom.rgbled(0x008080) # Cyan # Connect to Wifi nets = wlan.scan() for net in nets: if net.ssid == 'HDTL-a': print('Network found!') wlan.connect(net.ssid, auth=(net.sec, 'FEE...
the-stack_106_25827
# -------------------------------------------------------------------------------------------- # 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_25828
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com> # (c) 2017 Ansible Project # 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 = """ name: file author: Daniel Hok...
the-stack_106_25829
# DADSA - Assignment 1 # Reece Benson from os import system as call from collections import OrderedDict class Menu(): # Define the variables we will be using _app = None _menu = None _current_menu = 0 def __init__(self, app): # Set our Application self._app = app def load(sel...
the-stack_106_25831
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2020 Fetch.AI Limited # # 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 ...
the-stack_106_25832
""" testplan.py - NOTE: this module should not be run as a standalone scripts, excepts for built-in tests. """ # HISTORY #################################################################### # # 1 Apr11 MR # initial version # 2 Jan12 MR # simplification: Configura...
the-stack_106_25834
from typing import cast from .. import imaging from ..pack import PackCollection from ..ex.language import Language class IconHelper(object): ICON_FILE_FORMAT = 'ui/icon/{0:03d}000/{1}{2:06d}.tex' @staticmethod def get_icon(pack: PackCollection, nr: int, language: Langu...
the-stack_106_25835
''' This code is inspired on https://github.com/jrieke/shape-detection/ ''' import matplotlib.pyplot as plt import matplotlib import numpy as np import datetime import random # import cairo,math from skimage.draw import circle, polygon from tqdm import tqdm import h5py, os class HelloWorldDataset: def __init__(s...
the-stack_106_25837
# NOTE: # Most of these functions are based off pathsim.py from the torps project, # but this code is neither reviewed nor endorsed by the torps authors. # Torps is a relatively straightforward Python port of tor's path selection # algorithm. The original torps code and licensing information can be # found at...
the-stack_106_25838
#Importing required libraries and dataset import numpy as np from nilearn.input_data import MultiNiftiMasker from sklearn.linear_model import OrthogonalMatchingPursuit as OMP from sklearn.feature_selection import f_classif, SelectKBest from sklearn.pipeline import Pipeline from sklearn.metrics import (accuracy_score, p...
the-stack_106_25840
""" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 """ import concurrent.futures import time import pytest from botocore.session import get_session from graph_notebook.neptune.client import Client from test.integration import DataDrivenSparqlTest def long_ru...
the-stack_106_25842
# Import relevant packages import numpy as np from scipy import optimize import matplotlib.pyplot as plt # Utility function def u_func(h, c, par): """ Cobb-Douglas utility function for consumption and housing quality Args: h (float): housing quality and equal to housing price c (float): o...
the-stack_106_25843
from typing_extensions import Final import numpy as np import torch from torch import nn from typing import Any, Dict, Optional, Union from ptgnn.baseneuralmodel import AbstractNeuralModel from ptgnn.baseneuralmodel.utils.data import enforce_not_None from ptgnn.neuralmodels.gnn.structs import AbstractNodeEmbedder c...
the-stack_106_25846
# # Copyright (c) 2021, 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 agreed ...
the-stack_106_25848
# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the ""Software""), ...
the-stack_106_25854
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import warnings from collections import OrderedDict from functools import partial from torch.distributions import biject_to, constraints from torch.nn import Parameter import pyro import pyro.distributions as dist from pyro.distr...
the-stack_106_25855
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import copy import numpy as np import pandas as pd from scipy.stats import spearmanr, pearsonr from ..data import D from collections import OrderedDict def _get_position...
the-stack_106_25856
""" The methods for loading Home Assistant integrations. This module has quite some complex parts. I have tried to add as much documentation as possible to keep it understandable. """ from __future__ import annotations import asyncio from collections.abc import Callable from contextlib import suppress import functool...
the-stack_106_25857
#!./parrott-env/bin/python from app import app, collector from apscheduler.scheduler import Scheduler if __name__ == '__main__': # Run the collector on start collector.collect() # Schedule the Collector scheduler = Scheduler() scheduler.add_interval_job(collector.collect, minutes=30) schedule...
the-stack_106_25858
import requests from bs4 import BeautifulSoup from .fetcher import Fetcher from ..excepts import MangaNotFound class Naver(Fetcher): def __init__(self, link:str=None, manga:str=None, chapstart=1, collection=""): super().__init__(link, manga, chapstart) if collection: self._collection =...