filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_28307
# 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 required by app...
the-stack_106_28311
# # Copyright 2019 AXA Group Operations S.A. # # 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_28312
''' 实验名称:三轴加速度计 版本:v1.0 日期:2019.4 作者:01Studio 说明:通过编程获取其各个方向的数值(X轴、Y轴、Z轴)并在OLED上显示。 ''' import pyb from machine import Pin,I2C from ssd1306 import SSD1306_I2C #初始化相关模块 i2c = I2C(sda=Pin("Y8"), scl=Pin("Y6")) oled = SSD1306_I2C(128, 64, i2c, addr=0x3c) accel = pyb.Accel() while True: oled.fill(0) #清屏 oled.text('0...
the-stack_106_28313
from zerver.lib.management import ZulipBaseCommand from corporate.models import Plan, Coupon, Customer from zproject.settings import get_secret from typing import Any import stripe stripe.api_key = get_secret('stripe_secret_key') class Command(ZulipBaseCommand): help = """Script to add the appropriate products a...
the-stack_106_28316
import subprocess from flask import Flask,request, jsonify from flask_restful import Api, Resource from flask_cors import CORS from webargs.flaskparser import parser, abort import json import time import sys from waitress import serve from multiprocessing import Process, Queue from concurrent.futures import TimeoutErro...
the-stack_106_28317
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
the-stack_106_28319
# -*- coding: utf-8 -*- import numpy as np from matplotlib import pyplot as plt from datetime import datetime from matplotlib import dates import seawater as sw def plts(date,y): """ Plot a multi-year time series y as a function of time of year (rather than absolute time). The time series from each separate year ...
the-stack_106_28320
# Copyright 2018 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...
the-stack_106_28321
import numpy as np import tensorflow as tf import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) import tf_util # ----------------- # Global Constants # ----------------- NUM_HEADING_BIN = 12 NUM_SIZE_CLUSTER = 8 # one cluster for each type NUM_OBJECT_POINT = 512 g_type2...
the-stack_106_28324
"""Base classes and utilities for wiring.""" from typing import Dict, List, Tuple, TypeVar, Callable wire_colors = { 12: "YE", 5: "RD", 48: "BU", 0: "BK", -2: "WH", 1: "WH", -1: "PK" } PinSpecs = List[Tuple[str, int]] class Board: """A board with connectors. This is not an element i...
the-stack_106_28325
# File: S (Python 2.4) from pandac.PandaModules import * from direct.showbase.DirectObject import * from direct.interval.IntervalGlobal import * from direct.actor import Actor from pirates.piratesbase import PiratesGlobals from PooledEffect import PooledEffect from EffectController import EffectController import rando...
the-stack_106_28326
# Copyright (C) 2012 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
the-stack_106_28328
# 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_28329
######### # Copyright (c) 2019 Cloudify Platform Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
the-stack_106_28330
from six import iteritems, callable from voluptuous import Schema, ALLOW_EXTRA from typedtuple import TypedTupleType from hieratic import Resource class ItemResource(Resource): def __init__(self, parent, name, engine_name, item_engine): Resource.__init__(self, parent, name) self.__engine_name ...
the-stack_106_28331
#!/usr/bin/env python3 # (C) Copyright 2020 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its statu...
the-stack_106_28333
from __future__ import division from itertools import product from collections import namedtuple import numpy as np from pgmpy.factors.base import BaseFactor from pgmpy.extern import tabulate from pgmpy.extern import six from pgmpy.extern.six.moves import map, range, reduce, zip from pgmpy.utils import StateNameInit...
the-stack_106_28335
#!/usr/bin/env python """ Copyright (C) 2013 Bo Zhu http://about.bozhu.me 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_28336
""" Msgpack serializer support for reading and writing pandas data structures to disk portions of msgpack_numpy package, by Lev Givon were incorporated into this module (and tests_packers.py) License ======= Copyright (c) 2013, Lev Givon. All rights reserved. Redistribution and use in source and binary forms, with ...
the-stack_106_28339
import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx import numpy as np kernels = [] data = [] with open("plot_data_orig.txt") as f: for line in f: kernel, vals = line.strip().split(":") kernels.append(kernel.strip()) data.append(eval(vals)) data =...
the-stack_106_28341
"""Activate coverage at python startup if appropriate. The python site initialisation will ensure that anything we import will be removed and not visible at the end of python startup. However we minimise all work by putting these init actions in this separate module and only importing what is needed when needed. For...
the-stack_106_28346
import copy configs = dict() config = dict( agent=dict( action_squash=1., pretrain_std=0.75, # 0.75 gets pretty uniform actions load_conv=True, load_all=False, store_latent=False, state_dict_filename=None, ), conv=dict( channels=[32, 32, 32, 32], ...
the-stack_106_28348
import RPi.GPIO as GPIO import time from math import * from random import * off = True while True: level = int(input("Input: ")) if level > 1 or level < 0: break if level == 1 and off: off = False GPIO.setmode(GPIO.BOARD) GPIO.setup(23, GPIO.OUT) GPIO.output(23, 0) elif level == 0 and not off: off = T...
the-stack_106_28352
#!/usr/bin/env python # -*- coding:utf-8 -*- import json import urllib.request import urllib.parse import os import sys BASE_DIR = os.path.dirname(os.getcwd()) # 设置工作目录,使得包和模块能够正常导入 sys.path.append(BASE_DIR) from conf import settings def update_test(data): """ 创建测试用例 :return: """ # 将数据打包到一个字典内,...
the-stack_106_28353
""" End-to-End Multi-Lingual Optical Character Recognition (OCR) Solution """ from setuptools import setup from io import open with open('requirements.txt', encoding="utf-8-sig") as f: requirements = f.readlines() def readme(): with open('README.md', encoding="utf-8-sig") as f: README = f.read() ...
the-stack_106_28354
''' Author: your name Date: 2021-12-07 14:53:54 LastEditTime: 2021-12-07 15:26:52 LastEditors: Please set LastEditors Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE FilePath: /PG-engine/run/single_view.py ''' import argparse import os from pickle import load ...
the-stack_106_28355
"""Binary Sensor platform for Sensibo integration.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from typing import TYPE_CHECKING from pysensibo.model import MotionSensor, SensiboDevice from homeassistant.components.binary_sensor import ( BinarySenso...
the-stack_106_28359
from setuptools import find_packages, setup with open("README.md") as fh: long_description = "" header_count = 0 for line in fh: if line.startswith("##"): header_count += 1 if header_count < 2: long_description += line else: break def get_version...
the-stack_106_28360
import json from django.apps import apps from django.core.exceptions import ObjectDoesNotExist from django.http import ( HttpResponse, HttpResponseNotFound, HttpResponseBadRequest, HttpResponseForbidden, ) from django.utils.translation import ugettext as _ from django.views.decorators.clickjacking impo...
the-stack_106_28361
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2014 Thomas Voegtlin # # 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...
the-stack_106_28362
#! /usr/bin/env python """ Create a final simulated exposure. This module contains code that will combine a seed image and a dark current exposure into a final simulated exposure. Cosmic rays, Poisson noise, and other detector effects are added. This is the final step when creating simulated data with Mirage. It can ...
the-stack_106_28363
from django.http import JsonResponse from rest_framework import viewsets,mixins from user.serializers import UserProfileSerializer, User, UserRegisterSerializer from rest_framework.views import APIView from django.contrib.auth import logout from django.views.generic.base import View from user.models import UserProfile ...
the-stack_106_28364
# pytorch re-implementation of # https://github.com/xuqiantong/GAN-Metrics/blob/master/framework/metric.py # https://github.com/stevenygd/PointFlow/blob/master/metrics/evaluation_metrics.py import torch from tqdm import tqdm from .distance import chamfer_distance, earth_mover_distance def compute_emd(pcs_1, pcs_2):...
the-stack_106_28365
from __future__ import absolute_import, division, print_function import re from unittest import TestCase from webob import Request, Response from webtest import TestApp, TestRequest from manhattan.middleware import ManhattanMiddleware from manhattan.record import Record from manhattan.log.memory import MemoryLog cl...
the-stack_106_28367
# Copyright 2014 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 ag...
the-stack_106_28369
import csv import datetime from django.contrib import admin from django.http import HttpResponse from .models import DataLogSheet def export_to_csv(modeladmin, request, queryset): opts = modeladmin.model._meta response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment...
the-stack_106_28370
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Pre-process Data / features files and build vocabulary """ import argparse import glob import sys import gc import codecs import torch from onmt.utils.logging import init_logger, logger import onmt.inputters as inputters import onmt.opts as opts def check_existi...
the-stack_106_28372
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'limin' ''' 菲阿里四价 策略(日内突破策略, 在每日收盘前对所持合约进行平仓) 参考: https://www.shinnytech.com/blog/fairy-four-price/ 注: 该示例策略仅用于功能示范, 实盘时请根据自己的策略/经验进行修改 ''' from tqsdk import TqApi, TqAuth, TargetPosTask from datetime import datetime import time symbol = "SHFE.ni2012" # 合约...
the-stack_106_28375
# Copyright 2018 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
the-stack_106_28376
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ATM Class Controller Created on Tue Aug 17 14:16:44 2021 Version: 1.0 Universidad Santo Tomás Tunja Simulation @author: Juana Valentina Mendoza Santamaría @author: Alix Ivonne Chaparro Vasquez presented to: Martha Susana Contreras Ortiz """ from random import rand...
the-stack_106_28379
# Copyright 2012 Nebula, Inc. # Copyright 2013 IBM Corp. # # 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...
the-stack_106_28381
from model.contact import Contact empty = Contact(firstname="",lastname= "",company="",address="",home="",mobile_phone="",work_phone="", email_1="") testdata = [Contact(firstname="fname1", lastname= "lname1", company="company1", address="address1", ...
the-stack_106_28382
# # The SELDnet architecture # from keras.layers import Bidirectional, Conv2D, MaxPooling2D, Input from keras.layers.core import Dense, Activation, Dropout, Reshape, Permute from keras.layers.recurrent import GRU from keras.layers.normalization import BatchNormalization from keras.models import Model from keras.layers...
the-stack_106_28383
import click from awsctl.packages.ssm import AmazonSystemsManager from awsctl.packages.cloudwatch import AmazonCloudwatch, AmazonCloudwatchLogs from awsctl.packages.inspector import AmazonInspector @click.group("install") def install_group(): pass @install_group.command("ssm") def install_ssm(): ssm = AmazonS...
the-stack_106_28384
# Copyright Epic Games, Inc. All Rights Reserved. import sys as _sys import json as _json import uuid as _uuid import time as _time import socket as _socket import logging as _logging import threading as _threading def hello(): _logging.debug("Hello from remote") # Protocol constants (see PythonScriptRemoteExe...
the-stack_106_28386
""" File: 1642.py Title: Furthest Building You Can Reach Difficulty: Medium URL: https://leetcode.com/problems/furthest-building-you-can-reach/ """ import unittest import heapq from typing import List, Tuple class Solution: def furthestBuilding(self, heights: List[int], ...
the-stack_106_28387
# -*- coding: UTF-8 -*- import dash from dash import Dash from dash.dependencies import Input, Output from dash.exceptions import PreventUpdate import dash_html_components as html import dash_core_components as dcc from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys imp...
the-stack_106_28388
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:40 ms, 在所有 Python3 提交中击败了80.24% 的用户 内存消耗:13.5 MB, 在所有 Python3 提交中击败了97.09% 的用户 解题思路: 使用双指针分别指向两字符串 具体实现见代码注释 """ class Solution: def strStr(self, haystack: str, needle: str) -> int: if needle == '': return 0 len_i, len_j = len(ha...
the-stack_106_28389
# @ ConfigEditor.py # # Copyright(c) 2018 - 2021, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## import os import sys import marshal import tkinter import tkinter.ttk as ttk import tkinter.messagebox as messagebox import tkinter.filedialog as filedialog from pathlib im...
the-stack_106_28390
#!/usr/bin/env python3 import sys import re import argparse import subprocess from pathlib import Path from snakemake.utils import read_job_properties parser = argparse.ArgumentParser(add_help=False) parser.add_argument( "--help", help="Display help message.", action="store_true") parser.add_argument( "positi...
the-stack_106_28393
""" Django Settings with Environment Variables | Cannlytics Console Author: Keegan Skeate <keegan@cannlytics.com> Created: 6/5/2021 Updated: 6/8/2021 Description: Django settings secured by Google Cloud Secret Manager. References: https://docs.djangoproject.com/en/3.1/topics/settings/ https://docs.djangop...
the-stack_106_28396
import numpy as np class SumTreeV2(object): """ This SumTree code is modified version and the original code is from: https://github.com/jaara/AI-blog/blob/master/SumTree.py Story the data with it priority in tree and data frameworks. """ # TODO: Under construction # TODO: STILL cannot fig...
the-stack_106_28397
import numpy as np import pandas as pd from .base_processing import path_data """ 3081 Foot measured for bone density 19 Heel ultrasound method 3146 Speed of sound through heel 3143 Ankle spacing width 3144 Heel Broadband ultrasound attenuation, direct entry 3147 Heel quantitative ultrasound index (QUI), direct entr...
the-stack_106_28398
#!/usr/bin/env python3 #coding: utf-8 from ev3dev.ev3 import * import time m1 = LargeMotor('outC') #Esquerdo m2 = LargeMotor('outD') #Direito gy = GyroSensor('in1') gy.mode = 'GYRO-ANG' def Modulo(x): if x < 0: return x * -1 return x def Girar(ang): atual = gy.value() while Modulo((gy.value...
the-stack_106_28399
import time import numpy as np import tensorflow as tf from gym.spaces import Discrete, Box from stable_baselines import logger from stable_baselines.a2c.utils import batch_to_seq, seq_to_batch, Scheduler, find_trainable_variables, EpisodeStats, \ get_by_index, check_shape, avg_norm, gradient_add, q_explained_var...
the-stack_106_28404
"""Support for interfacing to iTunes API.""" import logging import requests import voluptuous as vol from homeassistant.components.media_player import ( MediaPlayerDevice, PLATFORM_SCHEMA) from homeassistant.components.media_player.const import ( MEDIA_TYPE_MUSIC, MEDIA_TYPE_PLAYLIST, SUPPORT_NEXT_TRACK, ...
the-stack_106_28405
# Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import re from telemetry.internal.app import android_process from telemetry.internal.backends import android_browser_backend_settings from telemetry.interna...
the-stack_106_28406
#! /usr/bin/env python3 import argparse import sys import os import csv def get_arguments(argv): parser = argparse.ArgumentParser(description="list headers for all given csv files") parser.add_argument("files", nargs="+", help="a csv file to read") return parser.parse_args(argv[1:]) def get_header(filen...
the-stack_106_28409
import turtle x = 600 y = 600 turtle.setup(x, y) wn = turtle.Screen() wn.bgcolor("black") wn.title("Hey!") turtle.hideturtle() turtle.penup() turtle.pencolor("white") turtle.pensize(3) turtle.left(90) turtle.forward(150) turtle.pendown() turtle.goto(150.00, 0.00) turtle.goto(0.00, -150.00) turtle.goto(-150.00, 0.00) t...
the-stack_106_28410
import collections import six from . import logical from .dict_wrapper import DictWrapper from avro import schema from avro import io if six.PY3: io_validate = io.Validate else: io_validate = io.validate _PRIMITIVE_TYPES = set(schema.PRIMITIVE_TYPES) class AvroJsonConverter(object): def __init__( ...
the-stack_106_28411
import bpy import os import sys import argparse ''' Simplifies mesh to target number of faces Requires Blender 2.8 Author: Rana Hanocka @input: <obj_file> <target_faces> number of target faces <outfile> name of simplified .obj file @output: simplified mesh .obj to run it from cmd line: /opt/bl...
the-stack_106_28413
from firedrake import * import matplotlib.pyplot as plt parameters["pyop2_options"]["lazy_evaluation"] = False # Defining the mesh N = 15 use_quads = True mesh = UnitSquareMesh(N, N, quadrilateral=use_quads) # Function space declaration degree = 1 pressure_family = 'CG' velocity_family = 'CG' U = VectorFunctionSpace...
the-stack_106_28414
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
the-stack_106_28415
import numpy as np import torch import torch.distributed as dist import json class Merger(): def __init__(self, meta): if isinstance(meta, str): with open(meta) as f: meta = json.load(f) self.meta = meta def merge(self, multi_labels): """ args: ...
the-stack_106_28416
#!/usr/bin/env python3 # # Advent of Code 2020 - Day N # from pathlib import Path INPUTFILE = "input.txt" SAMPLE_INPUT = """ """ SAMPLE_CASES = [ (arg1, expected1), (arg2, expected2), ] # Utility functions ## Use these if blank lines should be discarded. def sample_input(): return filter_blank_lines(...
the-stack_106_28417
from os import path from setuptools import setup import sys class IncompatiblePackageError(Exception): pass # Make sure that the unrelated package by the name 'suitcase' is *not* # installed because if it is installed it will break this suitcase's namespace # package scheme. try: import suitcase except Impor...
the-stack_106_28418
#coding:utf-8 import os import json from django.core.urlresolvers import reverse from django.test.client import encode_multipart from seahub.test_utils import BaseTestCase from seaserv import seafile_api class FileTagTest(BaseTestCase): def setUp(self): self.login_as(self.user) self.test_filepath...
the-stack_106_28419
from __future__ import print_function # python imports import datetime import gzip import logging import os import random import shutil # vizard imports import viz import vizproximity import vizshape import viztask # local imports import vrlab import suit import targets # module constants GAP_MINUTES = 50 TIMESTAMP...
the-stack_106_28421
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_106_28423
""" conftest: global fixture file for tests """ import time import pytest @pytest.fixture(autouse=True) def time_test(): """Time a test and print out how long it took Note, this fixture is for example purposes. This information can also be achieved with the `--durations=n` command line flag. """ ...
the-stack_106_28425
### ### Copyright (C) 2018-2019 Intel Corporation ### ### SPDX-License-Identifier: BSD-3-Clause ### from ....lib import * from ....lib.gstreamer.msdk.util import * from ....lib.gstreamer.msdk.vpp import VppTest spec = load_test_spec("vpp", "sharpen") @slash.requires(*platform.have_caps("vpp", "sharpen")) class defau...
the-stack_106_28428
#!/usr/bin/env python import os, sys import boto3 import config from deepzoom import ImageCreator import shutil s3 = boto3.client('s3') def to_zoom(event, context): """ Receives an S3 event record for a new object. Downloads the object to the local filesystem, uses Deepzoom to tile it, and then uploa...
the-stack_106_28429
from pyrogram import Client, filters from utils import save_file from info import CHANNELS media_filter = filters.document | filters.video | filters.audio @Client.on_message(filters.chat(CHANNELS) & media_filter) async def media(bot, message): """Media Handler""" for file_type in ("document", "video", "audio...
the-stack_106_28430
''' Created on Aug 9, 2016 @author: David Zwicker <dzwicker@seas.harvard.edu> ''' from __future__ import division import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.ticker import Locator import six from six.moves import range def doublearrow(xs, ys, w=0.1, **...
the-stack_106_28433
# EcoDes-DK - Fix files missing from VRTs # Jakob J. Assmann j.assmann@bio.au.dk 2 December 2021 # Most files missing from the VRTs are missing because they are the wrong raster # file type (e.g. Int16 instead of float32) - the only tiles affected seem to # be NA tiles. # These originate from the processing workflow ...
the-stack_106_28434
import types from functools import wraps import numpy as np import datetime import collections import warnings import copy from pandas.compat import( zip, range, long, lzip, callable, map ) from pandas import compat from pandas.compat.numpy import function as nv from pandas.compat.numpy import _np_version_unde...
the-stack_106_28437
#!/usr/bin/env python import os import time import stat import json import random import ctypes import inspect import requests import traceback import threading import subprocess from collections import Counter from selfdrive.swaglog import cloudlog from selfdrive.loggerd.config import ROOT from common.params import ...
the-stack_106_28439
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
the-stack_106_28440
COUNT_TO = 1000 # A method arising from a literal interpretation of the question: sum1 = 0 for i in range(1, COUNT_TO): if ((i % 3 == 0) or (i % 5 == 0)): sum1 += i print(sum1) # Another method arising from insight into the particular question sum2 = 0 for i in range(3, COUNT_TO, 3): sum2 += i for i i...
the-stack_106_28441
# coding: utf-8 # In[1]: class CompareModels: def __init__(self): import pandas as pd self._models = pd.DataFrame( data=['r', 'R^2', 'RMSE', 'RMSRE', 'MAPE'], columns=['Model'] ).set_index(keys='Model') def add(self, model_name, y_test, y_pred): ...
the-stack_106_28443
import Image import ImageFont, ImageDraw import sys test_case_num = sys.argv[1] node1 = sys.argv[2] node2 = sys.argv[3] #opens an image: test_suite = "varied" test_folder = "results_%s_1000" % test_suite test_case = "%s_%s" % (test_suite, test_case_num) test_case_text = "Test: %s %s" % (test_suite.upper(), test_case_...
the-stack_106_28444
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import random import pytest from marshmallow import Schema, fields, utils, MarshalResult, UnmarshalResult from marshmallow.exceptions import MarshallingError from marshmallow.compat import unicode, binary_type from tests.base import * # noqa random.seed(1...
the-stack_106_28445
""" A script to systematicly check 1, read_cif 2, alternative setting 3, subgroup 4, supergroup """ from glob import glob import numpy as np import pymatgen.analysis.structure_matcher as sm from pymatgen.core import Structure from pyxtal import pyxtal from pyxtal.supergroup import supergroups for i, name in enumerate...
the-stack_106_28446
""" Handle the frontend for Home Assistant. For more details about this component, please refer to the documentation at https://home-assistant.io/components/frontend/ """ import asyncio import hashlib import json import logging import os from urllib.parse import urlparse from aiohttp import web import voluptuous as v...
the-stack_106_28447
"""Example of using a custom image env and model. Both the model and env are trivial (and super-fast), so they are useful for running perf microbenchmarks. """ import argparse import ray import ray.tune as tune from ray.tune import sample_from from ray.rllib.examples.env.fast_image_env import FastImageEnv from ray.r...
the-stack_106_28452
""" Extensions to the Mailbox and System classes for simulating message and/or node failures. """ from collections import namedtuple import random from paxos import SystemConfig from paxos.messages import ClientRequestMsg, AdjustWeightsMsg from paxos.sim import Mailbox from paxos.test import DebugMailbox class Fail...
the-stack_106_28453
import os, sys, subprocess import re, itertools, types import logging, tempfile from collections import defaultdict try: from pathlib2 import Path except ImportError: # pragma: py3 only from pathlib import Path from clckwrkbdgr import utils import clckwrkbdgr.winnt.registry as registry def list_starts_with(main_list...
the-stack_106_28456
#!/usr/bin/env python from __future__ import print_function """objectivefunction Objective function utilities for inversions """ from setuptools import find_packages try: from numpy.distutils.core import setup except Exception: raise Exception( "Install requires numpy. " "If you use conda, `c...
the-stack_106_28458
# Copyright (C) 2017 Datera 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 ...
the-stack_106_28459
from .inceptionv3 import inception_v3 from .vgg import vggnet from .resnet import resnet import torch def initialise_model(args): # create model if args.arch.find('inceptionV3') > -1: if args.pretrained: print("=> using pre-trained model '{}'".format(args.arch)) print("NUmber o...
the-stack_106_28460
# qubit number=4 # total number=13 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=1 pr...
the-stack_106_28461
import FWCore.ParameterSet.Config as cms process = cms.Process("EcalSimRawData") #simulation of raw data. Defines the ecalSimRawData module: process.load("SimCalorimetry.EcalElectronicsEmulation.EcalSimRawData_cfi") # Geometry # process.load("Geometry.CMSCommonData.cmsSimIdealGeometryXML_cfi") # Calo geometry servic...
the-stack_106_28463
# ------------------------------------------------------------------------------ # Portions of this code are from # CornerNet (https://github.com/princeton-vl/CornerNet) # Copyright (c) 2018, University of Michigan # Licensed under the BSD 3-Clause License # -------------------------------------------------------------...
the-stack_106_28465
# -*- coding: utf-8 -*- import numpy as np from aesara_theano_fallback import aesara from aesara_theano_fallback import tensor as aet from rebound_pymc3.test_tools import InferShapeTester from rebound_pymc3.python_impl import ReboundOp class TestRebound(InferShapeTester): def setup_method(self): super(...
the-stack_106_28467
import math import torch import warnings import numpy as np import pandas as pd from scipy.interpolate import pchip_interpolate import itertools from typing import Dict from torchkbnufft import AdjKbNufft from torchkbnufft.math import complex_mult, imag_exp, absolute from torchio.transforms.augmentation.random_transfor...
the-stack_106_28468
matOne = [] print("Enter 9 Elements for First Matrix: ") for i in range(3): matOne.append([]) for j in range(3): num = int(input()) matOne[i].append(num) matTwo = [] print("Enter 9 Elements for Second Matrix: ") for i in range(3): matTwo.append([]) for j in range(3): num = int(i...
the-stack_106_28469
import turtle as t def triangle(index, len): for i in range(3): t.fd(len) t.right(120) t.fd(len / 2) def init(): t.setup(1200, 1200) t.bgcolor("black") t.color("white") t.pensize(2) t.speed(10) def main(): init() length = 100 triangle(2, length) t.mainl...
the-stack_106_28471
import logging from typing import Callable, Optional, Tuple import numpy as np from numpy import ndarray from scipy.sparse import coo_matrix from skfem.element import DiscreteField, Element from skfem.mapping import Mapping from skfem.mesh import Mesh from .abstract_basis import AbstractBasis from ..dofs import Dofs ...
the-stack_106_28474
from bytecode import Instr, Bytecode, Label from boa.code.vmtoken import VMTokenizer from boa.code.expression import Expression from boa.code import pyop from uuid import uuid4 class method(object): code = None bytecode = None block = None blocks = [] stack_size = 0 tokens = [] tokeni...
the-stack_106_28476
import matplotlib.pyplot as plt import numpy as np import sampler as randc ############################################################################ # RANDOM COUNTERS ############################################################################ bins = 17 rc = randc.Sampler(np.ones(bins)) rc.update(.3, 6) rc.update(...